Add option to skip tags when copying items between libraries

This commit is contained in:
Dan Stillman 2012-11-02 05:45:26 -04:00
parent 079b767974
commit dfd0a7ad83
6 changed files with 17 additions and 8 deletions

View file

@ -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>

View file

@ -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);

View file

@ -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);

View file

@ -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()) {

View file

@ -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">

View file

@ -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);