diff --git a/chrome/content/zotero/addCitationDialog.js b/chrome/content/zotero/addCitationDialog.js index 37376f74a..8b784d18c 100644 --- a/chrome/content/zotero/addCitationDialog.js +++ b/chrome/content/zotero/addCitationDialog.js @@ -42,21 +42,22 @@ var Zotero_Citation_Dialog = new function () { } function toggleMultipleSources() { + _multipleSourcesOn = !_multipleSourcesOn; if(_multipleSourcesOn) { - document.getElementById("multiple-sources").hidden = true; - document.getElementById("add-citation-dialog").width = "600"; - document.getElementById("multiple-sources-button").label = Zotero.getString("citation.multipleSources"); - window.sizeToContent(); - window.moveTo((window.screenX+75), window.screenY); - } else { document.getElementById("multiple-sources").hidden = undefined; document.getElementById("add-citation-dialog").width = "750"; document.getElementById("multiple-sources-button").label = Zotero.getString("citation.singleSource"); window.sizeToContent(); window.moveTo((window.screenX-75), window.screenY); + Zotero.debug("Calling treeItemSelected"); + treeItemSelected(); + } else { + document.getElementById("multiple-sources").hidden = true; + document.getElementById("add-citation-dialog").width = "600"; + document.getElementById("multiple-sources-button").label = Zotero.getString("citation.multipleSources"); + window.sizeToContent(); + window.moveTo((window.screenX+75), window.screenY); } - - _multipleSourcesOn = !_multipleSourcesOn; } function treeItemSelected() { @@ -64,6 +65,8 @@ var Zotero_Citation_Dialog = new function () { // get selected item (from selectItemsDialog.js) var item = getSelectedItems(true); + Zotero.debug(item); + // if item has already been added, disable add button document.getElementById("citation-add").disabled = (!item.length || _itemLocators[item[0]] != undefined ? true : false); } @@ -111,7 +114,7 @@ var Zotero_Citation_Dialog = new function () { // flag _itemLocators[itemID] = document.getElementById("tree-locator").value; - _itemLocatorTypes[itemID] = document.getElementById("tree-locator-type").selectedIndex; + _itemLocatorTypes[itemID] = document.getElementById("tree-locator-type").selectedItem.value; document.getElementById("tree-locator").value = ""; } diff --git a/chrome/content/zotero/addCitationDialog.xul b/chrome/content/zotero/addCitationDialog.xul index d36dcf018..5578478b2 100644 --- a/chrome/content/zotero/addCitationDialog.xul +++ b/chrome/content/zotero/addCitationDialog.xul @@ -122,7 +122,7 @@ - + diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index dd985b63f..7590dd47d 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -426,8 +426,8 @@ Zotero.CSL._locatorTerms = { * create a citation (in-text or footnote) */ Zotero.CSL.prototype.createCitation = function(citation, format) { + var string = new Zotero.CSL.FormattedString(this, format); if(citation.citationType >= 3) { // indicates ibid - var string = new Zotero.CSL.FormattedString(this, format); var term = this._getTerm("ibid"); string.append(term[0].toUpperCase()+term.substr(1)); @@ -464,13 +464,14 @@ Zotero.CSL.prototype.createCitation = function(citation, format) { locator = citation.locators[i]; } - string = this._getCitation(Zotero.Items.get(citation.itemIDs[i]), + var citationString = this._getCitation(Zotero.Items.get(citation.itemIDs[i]), (citation.citationType[i] == 1 ? "first" : "subsequent"), locatorType, locator, format, this._cit); + string.concat(citationString); if(this._cit.format && this._cit.format.delimiter && i != lasti) { // add delimiter if one exists, and this isn't the last element - string += this._cit.format.delimiter; + string.append(this._cit.format.delimiter); } } } diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 50b947ecb..0e87401af 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -596,8 +596,9 @@ Zotero.Integration.Citation.prototype.setData = function(itemIDs, locators, loca this.locatorString = ""; for(var i in locators) { - this.locatorString += locatorTypes[i]+locators[i].replace("|", ""); + this.locatorString += "|"+locatorTypes[i]+locators[i].replace("|", ""); } + if(this.locatorString) this.locatorString = this.locatorString.substr(1); this.serialization = this.itemIDString+"_"+this.locatorString; }