Closes #202, attachments categorized as notes

"Notes" column changed to "#" and combined with the attachment count. "#" isn't exactly immediately self-explanatory, but "Notes/attachments" would be way too long, and once you realize what it's for (i.e. the first time you create a child item), you really don't want the column taking up any more room than that... If people have a better suggestion, do share.
This commit is contained in:
Dan Stillman 2006-08-25 08:37:16 +00:00
parent 59c00ba6c2
commit 624faaf110
5 changed files with 18 additions and 19 deletions

View File

@ -214,9 +214,9 @@ Scholar.ItemTreeView.prototype.getCellText = function(row, column)
var obj = this._getItemAtRow(row);
var val;
if(column.id == "numNotes")
if(column.id == "numChildren")
{
var c = obj.numNotes();
var c = obj.numChildren();
if(c) //don't display '0'
val = c;
}
@ -280,7 +280,7 @@ Scholar.ItemTreeView.prototype.isContainerOpen = function(row)
Scholar.ItemTreeView.prototype.isContainerEmpty = function(row)
{
return (this._getItemAtRow(row).numNotes() == 0 && this._getItemAtRow(row).numAttachments() == 0);
return this._getItemAtRow(row).numChildren() == 0;
}
Scholar.ItemTreeView.prototype.getLevel = function(row)
@ -407,11 +407,11 @@ Scholar.ItemTreeView.prototype.sort = function()
return (typeA > typeB) ? -1 : (typeA < typeB) ? 1 : 0;
}
}
else if(column.id == 'numNotes')
else if(column.id == 'numChildren')
{
function columnSort(a,b)
{
return b.numNotes() - a.numNotes();
return b.numChildren() - a.numChildren();
}
}
else
@ -775,18 +775,10 @@ Scholar.ItemTreeView.TreeRow.prototype.getType = function()
return this.ref.getType();
}
Scholar.ItemTreeView.TreeRow.prototype.numNotes = function()
Scholar.ItemTreeView.TreeRow.prototype.numChildren = function()
{
if(this.isRegularItem())
return this.ref.numNotes();
else
return 0;
}
Scholar.ItemTreeView.TreeRow.prototype.numAttachments = function()
{
if(this.isRegularItem())
return this.ref.numAttachments();
return this.ref.numChildren();
else
return 0;
}

View File

@ -267,7 +267,7 @@ var ScholarPane = new function()
{
itemsView.selection.getRangeAt(i,start,end);
for (var j=start.value; j<=end.value && !hasChildren; j++)
if(itemsView._getItemAtRow(j).numNotes() || itemsView._getItemAtRow(j).numAttachments())
if(itemsView._getItemAtRow(j).numChildren())
hasChildren = true;
}
}
@ -436,6 +436,8 @@ var ScholarPane = new function()
{
var row = {}, col = {}, obj = {};
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj);
// obj.value == cell/text/image
// TODO: handle collection double-click
if (obj.value && itemsView && itemsView.selection.currentIndex > -1)
{
var item = getSelectedItems()[0];

View File

@ -137,8 +137,8 @@
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol
id="numNotes"
label="&items.numNotes_column;"
id="numChildren"
label="&items.numChildren_column;"
persist="width ordinal hidden sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol

View File

@ -792,6 +792,11 @@ Scholar.Item.prototype.isRegularItem = function(){
}
Scholar.Item.prototype.numChildren = function(){
return this.numNotes() + this.numAttachments();
}
////////////////////////////////////////////////////////
//
// Methods dealing with note items

View File

@ -12,7 +12,7 @@
<!ENTITY items.creator_column "Creator">
<!ENTITY items.source_column "Source">
<!ENTITY items.rights_column "Rights">
<!ENTITY items.numNotes_column "Notes">
<!ENTITY items.numChildren_column "#">
<!ENTITY items.dateAdded_column "Date Added">
<!ENTITY items.dateModified_column "Date Modified">