commit cc4d3db84583d818421bce545af7a8108da8ef4d
parent 53e6b2a572cea3354fdc5d674bf43de910714a41
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 17 Jan 2012 01:08:58 -0500
Fix a couple syncing errors
Diffstat:
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -3947,7 +3947,8 @@ Zotero.Sync.Server.Data = new function() {
// Item data
var fields = itemNode.getElementsByTagName('field');
- for each(var field in fields) {
+ for (var i=0, len=fields.length; i<len; i++) {
+ var field = fields[i];
var fieldName = field.getAttribute('name');
item.setField(fieldName, field.textContent);
changedFields[fieldName] = true;
@@ -4080,26 +4081,18 @@ Zotero.Sync.Server.Data = new function() {
var children = collection.getChildren();
if (children) {
- //var collectionKeys = [];
var itemKeys = [];
for each(var child in children) {
- /*
- if (child.type == 'collection') {
- collectionKeys.push(child.key);
- }
- else */if (child.type == 'item') {
+ if (child.type == 'item') {
itemKeys.push(child.key);
}
}
- /*if (collectionKeys.length) {
- var collectionsElem = doc.createElement('collections');
- collectionsElem.appendChild(doc.createTextNode(collectionKeys.join(' ')));
- }*/
if (itemKeys.length) {
var itemsElem = doc.createElement('items');
- itemsElem.textContent(itemKeys.join(' '));
+ itemsElem.appendChild(doc.createTextNode(itemKeys.join(' ')));
+ colElem.appendChild(itemsElem);
}
}
@@ -4358,7 +4351,8 @@ Zotero.Sync.Server.Data = new function() {
// Search conditions
var conditions = searchNode.getElementsByTagName('condition');
- for each(var condition in conditions) {
+ for (var i=0, len=conditions.length; i<len; i++) {
+ var condition = conditions[i];
conditionID = parseInt(condition.getAttribute('id'));
var name = condition.getAttribute('condition');
var mode = condition.getAttribute('mode');