[interface] You can resize the view/edit pane on the right.

[interface] You can press 'escape' on editing a field to cancel changes.
[style] The add/remove creator buttons provide rollover feedback.
This commit is contained in:
David Norton 2006-06-07 18:20:45 +00:00
parent 1e48189c3b
commit 8fc4a02814
4 changed files with 33 additions and 10 deletions

View file

@ -113,11 +113,13 @@ MetadataPane = new function()
var removeButton = document.createElement('toolbarbutton'); var removeButton = document.createElement('toolbarbutton');
removeButton.setAttribute("label","-"); removeButton.setAttribute("label","-");
removeButton.setAttribute("class","addremove");
removeButton.setAttribute("oncommand","MetadataPane.removeCreator("+_creatorCount+")"); removeButton.setAttribute("oncommand","MetadataPane.removeCreator("+_creatorCount+")");
row.appendChild(removeButton); row.appendChild(removeButton);
var addButton = document.createElement('toolbarbutton'); var addButton = document.createElement('toolbarbutton');
addButton.setAttribute("label","+"); addButton.setAttribute("label","+");
addButton.setAttribute("class","addremove");
addButton.setAttribute("oncommand","MetadataPane.addCreatorRow('','',1);"); addButton.setAttribute("oncommand","MetadataPane.addCreatorRow('','',1);");
row.appendChild(addButton); row.appendChild(addButton);
@ -188,11 +190,11 @@ MetadataPane = new function()
box.replaceChild(t,elem); box.replaceChild(t,elem);
t.select(); t.select();
t.setAttribute('onblur',"MetadataPane.hideEditor(this);"); t.setAttribute('onblur',"MetadataPane.hideEditor(this, true);");
t.setAttribute('onkeypress','if(event.keyCode == event.DOM_VK_RETURN) document.commandDispatcher.focusedElement.blur()'); //for some reason I can't just say this.blur(); t.setAttribute('onkeypress','if(event.keyCode == event.DOM_VK_RETURN) document.commandDispatcher.focusedElement.blur(); else if(event.keyCode == event.DOM_VK_ESCAPE) MetadataPane.hideEditor(document.commandDispatcher.focusedElement, false);'); //for some reason I can't just say this.blur();
} }
function hideEditor(t) function hideEditor(t, saveChanges)
{ {
var textbox = t.parentNode.parentNode; var textbox = t.parentNode.parentNode;
var fieldName = textbox.getAttribute('fieldname'); var fieldName = textbox.getAttribute('fieldname');
@ -202,14 +204,18 @@ MetadataPane = new function()
var creatorFields = fieldName.split('-'); var creatorFields = fieldName.split('-');
if(creatorFields[0] == 'creator') if(creatorFields[0] == 'creator')
{ {
modifyCreator(creatorFields[1],creatorFields[2],value); if(saveChanges)
modifyCreator(creatorFields[1],creatorFields[2],value);
elem = createValueElement(value, fieldName); elem = createValueElement(_itemBeingEdited.getCreator(creatorFields[1])[creatorFields[2]], fieldName);
} }
else else
{ {
_itemBeingEdited.setField(fieldName,value); if(saveChanges)
_itemBeingEdited.save(); {
_itemBeingEdited.setField(fieldName,value);
_itemBeingEdited.save();
}
elem = createValueElement(_itemBeingEdited.getField(fieldName),fieldName); elem = createValueElement(_itemBeingEdited.getField(fieldName),fieldName);
} }

View file

@ -72,6 +72,7 @@ var ScholarPane = new function()
{ {
MetadataPane.viewItem(new Scholar.Item(typeID)); MetadataPane.viewItem(new Scholar.Item(typeID));
document.getElementById('scholar-view-item').hidden = false; document.getElementById('scholar-view-item').hidden = false;
document.getElementById('scholar-view-splitter').hidden = false;
} }
function newCollection() function newCollection()
@ -112,10 +113,12 @@ var ScholarPane = new function()
MetadataPane.viewItem(item); MetadataPane.viewItem(item);
document.getElementById('scholar-view-item').hidden=false; document.getElementById('scholar-view-item').hidden=false;
document.getElementById('scholar-view-splitter').hidden = false;
} }
else else
{ {
document.getElementById('scholar-view-item').hidden=true; document.getElementById('scholar-view-item').hidden=true;
document.getElementById('scholar-view-splitter').hidden = true;
} }

View file

@ -21,7 +21,7 @@
<vbox id="appcontent"> <vbox id="appcontent">
<hbox id="scholar-pane" position="1" persist="height collapsed"> <hbox id="scholar-pane" position="1" persist="height collapsed">
<vbox persist="width" flex="1"> <vbox persist="width" flex="1" style="min-width: 150px;">
<toolbar> <toolbar>
<toolbarbutton label="&toolbar.newCollection.label;" command="cmd_scholar_newCollection"/> <toolbarbutton label="&toolbar.newCollection.label;" command="cmd_scholar_newCollection"/>
<toolbarbutton id="tb-rename" label="&toolbar.renameCollection.label;" oncommand="ScholarPane.renameSelectedCollection();" disabled="true"/> <toolbarbutton id="tb-rename" label="&toolbar.renameCollection.label;" oncommand="ScholarPane.renameSelectedCollection();" disabled="true"/>
@ -42,7 +42,7 @@
</tree> </tree>
</vbox> </vbox>
<splitter id="scholar-tree-splitter" resizebefore="closest" resizeafter="closest"/> <splitter id="scholar-tree-splitter" resizebefore="closest" resizeafter="closest"/>
<vbox persist="width" flex="5"> <vbox persist="width" flex="5" style="min-width: 300px;">
<toolbar align="center"> <toolbar align="center">
<toolbarbutton id="tb-add" label="&toolbar.newItem.label;" type="menu"> <toolbarbutton id="tb-add" label="&toolbar.newItem.label;" type="menu">
<menupopup> <menupopup>
@ -95,7 +95,8 @@
</tree> </tree>
</vbox> </vbox>
<tabbox id="scholar-view-item" hidden="true" flex="2" style="max-width: 300px; min-width: 300px;"> <splitter id="scholar-view-splitter" resizebefore="closest" resizeafter="closest" hidden="true"/>
<tabbox id="scholar-view-item" hidden="true" flex="2" style="min-width: 300px;">
<tabs> <tabs>
<tab label="Metadata"/> <tab label="Metadata"/>
<tab label="Notes"/> <tab label="Notes"/>

View file

@ -56,4 +56,17 @@ tree #items-tree
#scholar-metadata #scholar-metadata
{ {
overflow: auto; overflow: auto;
}
#scholar-metadata .addremove
{
-moz-border-radius: 8px;
width: 16px;
height: 16px;
}
#scholar-metadata .addremove:hover
{
color: white;
background: #666666;
} }