Fixes #113, "New Note" should put note in currently selected project

This commit is contained in:
David Norton 2006-07-26 14:30:38 +00:00
parent a08bbe5347
commit dd4bc6f5e8
4 changed files with 25 additions and 5 deletions

View file

@ -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);
}
]]>

View file

@ -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);
}
}

View file

@ -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');
}
}

View file

@ -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"/>