www

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

commit 4c09cbb7ac1ccc33cd1539e76e53191e000e08ce
parent 0ab3f1d2d6d5ac01dad916e33e6fb4bf6348ac7f
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed,  6 May 2009 07:58:28 +0000

- fix progress window issues with lookup and scraping
- prevent multiple lookups and fix error dialog


Diffstat:
Mchrome/content/zotero/lookup.js | 16++++++++++++----
Mchrome/content/zotero/lookup.xul | 4++--
Mchrome/content/zotero/xpcom/progressWindow.js | 2+-
Mchrome/content/zotero/xpcom/translate.js | 2++
4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/chrome/content/zotero/lookup.js b/chrome/content/zotero/lookup.js @@ -1,6 +1,7 @@ const Zotero_Lookup = new function () { this.accept = function() { document.getElementById("progress").setAttribute("status", "animate"); + document.getElementById("accept-button").disabled = true; var identifier = document.getElementById("lookup-textbox").value; if(identifier.substr(0, 3) == "10.") { // DOI @@ -17,16 +18,18 @@ const Zotero_Lookup = new function () { } } - translate = new Zotero.Translate("search", true, false); + var translate = new Zotero.Translate("search", true, false); translate.setSearch(item); + // be lenient about translators var translators = translate.getTranslators(); - Zotero.debug(translators[0].label); translate.setTranslator(translators); + translate.setHandler("done", function(translate, success) { if(success) { window.close(); } else { + document.getElementById("accept-button").disabled = undefined; document.getElementById("progress").setAttribute("status", "error"); var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); @@ -34,10 +37,15 @@ const Zotero_Lookup = new function () { Zotero.getString("lookup.failure.description")); } }); + + var saveLocation = false; try { - var saveLocation = window.opener.ZoteroPane.getSelectedCollection(); + saveLocation = window.opener.ZoteroPane.getSelectedCollection(); } catch(e) {} - translate.setHandler("itemDone", function(obj, item) { window.opener.Zotero_Browser.itemDone(obj, item, saveLocation) }); + translate.setHandler("itemDone", function(obj, item) { + if(saveLocation) saveLocation.addItem(item.getID()); + }); + translate.translate(); return false; } diff --git a/chrome/content/zotero/lookup.xul b/chrome/content/zotero/lookup.xul @@ -20,7 +20,7 @@ <hbox id="dialog-button-box"> <toolbarbutton class="zotero-small-progress-indicator" id="progress"/> <spacer flex="1"/> - <button class="dialog-button" style="font: menu" dlgtype="cancel"/> - <button class="dialog-button" style="font: menu" dlgtype="accept"/> + <button id="cancel-button" class="dialog-button" style="font: menu" dlgtype="cancel"/> + <button id="accept-button" class="dialog-button" style="font: menu" dlgtype="accept"/> </hbox> </dialog> diff --git a/chrome/content/zotero/xpcom/progressWindow.js b/chrome/content/zotero/xpcom/progressWindow.js @@ -147,7 +147,7 @@ Zotero.ProgressWindow = function(_window){ _progressWindow = ww.openWindow(null, "chrome://zotero/content/progressWindow.xul", "", "chrome,dialog=no,titlebar=no,popup=yes", null); } - _progressWindow.addEventListener("pageshow", _onWindowLoaded, false); + _progressWindow.addEventListener("load", _onWindowLoaded, false); _progressWindow.addEventListener("mouseover", _onMouseOver, false); _progressWindow.addEventListener("mouseout", _onMouseOut, false); _progressWindow.addEventListener("mouseup", _onMouseUp, false); diff --git a/chrome/content/zotero/xpcom/translate.js b/chrome/content/zotero/xpcom/translate.js @@ -948,6 +948,8 @@ Zotero.Translate.prototype._translationComplete = function(returnValue, error) { this.translate(); return; } + + returnValue = false; } else { // close open streams this._closeStreams();