diff --git a/chrome/content/zotero/addCitationDialog.js b/chrome/content/zotero/addCitationDialog.js index 5bad4da32..552ab778e 100644 --- a/chrome/content/zotero/addCitationDialog.js +++ b/chrome/content/zotero/addCitationDialog.js @@ -34,6 +34,7 @@ var Zotero_Citation_Dialog = new function () { var _lastSelected = null; var _previewShown = false; var _suppressNextTreeSelect = false; + var _locatorIndexArray = {}; var _autoRegeneratePref; var _acceptButton; var _sortCheckbox; @@ -45,8 +46,8 @@ var Zotero_Citation_Dialog = new function () { this.toggleEditor = toggleEditor; this.treeItemSelected = treeItemSelected; this.listItemSelected = listItemSelected; - this.addCitation = addCitation; - this.deleteCitation = deleteCitation; + this.add = add; + this.remove = remove; this.sortCitation = sortCitation; this.confirmRegenerate = confirmRegenerate; this.accept = accept; @@ -66,7 +67,6 @@ var Zotero_Citation_Dialog = new function () { // find accept button _acceptButton = document.getElementById("add-citation-dialog").getButton("accept"); - _autoRegeneratePref = Zotero.Prefs.get("integration.autoRegenerate"); // if a style with sortable citations, present checkbox @@ -74,8 +74,28 @@ var Zotero_Citation_Dialog = new function () { _sortCheckbox = document.getElementById("keepSorted"); _sortCheckbox.hidden = false; _sortCheckbox.checked = true; + io.citation.properties.sort = true; } + // load locators + var locators = Zotero.CSL.Global.getLocatorStrings(); + var menu = document.getElementById("locatorType"); + var popup = document.getElementById("locator-type-popup"); + var i = 0; + for(var value in locators) { + var locator = locators[value]; + locator = locator[0].toUpperCase()+locator.substr(1); + // add to popup + var child = document.createElement("menuitem"); + child.setAttribute("value", value); + child.setAttribute("label", locator); + popup.appendChild(child); + // add to array + _locatorIndexArray[value] = i; + i++; + } + menu.selectedIndex = 0; + // load (from selectItemsDialog.js) doLoad(); @@ -88,15 +108,22 @@ var Zotero_Citation_Dialog = new function () { selectItem(io.citation.citationItems[0].itemID); // from selectItemsDialog.js for(var property in _preserveData) { if(io.citation.citationItems[0][property]) { - document.getElementById(property)[_preserveData[property]] = io.citation.citationItems[0][property]; + if(property == "locatorType") { + document.getElementById(property)[_preserveData[property]] = _locatorIndexArray[io.citation.citationItems[0][property]]; + } else { + document.getElementById(property)[_preserveData[property]] = io.citation.citationItems[0][property]; + } } } } else { // multiple citations toggleMultipleSources(); for(var i=0; i - +