Don't show Add and remove buttons for read-only tags

This commit is contained in:
Dan Stillman 2009-08-09 23:51:54 +00:00
parent 53bd9afeac
commit 3bd954e3da

View file

@ -107,6 +107,9 @@
<![CDATA[ <![CDATA[
Zotero.debug('Reloading tags'); Zotero.debug('Reloading tags');
var addButton = this.id('addButton');
addButton.hidden = !this.editable;
var rows = this.id('tagRows'); var rows = this.id('tagRows');
while(rows.hasChildNodes()) while(rows.hasChildNodes())
rows.removeChild(rows.firstChild); rows.removeChild(rows.firstChild);
@ -174,23 +177,27 @@
var label = this.createValueElement(name, tabindex); var label = this.createValueElement(name, tabindex);
var remove = document.createElement("label"); if (this.editable) {
remove.setAttribute('value','-'); var remove = document.createElement("label");
remove.setAttribute('class','zotero-clicky'); remove.setAttribute('value','-');
if (tagID) remove.setAttribute('class','zotero-clicky');
{ if (tagID)
remove.setAttribute('ztabindex', -1); {
remove.setAttribute('onclick',"document.getBindingParent(this).remove('"+ tagID +"');"); remove.setAttribute('ztabindex', -1);
} remove.setAttribute('onclick',"document.getBindingParent(this).remove('"+ tagID +"');");
else }
{ else
remove.setAttribute('disabled', true); {
remove.setAttribute('disabled', true);
}
} }
var row = document.createElement("row"); var row = document.createElement("row");
row.appendChild(icon); row.appendChild(icon);
row.appendChild(label); row.appendChild(label);
row.appendChild(remove); if (this.editable) {
row.appendChild(remove);
}
if (tagID) if (tagID)
{ {
@ -694,8 +701,9 @@
<xul:scrollbox xbl:inherits="flex" orient="vertical" style="overflow:auto"> <xul:scrollbox xbl:inherits="flex" orient="vertical" style="overflow:auto">
<xul:hbox align="center"> <xul:hbox align="center">
<xul:label id="tagsNum"/> <xul:label id="tagsNum"/>
<xul:button label="&zotero.item.add;" oncommand="document.getBindingParent(this).new();"/> <xul:button id="addButton" label="&zotero.item.add;" oncommand="document.getBindingParent(this).new();" hidden="true"/>
</xul:hbox> </xul:hbox>
<xul:separator class="thin"/>
<xul:grid> <xul:grid>
<xul:columns> <xul:columns>
<xul:column/> <xul:column/>