diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index cbd073644d..fce82cda86 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -120,6 +120,17 @@ var Zotero_Browser = new function() { * @return void */ function scrapeThisPage(libraryID, collectionID) { + if (Zotero.locked) { + Zotero_Browser.progress.changeHeadline(Zotero.getString("ingester.scrapeError")); + // TODO: localize + var desc = "A Zotero operation is currently in progress. Please wait until it finishes and try again."; + Zotero_Browser.progress.addDescription(desc); + Zotero_Browser.progress.show(); + Zotero_Browser.progress.startCloseTimer(8000); + return; + return; + } + if (!Zotero.stateCheck()) { Zotero_Browser.progress.changeHeadline(Zotero.getString("ingester.scrapeError")); var desc = Zotero.getString("ingester.scrapeError.transactionInProgress.previousError") diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 7fce01c010..402d571b89 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -80,10 +80,9 @@ Zotero_File_Exporter.prototype.save = function() { translation.setHandler("done", this._exportDone); Zotero.UnresponsiveScriptIndicator.disable(); Zotero_File_Interface.Progress.show( - Zotero.getString("fileInterface.itemsExported"), - function() { - translation.translate(); - }); + Zotero.getString("fileInterface.itemsExported") + ); + translation.translate() } return false; } @@ -269,13 +268,10 @@ var Zotero_File_Interface = new function() { // show progress indicator Zotero_File_Interface.Progress.show( - Zotero.getString("fileInterface.itemsImported"), - function() { - Zotero.DB.beginTransaction(); - - // translate - translation.translate(); - }); + Zotero.getString("fileInterface.itemsImported") + ); + Zotero.DB.beginTransaction(); + translation.translate(); } else { var prompt = Components.classes["@mozilla.org/network/default-prompt;1"] .getService(Components.interfaces.nsIPrompt); @@ -569,50 +565,14 @@ var Zotero_File_Interface = new function() { // Handles the display of a progress indicator Zotero_File_Interface.Progress = new function() { - var _windowLoaded = false; - var _windowLoading = false; - var _progressWindow; - // keep track of all of these things in case they're called before we're - // done loading the progress window - var _loadHeadline, _loadNumber, _outOf, _callback; - this.show = show; this.close = close; - function show(headline, callback) { - if(_windowLoading || _windowLoaded) { // already loading or loaded - _progressWindow.focus(); - return false; - } - _windowLoading = true; - - _loadHeadline = headline; - _loadNumber = 0; - _outOf = 0; - _callback = callback; - - _progressWindow = window.openDialog("chrome://zotero/content/fileProgress.xul", "", "chrome,resizable=no,close=no,dependent,dialog,centerscreen"); - _progressWindow.addEventListener("pageshow", _onWindowLoaded, false); - - return true; + function show(headline) { + Zotero.showZoteroPaneProgressBar(headline) } function close() { - _windowLoaded = false; - try { - _progressWindow.close(); - } catch(ex) {} - } - - function _onWindowLoaded() { - _windowLoading = false; - _windowLoaded = true; - - // do things we delayed because the winodw was loading - _progressWindow.document.getElementById("progress-label").value = _loadHeadline; - - if(_callback) { - window.setTimeout(_callback, 1500); - } + Zotero.hideZoteroPaneOverlay(); } } \ No newline at end of file diff --git a/chrome/content/zotero/fileProgress.xul b/chrome/content/zotero/fileProgress.xul deleted file mode 100644 index ed2e0160a8..0000000000 --- a/chrome/content/zotero/fileProgress.xul +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index ee891ee31d..6b7caea20e 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -27,6 +27,7 @@ var ZoteroPane = new function() { this.collectionsView = false; this.itemsView = false; + this.__defineGetter__('loaded', function () _loaded); //Privileged methods this.onLoad = onLoad; @@ -85,6 +86,7 @@ var ZoteroPane = new function() const COLLECTIONS_HEIGHT = 32; // minimum height of the collections pane and toolbar var self = this; + var _loaded = false; var titlebarcolorState, toolbarCollapseState, titleState; // Also needs to be changed in collectionTreeView.js @@ -99,6 +101,11 @@ var ZoteroPane = new function() return; } + if (Zotero.locked) { + return; + } + _loaded = true; + if(Zotero.Prefs.get("zoteroPaneOnTop")) { var oldPane = document.getElementById('zotero-pane'); @@ -245,7 +252,7 @@ var ZoteroPane = new function() */ function onUnload() { - if (!Zotero || !Zotero.initialized) { + if (!Zotero || !Zotero.initialized || !_loaded) { return; } @@ -262,7 +269,19 @@ var ZoteroPane = new function() */ function toggleDisplay() { - var zoteroPane = document.getElementById('zotero-pane'); + if (!ZoteroPane.loaded) { + if (Zotero.locked) { + var pr = Components.classes["@mozilla.org/network/default-prompt;1"] + .getService(Components.interfaces.nsIPrompt); + // TODO: localize + var msg = "Another Zotero operation is currently in progress.\n\nPlease wait until it has finished."; + pr.alert("", msg); + return; + } + ZoteroPane.onLoad(); + } + + var zoteroPane = document.getElementById('zotero-pane-stack'); var zoteroSplitter = document.getElementById('zotero-splitter') if (zoteroPane.getAttribute('hidden') == 'true') { @@ -383,7 +402,7 @@ var ZoteroPane = new function() function isShowing() { - var zoteroPane = document.getElementById('zotero-pane'); + var zoteroPane = document.getElementById('zotero-pane-stack'); return zoteroPane.getAttribute('hidden') != 'true' && zoteroPane.getAttribute('collapsed') != 'true'; } @@ -391,21 +410,21 @@ var ZoteroPane = new function() function fullScreen(set) { - var zPane = document.getElementById('zotero-pane'); + var zoteroPane = document.getElementById('zotero-pane-stack'); if (set != undefined) { var makeFullScreen = !!set; } else { - var makeFullScreen = zPane.getAttribute('fullscreenmode') != 'true'; + var makeFullScreen = zoteroPane.getAttribute('fullscreenmode') != 'true'; } // Turn Z-pane flex on to stretch to window in full-screen, but off otherwise so persist works - zPane.setAttribute('flex', makeFullScreen ? "1" : "0"); + zoteroPane.setAttribute('flex', makeFullScreen ? "1" : "0"); document.getElementById('content').setAttribute('collapsed', makeFullScreen); document.getElementById('zotero-splitter').setAttribute('hidden', makeFullScreen); - zPane.setAttribute('fullscreenmode', makeFullScreen); + zoteroPane.setAttribute('fullscreenmode', makeFullScreen); _setFullWindowMode(makeFullScreen); } @@ -468,6 +487,11 @@ var ZoteroPane = new function() Zotero.debug(e); } + if (Zotero.locked) { + event.preventDefault(); + return; + } + if (from == 'zotero-pane') { // Highlight collections containing selected items // @@ -497,7 +521,7 @@ var ZoteroPane = new function() } // Ignore keystrokes if Zotero pane is closed - var zoteroPane = document.getElementById('zotero-pane'); + var zoteroPane = document.getElementById('zotero-pane-stack'); if (zoteroPane.getAttribute('hidden') == 'true' || zoteroPane.getAttribute('collapsed') == 'true') { return; @@ -783,7 +807,6 @@ var ZoteroPane = new function() function toggleTagSelector(){ - var zoteroPane = document.getElementById('zotero-pane'); var tagSelector = document.getElementById('zotero-tag-selector'); var showing = tagSelector.getAttribute('collapsed') == 'true'; @@ -805,7 +828,7 @@ var ZoteroPane = new function() function updateTagSelectorSize() { //Zotero.debug('Updating tag selector size'); - var zoteroPane = document.getElementById('zotero-pane'); + var zoteroPane = document.getElementById('zotero-pane-stack'); var splitter = document.getElementById('zotero-tags-splitter'); var tagSelector = document.getElementById('zotero-tag-selector'); @@ -966,7 +989,6 @@ var ZoteroPane = new function() } - this.showDuplicates = function () { if (this.collectionsView.selection.count == 1 && this.collectionsView.selection.currentIndex != -1) { var itemGroup = this.collectionsView._getItemAtRow(this.collectionsView.selection.currentIndex); @@ -2225,8 +2247,11 @@ var ZoteroPane = new function() } } - var separator = document.getElementById("zotero-context-separator"); - separator.hidden = !showing; + // If Zotero is locked, disable menu items + var menu = document.getElementById('zotero-content-area-context-menu'); + for each(var menuitem in menu.firstChild.childNodes) { + menuitem.disabled = Zotero.locked; + } } diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index 2bbbdd88a8..7a7ce39ea0 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -53,20 +53,23 @@ - @@ -74,7 +77,15 @@ + + + + + + +