[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');
removeButton.setAttribute("label","-");
removeButton.setAttribute("class","addremove");
removeButton.setAttribute("oncommand","MetadataPane.removeCreator("+_creatorCount+")");
row.appendChild(removeButton);
var addButton = document.createElement('toolbarbutton');
addButton.setAttribute("label","+");
addButton.setAttribute("class","addremove");
addButton.setAttribute("oncommand","MetadataPane.addCreatorRow('','',1);");
row.appendChild(addButton);
@ -188,11 +190,11 @@ MetadataPane = new function()
box.replaceChild(t,elem);
t.select();
t.setAttribute('onblur',"MetadataPane.hideEditor(this);");
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('onblur',"MetadataPane.hideEditor(this, true);");
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 fieldName = textbox.getAttribute('fieldname');
@ -202,14 +204,18 @@ MetadataPane = new function()
var creatorFields = fieldName.split('-');
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
{
_itemBeingEdited.setField(fieldName,value);
_itemBeingEdited.save();
if(saveChanges)
{
_itemBeingEdited.setField(fieldName,value);
_itemBeingEdited.save();
}
elem = createValueElement(_itemBeingEdited.getField(fieldName),fieldName);
}

View file

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

View file

@ -21,7 +21,7 @@
<vbox id="appcontent">
<hbox id="scholar-pane" position="1" persist="height collapsed">
<vbox persist="width" flex="1">
<vbox persist="width" flex="1" style="min-width: 150px;">
<toolbar>
<toolbarbutton label="&toolbar.newCollection.label;" command="cmd_scholar_newCollection"/>
<toolbarbutton id="tb-rename" label="&toolbar.renameCollection.label;" oncommand="ScholarPane.renameSelectedCollection();" disabled="true"/>
@ -42,7 +42,7 @@
</tree>
</vbox>
<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">
<toolbarbutton id="tb-add" label="&toolbar.newItem.label;" type="menu">
<menupopup>
@ -95,7 +95,8 @@
</tree>
</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>
<tab label="Metadata"/>
<tab label="Notes"/>

View file

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