commit dd4bc6f5e829534333201a55dae31a6c3e01bb5e
parent a08bbe5347a7749e43cf36f66865e70d4fc78dd1
Author: David Norton <david@nortoncrew.com>
Date: Wed, 26 Jul 2006 14:30:38 +0000
Fixes #113, "New Note" should put note in currently selected project
Diffstat:
4 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/customControls.xml b/chrome/chromeFiles/content/scholar/customControls.xml
@@ -72,6 +72,8 @@
]]>
</setter>
</property>
+ <field name="collectionRef"/>
+ <property name="collection" onget="return this.collectionRef;" onset="this.collectionRef = val;"/>
<property name="value" onget="return this.id('noteField').value;" onset="this.id('noteField').value = val;"/>
<method name="save">
<body>
@@ -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
@@ -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
@@ -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
@@ -71,7 +71,7 @@
<toolbarbutton id="tb-add" tooltiptext="&toolbar.newItem.label;" type="menu">
<menupopup/>
</toolbarbutton>
- <toolbarbutton label="New Note" oncommand="ScholarPane.openNoteWindow();"/>
+ <toolbarbutton label="New Note" oncommand="ScholarPane.newNote();"/>
<spacer flex="1"/>
<label value="&toolbar.search.label;" control="tb-search"/>
<textbox id="tb-search" type="timed" timeout="250" command="cmd_scholar_search"/>