diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index b1195ee520..ba0019388f 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -179,12 +179,40 @@ var ZoteroPane = new function() // If the database was initialized and Zotero hasn't been run before // in this profile, display the Quick Start Guide -- this way the guide - // won't be displayed they sync their DB to another profile or if + // won't be displayed when they sync their DB to another profile or if // they the DB is initialized erroneously (e.g. while switching data // directory locations) - if (Zotero.Schema.dbInitialized && Zotero.Prefs.get('firstRun')) { + if (Zotero.restoreFromServer) { + Zotero.restoreFromServer = false; + setTimeout(function () { - gBrowser.selectedTab = gBrowser.addTab('http://www.zotero.org/documentation/quick_start_guide'); + var pr = Components.classes["@mozilla.org/network/default-prompt;1"] + .getService(Components.interfaces.nsIPrompt); + var buttonFlags = (pr.BUTTON_POS_0) * (pr.BUTTON_TITLE_IS_STRING) + + (pr.BUTTON_POS_1) * (pr.BUTTON_TITLE_CANCEL); + var index = pr.confirmEx( + "Zotero Restore", + "The local Zotero database has been cleared." + + " " + + "Would you like to restore from the Zotero server now?", + buttonFlags, + "Sync Now", + null, null, null, {} + ); + + if (index == 0) { + Zotero.Sync.Server.sync(function () { + pr.alert( + "Restore Completed", + "The local Zotero database has been successfully restored." + ); + }); + } + }, 1000); + } + else if (Zotero.Schema.dbInitialized && Zotero.Prefs.get('firstRun')) { + setTimeout(function () { + gBrowser.selectedTab = gBrowser.addTab(ZOTERO_CONFIG.FIRST_RUN_URL); }, 400); Zotero.Prefs.set('firstRun', false); } diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index edbfbbcfb2..7ace0d5c0d 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -148,6 +148,24 @@ function populateOpenURLResolvers() { // // Sync // +/* +function updateSyncStatus() { + var disabled = !Zotero.Sync.Server.enabled; + + var radioGroup = document.getElementById('zotero-reset').firstChild; + radioGroup.disabled = disabled; + var labels = radioGroup.getElementsByTagName('label'); + for each(var label in labels) { + label.disabled = disabled; + } + var labels = radioGroup.getElementsByTagName('description'); + for each(var label in labels) { + label.disabled = disabled; + } + document.getElementById('zotero-reset-button').disabled = disabled; +} +*/ + function updateStorageSettings(value) { if (!value) { value = document.getElementById('pref-storage-protocol').value; @@ -223,6 +241,130 @@ function verifyStorageServer() { } } +function handleSyncResetSelect(obj) { + var index = obj.selectedIndex; + var rows = obj.getElementsByTagName('row'); + + for (var i=0; i - - + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +