Skip to content
Browse files

Resolved conflict and added test for existence to deleteNext

  • Loading branch information...
1 parent 381db91 commit 62ad8e173f30c6ec1820c15484658ebd36c9b503 @jawj committed Aug 14, 2008
Showing with 14 additions and 8 deletions.
  1. +9 −1 chrome/content/zot2bib/help.html
  2. +5 −7 chrome/content/zot2bib/zot2bib.js
View
10 chrome/content/zot2bib/help.html
@@ -1,4 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
+<head>
+ <title>zot2bib help</title>
+ <style type="text/css"><!--
+body {
+padding: 0;
+margin: 0;
+background: #f4f4f8;
+}
+#header {
View
12 chrome/content/zot2bib/zot2bib.js
@@ -120,7 +120,10 @@ Zotero.Zot2Bib = {
translator.setLocation(file);
translator.setHandler('done', function() {
- for (var j = 0; j < destfiles.length; j ++) {
+ if (Zotero.Zot2Bib.numdests() < 1) {
+ var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
+ prompts.alert(null, "No destination for new publications is selected in Zot2Bib", "Use the Zot2Bib status bar menu to select a destination, then try again.");
+ }
for (var j = 0; j < destfiles.length; j ++) {
var args = [script_path, destfiles[j], file.path, openpub, bringtofront, extrabraces];
process.run(true, args, args.length); // first param true => calling thread will be blocked until called process terminates
@@ -129,11 +132,6 @@ Zotero.Zot2Bib = {
if (! prefs.getBoolPref('keepinzotero')) {
Zotero.Zot2Bib.deleteQueue.push(item.id);
setTimeout(Zotero.Zot2Bib.deleteNext, 5000);
-
- if (Zotero.Zot2Bib.numDests() < 1) {
- var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
- prompts.alert(null, "No Zot2Bib destinations are selected", "New publications are therefore being discarded. Please select a destination using the Zot2Bib status bar menu, and try again.");
- }
}
});
translator.translate();
@@ -146,7 +144,7 @@ Zotero.Zot2Bib = {
deleteQueue: [],
deleteNext: function () {
if (this.deleteQueue.length < 1) return;
- if (itemId) Zotero.Items.erase([itemId], true); // && Zotero.Items.find... ?
+ var itemId = this.deleteQueue.shift();
if (itemId && Zotero.Items.get(itemId)) Zotero.Items.erase([itemId], true);
}

0 comments on commit 62ad8e1

Please sign in to comment.
Something went wrong with that request. Please try again.