I got the basic object pane working, so that it displays all the metadata.
I also started implementing some of the localization. There is a lot to do still, and I am still learning a lot of the Firefox extension technologies (XUL, adv. Javascript, etc.) but things are going great.
This commit is contained in:
parent
47d7525e80
commit
749ef47bbd
5 changed files with 105 additions and 14 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
var ScholarLocalizedStrings;
|
||||||
|
|
||||||
var treeView = {
|
var treeView = {
|
||||||
treebox: null,
|
treebox: null,
|
||||||
dataObjects: null,
|
dataObjects: null,
|
||||||
|
@ -22,11 +24,6 @@ var treeView = {
|
||||||
setTree: function(treebox){
|
setTree: function(treebox){
|
||||||
this.treebox = treebox;
|
this.treebox = treebox;
|
||||||
this.dataObjects = Scholar_Objects.getAll();
|
this.dataObjects = Scholar_Objects.getAll();
|
||||||
|
|
||||||
//Dan S: Check out the debug output created by this
|
|
||||||
for(var i = 0; i < this.dataObjects.length; i++)
|
|
||||||
Scholar.debug(Scholar.varDump(this.dataObjects[i]),5);
|
|
||||||
|
|
||||||
},
|
},
|
||||||
isContainer: function(row){ return false; },
|
isContainer: function(row){ return false; },
|
||||||
isSeparator: function(row){ return false; },
|
isSeparator: function(row){ return false; },
|
||||||
|
@ -35,10 +32,71 @@ var treeView = {
|
||||||
getImageSrc: function(row,col){ return null; },
|
getImageSrc: function(row,col){ return null; },
|
||||||
getRowProperties: function(row,props){},
|
getRowProperties: function(row,props){},
|
||||||
getCellProperties: function(row,col,props){},
|
getCellProperties: function(row,col,props){},
|
||||||
getColumnProperties: function(colid,col,props){}
|
getColumnProperties: function(colid,col,props){},
|
||||||
|
selectionChanged: function(){
|
||||||
|
if(this.selection.count == 0)
|
||||||
|
{
|
||||||
|
setObjectPaneVisibility(false);
|
||||||
|
document.getElementById('status-text').value = "(No selection)";
|
||||||
|
}
|
||||||
|
else if(this.selection.count == 1)
|
||||||
|
{
|
||||||
|
document.getElementById('status-text').value = "Selected: " + this.selection.currentIndex;
|
||||||
|
setObjectPaneVisibility(true);
|
||||||
|
populateObjectPane(this.dataObjects[this.selection.currentIndex]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setObjectPaneVisibility(false);
|
||||||
|
document.getElementById('status-text').value = "(Multiple selection)";
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setObjectPaneVisibility(vis)
|
||||||
|
{
|
||||||
|
document.getElementById('scholar-sidebar-object-pane').hidden = !vis;
|
||||||
|
document.getElementById('status-text').hidden = vis;
|
||||||
|
}
|
||||||
|
|
||||||
|
function populateObjectPane(objectRow)
|
||||||
|
{
|
||||||
|
var dynamicBox = document.getElementById('scholar-sidebar-object-pane-dynamic-fields');
|
||||||
|
while(dynamicBox.hasChildNodes())
|
||||||
|
dynamicBox.removeChild(dynamicBox.firstChild);
|
||||||
|
|
||||||
|
var fields = Scholar_ObjectFields.getObjectTypeFields(objectRow.getField("objectTypeID"));
|
||||||
|
var fieldNames = new Array("title","dateAdded","dateModified","source","rights");
|
||||||
|
for(var i = 0; i<fields.length; i++)
|
||||||
|
fieldNames.push(Scholar_ObjectFields.getName(fields[i]));
|
||||||
|
|
||||||
|
for(var i = 0; i<fieldNames.length; i++)
|
||||||
|
{
|
||||||
|
if(objectRow.getField(fieldNames[i]) != "")
|
||||||
|
{
|
||||||
|
var label = document.createElement("label");
|
||||||
|
label.setAttribute("value",ScholarLocalizedStrings.getString("objectFields."+fieldNames[i])+":");
|
||||||
|
|
||||||
|
var valueElement = document.createElement("description");
|
||||||
|
valueElement.appendChild(document.createTextNode(objectRow.getField(fieldNames[i])));
|
||||||
|
|
||||||
|
var row = document.createElement("row");
|
||||||
|
row.appendChild(label)
|
||||||
|
row.appendChild(valueElement)
|
||||||
|
|
||||||
|
dynamicBox.appendChild(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectionChanged()
|
||||||
|
{
|
||||||
|
treeView.selectionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
function setView()
|
function setView()
|
||||||
{
|
{
|
||||||
|
ScholarLocalizedStrings = document.getElementById('scholar-strings');
|
||||||
document.getElementById('scholar-sidebar-items').view=treeView;
|
document.getElementById('scholar-sidebar-items').view=treeView;
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<?xml-stylesheet href="chrome://global/skin/" type"text/css"?>
|
<?xml-stylesheet href="chrome://global/skin/" type"text/css"?>
|
||||||
<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
|
<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://scholar/skin/scholar.css" type="text/css"?>
|
||||||
|
<!DOCTYPE window SYSTEM "chrome://scholar/locale/scholar.dtd">
|
||||||
|
|
||||||
<page id="scholar-sidebar" title="Scholar"
|
<page id="scholar-sidebar" title="Scholar"
|
||||||
onload="setView()"
|
onload="setView()"
|
||||||
|
@ -10,10 +12,12 @@
|
||||||
<script src="scholar.js"/>
|
<script src="scholar.js"/>
|
||||||
<script src="db.js"/>
|
<script src="db.js"/>
|
||||||
<script src="data_access.js"/>
|
<script src="data_access.js"/>
|
||||||
|
<stringbundle id="scholar-strings" src="chrome://scholar/locale/scholar.properties"/>
|
||||||
|
|
||||||
<tree
|
<tree
|
||||||
id="scholar-sidebar-items"
|
id="scholar-sidebar-items"
|
||||||
seltype="multiple"
|
seltype="multiple"
|
||||||
|
onselect="selectionChanged()"
|
||||||
flex="1"
|
flex="1"
|
||||||
enableColumnDrag="true"
|
enableColumnDrag="true"
|
||||||
datasources="rdf:null"
|
datasources="rdf:null"
|
||||||
|
@ -23,25 +27,31 @@
|
||||||
<treecols>
|
<treecols>
|
||||||
<treecol
|
<treecol
|
||||||
id="title_column"
|
id="title_column"
|
||||||
label="Title"
|
label="&sidebar.items.title_column;"
|
||||||
flex="1"/>
|
flex="1"/>
|
||||||
<splitter class="tree-splitter"/>
|
<splitter class="tree-splitter"/>
|
||||||
<treecol
|
<treecol
|
||||||
id="creator_column"
|
id="creator_column"
|
||||||
label="Creator"
|
label="&sidebar.items.creator_column;"
|
||||||
flex="1"/>
|
flex="1"/>
|
||||||
</treecols>
|
</treecols>
|
||||||
<treechildren/>
|
<treechildren/>
|
||||||
</tree>
|
</tree>
|
||||||
<splitter collapse="before" resizeafter="grow"/>
|
<label id="status-text" value="(No selection)"/>
|
||||||
|
<grid id="scholar-sidebar-object-pane" hidden="true">
|
||||||
<vbox>
|
<columns>
|
||||||
<label control="test1" value="Test1:"/>
|
<column/>
|
||||||
|
<column flex="1"/>
|
||||||
|
</columns>
|
||||||
|
|
||||||
|
<rows id="scholar-sidebar-object-pane-dynamic-fields">
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<!--
|
||||||
<textbox id="test1"/>
|
<textbox id="test1"/>
|
||||||
<label control="test2" value="Test2:"/>
|
<label control="test2" value="Test2:"/>
|
||||||
<textbox id="test2"/>
|
<textbox id="test2"/>
|
||||||
<label control="test3" value="Test3:"/>
|
<label control="test3" value="Test3:"/>
|
||||||
<textbox id="test3"/>
|
<textbox id="test3"/>
|
||||||
</vbox>
|
-->
|
||||||
|
|
||||||
</page>
|
</page>
|
|
@ -1 +1,4 @@
|
||||||
<!ENTITY statusbarpanel.helloworld "Hello, World">
|
<!ENTITY statusbarpanel.helloworld "Hello, World">
|
||||||
|
|
||||||
|
<!ENTITY sidebar.items.title_column "Title">
|
||||||
|
<!ENTITY sidebar.items.creator_column "Creator">
|
17
chrome/chromeFiles/locale/en-US/scholar/scholar.properties
Normal file
17
chrome/chromeFiles/locale/en-US/scholar/scholar.properties
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
objectFields.title = Title
|
||||||
|
objectFields.dateAdded = Date Added
|
||||||
|
objectFields.dateModified = Modified
|
||||||
|
objectFields.source = Source
|
||||||
|
objectFields.rights = Rights
|
||||||
|
|
||||||
|
objectFields.series = Series
|
||||||
|
objectFields.volume = Volume
|
||||||
|
objectFields.number = Number
|
||||||
|
objectFields.edition = Edition
|
||||||
|
objectFields.place = Place
|
||||||
|
objectFields.publisher = Publisher
|
||||||
|
objectFields.year = Year
|
||||||
|
objectFields.pages = Pages
|
||||||
|
objectFields.ISBN = ISBN
|
||||||
|
objectFields.publication = Publication
|
||||||
|
objectFields.ISSN = ISSN
|
|
@ -0,0 +1,3 @@
|
||||||
|
#scholar-sidebar-object-pane-dynamic-fields label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
Loading…
Reference in a new issue