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
This commit is contained in:
David Norton 2006-08-02 15:13:31 +00:00
parent f6c12d3d81
commit b79420e75b
6 changed files with 59 additions and 17 deletions

View file

@ -58,6 +58,14 @@
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','-');
@ -65,8 +73,7 @@
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>

View file

@ -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);

View file

@ -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">

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B