diff --git a/chrome/chromeFiles/content/scholar/customControls.xml b/chrome/chromeFiles/content/scholar/customControls.xml index 76274675ed..ed54b337e9 100644 --- a/chrome/chromeFiles/content/scholar/customControls.xml +++ b/chrome/chromeFiles/content/scholar/customControls.xml @@ -41,4 +41,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/note.js b/chrome/chromeFiles/content/scholar/note.js index ab16b5c029..a616b9df55 100644 --- a/chrome/chromeFiles/content/scholar/note.js +++ b/chrome/chromeFiles/content/scholar/note.js @@ -1,11 +1,9 @@ -var item; -var note; -var _notesField; +var noteEditor; function onLoad() { - _notesField = document.getElementById('notes-box'); - _notesField.focus(); + noteEditor = document.getElementById('note-editor'); + noteEditor.focus(); var params = new Array(); var b = document.location.href.substr(document.location.href.indexOf('?')+1).split('&'); @@ -22,41 +20,25 @@ function onLoad() var ref = Scholar.Items.get(id); if(ref.isNote()) { - note = ref; - if(note.getNoteSource()) - item = Scholar.Items.get(note.getNoteSource()); - - _notesField.setAttribute('value',note.getNote()); + noteEditor.note = ref; + window.title = "Edit Note"; } else { - item = ref; + noteEditor.item = ref; + window.title = "Add Note"; } - - if(item) - document.getElementById('info-label').appendChild(document.createTextNode(item.getField('title') + " by " + item.getField('firstCreator'))); + } + else + { + window.title = "Edit Note"; } } function onUnload() { - save(); -} - -function save() -{ - if(note) //Update note - { - note.updateNote(_notesField.value); - } - else //Create new note - { - if(item) - var noteID = Scholar.Notes.add(_notesField.value,item.getID()); //attached to an item - else - var noteID = Scholar.Notes.add(_notesField.value); //independant note - note = Scholar.Items.get(noteID); - } + if(noteEditor && noteEditor.value) + noteEditor.save(); } addEventListener("load", function(e) { onLoad(e); }, false); diff --git a/chrome/chromeFiles/content/scholar/note.xul b/chrome/chromeFiles/content/scholar/note.xul index d88298f57a..b190cc855f 100644 --- a/chrome/chromeFiles/content/scholar/note.xul +++ b/chrome/chromeFiles/content/scholar/note.xul @@ -4,7 +4,6 @@ - \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 955b9e7795..2e5d4b630d 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -139,6 +139,9 @@ var ScholarPane = new function() if(item.isNote()) { + var noteEditor = document.getElementById('scholar-note-editor'); + noteEditor.item = null; + noteEditor.note = item.ref; document.getElementById('scholar-view-note').lastChild.setAttribute('noteID',item.ref.getID()); document.getElementById('item-pane').selectedIndex = 2; } diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index ff40a26d0e..182e0a5123 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -144,8 +144,8 @@ - - + +