commit 624faaf1103448957a232dce98939928fec1e029
parent 59c00ba6c20e925120d4f62f7265196b32da3a7f
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 25 Aug 2006 08:37:16 +0000
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.
Diffstat:
5 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js
@@ -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;
}
\ No newline at end of file
diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js
@@ -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];
diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul
@@ -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
diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
@@ -792,6 +792,11 @@ Scholar.Item.prototype.isRegularItem = function(){
}
+Scholar.Item.prototype.numChildren = function(){
+ return this.numNotes() + this.numAttachments();
+}
+
+
////////////////////////////////////////////////////////
//
// Methods dealing with note items
diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
@@ -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">