closes #572, 'Multiple sources" does not work

This commit is contained in:
Simon Kornblith 2007-03-23 02:46:35 +00:00
parent f01fd20826
commit 85fb1f7cf3
4 changed files with 19 additions and 14 deletions

View File

@ -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 = "";
}

View File

@ -122,7 +122,7 @@
<menuitem value="l" label="&zotero.citation.line;"/>
</menupopup>
</menulist>
<textbox id="item-locator"/>
<textbox id="item-locator" disabled="true"/>
</hbox>
</vbox>
</hbox>

View File

@ -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);
}
}
}

View File

@ -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;
}