From 0a3913d792ed1014a74a5c30fb38c78a8bed2667 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 12 Feb 2007 07:06:06 +0000 Subject: [PATCH] Add 'isAbstract' property to notes arrays in toArray() output; changed translate.js to use it (not that it matters). We might want to add abstractID and abstract to the parent too--should the abstract be included if the user doesn't check "Export Notes"? Don't include empty 'firstCreator' in notes and attachments in toArray() --- chrome/content/zotero/xpcom/data_access.js | 15 +++++++++++---- chrome/content/zotero/xpcom/translate.js | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index a9549e4d2..a515614dd 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -2157,6 +2157,12 @@ Zotero.Item.prototype.toArray = function(){ case 'numAttachments': continue; + case 'firstCreator': + if (!this.isRegularItem()) { + continue; + } + // fall through + // For the rest, just copy over default: arr[i] = this._data[i]; @@ -2184,9 +2190,10 @@ Zotero.Item.prototype.toArray = function(){ } // Notes - if (this.isNote()){ + if (this.isNote()) { // Don't need title for notes delete arr['title']; + arr['isAbstract'] = this.isAbstract(); arr['note'] = this.getNote(); if (this.getSource()){ arr['sourceItemID'] = this.getSource(); @@ -2203,9 +2210,6 @@ Zotero.Item.prototype.toArray = function(){ } } - arr['tags'] = this.getTags(); - arr['seeAlso'] = this.getSeeAlso(); - // Attach children of regular items if (this.isRegularItem()){ // Append attached notes @@ -2224,6 +2228,9 @@ Zotero.Item.prototype.toArray = function(){ } } + arr['tags'] = this.getTags(); + arr['seeAlso'] = this.getSeeAlso(); + return arr; } diff --git a/chrome/content/zotero/xpcom/translate.js b/chrome/content/zotero/xpcom/translate.js index 00a554907..f04673977 100644 --- a/chrome/content/zotero/xpcom/translate.js +++ b/chrome/content/zotero/xpcom/translate.js @@ -1819,7 +1819,7 @@ Zotero.Translate.prototype._exportGetItem = function() { if(abstractID) { // look for the abstract in the notes array and remove it for(var i in returnItemArray.notes) { - if(returnItemArray.notes[i].itemID == abstractID) { + if(returnItemArray.notes[i].isAbstract) { returnItemArray.abstractNote = returnItemArray.notes[i].note; returnItemArray.notes.splice(i, 1); break;