- 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
This commit is contained in:
Dan Stillman 2009-08-10 00:28:23 +00:00
parent f3f1c848cc
commit c9706c9f33
4 changed files with 51 additions and 12 deletions

View file

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

View file

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

View file

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

View file

@ -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()"/>