2006-06-28 18:30:29 +00:00
|
|
|
var noteEditor;
|
2006-06-26 12:58:22 +00:00
|
|
|
|
|
|
|
function onLoad()
|
|
|
|
{
|
2006-06-28 18:30:29 +00:00
|
|
|
noteEditor = document.getElementById('note-editor');
|
|
|
|
noteEditor.focus();
|
2006-06-26 14:46:21 +00:00
|
|
|
|
2006-06-26 12:58:22 +00:00
|
|
|
var params = new Array();
|
|
|
|
var b = document.location.href.substr(document.location.href.indexOf('?')+1).split('&');
|
|
|
|
for(var i = 0; i < b.length; i++)
|
|
|
|
{
|
|
|
|
var mid = b[i].indexOf('=');
|
|
|
|
|
|
|
|
params[b[i].substr(0,mid)] = b[i].substr(mid+1);
|
|
|
|
}
|
2006-06-27 22:47:17 +00:00
|
|
|
var id = params['id'];
|
2006-07-26 14:30:38 +00:00
|
|
|
var collectionID = params['coll'];
|
2006-06-26 12:58:22 +00:00
|
|
|
|
2006-06-27 22:47:17 +00:00
|
|
|
if(id && id != '' && id != 'undefined')
|
2006-06-27 20:37:02 +00:00
|
|
|
{
|
2006-06-27 22:47:17 +00:00
|
|
|
var ref = Scholar.Items.get(id);
|
|
|
|
if(ref.isNote())
|
|
|
|
{
|
2006-06-28 18:30:29 +00:00
|
|
|
noteEditor.note = ref;
|
|
|
|
window.title = "Edit Note";
|
2006-06-27 22:47:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-06-28 18:30:29 +00:00
|
|
|
noteEditor.item = ref;
|
|
|
|
window.title = "Add Note";
|
2006-06-27 22:47:17 +00:00
|
|
|
}
|
2006-06-28 18:30:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-07-26 14:30:38 +00:00
|
|
|
window.title = "Add Note";
|
|
|
|
if(collectionID && collectionID != '' && collectionID != 'undefined')
|
|
|
|
noteEditor.collection = Scholar.Collections.get(collectionID);
|
2006-06-27 20:37:02 +00:00
|
|
|
}
|
2006-06-26 12:58:22 +00:00
|
|
|
}
|
|
|
|
|
2006-06-26 14:46:21 +00:00
|
|
|
function onUnload()
|
|
|
|
{
|
2006-06-28 18:30:29 +00:00
|
|
|
if(noteEditor && noteEditor.value)
|
|
|
|
noteEditor.save();
|
2006-06-26 12:58:22 +00:00
|
|
|
}
|
|
|
|
|
2006-06-26 14:46:21 +00:00
|
|
|
addEventListener("load", function(e) { onLoad(e); }, false);
|
|
|
|
addEventListener("unload", function(e) { onUnload(e); }, false);
|