2006-05-23 21:59:31 +00:00
|
|
|
var foldersView;
|
|
|
|
var itemsView;
|
|
|
|
|
2006-05-23 19:06:11 +00:00
|
|
|
function init()
|
|
|
|
{
|
2006-05-23 21:59:31 +00:00
|
|
|
foldersView = new Scholar.TreeView(0); //pass params here?
|
|
|
|
document.getElementById('folders-tree').view = foldersView;
|
|
|
|
itemsView = new Scholar.TreeView(0);
|
|
|
|
document.getElementById('items-tree').view = itemsView;
|
|
|
|
|
|
|
|
var addMenu = document.getElementById('tb-add').firstChild;
|
|
|
|
var itemTypes = Scholar.ItemTypes.getTypes();
|
|
|
|
for(var i = 0; i<itemTypes.length; i++)
|
|
|
|
{
|
|
|
|
var menuitem = document.createElement("menuitem");
|
2006-05-27 00:20:27 +00:00
|
|
|
menuitem.setAttribute("label", Scholar.getString("itemTypes."+itemTypes[i]['name']));
|
2006-05-23 21:59:31 +00:00
|
|
|
menuitem.setAttribute("oncommand","newItem("+itemTypes[i]['id']+")");
|
|
|
|
addMenu.appendChild(menuitem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function newItem(typeID)
|
|
|
|
{
|
2006-05-24 13:31:39 +00:00
|
|
|
alert("new item of type: "+typeID);
|
2006-05-23 21:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function newFolder()
|
|
|
|
{
|
2006-05-24 13:31:39 +00:00
|
|
|
alert("new folder");
|
2006-05-23 21:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function folderSelected()
|
|
|
|
{
|
|
|
|
if(foldersView.selection.count == 1 && foldersView.selection.currentIndex != -1)
|
|
|
|
{
|
|
|
|
itemsView = new Scholar.TreeView(foldersView._getItemAtRow(foldersView.selection.currentIndex).getID());
|
|
|
|
document.getElementById('items-tree').view = itemsView;
|
|
|
|
}
|
|
|
|
else if(foldersView.selection.count == 0)
|
|
|
|
{
|
|
|
|
itemsView = new Scholar.TreeView(0);
|
|
|
|
document.getElementById('items-tree').view = itemsView;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
document.getElementById('items-tree').view = null;
|
|
|
|
}
|
|
|
|
|
2006-05-24 13:31:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function itemSelected()
|
|
|
|
{
|
|
|
|
document.getElementById('view-pane').setAttribute('src','http://www.apple.com/');
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteSelection()
|
|
|
|
{
|
|
|
|
if(itemsView && itemsView.selection.count > 0 && confirm("Are you sure you want to delete the selection????"))
|
|
|
|
{
|
2006-05-24 16:03:24 +00:00
|
|
|
itemsView.deleteSelection();
|
2006-05-24 13:31:39 +00:00
|
|
|
}
|
2006-05-24 18:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function search()
|
|
|
|
{
|
|
|
|
//TO DO: reload items tree with a search instead of a root folder
|
|
|
|
alert(document.getElementById('tb-search').value);
|
2006-05-23 19:06:11 +00:00
|
|
|
}
|