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:
David Norton 2006-03-18 22:51:05 +00:00
parent 47d7525e80
commit 749ef47bbd
5 changed files with 105 additions and 14 deletions

View file

@ -1,3 +1,5 @@
var ScholarLocalizedStrings;
var treeView = {
treebox: null,
dataObjects: null,
@ -22,11 +24,6 @@ var treeView = {
setTree: function(treebox){
this.treebox = treebox;
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; },
isSeparator: function(row){ return false; },
@ -35,10 +32,71 @@ var treeView = {
getImageSrc: function(row,col){ return null; },
getRowProperties: function(row,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()
{
ScholarLocalizedStrings = document.getElementById('scholar-strings');
document.getElementById('scholar-sidebar-items').view=treeView;
}

View file

@ -1,6 +1,8 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" 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"
onload="setView()"
@ -10,10 +12,12 @@
<script src="scholar.js"/>
<script src="db.js"/>
<script src="data_access.js"/>
<stringbundle id="scholar-strings" src="chrome://scholar/locale/scholar.properties"/>
<tree
id="scholar-sidebar-items"
seltype="multiple"
onselect="selectionChanged()"
flex="1"
enableColumnDrag="true"
datasources="rdf:null"
@ -23,25 +27,31 @@
<treecols>
<treecol
id="title_column"
label="Title"
label="&sidebar.items.title_column;"
flex="1"/>
<splitter class="tree-splitter"/>
<treecol
id="creator_column"
label="Creator"
label="&sidebar.items.creator_column;"
flex="1"/>
</treecols>
<treechildren/>
</tree>
<splitter collapse="before" resizeafter="grow"/>
<vbox>
<label control="test1" value="Test1:"/>
<label id="status-text" value="(No selection)"/>
<grid id="scholar-sidebar-object-pane" hidden="true">
<columns>
<column/>
<column flex="1"/>
</columns>
<rows id="scholar-sidebar-object-pane-dynamic-fields">
</rows>
</grid>
<!--
<textbox id="test1"/>
<label control="test2" value="Test2:"/>
<textbox id="test2"/>
<label control="test3" value="Test3:"/>
<textbox id="test3"/>
</vbox>
-->
</page>

View file

@ -1 +1,4 @@
<!ENTITY statusbarpanel.helloworld "Hello, World">
<!ENTITY sidebar.items.title_column "Title">
<!ENTITY sidebar.items.creator_column "Creator">

View 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

View file

@ -0,0 +1,3 @@
#scholar-sidebar-object-pane-dynamic-fields label {
font-weight: bold;
}