commit fffe67967b719bad9dd6e60cadc37e9c730cbb51
parent 2db050290d8b88a78da4540c8de32b6c48676951
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 5 Aug 2011 22:19:52 +0000
Clear all tags in tag selector if a selected tag is removed via the tags pane
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/tag.js b/chrome/content/zotero/xpcom/data/tag.js
@@ -397,6 +397,12 @@ Zotero.Tag.prototype.save = function (full) {
var done = 0;
var maxItems = 998; // stay below compiled limit
var numItems = removed.length;
+
+ var pairs = [];
+ for each(var itemID in removed) {
+ pairs.push(itemID + "-" + tagID);
+ }
+
var tempRemoved = removed;
do {
@@ -409,12 +415,15 @@ Zotero.Tag.prototype.save = function (full) {
done += chunk.length;
}
while (done < numItems);
+
+ Zotero.Notifier.trigger('remove', 'item-tag', pairs);
}
if (newids.length) {
var sql = "INSERT INTO itemTags (itemID, tagID) VALUES (?,?)";
var insertStatement = Zotero.DB.getStatement(sql);
+ var pairs = [];
for each(var itemID in newids) {
insertStatement.bindInt32Parameter(0, itemID);
insertStatement.bindInt32Parameter(1, tagID);
@@ -427,11 +436,13 @@ Zotero.Tag.prototype.save = function (full) {
Zotero.debug("tagID: " + tagID);
throw (e + ' [ERROR: ' + Zotero.DB.getLastErrorString() + ']');
}
+
+ pairs.push(itemID + "-" + tagID);
}
+
+ Zotero.Notifier.trigger('add', 'item-tag', pairs);
}
- //Zotero.Notifier.trigger('add', 'tag-item', this.id + '-' + itemID);
-
// TODO: notify linked items of name changes?
Zotero.Notifier.trigger('modify', 'item', removed.concat(newids));
}