commit b79420e75b732f0c371044265ade3fed0b28e86d
parent f6c12d3d81865266bbb5db01a830e16694e5f93a
Author: David Norton <david@nortoncrew.com>
Date: Wed, 2 Aug 2006 15:13:31 +0000
Closes #154, Clicking an item in Related should display that item.
Cancel Search ('x') button now uses a custom image.
Fixes problem with items list freezing on item add
Diffstat:
6 files changed, 59 insertions(+), 17 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/bindings/relatedbox.xml b/chrome/chromeFiles/content/scholar/bindings/relatedbox.xml
@@ -58,15 +58,22 @@
var label = document.createElement("label");
label.setAttribute('value', seealso[i].getField('title'));
label.setAttribute('crop','end');
-
+ label.setAttribute('flex','1');
+
+ var box = document.createElement('box');
+ box.setAttribute('onclick',"this.parentNode.parentNode.parentNode.parentNode.parentNode.showItem('"+seealso[i].getID()+"')");
+ box.setAttribute('class','clicky');
+ box.setAttribute('flex','1');
+ box.appendChild(icon);
+ box.appendChild(label);
+
var remove = document.createElement("label");
remove.setAttribute('value','-');
remove.setAttribute('onclick',"this.parentNode.parentNode.parentNode.parentNode.parentNode.remove('"+seealso[i].getID()+"');");
remove.setAttribute('class','clicky');
var row = document.createElement("row");
- row.appendChild(icon);
- row.appendChild(label);
+ row.appendChild(box);
row.appendChild(remove);
row.setAttribute('id','seealso-'+seealso[i].getID());
rows.appendChild(row);
@@ -111,6 +118,42 @@
]]>
</body>
</method>
+ <method name="showItem">
+ <parameter name="id"/>
+ <body>
+ <![CDATA[
+ if(id)
+ {
+ var p;
+ if(window.ScholarPane)
+ {
+ p = window.ScholarPane;
+ }
+ else
+ {
+ var win;
+
+ if(window.opener && window.opener.ScholarPane)
+ {
+ win = window.opener;
+ }
+ else
+ {
+ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ win = wm.getMostRecentWindow('navigator:browser');
+ if(!win)
+ return;
+ }
+
+ p = win.ScholarPane;
+ }
+
+ p.selectItem(id);
+ }
+ ]]>
+ </body>
+ </method>
<method name="updateCount">
<parameter name="count"/>
<body>
@@ -143,9 +186,8 @@
<xul:label id="seeAlsoNum"/>
<xul:button label="Add" oncommand="this.parentNode.parentNode.parentNode.add();"/>
</xul:hbox>
- <xul:grid>
+ <xul:grid flex="1">
<xul:columns>
- <xul:column/>
<xul:column flex="1"/>
<xul:column/>
</xul:columns>
diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js
@@ -141,7 +141,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids)
if(action == 'add')
{
- this.selectItem(this._itemRowMap[item.getID()]);
+ this.selectItem(item.getID());
}
else
{
@@ -440,12 +440,12 @@ Scholar.ItemTreeView.prototype.sort = function()
*/
Scholar.ItemTreeView.prototype.selectItem = function(id)
{
- var item = Scholar.Items.get(id);
- var row = this._itemRowMap[item.getID()];
+ var row = this._itemRowMap[id];
if(row == null)
{
+ var item = Scholar.Items.get(id);
this.toggleOpenState(this._itemRowMap[item.getSource()]); //opens the parent of the item
- row = this._itemRowMap[item.getID()];
+ row = this._itemRowMap[id];
}
this.selection.select(row);
diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul
@@ -93,7 +93,7 @@
<spacer flex="1"/>
<label value="&toolbar.search.label;" control="tb-search"/>
<textbox id="tb-search" type="timed" timeout="250" command="cmd_scholar_search" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_scholar_search'); return false; }">
- <toolbarbutton id="tb-search-cancel" class="tabs-closebutton" oncommand="this.parentNode.value='';" hidden="true"/>
+ <toolbarbutton id="tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/>
</textbox>
</toolbar>
<hbox id="scholar-search-options" hidden="true">
diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css
@@ -133,19 +133,19 @@
#tb-search
{
width: 150px;
- height: 24px;
- margin: 0px;
- margin-bottom: 2px;
- padding: 0px;
- vertical-align: middle;
- font-size: 12px;
}
#tb-search-cancel
{
margin: 0px;
padding: 0px;
- cursor: pointer;
+ cursor: default;
+ list-style-image: url('chrome://scholar/skin/search-cancel.png');
+}
+
+#tb-search-cancel:hover:active
+{
+ list-style-image: url('chrome://scholar/skin/search-cancel-active.png');
}
#scholar-view-item vbox
diff --git a/chrome/chromeFiles/skin/default/scholar/search-cancel-active.png b/chrome/chromeFiles/skin/default/scholar/search-cancel-active.png
Binary files differ.
diff --git a/chrome/chromeFiles/skin/default/scholar/search-cancel.png b/chrome/chromeFiles/skin/default/scholar/search-cancel.png
Binary files differ.