From 624faaf1103448957a232dce98939928fec1e029 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 25 Aug 2006 08:37:16 +0000 Subject: [PATCH] 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. --- .../content/scholar/itemTreeView.js | 22 ++++++------------- chrome/chromeFiles/content/scholar/overlay.js | 4 +++- .../chromeFiles/content/scholar/overlay.xul | 4 ++-- .../content/scholar/xpcom/data_access.js | 5 +++++ .../locale/en-US/scholar/scholar.dtd | 2 +- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js index eadf1d402..b236f86b7 100644 --- 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 index c7544d6bd..bc447456c 100644 --- 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 index 250965438..113ac2063 100644 --- 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"/> - +