www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit dfd0a7ad83abe38c3103b8464226426cc5e571c8
parent 079b7679743e4d7a60793a8333fddff489bfa017
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri,  2 Nov 2012 05:45:26 -0400

Add option to skip tags when copying items between libraries

Diffstat:
Mchrome/content/zotero/preferences/preferences.xul | 2++
Mchrome/content/zotero/xpcom/collectionTreeView.js | 2+-
Mchrome/content/zotero/xpcom/data/item.js | 17+++++++++++------
Mchrome/content/zotero/zoteroPane.js | 2+-
Mchrome/locale/en-US/zotero/preferences.dtd | 1+
Mdefaults/preferences/zotero.js | 1+
6 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul @@ -64,6 +64,7 @@ To add a new preference: <preference id="pref-groups-copyChildNotes" name="extensions.zotero.groups.copyChildNotes" type="bool"/> <preference id="pref-groups-copyChildFileAttachments" name="extensions.zotero.groups.copyChildFileAttachments" type="bool"/> <preference id="pref-groups-copyChildLinks" name="extensions.zotero.groups.copyChildLinks" type="bool"/> + <preference id="pref-groups-copyTags" name="extensions.zotero.groups.copyTags" type="bool"/> </preferences> <groupbox id="zotero-prefpane-general-groupbox"> @@ -148,6 +149,7 @@ To add a new preference: <checkbox label="&zotero.preferences.groups.childNotes;" preference="pref-groups-copyChildNotes"/> <checkbox label="&zotero.preferences.groups.childFiles;" preference="pref-groups-copyChildFileAttachments"/> <checkbox label="&zotero.preferences.groups.childLinks;" preference="pref-groups-copyChildLinks"/> + <checkbox label="&zotero.preferences.groups.tags;" preference="pref-groups-copyTags"/> </vbox> </groupbox> diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -1449,7 +1449,7 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient) // DEBUG: save here because clone() doesn't currently work on unsaved tagged items var id = newItem.save(); newItem = Zotero.Items.get(id); - item.clone(false, newItem); + item.clone(false, newItem, false, !Zotero.Prefs.get('groups.copyTags')); newItem.save(); //var id = newItem.save(); //var newItem = Zotero.Items.get(id); diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -3873,18 +3873,23 @@ Zotero.Item.prototype.multiDiff = function (otherItems, ignoreFields) { /** * Returns an unsaved copy of the item * - * @param {Boolean} [includePrimary=false] - * @param {Zotero.Item} [newItem=null] Target item for clone (used to pass a saved - * item for duplicating items with tags) - * @param {Boolean} [unsaved=false] Skip properties that require a saved object (e.g., tags) + * @param {Boolean} [includePrimary=false] + * @param {Zotero.Item} [newItem=null] Target item for clone (used to pass a saved + * item for duplicating items with tags) + * @param {Boolean} [unsaved=false] Skip properties that require a saved object (e.g., tags) + * @param {Boolean} [skipTags=false] Skip tags (implied by 'unsaved') */ -Zotero.Item.prototype.clone = function(includePrimary, newItem, unsaved) { +Zotero.Item.prototype.clone = function(includePrimary, newItem, unsaved, skipTags) { Zotero.debug('Cloning item ' + this.id); if (includePrimary && newItem) { throw ("includePrimary and newItem parameters are mutually exclusive in Zotero.Item.clone()"); } + if (unsaved) { + skipTags = true; + } + Zotero.DB.beginTransaction(); // TODO: get rid of serialize() call @@ -4024,7 +4029,7 @@ Zotero.Item.prototype.clone = function(includePrimary, newItem, unsaved) { } } - if (!unsaved && obj.tags) { + if (!skipTags && obj.tags) { for each(var tag in obj.tags) { if (sameLibrary) { newItem.addTagByID(tag.primary.tagID); diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -1463,7 +1463,7 @@ var ZoteroPane = new function() var id = newItem.save(); var newItem = Zotero.Items.get(id); - item.clone(false, newItem); + item.clone(false, newItem, false, !Zotero.Prefs.get('groups.copyTags')); newItem.save(); if (this.itemsView._itemGroup.isCollection() && !newItem.getSource()) { diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd @@ -38,6 +38,7 @@ <!ENTITY zotero.preferences.groups.childNotes "child notes"> <!ENTITY zotero.preferences.groups.childFiles "child snapshots and imported files"> <!ENTITY zotero.preferences.groups.childLinks "child links"> +<!ENTITY zotero.preferences.groups.tags "tags"> <!ENTITY zotero.preferences.openurl.caption "OpenURL"> diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js @@ -44,6 +44,7 @@ pref("extensions.zotero.viewOnDoubleClick", true); pref("extensions.zotero.groups.copyChildLinks", true); pref("extensions.zotero.groups.copyChildFileAttachments", true); pref("extensions.zotero.groups.copyChildNotes", true); +pref("extensions.zotero.groups.copyTags", true); pref("extensions.zotero.backup.numBackups", 2); pref("extensions.zotero.backup.interval", 1440);