diff --git a/chrome/chromeFiles/content/scholar/customControls.xml b/chrome/chromeFiles/content/scholar/customControls.xml index 196231d92..cd458e86c 100644 --- a/chrome/chromeFiles/content/scholar/customControls.xml +++ b/chrome/chromeFiles/content/scholar/customControls.xml @@ -72,6 +72,8 @@ ]]> + + @@ -86,7 +88,12 @@ if(this.item) var noteID = Scholar.Notes.add(noteField.value,this.item.getID()); //attached to an item else - var noteID = Scholar.Notes.add(noteField.value); //independant note + { + //independent note + var noteID = Scholar.Notes.add(noteField.value); + if(this.collection) + this.collection.addItem(noteID); + } this.note = Scholar.Items.get(noteID); } ]]> diff --git a/chrome/chromeFiles/content/scholar/note.js b/chrome/chromeFiles/content/scholar/note.js index a616b9df5..620bdaa9b 100644 --- a/chrome/chromeFiles/content/scholar/note.js +++ b/chrome/chromeFiles/content/scholar/note.js @@ -14,6 +14,7 @@ function onLoad() params[b[i].substr(0,mid)] = b[i].substr(mid+1); } var id = params['id']; + var collectionID = params['coll']; if(id && id != '' && id != 'undefined') { @@ -31,7 +32,9 @@ function onLoad() } else { - window.title = "Edit Note"; + window.title = "Add Note"; + if(collectionID && collectionID != '' && collectionID != 'undefined') + noteEditor.collection = Scholar.Collections.get(collectionID); } } diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 591a4795b..a4ee307d1 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -27,6 +27,7 @@ var ScholarPane = new function() this.buildCollectionContextMenu = buildCollectionContextMenu; this.buildItemContextMenu = buildItemContextMenu; this.openNoteWindow = openNoteWindow; + this.newNote = newNote; /* * Called when the window is open @@ -291,9 +292,18 @@ var ScholarPane = new function() menu.childNodes[2].setAttribute('label', Scholar.getString('pane.items.menu.remove')); } - function openNoteWindow(id) + function newNote() { - window.open('chrome://scholar/content/note.xul?id='+id,'','chrome,resizable,centerscreen'); + var c = getSelectedCollection(); + if(c) + openNoteWindow(null, c.getID()); + else + openNoteWindow(); + } + + function openNoteWindow(id, parent) + { + window.open('chrome://scholar/content/note.xul?v=1'+(id ? '&id='+id : '')+(parent ? '&coll='+parent : ''),'','chrome,resizable,centerscreen'); } } diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index 16e182d79..ff2a0277f 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -71,7 +71,7 @@ - +