Add "Full Sync" option to Zotero prefs
This commit is contained in:
parent
34732fe78e
commit
3f911faa07
2 changed files with 47 additions and 6 deletions
|
@ -354,7 +354,7 @@ function handleSyncReset(action) {
|
||||||
var index = pr.confirmEx(
|
var index = pr.confirmEx(
|
||||||
// TODO: localize
|
// TODO: localize
|
||||||
Zotero.getString('general.warning'),
|
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.",
|
+ "will be erased and replaced with data from this copy of Zotero.",
|
||||||
buttonFlags,
|
buttonFlags,
|
||||||
"Replace Server Data",
|
"Replace Server Data",
|
||||||
|
@ -368,8 +368,7 @@ function handleSyncReset(action) {
|
||||||
Zotero.Sync.Server.sync(function () {
|
Zotero.Sync.Server.sync(function () {
|
||||||
pr.alert(
|
pr.alert(
|
||||||
"Restore Completed",
|
"Restore Completed",
|
||||||
"Item data on the Zotero server has been "
|
"Data on the Zotero server has been successfully restored."
|
||||||
+ "successfully restored."
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -382,6 +381,40 @@ function handleSyncReset(action) {
|
||||||
|
|
||||||
break;
|
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:
|
default:
|
||||||
throw ("Invalid action '" + action + "' in handleSyncReset()");
|
throw ("Invalid action '" + action + "' in handleSyncReset()");
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,10 +341,18 @@ To add a new preference:
|
||||||
</columns>
|
</columns>
|
||||||
|
|
||||||
<rows>
|
<rows>
|
||||||
<row id="zotero-restore-from-server" selected="true">
|
<row id="zotero-full-sync">
|
||||||
<radio/>
|
<radio/>
|
||||||
<vbox onclick="this.previousSibling.click()">
|
<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>
|
<description>Erase all local Zotero data and restore from the sync server.</description>
|
||||||
</vbox>
|
</vbox>
|
||||||
</row>
|
</row>
|
||||||
|
@ -352,7 +360,7 @@ To add a new preference:
|
||||||
<row id="zotero-restore-to-server">
|
<row id="zotero-restore-to-server">
|
||||||
<radio/>
|
<radio/>
|
||||||
<vbox onclick="this.previousSibling.click()">
|
<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>
|
<description>Erase all server data and overwrite with local Zotero data.</description>
|
||||||
</vbox>
|
</vbox>
|
||||||
</row>
|
</row>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue