integration fixes:
- fixes maximum length issue - fixes empty field issue - fixes issues with deleted items
This commit is contained in:
parent
b9793ac765
commit
01c408695e
|
@ -159,6 +159,8 @@ var Zotero_Citation_Dialog = new function () {
|
||||||
if(io.items.length) {
|
if(io.items.length) {
|
||||||
io.locatorTypes = new Array(document.getElementById("tree-locator-type").selectedItem.value);
|
io.locatorTypes = new Array(document.getElementById("tree-locator-type").selectedItem.value);
|
||||||
io.locators = new Array(document.getElementById("tree-locator").value);
|
io.locators = new Array(document.getElementById("tree-locator").value);
|
||||||
|
} else {
|
||||||
|
io.items = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1272,14 +1272,13 @@ Zotero.CSL.ItemSet.prototype.add = function(items) {
|
||||||
* or item IDs
|
* or item IDs
|
||||||
*/
|
*/
|
||||||
Zotero.CSL.ItemSet.prototype.remove = function(items) {
|
Zotero.CSL.ItemSet.prototype.remove = function(items) {
|
||||||
Zotero.debug("removing!")
|
|
||||||
for(var i in items) {
|
for(var i in items) {
|
||||||
|
if(!item) continue;
|
||||||
if(items[i] instanceof Zotero.CSL.Item) {
|
if(items[i] instanceof Zotero.CSL.Item) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
} else {
|
} else {
|
||||||
var item = this.itemsById[items[i]];
|
var item = this.itemsById[items[i]];
|
||||||
}
|
}
|
||||||
Zotero.debug("old index was "+this.items.indexOf(item))
|
|
||||||
this.itemsById[item.getID()] = undefined;
|
this.itemsById[item.getID()] = undefined;
|
||||||
this.items.splice(this.items.indexOf(item), 1);
|
this.items.splice(this.items.indexOf(item), 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,10 +295,12 @@ Zotero.CSL.Compat.ItemSet.prototype.getItemsByIds = function(ids) {
|
||||||
|
|
||||||
Zotero.CSL.Compat.ItemSet.prototype.add = function(items) {
|
Zotero.CSL.Compat.ItemSet.prototype.add = function(items) {
|
||||||
this.items = this.items.concat(items);
|
this.items = this.items.concat(items);
|
||||||
|
Zotero.debug(this.items);
|
||||||
}
|
}
|
||||||
|
|
||||||
Zotero.CSL.Compat.ItemSet.prototype.remove = function(items) {
|
Zotero.CSL.Compat.ItemSet.prototype.remove = function(items) {
|
||||||
for(var i in items) {
|
for(var i in items) {
|
||||||
|
if(!item) continue;
|
||||||
if(items[i] instanceof Zotero.Item) {
|
if(items[i] instanceof Zotero.Item) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -306,12 +306,16 @@ Zotero.Integration.DataListener.prototype._bodyData = function() {
|
||||||
|
|
||||||
var utf8Stream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
|
var utf8Stream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
|
||||||
.createInstance(Components.interfaces.nsIConverterInputStream);
|
.createInstance(Components.interfaces.nsIConverterInputStream);
|
||||||
utf8Stream.init(dataStream, "UTF-8", 1024, "?");
|
utf8Stream.init(dataStream, "UTF-8", 4096, "?");
|
||||||
|
|
||||||
|
this.body = "";
|
||||||
var string = {};
|
var string = {};
|
||||||
utf8Stream.readString(this.bodyLength, string)
|
while(utf8Stream.readString(this.bodyLength, string)) {
|
||||||
|
this.body += string.value;
|
||||||
|
}
|
||||||
|
|
||||||
// handle envelope
|
// handle envelope
|
||||||
var output = Zotero.Integration.handleEnvelope(string.value);
|
var output = Zotero.Integration.handleEnvelope(this.body);
|
||||||
this._requestFinished(output);
|
this._requestFinished(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,6 +386,16 @@ Zotero.Integration.SOAP = new function() {
|
||||||
|
|
||||||
var citation, update;
|
var citation, update;
|
||||||
for(var i=3; i<vars.length; i+=2) {
|
for(var i=3; i<vars.length; i+=2) {
|
||||||
|
// correction for empty field
|
||||||
|
if(vars[i].substr(":")) {
|
||||||
|
var ids = vars[i].split(":");
|
||||||
|
vars[i] = ids[ids.length-1];
|
||||||
|
// delete empty fields
|
||||||
|
for(var j=0; j<ids.length-1; j++) {
|
||||||
|
updatedCitations[ids[j]] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(vars[i+1] == "X") {
|
if(vars[i+1] == "X") {
|
||||||
// get a new citation for a field with an X
|
// get a new citation for a field with an X
|
||||||
var io = new function() { this.wrappedJSObject = this; }
|
var io = new function() { this.wrappedJSObject = this; }
|
||||||
|
@ -472,6 +486,7 @@ Zotero.Integration.SOAP = new function() {
|
||||||
if(citation.updateField) {
|
if(citation.updateField) {
|
||||||
output.push(citation.field);
|
output.push(citation.field);
|
||||||
} else {
|
} else {
|
||||||
|
Zotero.debug("!");
|
||||||
output.push("!");
|
output.push("!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,6 +768,13 @@ Zotero.Integration.CitationFactory.prototype.updateItems = function(citationSet,
|
||||||
var item = Zotero.Items.get(i);
|
var item = Zotero.Items.get(i);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
deletedItems.push(i);
|
deletedItems.push(i);
|
||||||
|
|
||||||
|
if(updateCitations) {
|
||||||
|
for each(var citation in citationSet.citationsByID[i]) {
|
||||||
|
updateCitations[citation.index] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resort = true;
|
resort = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user