Some new CSS placeholders once the designers start making this look good.
Scholar.TreeView is now Scholar.FolderTreeView (SourcesTreeView later? depends) Some changes to the way FolderTreeView works. New Scholar.ItemGroup -- used by FolderTreeView and ItemTreeView. the root folder is not currently displayed -- doesn't really matter because we are changing the way it all works. (note: the Scholar.Items.getAll() function does not seem to be working correctly -- try clicking on the library)
This commit is contained in:
parent
a1ae5c13c9
commit
22cd938ecc
8 changed files with 141 additions and 99 deletions
|
@ -1,63 +1,48 @@
|
|||
Scholar.TreeView = function(root)
|
||||
Scholar.FolderTreeView = function()
|
||||
{
|
||||
this._treebox = null;
|
||||
this._dataItems = new Array();
|
||||
this.rowCount = 0;
|
||||
this._treeType;
|
||||
this._rootFolder = root;
|
||||
this._showItem(new Scholar.ItemGroup('library',null),0,1);
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype.setTree = function(treebox)
|
||||
Scholar.FolderTreeView.prototype.setTree = function(treebox)
|
||||
{
|
||||
if(this._treebox)
|
||||
return;
|
||||
this._treebox = treebox;
|
||||
this._treeType = treebox.element.getAttribute("treeviewtype");
|
||||
|
||||
var newRows = Scholar.Items.getTreeRows(this._rootFolder,this._treeType);
|
||||
var newRows = Scholar.Items.getTreeRows(0,'folders');
|
||||
for(var i = 0; i < newRows.length; i++)
|
||||
this._showItem(newRows[i], 0, i+1); //item ref, isContainerOpen, level
|
||||
this._showItem(new Scholar.ItemGroup('folder',newRows[i]), 0, this._dataItems.length); //item ref, level, beforeRow
|
||||
|
||||
this._refreshHashMap();
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype.getCellText = function(row, column)
|
||||
Scholar.FolderTreeView.prototype.getCellText = function(row, column)
|
||||
{
|
||||
var obj = this._getItemAtRow(row);
|
||||
|
||||
if(obj.isFolder())
|
||||
{
|
||||
if(column.id == "name_column")
|
||||
return obj.getName();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
if(column.id == "name_column")
|
||||
return obj.getName();
|
||||
else
|
||||
{
|
||||
if(column.id == "title_column")
|
||||
return obj.getField("title");
|
||||
else if(column.id == "creator_column")
|
||||
return obj.getField("firstCreator");
|
||||
else if(column.id == "source_column")
|
||||
return obj.getField("source");
|
||||
else
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype.isContainer = function(row) { return this._getItemAtRow(row).isFolder(); }
|
||||
Scholar.TreeView.prototype.isContainerOpen = function(row) { return this._dataItems[row][1]; }
|
||||
Scholar.TreeView.prototype.isContainerEmpty = function(row)
|
||||
Scholar.FolderTreeView.prototype.isContainer = function(row) { return this._getItemAtRow(row).isFolder(); }
|
||||
Scholar.FolderTreeView.prototype.isContainerOpen = function(row) { return this._dataItems[row][1]; }
|
||||
Scholar.FolderTreeView.prototype.isContainerEmpty = function(row)
|
||||
{
|
||||
if(this._treeType == 'folders')
|
||||
return !this._getItemAtRow(row).hasChildFolders();
|
||||
var itemGroup = this._getItemAtRow(row);
|
||||
if(itemGroup.isFolder())
|
||||
return !itemGroup.ref.hasChildFolders();
|
||||
else
|
||||
return (this.isContainer(row) && this._getItemAtRow(row).isEmpty());
|
||||
return true;
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype.getLevel = function(row) { return this._dataItems[row][2]; }
|
||||
Scholar.FolderTreeView.prototype.getLevel = function(row) { return this._dataItems[row][2]; }
|
||||
|
||||
Scholar.TreeView.prototype.getParentIndex = function(row)
|
||||
Scholar.FolderTreeView.prototype.getParentIndex = function(row)
|
||||
{
|
||||
var thisLevel = this.getLevel(row);
|
||||
if(thisLevel == 0) return -1;
|
||||
|
@ -67,7 +52,7 @@ Scholar.TreeView.prototype.getParentIndex = function(row)
|
|||
return -1;
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype.hasNextSibling = function(row, afterIndex)
|
||||
Scholar.FolderTreeView.prototype.hasNextSibling = function(row, afterIndex)
|
||||
{
|
||||
var thisLevel = this.getLevel(row);
|
||||
for(var i = afterIndex + 1; i < this.rowCount; i++)
|
||||
|
@ -78,7 +63,7 @@ Scholar.TreeView.prototype.hasNextSibling = function(row, afterIndex)
|
|||
}
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype.toggleOpenState = function(row)
|
||||
Scholar.FolderTreeView.prototype.toggleOpenState = function(row)
|
||||
{
|
||||
var count = 0; //used to tell the tree how many rows were added/removed
|
||||
var thisLevel = this.getLevel(row);
|
||||
|
@ -94,12 +79,12 @@ Scholar.TreeView.prototype.toggleOpenState = function(row)
|
|||
}
|
||||
else
|
||||
{
|
||||
var newRows = Scholar.Items.getTreeRows(this._getItemAtRow(row).getID(),this._treeType); //Get children
|
||||
var newRows = Scholar.Items.getTreeRows(this._getItemAtRow(row).ref.getID(),'folders'); //Get children
|
||||
|
||||
for(var i = 0; i < newRows.length; i++)
|
||||
{
|
||||
count++;
|
||||
this._showItem(newRows[i], thisLevel+1, row+i+1); //insert new row
|
||||
this._showItem(new Scholar.ItemGroup('folder',newRows[i]), thisLevel+1, row+i+1); //insert new row
|
||||
}
|
||||
}
|
||||
this._dataItems[row][1] = !this._dataItems[row][1]; //toggle container open value
|
||||
|
@ -110,24 +95,25 @@ Scholar.TreeView.prototype.toggleOpenState = function(row)
|
|||
this._refreshHashMap();
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype._showItem = function(item, level, beforeRow) { this._dataItems.splice(beforeRow, 0, [item, false, level]); this.rowCount++; }
|
||||
Scholar.FolderTreeView.prototype._showItem = function(item, level, beforeRow) { this._dataItems.splice(beforeRow, 0, [item, false, level]); this.rowCount++; }
|
||||
|
||||
Scholar.TreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; }
|
||||
Scholar.FolderTreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; }
|
||||
|
||||
Scholar.TreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row][0]; }
|
||||
Scholar.TreeView.prototype.isSorted = function() { return false; }
|
||||
Scholar.TreeView.prototype.isSeparator = function(row) { return false; }
|
||||
Scholar.TreeView.prototype.isEditable = function(row, idx) { return false; }
|
||||
Scholar.TreeView.prototype.getRowProperties = function(row, prop) { }
|
||||
Scholar.TreeView.prototype.getColumnProperties = function(col, prop) { }
|
||||
Scholar.TreeView.prototype.getCellProperties = function(row, col, prop) { }
|
||||
Scholar.TreeView.prototype.getImageSrc = function(row, col) { }
|
||||
Scholar.TreeView.prototype.performAction = function(action) { }
|
||||
Scholar.TreeView.prototype.performActionOnCell = function(action, row, col) { }
|
||||
Scholar.TreeView.prototype.getProgressMode = function(row, col) { }
|
||||
Scholar.FolderTreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row][0]; }
|
||||
Scholar.FolderTreeView.prototype.isSorted = function() { return false; }
|
||||
Scholar.FolderTreeView.prototype.isSeparator = function(row) { return false; }
|
||||
Scholar.FolderTreeView.prototype.isEditable = function(row, idx) { return false; }
|
||||
Scholar.FolderTreeView.prototype.getRowProperties = function(row, prop) { }
|
||||
Scholar.FolderTreeView.prototype.getColumnProperties = function(col, prop) { }
|
||||
Scholar.FolderTreeView.prototype.getCellProperties = function(row, col, prop) { }
|
||||
Scholar.FolderTreeView.prototype.getImageSrc = function(row, col) { }
|
||||
Scholar.FolderTreeView.prototype.performAction = function(action) { }
|
||||
Scholar.FolderTreeView.prototype.performActionOnCell = function(action, row, col) { }
|
||||
Scholar.FolderTreeView.prototype.getProgressMode = function(row, col) { }
|
||||
|
||||
Scholar.TreeView.prototype.deleteSelection = function()
|
||||
Scholar.FolderTreeView.prototype.deleteSelection = function()
|
||||
{
|
||||
/*
|
||||
if(this.selection.count == 0)
|
||||
return;
|
||||
|
||||
|
@ -161,23 +147,55 @@ Scholar.TreeView.prototype.deleteSelection = function()
|
|||
this._treebox.endUpdateBatch();
|
||||
|
||||
this._refreshHashMap();
|
||||
*/
|
||||
}
|
||||
|
||||
Scholar.TreeView.prototype._refreshHashMap = function()
|
||||
Scholar.FolderTreeView.prototype._refreshHashMap = function()
|
||||
{
|
||||
// Create hash map of folder and object ids to row indexes
|
||||
|
||||
this._itemRowMap = new Array();
|
||||
this._folderRowMap = new Array();
|
||||
for(var i=0; i < this.rowCount; i++){
|
||||
if (this.isContainer(i)){
|
||||
this._folderRowMap[this._getItemAtRow(i).getID()] = i;
|
||||
}
|
||||
else {
|
||||
this._itemRowMap[this._getItemAtRow(i).getID()] = i;
|
||||
this._folderRowMap[this._getItemAtRow(i).ref.getID()] = i;
|
||||
}
|
||||
}
|
||||
//Scholar.debug(Scholar.varDump(this.folderRowMap));
|
||||
//Scholar.debug(Scholar.varDump(this.objectRowMap));
|
||||
}
|
||||
|
||||
Scholar.ItemGroup = function(type, ref)
|
||||
{
|
||||
this.type = type;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
Scholar.ItemGroup.prototype.isLibrary = function()
|
||||
{
|
||||
return this.type == 'library';
|
||||
}
|
||||
|
||||
Scholar.ItemGroup.prototype.isFolder = function()
|
||||
{
|
||||
return this.type == 'folder';
|
||||
}
|
||||
|
||||
Scholar.ItemGroup.prototype.getName = function()
|
||||
{
|
||||
if(this.isFolder())
|
||||
return this.ref.getName();
|
||||
else if(this.isLibrary())
|
||||
return "Library";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
Scholar.ItemGroup.prototype.getChildItems = function()
|
||||
{
|
||||
if(this.isFolder())
|
||||
return Scholar.Items.getTreeRows(this.ref.getID(),'items');
|
||||
else if(this.isLibrary())
|
||||
return Scholar.Items.getAll();
|
||||
else
|
||||
return null;
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
Scholar.ItemTreeView = function(root)
|
||||
Scholar.ItemTreeView = function(itemGroup)
|
||||
{
|
||||
this._treebox = null;
|
||||
this._dataItems = new Array();
|
||||
this.rowCount = 0;
|
||||
this._rootFolder = root;
|
||||
this._itemGroup = itemGroup;
|
||||
}
|
||||
|
||||
Scholar.ItemTreeView.prototype.setTree = function(treebox)
|
||||
|
@ -12,7 +12,7 @@ Scholar.ItemTreeView.prototype.setTree = function(treebox)
|
|||
return;
|
||||
this._treebox = treebox;
|
||||
|
||||
var newRows = Scholar.Items.getTreeRows(this._rootFolder,"items");
|
||||
var newRows = this._itemGroup.getChildItems();
|
||||
for(var i = 0; i < newRows.length; i++)
|
||||
this._showItem(newRows[i], i+1); //item ref, before row
|
||||
|
||||
|
|
|
@ -15,10 +15,9 @@ var ScholarPane = new function()
|
|||
|
||||
function init()
|
||||
{
|
||||
foldersView = new Scholar.TreeView(0); //pass params here?
|
||||
foldersView = new Scholar.FolderTreeView(); //pass params here?
|
||||
document.getElementById('folders-tree').view = foldersView;
|
||||
itemsView = new Scholar.ItemTreeView(0);
|
||||
document.getElementById('items-tree').view = itemsView;
|
||||
document.getElementById('items-tree').view = null;
|
||||
|
||||
var addMenu = document.getElementById('tb-add').firstChild;
|
||||
var itemTypes = Scholar.ItemTypes.getTypes();
|
||||
|
@ -45,13 +44,12 @@ var ScholarPane = new function()
|
|||
{
|
||||
if(foldersView.selection.count == 1 && foldersView.selection.currentIndex != -1)
|
||||
{
|
||||
itemsView = new Scholar.ItemTreeView(foldersView._getItemAtRow(foldersView.selection.currentIndex).getID());
|
||||
itemsView = new Scholar.ItemTreeView(foldersView._getItemAtRow(foldersView.selection.currentIndex));
|
||||
document.getElementById('items-tree').view = itemsView;
|
||||
}
|
||||
else if(foldersView.selection.count == 0)
|
||||
{
|
||||
itemsView = new Scholar.ItemTreeView(0);
|
||||
document.getElementById('items-tree').view = itemsView;
|
||||
document.getElementById('items-tree').view = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://scholar/skin/overlay.css" type="text/css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd">
|
||||
|
||||
<overlay id="scholar"
|
||||
|
@ -20,7 +21,7 @@
|
|||
<vbox id="scholar-pane" position="1" persist="height">
|
||||
<hbox flex="1">
|
||||
<tree id="folders-tree"
|
||||
treeviewtype="folders" style="-moz-user-focus: ignore;" hidecolumnpicker="true"
|
||||
style="-moz-user-focus: ignore;" hidecolumnpicker="true"
|
||||
onselect="ScholarPane.folderSelected();"
|
||||
persist="width" flex="1">
|
||||
<treecols>
|
||||
|
@ -32,7 +33,7 @@
|
|||
</treecols>
|
||||
<treechildren/>
|
||||
</tree>
|
||||
<splitter resizebefore="closest" resizeafter="closest"/>
|
||||
<splitter id="scholar-tree-splitter" resizebefore="closest" resizeafter="closest"/>
|
||||
<tree
|
||||
id="items-tree"
|
||||
enableColumnDrag="true"
|
||||
|
@ -73,7 +74,7 @@
|
|||
<treechildren/>
|
||||
</tree>
|
||||
</hbox>
|
||||
<toolbar>
|
||||
<toolbar id="scholar-toolbar">
|
||||
<toolbarbutton label="&menuitem.newFolder.label;" command="cmd_scholar_newFolder"/>
|
||||
<toolbarbutton id="tb-add" label="&menuitem.newItem.label;" type="menu">
|
||||
<menupopup>
|
||||
|
@ -81,10 +82,10 @@
|
|||
</toolbarbutton>
|
||||
<spacer flex="1"/>
|
||||
<label value="Search:" control="tb-search"/>
|
||||
<textbox id="tb-search" type="timed" timeout="500" width="150" command="cmd_scholar_search"/>
|
||||
<textbox id="tb-search" type="timed" timeout="500" command="cmd_scholar_search"/>
|
||||
</toolbar>
|
||||
</vbox>
|
||||
<splitter resizebefore="closest" resizeafter="closest" position="2"/>
|
||||
<splitter id="scholar-splitter" resizebefore="closest" resizeafter="closest" position="2"/>
|
||||
</vbox>
|
||||
|
||||
<statusbar id="status-bar">
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<browser id="view" flex="1"/>
|
||||
<vbox>
|
||||
<stack id="metadata">
|
||||
<box id="metadata-background"/>
|
||||
<vbox id="metadata-pane">
|
||||
<textbox value="Title"/>
|
||||
<textbox value="Rights"/>
|
||||
|
@ -26,7 +25,6 @@
|
|||
</vbox>
|
||||
</stack>
|
||||
<stack id="notes">
|
||||
<box id="notes-background"/>
|
||||
<vbox id="notes-pane">
|
||||
<textbox value="Notes.... lorem ispum delorum..." multiline="true" flex="1"/>
|
||||
</vbox>
|
||||
|
|
45
chrome/chromeFiles/skin/default/scholar/overlay.css
Normal file
45
chrome/chromeFiles/skin/default/scholar/overlay.css
Normal file
|
@ -0,0 +1,45 @@
|
|||
vbox #scholar-pane
|
||||
{
|
||||
background: #f5f5f5;
|
||||
min-height: 150px;
|
||||
}
|
||||
|
||||
tree #folders-tree
|
||||
{
|
||||
min-width: 100px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
#scholar-tree-splitter
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
tree #items-tree
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#scholar-toolbar
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#scholar-toolbar toolbarbutton
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#tb-search
|
||||
{
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#scholar-splitter
|
||||
{
|
||||
border-top: none;
|
||||
border-bottom: 1px solid #A3A3A3;
|
||||
min-height: 4px;
|
||||
max-height: 4px;
|
||||
background: #f5f5f5 !important;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#scholar-sidebar-object-pane-dynamic-fields label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#editpane {
|
||||
background-color: rgb(239, 248, 206);
|
||||
}
|
|
@ -5,18 +5,12 @@
|
|||
|
||||
#view-toolbar .toggler
|
||||
{
|
||||
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
#metadata-background
|
||||
#subs
|
||||
{
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
left: 10px;
|
||||
width: 400px;
|
||||
height: 100px;
|
||||
background-color: black;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
#metadata-pane
|
||||
|
@ -27,17 +21,9 @@
|
|||
width: 400px;
|
||||
height: 100px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#notes-background
|
||||
{
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
left: 10px;
|
||||
width: 400px;
|
||||
height: 100px;
|
||||
background-color: black;
|
||||
opacity: 0.4;
|
||||
padding: 5px;
|
||||
font-size: 11px;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
#notes-pane
|
||||
|
@ -47,4 +33,7 @@
|
|||
left: 10px;
|
||||
width: 400px;
|
||||
height: 100px;
|
||||
padding: 5px;
|
||||
font-size: 11px;
|
||||
background: #f5f5f5;
|
||||
}
|
Loading…
Reference in a new issue