- Add "Reset File Sync History" reset option to sync preferences
- Fix erroneous uploading of all files on storage history reset - Fix re-verification of storage server after every opening of the preferences
This commit is contained in:
parent
9c8738dca0
commit
d106fc0313
|
@ -231,6 +231,7 @@ var ZoteroPane = new function()
|
||||||
sep.nextSibling.nextSibling.hidden = false;
|
sep.nextSibling.nextSibling.hidden = false;
|
||||||
sep.nextSibling.nextSibling.nextSibling.hidden = false;
|
sep.nextSibling.nextSibling.nextSibling.hidden = false;
|
||||||
sep.nextSibling.nextSibling.nextSibling.nextSibling.hidden = false;
|
sep.nextSibling.nextSibling.nextSibling.nextSibling.hidden = false;
|
||||||
|
sep.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Zotero.Prefs.get('debugShowDuplicates')) {
|
if (Zotero.Prefs.get('debugShowDuplicates')) {
|
||||||
|
|
|
@ -142,7 +142,7 @@
|
||||||
<menuitem hidden="true" label=" Reset Server Lock" oncommand="Zotero.Sync.Server.resetServer()"/>
|
<menuitem hidden="true" label=" Reset Server Lock" oncommand="Zotero.Sync.Server.resetServer()"/>
|
||||||
<menuitem hidden="true" label=" Reset Client" oncommand="Zotero.Sync.Server.resetClient()"/>
|
<menuitem hidden="true" label=" Reset Client" oncommand="Zotero.Sync.Server.resetClient()"/>
|
||||||
<menuitem label="Storage Debugging" disabled="true"/>
|
<menuitem label="Storage Debugging" disabled="true"/>
|
||||||
<menuitem label=" Reset Storage History" oncommand="Zotero.Sync.Storage.resetAllSyncStates()"/>
|
<menuitem hidden="true" label=" Reset Storage History" oncommand="Zotero.Sync.Storage.resetAllSyncStates()"/>
|
||||||
<menuitem label=" Purge Deleted Storage Files" oncommand="Zotero.Sync.Storage.purgeDeletedStorageFiles(function(results) { Zotero.debug(results); })"/>
|
<menuitem label=" Purge Deleted Storage Files" oncommand="Zotero.Sync.Storage.purgeDeletedStorageFiles(function(results) { Zotero.debug(results); })"/>
|
||||||
<menuitem label=" Purge Orphaned Storage Files" oncommand="Zotero.Sync.Storage.purgeOrphanedStorageFiles(function(results) { Zotero.debug(results); })"/>
|
<menuitem label=" Purge Orphaned Storage Files" oncommand="Zotero.Sync.Storage.purgeOrphanedStorageFiles(function(results) { Zotero.debug(results); })"/>
|
||||||
<menuseparator id="zotero-tb-actions-separator"/>
|
<menuseparator id="zotero-tb-actions-separator"/>
|
||||||
|
|
|
@ -194,7 +194,6 @@ function updateStorageSettings(value) {
|
||||||
prefix.value = 'https://';
|
prefix.value = 'https://';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
unverifyStorageServer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function unverifyStorageServer() {
|
function unverifyStorageServer() {
|
||||||
|
@ -415,6 +414,36 @@ function handleSyncReset(action) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'reset-storage-history':
|
||||||
|
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'),
|
||||||
|
"All file sync history will be cleared.\n\n"
|
||||||
|
+ "Any local attachment files that do not exist on the storage server will be uploaded on the next sync.",
|
||||||
|
buttonFlags,
|
||||||
|
"Reset",
|
||||||
|
null, null, null, {}
|
||||||
|
);
|
||||||
|
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
Zotero.Sync.Storage.resetAllSyncStates();
|
||||||
|
pr.alert(
|
||||||
|
"File Sync History Cleared",
|
||||||
|
"The file sync history has been cleared."
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Cancel
|
||||||
|
case 1:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw ("Invalid action '" + action + "' in handleSyncReset()");
|
throw ("Invalid action '" + action + "' in handleSyncReset()");
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ To add a new preference:
|
||||||
<hbox>
|
<hbox>
|
||||||
<menulist id="storage-url-protocol"
|
<menulist id="storage-url-protocol"
|
||||||
preference="pref-storage-protocol"
|
preference="pref-storage-protocol"
|
||||||
onsynctopreference="updateStorageSettings(this.value)">
|
onsynctopreference="updateStorageSettings(this.value); unverifyStorageServer();">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem label="WebDAV" value="webdav"/>
|
<menuitem label="WebDAV" value="webdav"/>
|
||||||
<!-- TODO: localize -->
|
<!-- TODO: localize -->
|
||||||
|
@ -330,10 +330,11 @@ To add a new preference:
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
|
|
||||||
<tabpanel id="zotero-reset" orient="vertical">
|
<tabpanel id="zotero-reset" orient="vertical">
|
||||||
|
<radiogroup id="zotero-reset-sync-group" oncommand="handleSyncResetSelect(this)">
|
||||||
<groupbox>
|
<groupbox>
|
||||||
|
<!-- TODO: localize -->
|
||||||
<caption label="Zotero Sync Server"/>
|
<caption label="Zotero Sync Server"/>
|
||||||
|
|
||||||
<radiogroup id="zotero-reset-sync-group" oncommand="handleSyncResetSelect(this);">
|
|
||||||
<grid>
|
<grid>
|
||||||
<columns>
|
<columns>
|
||||||
<column/>
|
<column/>
|
||||||
|
@ -366,12 +367,33 @@ To add a new preference:
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
|
</groupbox>
|
||||||
|
|
||||||
|
<groupbox>
|
||||||
|
<caption label="Storage Server"/>
|
||||||
|
|
||||||
|
<grid>
|
||||||
|
<columns>
|
||||||
|
<column/>
|
||||||
|
<column align="start" pack="start" flex="1"/>
|
||||||
|
</columns>
|
||||||
|
|
||||||
|
<rows>
|
||||||
|
<row id="zotero-reset-storage-history">
|
||||||
|
<radio/>
|
||||||
|
<vbox onclick="this.previousSibling.click()">
|
||||||
|
<label value="Reset File Sync History"/>
|
||||||
|
<description>Force checking of the storage server for all local attachment files.</description>
|
||||||
|
</vbox>
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
</groupbox>
|
||||||
</radiogroup>
|
</radiogroup>
|
||||||
|
|
||||||
<hbox>
|
<hbox>
|
||||||
<button id="zotero-reset-button" label="Reset..." oncommand="handleSyncReset(document.getElementById('zotero-reset-sync-group').selectedItem.parentNode.id.substr(7))"/>
|
<button id="zotero-reset-button" label="Reset..." oncommand="handleSyncReset(document.getElementById('zotero-reset-sync-group').selectedItem.parentNode.id.substr(7))"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</groupbox>
|
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
</tabpanels>
|
</tabpanels>
|
||||||
</tabbox>
|
</tabbox>
|
||||||
|
|
|
@ -1291,11 +1291,13 @@ Zotero.Sync.Storage = new function () {
|
||||||
if (mdate) {
|
if (mdate) {
|
||||||
var mtime = Zotero.Date.toUnixTimestamp(mdate);
|
var mtime = Zotero.Date.toUnixTimestamp(mdate);
|
||||||
var smtime = Zotero.Sync.Storage.getSyncedModificationTime(item.id);
|
var smtime = Zotero.Sync.Storage.getSyncedModificationTime(item.id);
|
||||||
// File has been uploaded to storage server but there's
|
// If file has been uploaded to storage server but there's
|
||||||
// no local record of the time (e.g., due to a reset),
|
// no local record of the time (e.g., due to a reset?),
|
||||||
// use local file's time
|
// use local file's time
|
||||||
if (!smtime) {
|
if (!smtime) {
|
||||||
smtime = item.attachmentModificationTime;
|
smtime = item.attachmentModificationTime;
|
||||||
|
}
|
||||||
|
|
||||||
if (smtime == mtime) {
|
if (smtime == mtime) {
|
||||||
Zotero.debug("Stored file mod time matches remote file -- skipping upload");
|
Zotero.debug("Stored file mod time matches remote file -- skipping upload");
|
||||||
|
|
||||||
|
@ -1308,9 +1310,7 @@ Zotero.Sync.Storage = new function () {
|
||||||
request.finish();
|
request.finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (smtime != mtime) {
|
|
||||||
var localData = { modTime: smtime };
|
var localData = { modTime: smtime };
|
||||||
var remoteData = { modTime: mtime };
|
var remoteData = { modTime: mtime };
|
||||||
Zotero.Sync.Storage.QueueManager.addConflict(
|
Zotero.Sync.Storage.QueueManager.addConflict(
|
||||||
|
@ -1322,7 +1322,6 @@ Zotero.Sync.Storage = new function () {
|
||||||
request.finish();
|
request.finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
Zotero.debug("Remote file not found for item " + item.id);
|
Zotero.debug("Remote file not found for item " + item.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,12 +119,11 @@ grid row hbox:first-child
|
||||||
#zotero-reset row
|
#zotero-reset row
|
||||||
{
|
{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 15px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#zotero-reset row:not(:last-child)
|
#zotero-reset row:not(:last-child)
|
||||||
{
|
{
|
||||||
border-bottom: 1px #999 solid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#zotero-reset row vbox
|
#zotero-reset row vbox
|
||||||
|
@ -155,7 +154,6 @@ grid row hbox:first-child
|
||||||
#zotero-reset > hbox
|
#zotero-reset > hbox
|
||||||
{
|
{
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
-moz-box-pack: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user