Some temporary viewing in-browser.
This commit is contained in:
parent
a4a1f9bd2b
commit
233a2414e7
2 changed files with 173 additions and 1 deletions
93
chrome/chromeFiles/content/scholar/overlay.js
Normal file
93
chrome/chromeFiles/content/scholar/overlay.js
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
var ScholarPane = new function()
|
||||||
|
{
|
||||||
|
|
||||||
|
var foldersView;
|
||||||
|
var itemsView;
|
||||||
|
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
|
||||||
|
|
||||||
|
this.init = init;
|
||||||
|
this.newItem = newItem;
|
||||||
|
this.newFolder = newFolder;
|
||||||
|
this.folderSelected = folderSelected;
|
||||||
|
this.itemSelected = itemSelected;
|
||||||
|
this.deleteSelection = deleteSelection;
|
||||||
|
this.search = search;
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
foldersView = new Scholar.TreeView(0); //pass params here?
|
||||||
|
document.getElementById('folders-tree').view = foldersView;
|
||||||
|
itemsView = new Scholar.ItemTreeView(0);
|
||||||
|
document.getElementById('items-tree').view = itemsView;
|
||||||
|
|
||||||
|
var addMenu = document.getElementById('tb-add').firstChild;
|
||||||
|
var itemTypes = Scholar.ItemTypes.getTypes();
|
||||||
|
for(var i = 0; i<itemTypes.length; i++)
|
||||||
|
{
|
||||||
|
var menuitem = document.createElement("menuitem");
|
||||||
|
menuitem.setAttribute("label", Scholar.getString("itemTypes."+itemTypes[i]['name']));
|
||||||
|
menuitem.setAttribute("oncommand","ScholarPane.newItem("+itemTypes[i]['id']+")");
|
||||||
|
addMenu.appendChild(menuitem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function newItem(typeID)
|
||||||
|
{
|
||||||
|
alert("new item of type: "+typeID);
|
||||||
|
}
|
||||||
|
|
||||||
|
function newFolder()
|
||||||
|
{
|
||||||
|
alert("new folder");
|
||||||
|
}
|
||||||
|
|
||||||
|
function folderSelected()
|
||||||
|
{
|
||||||
|
if(foldersView.selection.count == 1 && foldersView.selection.currentIndex != -1)
|
||||||
|
{
|
||||||
|
itemsView = new Scholar.ItemTreeView(foldersView._getItemAtRow(foldersView.selection.currentIndex).getID());
|
||||||
|
document.getElementById('items-tree').view = itemsView;
|
||||||
|
}
|
||||||
|
else if(foldersView.selection.count == 0)
|
||||||
|
{
|
||||||
|
itemsView = new Scholar.ItemTreeView(0);
|
||||||
|
document.getElementById('items-tree').view = itemsView;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
document.getElementById('items-tree').view = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function itemSelected()
|
||||||
|
{
|
||||||
|
var editButton = document.getElementById('metadata-pane-edit-button');
|
||||||
|
|
||||||
|
if(itemsView && itemsView.selection.count == 1)
|
||||||
|
{
|
||||||
|
var item = itemsView._getItemAtRow(itemsView.selection.currentIndex);
|
||||||
|
|
||||||
|
document.getElementById('content').loadURI('chrome://scholar/content/view.xul?url='+encodeURIComponent('http://www.google.com/search?q='+encodeURIComponent('"'+item.getField("title")+'"')+'&btnI'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteSelection()
|
||||||
|
{
|
||||||
|
if(itemsView && itemsView.selection.count > 0 && confirm("Are you sure you want to delete the selected items?"))
|
||||||
|
itemsView.deleteSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
function search()
|
||||||
|
{
|
||||||
|
//TO DO: reload items tree with a search instead of a root folder
|
||||||
|
alert(document.getElementById('tb-search').value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("load", function(e) { ScholarPane.init(e); }, false);
|
|
@ -8,6 +8,85 @@
|
||||||
<!-- Include the global XPCOM object -->
|
<!-- Include the global XPCOM object -->
|
||||||
<script src="include.js"/>
|
<script src="include.js"/>
|
||||||
|
|
||||||
|
<script src="overlay.js"/>
|
||||||
|
<script src="itemTreeView.js"/>
|
||||||
|
<script src="folderTreeView.js"/>
|
||||||
|
|
||||||
|
<command id="cmd_scholar_newItem" oncommand="ScholarPane.newItem(1);"/>
|
||||||
|
<command id="cmd_scholar_newFolder" oncommand="ScholarPane.newFolder();"/>
|
||||||
|
<command id="cmd_scholar_search" oncommand="ScholarPane.search();"/>
|
||||||
|
|
||||||
|
<vbox id="appcontent">
|
||||||
|
<vbox id="scholar-pane" position="1" persist="height">
|
||||||
|
<hbox flex="1">
|
||||||
|
<tree id="folders-tree"
|
||||||
|
treeviewtype="folders" style="-moz-user-focus: ignore;" hidecolumnpicker="true"
|
||||||
|
onselect="ScholarPane.folderSelected();"
|
||||||
|
persist="width" flex="1">
|
||||||
|
<treecols>
|
||||||
|
<treecol
|
||||||
|
id="name_column"
|
||||||
|
label="&folders.name_column;"
|
||||||
|
flex="1"
|
||||||
|
primary="true"/>
|
||||||
|
</treecols>
|
||||||
|
<treechildren/>
|
||||||
|
</tree>
|
||||||
|
<splitter resizebefore="closest" resizeafter="closest"/>
|
||||||
|
<tree
|
||||||
|
id="items-tree"
|
||||||
|
enableColumnDrag="true"
|
||||||
|
onselect="ScholarPane.itemSelected();"
|
||||||
|
persist="width" flex="5">
|
||||||
|
<treecols>
|
||||||
|
<treecol
|
||||||
|
id="title"
|
||||||
|
label="&items.title_column;"
|
||||||
|
flex="4" persist="width ordinal hidden"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol
|
||||||
|
id="firstCreator"
|
||||||
|
label="&items.creator_column;"
|
||||||
|
flex="1" persist="width ordinal hidden"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol
|
||||||
|
id="source"
|
||||||
|
label="&items.source_column;"
|
||||||
|
flex="1" persist="width ordinal hidden"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol
|
||||||
|
id="rights" hidden="true"
|
||||||
|
label="&items.rights_column;"
|
||||||
|
flex="1" persist="width ordinal hidden"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol
|
||||||
|
id="dateAdded" hidden="true"
|
||||||
|
label="&items.dateAdded_column;"
|
||||||
|
flex="1" persist="width ordinal hidden"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol
|
||||||
|
id="dateModified" hidden="true"
|
||||||
|
label="&items.dateModified_column;"
|
||||||
|
flex="1" persist="width ordinal hidden"/>
|
||||||
|
</treecols>
|
||||||
|
|
||||||
|
<treechildren/>
|
||||||
|
</tree>
|
||||||
|
</hbox>
|
||||||
|
<toolbar>
|
||||||
|
<toolbarbutton label="&menuitem.newFolder.label;" command="cmd_scholar_newFolder"/>
|
||||||
|
<toolbarbutton id="tb-add" label="&menuitem.newItem.label;" type="menu">
|
||||||
|
<menupopup>
|
||||||
|
</menupopup>
|
||||||
|
</toolbarbutton>
|
||||||
|
<spacer flex="1"/>
|
||||||
|
<label value="Search:" control="tb-search"/>
|
||||||
|
<textbox id="tb-search" type="timed" timeout="500" width="150" command="cmd_scholar_search"/>
|
||||||
|
</toolbar>
|
||||||
|
</vbox>
|
||||||
|
<splitter resizebefore="closest" resizeafter="closest" position="2"/>
|
||||||
|
</vbox>
|
||||||
|
|
||||||
<statusbar id="status-bar">
|
<statusbar id="status-bar">
|
||||||
<statusbarpanel id="scholar-load-status" label="Scholar is NOT loaded"/>
|
<statusbarpanel id="scholar-load-status" label="Scholar is NOT loaded"/>
|
||||||
</statusbar>
|
</statusbar>
|
||||||
|
@ -23,7 +102,7 @@
|
||||||
<menupopup id="menu_ToolsPopup">
|
<menupopup id="menu_ToolsPopup">
|
||||||
<menuseparator id="scholarSeparator" insertbefore="devToolsSeparator"/>
|
<menuseparator id="scholarSeparator" insertbefore="devToolsSeparator"/>
|
||||||
<menuitem id="tools-scholar" insertbefore="devToolsSeparator"
|
<menuitem id="tools-scholar" insertbefore="devToolsSeparator"
|
||||||
oncommand="toOpenWindowByType('scholar:window','chrome://scholar/content/organizeWindow.xul');" label="Scholar"
|
oncommand="document.getElementById('scholar-pane').collapsed='false';" label="Scholar"
|
||||||
key="key_openScholar"/>
|
key="key_openScholar"/>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue