f7aafec402
Stripped GPL text and removed ECL license for now -- leaving in copyright notice where it exists
204 lines
No EOL
5.1 KiB
XML
204 lines
No EOL
5.1 KiB
XML
<?xml version="1.0"?>
|
|
<!--
|
|
Zotero
|
|
Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA
|
|
http://chnm.gmu.edu/
|
|
-->
|
|
<bindings xmlns="http://www.mozilla.org/xbl"
|
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
<binding id="seealso-box">
|
|
<implementation>
|
|
<field name="itemRef"/>
|
|
<property name="item" onget="return this.itemRef;">
|
|
<setter>
|
|
<![CDATA[
|
|
this.itemRef = val;
|
|
this.reload();
|
|
]]>
|
|
</setter>
|
|
</property>
|
|
<property name="summary">
|
|
<getter>
|
|
<![CDATA[
|
|
var r = "";
|
|
|
|
if(this.item)
|
|
{
|
|
var seealso = this.item.getSeeAlso();
|
|
if(seealso)
|
|
{
|
|
seealso = Scholar.Items.get(seealso);
|
|
for(var i = 0; i < seealso.length; i++)
|
|
{
|
|
r = r + seealso[i].getField('title') + ", ";
|
|
}
|
|
r = r.substr(0,r.length-2);
|
|
}
|
|
}
|
|
|
|
return r;
|
|
]]>
|
|
</getter>
|
|
</property>
|
|
<method name="reload">
|
|
<body>
|
|
<![CDATA[
|
|
var rows = this.id('seeAlsoRows');
|
|
while(rows.hasChildNodes())
|
|
rows.removeChild(rows.firstChild);
|
|
|
|
if(this.item)
|
|
{
|
|
var seealso = this.item.getSeeAlso();
|
|
|
|
if(seealso)
|
|
{
|
|
seealso = Scholar.Items.get(seealso);
|
|
for(var i = 0; i < seealso.length; i++)
|
|
{
|
|
var icon= document.createElement("image");
|
|
icon.setAttribute('src','chrome://scholar/skin/treeitem-'+Scholar.ItemTypes.getName(seealso[i].getType())+'.png');
|
|
|
|
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(box);
|
|
row.appendChild(remove);
|
|
row.setAttribute('id','seealso-'+seealso[i].getID());
|
|
rows.appendChild(row);
|
|
}
|
|
this.updateCount(seealso.length);
|
|
}
|
|
else
|
|
{
|
|
this.updateCount();
|
|
}
|
|
}
|
|
]]>
|
|
</body>
|
|
</method>
|
|
<method name="add">
|
|
<body>
|
|
<![CDATA[
|
|
var io = {dataIn: null, dataOut: null};
|
|
window.openDialog('chrome://scholar/content/selectItemsDialog.xul','','chrome,modal',io);
|
|
|
|
if(io.dataOut && this.item)
|
|
{
|
|
for(var i = 0; i < io.dataOut.length; i++)
|
|
{
|
|
this.item.addSeeAlso(io.dataOut[i]);
|
|
}
|
|
}
|
|
]]>
|
|
</body>
|
|
</method>
|
|
<method name="remove">
|
|
<parameter name="id"/>
|
|
<body>
|
|
<![CDATA[
|
|
if(id)
|
|
{
|
|
this.item.removeSeeAlso(id);
|
|
var rows = this.id('seeAlsoRows');
|
|
rows.removeChild(this.id('seealso-'+id));
|
|
this.updateCount();
|
|
}
|
|
]]>
|
|
</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>
|
|
<![CDATA[
|
|
if(count == null)
|
|
{
|
|
seealso = this.item.getSeeAlso();
|
|
if(seealso)
|
|
count = seealso.length;
|
|
else
|
|
count = 0;
|
|
}
|
|
|
|
this.id('seeAlsoNum').value = count + ' related:';
|
|
]]>
|
|
</body>
|
|
</method>
|
|
<method name="id">
|
|
<parameter name="id"/>
|
|
<body>
|
|
<![CDATA[
|
|
return document.getAnonymousNodes(this)[0].getElementsByAttribute('id',id)[0];
|
|
]]>
|
|
</body>
|
|
</method>
|
|
</implementation>
|
|
<content>
|
|
<xul:vbox xbl:inherits="flex">
|
|
<xul:hbox align="center">
|
|
<xul:label id="seeAlsoNum"/>
|
|
<xul:button label="Add" oncommand="this.parentNode.parentNode.parentNode.add();"/>
|
|
</xul:hbox>
|
|
<xul:grid flex="1">
|
|
<xul:columns>
|
|
<xul:column flex="1"/>
|
|
<xul:column/>
|
|
</xul:columns>
|
|
<xul:rows id="seeAlsoRows"/>
|
|
</xul:grid>
|
|
</xul:vbox>
|
|
</content>
|
|
</binding>
|
|
</bindings> |