Add "Full Sync" option to Zotero prefs

This commit is contained in:
Dan Stillman 2009-07-03 22:40:50 +00:00
parent 34732fe78e
commit 3f911faa07
2 changed files with 47 additions and 6 deletions

View File

@ -354,7 +354,7 @@ function handleSyncReset(action) {
var index = pr.confirmEx(
// TODO: localize
Zotero.getString('general.warning'),
"All item data belonging to user '" + account + "' on the Zotero server "
"All data belonging to user '" + account + "' on the Zotero server "
+ "will be erased and replaced with data from this copy of Zotero.",
buttonFlags,
"Replace Server Data",
@ -368,8 +368,7 @@ function handleSyncReset(action) {
Zotero.Sync.Server.sync(function () {
pr.alert(
"Restore Completed",
"Item data on the Zotero server has been "
+ "successfully restored."
"Data on the Zotero server has been successfully restored."
);
});
});
@ -382,6 +381,40 @@ function handleSyncReset(action) {
break;
case 'full-sync':
var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING)
+ (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL)
+ pr.BUTTON_POS_1_DEFAULT;
var index = pr.confirmEx(
// TODO: localize
Zotero.getString('general.warning'),
"The local Zotero library will be completely merged with data belonging to user '" + account + "' on the Zotero server. "
+ "Any unsynced changes will appear as conflicts.\n\n"
+ "This option should generally be used only for troubleshooting sync errors.",
buttonFlags,
"Sync",
null, null, null, {}
);
switch (index) {
case 0:
// TODO: better error handling
Zotero.Sync.Server.resetClient();
Zotero.Sync.Server.sync(function () {
pr.alert(
"Full Sync Completed",
"The local Zotero library has been merged with data from the Zotero server."
);
});
break;
// Cancel
case 1:
return;
}
break;
default:
throw ("Invalid action '" + action + "' in handleSyncReset()");
}

View File

@ -341,10 +341,18 @@ To add a new preference:
</columns>
<rows>
<row id="zotero-restore-from-server" selected="true">
<row id="zotero-full-sync">
<radio/>
<vbox onclick="this.previousSibling.click()">
<label value="Restore from Zotero server"/>
<label value="Full Sync with Zotero Server"/>
<description>Merge local Zotero data with data from the sync server, ignoring sync history.</description>
</vbox>
</row>
<row id="zotero-restore-from-server" selected="true">
<radio/>
<vbox onclick="this.previousSibling.click()">
<label value="Restore from Zotero Server"/>
<description>Erase all local Zotero data and restore from the sync server.</description>
</vbox>
</row>
@ -352,7 +360,7 @@ To add a new preference:
<row id="zotero-restore-to-server">
<radio/>
<vbox onclick="this.previousSibling.click()">
<label value="Restore to Zotero server"/>
<label value="Restore to Zotero Server"/>
<description>Erase all server data and overwrite with local Zotero data.</description>
</vbox>
</row>