commit c9706c9f33eddd0cbe7b26bb84334a76e37c77ad
parent f3f1c848cc9bb99d3a2d011a81b261a460a47c81
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 10 Aug 2009 00:28:23 +0000
- Don't show context menu or allow drag in tag selector in read-only mode
- Don't show create type context menu hover effect or dropmarker in read-only mode
Diffstat:
4 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml
@@ -628,11 +628,15 @@
typeBox.setAttribute("typeid", typeID);
typeBox.setAttribute("popup", "creator-type-menu");
typeBox.setAttribute("fieldname", 'creator-' + this._creatorCount + '-typeID');
- typeBox.className = 'creator-type-label zotero-clicky';
-
- var img = document.createElement('image');
- img.setAttribute('src', 'chrome://zotero/skin/arrow-down.gif');
- typeBox.appendChild(img);
+ if (this.editable) {
+ typeBox.className = 'creator-type-label zotero-clicky';
+ var img = document.createElement('image');
+ img.setAttribute('src', 'chrome://zotero/skin/arrow-down.gif');
+ typeBox.appendChild(img);
+ }
+ else {
+ typeBox.className = 'creator-type-label';
+ }
var label = document.createElement("label");
label.setAttribute('value',
diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml
@@ -40,6 +40,35 @@
<field name="_empty">null</field>
<field name="selection"/>
+ <!-- Modes are predefined settings groups for particular tasks -->
+ <field name="_mode">"view"</field>
+ <property name="mode" onget="return this._mode;">
+ <setter>
+ <![CDATA[
+ this.clickable = false;
+ this.editable = false;
+
+ switch (val) {
+ case 'view':
+ break;
+
+ case 'edit':
+ this.clickable = true;
+ this.editable = true;
+ //this.clickHandler = this.showEditor;
+ //this.blurHandler = this.hideEditor;
+ break;
+
+ default:
+ throw ("Invalid mode '" + val + "' in tagselector.xml");
+ }
+
+ this._mode = val;
+ document.getAnonymousNodes(this)[0].setAttribute('mode', val);
+ ]]>
+ </setter>
+ </property>
+
<field name="_libraryID"/>
<property name="libraryID" onget="return this._libraryID">
<setter>
@@ -182,6 +211,7 @@
var empty = true;
var tagsToggleBox = this.id('tags-toggle');
+
if (fetch || this._dirty) {
this._tags = Zotero.Tags.getAll(this._types, this.libraryID);
@@ -190,8 +220,6 @@
tagsToggleBox.removeChild(tagsToggleBox.firstChild);
}
-
-
var i=0;
for (var tagID in this._tags) {
// If the last tag was the same, add this tagID and tagType to it
@@ -212,10 +240,12 @@
label.setAttribute('value', this._tags[tagID].name);
label.setAttribute('tagID', tagID);
label.setAttribute('tagType', this._tags[tagID].type);
- label.setAttribute('context', 'tag-menu');
- label.setAttribute('ondragover', 'nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode.dragObserver)');
- label.setAttribute('ondragexit', 'nsDragAndDrop.dragExit(event, this.parentNode.parentNode.parentNode.dragObserver)');
- label.setAttribute('ondragdrop', 'nsDragAndDrop.drop(event, this.parentNode.parentNode.parentNode.dragObserver)');
+ if (this.editable) {
+ label.setAttribute('context', 'tag-menu');
+ label.setAttribute('ondragover', 'nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode.dragObserver)');
+ label.setAttribute('ondragexit', 'nsDragAndDrop.dragExit(event, this.parentNode.parentNode.parentNode.dragObserver)');
+ label.setAttribute('ondragdrop', 'nsDragAndDrop.drop(event, this.parentNode.parentNode.parentNode.dragObserver)');
+ }
tagsToggleBox.appendChild(label);
}
i++;
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
@@ -889,6 +889,12 @@ var ZoteroPane = new function()
if (!tagSelector.getAttribute('collapsed') ||
tagSelector.getAttribute('collapsed') == 'false') {
Zotero.debug('Updating tag selector with current tags');
+ if (itemGroup.isEditable()) {
+ tagSelector.mode = 'edit';
+ }
+ else {
+ tagSelector.mode = 'view';
+ }
tagSelector.libraryID = itemGroup.ref.libraryID;
tagSelector.scope = itemGroup.getChildTags();
}
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
@@ -73,7 +73,6 @@
</popup>
<vbox id="appcontent">
- <!-- Changes to attributes of zotero-splitter and zotero-pane must be mirrored on overlay.js's onLoad() function -->
<!-- onmouseup shouldn't be necessary but seems to help prevent tag selector from sometimes going off the screen -->
<splitter id="zotero-splitter" resizebefore="closest" resizeafter="closest" hidden="true"
onmouseup="ZoteroPane.updateTagSelectorSize()"/>