www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 3f911faa07b067cbb77b207692c622b0d6a4d57a
parent 34732fe78e8fe2360621597cf62659d0a26d4d4b
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri,  3 Jul 2009 22:40:50 +0000

Add "Full Sync" option to Zotero prefs


Diffstat:
Mchrome/content/zotero/preferences/preferences.js | 39++++++++++++++++++++++++++++++++++++---
Mchrome/content/zotero/preferences/preferences.xul | 14+++++++++++---
2 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js @@ -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()"); } diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul @@ -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>