commit 7333a1b538c832f56965d4a84aad1d33fc20bc49
parent 07e75aa9de2975cb3ddae229acff6bbc9a829c0f
Author: David Norton <david@nortoncrew.com>
Date: Wed, 5 Jul 2006 13:09:58 +0000
Fixes #32, implement tags in tags tab
Diffstat:
3 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js
@@ -4,6 +4,7 @@ ScholarItemPane = new function()
var _creatorTypeMenu;
var _beforeRow;
var _notesList;
+ var _tagsList;
var _notesLabel;
var _creatorCount;
@@ -21,6 +22,8 @@ ScholarItemPane = new function()
this.modifyCreator = modifyCreator;
this.removeNote = removeNote;
this.addNote = addNote;
+ this.removeTag = removeTag;
+ this.addTag = addTag;
function onLoad()
{
@@ -29,6 +32,7 @@ ScholarItemPane = new function()
_creatorTypeMenu = document.getElementById('creatorTypeMenu');
_notesList = document.getElementById('editpane-dynamic-notes');
_notesLabel = document.getElementById('editpane-notes-label');
+ _tagsList = document.getElementById('editpane-dynamic-tags');
var creatorTypes = Scholar.CreatorTypes.getTypes();
for(var i = 0; i < creatorTypes.length; i++)
@@ -121,7 +125,7 @@ ScholarItemPane = new function()
label.setAttribute('value',_noteToTitle(notes[i].getNote()));
label.setAttribute('crop','end');
- box = document.createElement('box');
+ var box = document.createElement('box');
box.setAttribute('onclick',"ScholarPane.openNoteWindow("+notes[i].getID()+");");
box.setAttribute('class','clicky');
box.appendChild(icon);
@@ -139,7 +143,38 @@ ScholarItemPane = new function()
_notesList.appendChild(row);
}
}
+
_updateNoteCount();
+
+ //TAGS:
+ while(_tagsList.hasChildNodes())
+ _tagsList.removeChild(_tagsList.firstChild);
+
+ var tags = _itemBeingEdited.getTags();
+ if(tags.length)
+ {
+ for(var i = 0; i < tags.length; i++)
+ {
+ var icon = document.createElement('image');
+ icon.setAttribute('src','chrome://scholar/skin/tag.png');
+
+ var label = document.createElement('label');
+ label.setAttribute('value',Scholar.Tags.getName(tags[i]));
+ label.setAttribute('crop','end');
+
+ var removeButton = document.createElement('label');
+ removeButton.setAttribute("value","-");
+ removeButton.setAttribute("class","clicky");
+ removeButton.setAttribute("onclick","ScholarItemPane.removeTag("+tags[i]+")");
+
+ var row = document.createElement('row');
+ row.appendChild(icon);
+ row.appendChild(label);
+ row.appendChild(removeButton);
+
+ _tagsList.appendChild(row);
+ }
+ }
}
function changeTypeTo(id)
@@ -352,6 +387,18 @@ ScholarItemPane = new function()
_notesLabel.value = Scholar.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":";
}
+
+ function removeTag(id)
+ {
+ _itemBeingEdited.removeTag(id);
+ }
+
+ function addTag()
+ {
+ var t = prompt("Add Tag:");
+ if(t)
+ _itemBeingEdited.addTag(t);
+ }
}
addEventListener("load", function(e) { ScholarItemPane.onLoad(e); }, false);
diff --git a/chrome/chromeFiles/content/scholar/itemPane.xul b/chrome/chromeFiles/content/scholar/itemPane.xul
@@ -31,7 +31,7 @@
<vbox flex="1">
<hbox align="center">
<label id="editpane-notes-label"/>
- <button label="New Note" oncommand="ScholarItemPane.addNote();"/>
+ <button label="Add Note" oncommand="ScholarItemPane.addNote();"/>
</hbox>
<grid flex="1">
<columns>
@@ -41,8 +41,19 @@
<rows id="editpane-dynamic-notes" flex="1"/>
</grid>
</vbox>
- <vbox align="center" pack="center">
- <label value="Coming soon"/>
+ <vbox flex="1">
+ <hbox align="center">
+ <label id="editpane-tags-label"/>
+ <button label="Add Tag" oncommand="ScholarItemPane.addTag();"/>
+ </hbox>
+ <grid flex="1">
+ <columns>
+ <column/>
+ <column flex="1"/>
+ <column/>
+ </columns>
+ <rows id="editpane-dynamic-tags" flex="1"/>
+ </grid>
</vbox>
<vbox align="center" pack="center">
<label value="Coming soon"/>
diff --git a/chrome/chromeFiles/skin/default/scholar/tag.png b/chrome/chromeFiles/skin/default/scholar/tag.png
Binary files differ.