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()
This commit is contained in:
Dan Stillman 2007-02-12 07:06:06 +00:00
parent f1c98f4450
commit 0a3913d792
2 changed files with 12 additions and 5 deletions

View File

@ -2157,6 +2157,12 @@ Zotero.Item.prototype.toArray = function(){
case 'numAttachments': case 'numAttachments':
continue; continue;
case 'firstCreator':
if (!this.isRegularItem()) {
continue;
}
// fall through
// For the rest, just copy over // For the rest, just copy over
default: default:
arr[i] = this._data[i]; arr[i] = this._data[i];
@ -2184,9 +2190,10 @@ Zotero.Item.prototype.toArray = function(){
} }
// Notes // Notes
if (this.isNote()){ if (this.isNote()) {
// Don't need title for notes // Don't need title for notes
delete arr['title']; delete arr['title'];
arr['isAbstract'] = this.isAbstract();
arr['note'] = this.getNote(); arr['note'] = this.getNote();
if (this.getSource()){ if (this.getSource()){
arr['sourceItemID'] = 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 // Attach children of regular items
if (this.isRegularItem()){ if (this.isRegularItem()){
// Append attached notes // Append attached notes
@ -2224,6 +2228,9 @@ Zotero.Item.prototype.toArray = function(){
} }
} }
arr['tags'] = this.getTags();
arr['seeAlso'] = this.getSeeAlso();
return arr; return arr;
} }

View File

@ -1819,7 +1819,7 @@ Zotero.Translate.prototype._exportGetItem = function() {
if(abstractID) { if(abstractID) {
// look for the abstract in the notes array and remove it // look for the abstract in the notes array and remove it
for(var i in returnItemArray.notes) { for(var i in returnItemArray.notes) {
if(returnItemArray.notes[i].itemID == abstractID) { if(returnItemArray.notes[i].isAbstract) {
returnItemArray.abstractNote = returnItemArray.notes[i].note; returnItemArray.abstractNote = returnItemArray.notes[i].note;
returnItemArray.notes.splice(i, 1); returnItemArray.notes.splice(i, 1);
break; break;