Fixes #113, "New Note" should put note in currently selected project
This commit is contained in:
parent
a08bbe5347
commit
dd4bc6f5e8
4 changed files with 25 additions and 5 deletions
|
@ -72,6 +72,8 @@
|
||||||
]]>
|
]]>
|
||||||
</setter>
|
</setter>
|
||||||
</property>
|
</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;"/>
|
<property name="value" onget="return this.id('noteField').value;" onset="this.id('noteField').value = val;"/>
|
||||||
<method name="save">
|
<method name="save">
|
||||||
<body>
|
<body>
|
||||||
|
@ -86,7 +88,12 @@
|
||||||
if(this.item)
|
if(this.item)
|
||||||
var noteID = Scholar.Notes.add(noteField.value,this.item.getID()); //attached to an item
|
var noteID = Scholar.Notes.add(noteField.value,this.item.getID()); //attached to an item
|
||||||
else
|
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);
|
this.note = Scholar.Items.get(noteID);
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
|
|
|
@ -14,6 +14,7 @@ function onLoad()
|
||||||
params[b[i].substr(0,mid)] = b[i].substr(mid+1);
|
params[b[i].substr(0,mid)] = b[i].substr(mid+1);
|
||||||
}
|
}
|
||||||
var id = params['id'];
|
var id = params['id'];
|
||||||
|
var collectionID = params['coll'];
|
||||||
|
|
||||||
if(id && id != '' && id != 'undefined')
|
if(id && id != '' && id != 'undefined')
|
||||||
{
|
{
|
||||||
|
@ -31,7 +32,9 @@ function onLoad()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
window.title = "Edit Note";
|
window.title = "Add Note";
|
||||||
|
if(collectionID && collectionID != '' && collectionID != 'undefined')
|
||||||
|
noteEditor.collection = Scholar.Collections.get(collectionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ var ScholarPane = new function()
|
||||||
this.buildCollectionContextMenu = buildCollectionContextMenu;
|
this.buildCollectionContextMenu = buildCollectionContextMenu;
|
||||||
this.buildItemContextMenu = buildItemContextMenu;
|
this.buildItemContextMenu = buildItemContextMenu;
|
||||||
this.openNoteWindow = openNoteWindow;
|
this.openNoteWindow = openNoteWindow;
|
||||||
|
this.newNote = newNote;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when the window is open
|
* 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'));
|
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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<toolbarbutton id="tb-add" tooltiptext="&toolbar.newItem.label;" type="menu">
|
<toolbarbutton id="tb-add" tooltiptext="&toolbar.newItem.label;" type="menu">
|
||||||
<menupopup/>
|
<menupopup/>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
<toolbarbutton label="New Note" oncommand="ScholarPane.openNoteWindow();"/>
|
<toolbarbutton label="New Note" oncommand="ScholarPane.newNote();"/>
|
||||||
<spacer flex="1"/>
|
<spacer flex="1"/>
|
||||||
<label value="&toolbar.search.label;" control="tb-search"/>
|
<label value="&toolbar.search.label;" control="tb-search"/>
|
||||||
<textbox id="tb-search" type="timed" timeout="250" command="cmd_scholar_search"/>
|
<textbox id="tb-search" type="timed" timeout="250" command="cmd_scholar_search"/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue