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