From dd4bc6f5e829534333201a55dae31a6c3e01bb5e Mon Sep 17 00:00:00 2001 From: David Norton Date: Wed, 26 Jul 2006 14:30:38 +0000 Subject: [PATCH] Fixes #113, "New Note" should put note in currently selected project --- .../chromeFiles/content/scholar/customControls.xml | 9 ++++++++- chrome/chromeFiles/content/scholar/note.js | 5 ++++- chrome/chromeFiles/content/scholar/overlay.js | 14 ++++++++++++-- chrome/chromeFiles/content/scholar/overlay.xul | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/customControls.xml b/chrome/chromeFiles/content/scholar/customControls.xml index 196231d927..cd458e86cf 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 a616b9df55..620bdaa9b6 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 591a4795ba..a4ee307d19 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 16e182d79f..ff2a0277ff 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -71,7 +71,7 @@ - +