From 1cdd1f3de238f725b6a05a78187ff8f5fc5d8126 Mon Sep 17 00:00:00 2001 From: David Norton Date: Wed, 5 Jul 2006 15:08:24 +0000 Subject: [PATCH] Fixes #24, tags for notes. This is now a new control, which is pretty darn portable. --- .../content/scholar/customControls.xml | 128 +++++++++++++++++- .../chromeFiles/content/scholar/itemPane.js | 43 +----- .../chromeFiles/content/scholar/itemPane.xul | 13 +- .../skin/default/scholar/scholar.css | 6 + 4 files changed, 135 insertions(+), 55 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/customControls.xml b/chrome/chromeFiles/content/scholar/customControls.xml index ed54b337e9..836a6b584d 100644 --- a/chrome/chromeFiles/content/scholar/customControls.xml +++ b/chrome/chromeFiles/content/scholar/customControls.xml @@ -68,6 +68,8 @@ this.item = Scholar.Items.get(this.note.getNoteSource()); document.getAnonymousNodes(this)[0].childNodes[1].setAttribute('value',this.note.getNote()); + document.getAnonymousNodes(this)[0].lastChild.firstChild.item = this.note; + this.updateTagsSummary(); ]]> @@ -98,6 +100,22 @@ ]]> + + + + + @@ -106,7 +124,115 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js index 92c4d6d417..4b5bc0dc39 100644 --- a/chrome/chromeFiles/content/scholar/itemPane.js +++ b/chrome/chromeFiles/content/scholar/itemPane.js @@ -22,8 +22,6 @@ ScholarItemPane = new function() this.modifyCreator = modifyCreator; this.removeNote = removeNote; this.addNote = addNote; - this.removeTag = removeTag; - this.addTag = addTag; function onLoad() { @@ -147,34 +145,7 @@ ScholarItemPane = new function() _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); - } - } + _tagsList.item = _itemBeingEdited; } function changeTypeTo(id) @@ -387,18 +358,6 @@ 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 index 4f2d3f33a0..c60c8fe124 100644 --- a/chrome/chromeFiles/content/scholar/itemPane.xul +++ b/chrome/chromeFiles/content/scholar/itemPane.xul @@ -42,18 +42,7 @@ - -