www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit fb9e803ab554b0400db9c86193416e67084b8d2a
parent a33b119dff95edeb6c24108df8e30345c426a724
Author: David Norton <david@nortoncrew.com>
Date:   Mon, 26 Jun 2006 12:58:22 +0000

closes #22, button in note pane for new note
closes #26, notes list in notes pane
closes #79, add icons for new object types
fixes #71, Metadata pane should be refreshed on a notify() event for the selected item

Diffstat:
Mchrome/chromeFiles/content/scholar/itemPane.js | 44++++++++++++++++++++------------------------
Mchrome/chromeFiles/content/scholar/itemPane.xul | 20++++++++------------
Achrome/chromeFiles/content/scholar/note.js | 34++++++++++++++++++++++++++++++++++
Achrome/chromeFiles/content/scholar/note.xul | 19+++++++++++++++++++
Mchrome/chromeFiles/skin/default/scholar/overlay.css | 5-----
Mchrome/chromeFiles/skin/default/scholar/scholar.css | 5+++++
Achrome/chromeFiles/skin/default/scholar/treeitem-artwork.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-bookSection.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-film.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-interview.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-letter.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-magazineArticle.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-manuscript.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-newspaperArticle.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-note.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-thesis.png | 0
Achrome/chromeFiles/skin/default/scholar/treeitem-website.png | 0
17 files changed, 86 insertions(+), 41 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js @@ -3,8 +3,7 @@ ScholarItemPane = new function() var _dynamicFields; var _creatorTypeMenu; var _beforeRow; - var _notesMenu; - var _notesField; + var _notesList; var _notesLabel; var _creatorCount; @@ -30,9 +29,8 @@ ScholarItemPane = new function() _dynamicFields = document.getElementById('editpane-dynamic-fields'); _itemTypeMenu = document.getElementById('editpane-type-menu'); _creatorTypeMenu = document.getElementById('creatorTypeMenu'); - _notesMenu = document.getElementById('scholar-notes-menu'); - _notesField = document.getElementById('scholar-notes-field'); - _notesLabel = document.getElementById('scholar-notes-label'); + _notesList = document.getElementById('editpane-dynamic-notes'); + _notesLabel = document.getElementById('editpane-notes-label'); var creatorTypes = Scholar.CreatorTypes.getTypes(); for(var i = 0; i < creatorTypes.length; i++) @@ -56,10 +54,7 @@ ScholarItemPane = new function() * Loads an item */ function viewItem(thisItem) - { - if(_itemBeingEdited && thisItem.getID() == _itemBeingEdited.getID()) - return; - + { if(document.commandDispatcher.focusedElement) document.commandDispatcher.focusedElement.blur(); @@ -112,19 +107,25 @@ ScholarItemPane = new function() } //NOTES: - _notesMenu.removeAllItems(); + while(_notesList.hasChildNodes()) + _notesList.removeChild(_notesList.firstChild); var notes = _itemBeingEdited.getNotes(); if(notes.length) + { for(var i = 0; i < notes.length; i++) - _notesMenu.appendItem(_noteToTitle(_itemBeingEdited.getNote(notes[i])),notes[i]); - else - addNote(); - + { + var row = document.createElement('row'); + var button = document.createElement('label'); + button.setAttribute('value',_noteToTitle(_itemBeingEdited.getNote(notes[i]))); + button.setAttribute('onclick',"window.open('chrome://scholar/content/note.xul?item="+_itemBeingEdited.getID()+"&note="+notes[i]+"','','chrome,resizable,centerscreen');"); + button.setAttribute('class','clicky') + row.appendChild(button); + + _notesList.appendChild(row); + } + } _updateNoteCount(); - _notesMenu.selectedIndex = 0; - - onNoteSelected(); } function changeTypeTo(id) @@ -347,12 +348,7 @@ ScholarItemPane = new function() function addNote() { - modifySelectedNote(); - _notesMenu.appendItem(Scholar.getString('pane.item.notes.untitled'),null); - _notesMenu.selectedIndex = _notesMenu.firstChild.childNodes.length-1; - - onNoteSelected(); - _updateNoteCount(); + window.open("chrome://scholar/content/note.xul?item="+_itemBeingEdited.getID(),'','chrome,resizable,centerscreen'); } function onNoteSelected() @@ -390,7 +386,7 @@ ScholarItemPane = new function() function _updateNoteCount() { - var c = _notesMenu.firstChild.childNodes.length; + var c = _notesList.childNodes.length; _notesLabel.value = Scholar.getString('pane.item.notes.count.'+(c != 1 ? "plural" : "singular")).replace('%1',c) + ":"; } diff --git a/chrome/chromeFiles/content/scholar/itemPane.xul b/chrome/chromeFiles/content/scholar/itemPane.xul @@ -31,18 +31,14 @@ </grid> </vbox> <vbox> - <hbox align="center"> - <label id="scholar-notes-label"/> - <menulist flex="1" id="scholar-notes-menu" oncommand="ScholarItemPane.onNoteSelected();"> - <menupopup/> - </menulist> - <label value="&scholar.minus;" class="clicky" onclick="ScholarItemPane.removeSelectedNote();"/> - <label value="&scholar.plus;" class="clicky" onclick="ScholarItemPane.addNote();"/> - </hbox> - <textbox id="scholar-notes-field" - type="timed" timeout="1000" oncommand="ScholarItemPane.modifySelectedNote();" - multiline="true" flex="1" - onblur="ScholarItemPane.modifySelectedNote();"/> + <button label="New Note" oncommand="ScholarItemPane.addNote();"/> + <label id="editpane-notes-label"/> + <grid flex="1"> + <columns> + <column flex="1"/> + </columns> + <rows id="editpane-dynamic-notes" flex="1"/> + </grid> </vbox> <vbox align="center" pack="center"> <label value="Coming soon"/> diff --git a/chrome/chromeFiles/content/scholar/note.js b/chrome/chromeFiles/content/scholar/note.js @@ -0,0 +1,33 @@ +var item; +var noteID; +var note; +var _notesField; + +function onLoad() +{ + _notesField = document.getElementById('notes-box'); + var params = new Array(); + var b = document.location.href.substr(document.location.href.indexOf('?')+1).split('&'); + for(var i = 0; i < b.length; i++) + { + var mid = b[i].indexOf('='); + + params[b[i].substr(0,mid)] = b[i].substr(mid+1); + } + item = Scholar.Items.get(params['item']); + noteID = params['note']; + + document.getElementById('info-label').setAttribute('value',item.getField('title')); + if(noteID) + _notesField.setAttribute('value',item.getNote(noteID)); +} + +function save() +{ + if(noteID) + item.updateNote(noteID,_notesField.value); + else + noteID = item.addNote(_notesField.value); +} + +addEventListener("load", function(e) { onLoad(e); }, false); +\ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/note.xul b/chrome/chromeFiles/content/scholar/note.xul @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?> + +<window + id="scholar-note-window" + title="Edit Note" + orient="vertical" + width="400" + height="250" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <script src="include.js"/> + <script src="note.js"/> + + <label id="info-label"/> + <textbox id="notes-box" flex="1" multiline="true" type="timed" timeout="1000" oncommand="save();"/> +</window> +\ No newline at end of file diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css @@ -120,11 +120,6 @@ vbox #scholar-pane background: #666666; } -textbox[multiline="true"][type="timed"] -{ - -moz-binding: url('chrome://scholar/content/customControls.xml#timed-textarea'); -} - #scholar-splitter { border-top: none; diff --git a/chrome/chromeFiles/skin/default/scholar/scholar.css b/chrome/chromeFiles/skin/default/scholar/scholar.css @@ -0,0 +1,4 @@ +textbox[multiline="true"][type="timed"] +{ + -moz-binding: url('chrome://scholar/content/customControls.xml#timed-textarea'); +} +\ No newline at end of file diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-artwork.png b/chrome/chromeFiles/skin/default/scholar/treeitem-artwork.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-bookSection.png b/chrome/chromeFiles/skin/default/scholar/treeitem-bookSection.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-film.png b/chrome/chromeFiles/skin/default/scholar/treeitem-film.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-interview.png b/chrome/chromeFiles/skin/default/scholar/treeitem-interview.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-letter.png b/chrome/chromeFiles/skin/default/scholar/treeitem-letter.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-magazineArticle.png b/chrome/chromeFiles/skin/default/scholar/treeitem-magazineArticle.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-manuscript.png b/chrome/chromeFiles/skin/default/scholar/treeitem-manuscript.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-newspaperArticle.png b/chrome/chromeFiles/skin/default/scholar/treeitem-newspaperArticle.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-note.png b/chrome/chromeFiles/skin/default/scholar/treeitem-note.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-thesis.png b/chrome/chromeFiles/skin/default/scholar/treeitem-thesis.png Binary files differ. diff --git a/chrome/chromeFiles/skin/default/scholar/treeitem-website.png b/chrome/chromeFiles/skin/default/scholar/treeitem-website.png Binary files differ.