Fixes #120, Scholar preference for Above Content breaks display.
Changes the edit pane to look a lot better (uses groupbox). Individual tabs don't load their content unless selected.
This commit is contained in:
parent
16a995df86
commit
a08bbe5347
7 changed files with 138 additions and 100 deletions
|
@ -195,10 +195,10 @@
|
|||
<xul:label id="seeAlsoLabel" class="clicky" crop="end" onclick="this.parentNode.parentNode.seeAlsoClick();"/>
|
||||
<xul:label id="tagsLabel" class="clicky" crop="end" onclick="this.parentNode.parentNode.tagsClick();"/>
|
||||
<xul:popupset>
|
||||
<xul:popup id="seeAlsoPopup" width="300" onpopupshowing="this.firstChild.reload();" onpopuphiding="this.parentNode.parentNode.parentNode.updateSeeAlsoSummary();">
|
||||
<xul:popup id="seeAlsoPopup" width="300" onpopupshowing="this.firstChild.reload();">
|
||||
<xul:seealsobox id="seeAlso" flex="1"/>
|
||||
</xul:popup>
|
||||
<xul:popup id="tagsPopup" width="300" onpopupshowing="this.firstChild.reload();" onpopuphiding="this.parentNode.parentNode.parentNode.updateTagsSummary();">
|
||||
<xul:popup id="tagsPopup" width="300" onpopupshowing="this.firstChild.reload();">
|
||||
<xul:tagsbox id="tags" flex="1"/>
|
||||
</xul:popup>
|
||||
</xul:popupset>
|
||||
|
@ -212,6 +212,7 @@
|
|||
<setter>
|
||||
<![CDATA[
|
||||
this.itemRef = val;
|
||||
this.reload();
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
@ -291,7 +292,6 @@
|
|||
if(t && this.item)
|
||||
{
|
||||
this.item.addTag(t);
|
||||
this.parentNode.parentNode.parentNode.parentNode.updateTagsSummary();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
|
@ -360,6 +360,7 @@
|
|||
<setter>
|
||||
<![CDATA[
|
||||
this.itemRef = val;
|
||||
this.reload();
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
@ -443,7 +444,6 @@
|
|||
{
|
||||
this.item.addSeeAlso(io.dataOut[i]);
|
||||
}
|
||||
this.parentNode.parentNode.parentNode.parentNode.updateSeeAlsoSummary();
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -9,10 +9,13 @@ ScholarItemPane = new function()
|
|||
|
||||
var _creatorCount;
|
||||
|
||||
var _loaded;
|
||||
|
||||
var _itemBeingEdited;
|
||||
|
||||
this.onLoad = onLoad;
|
||||
this.viewItem = viewItem;
|
||||
this.loadPane = loadPane;
|
||||
this.changeTypeTo = changeTypeTo;
|
||||
this.addCreatorRow = addCreatorRow;
|
||||
this.removeCreator = removeCreator;
|
||||
|
@ -25,12 +28,14 @@ ScholarItemPane = new function()
|
|||
|
||||
function onLoad()
|
||||
{
|
||||
_tabs = document.getElementById('scholar-view-tabs');
|
||||
_dynamicFields = document.getElementById('editpane-dynamic-fields');
|
||||
_itemTypeMenu = document.getElementById('editpane-type-menu');
|
||||
_creatorTypeMenu = document.getElementById('creatorTypeMenu');
|
||||
_notesList = document.getElementById('editpane-dynamic-notes');
|
||||
_notesLabel = document.getElementById('editpane-notes-label');
|
||||
_linksBox = document.getElementById('editpane-links');
|
||||
_tagsBox = document.getElementById('editpane-tags');
|
||||
_relatedBox = document.getElementById('editpane-related');
|
||||
|
||||
var creatorTypes = Scholar.CreatorTypes.getTypes();
|
||||
for(var i = 0; i < creatorTypes.length; i++)
|
||||
|
@ -58,91 +63,118 @@ ScholarItemPane = new function()
|
|||
{
|
||||
_itemBeingEdited = thisItem;
|
||||
|
||||
reloadFields();
|
||||
_loaded = new Array(5);
|
||||
|
||||
loadPane(_tabs.selectedIndex);
|
||||
}
|
||||
|
||||
function reloadFields()
|
||||
function loadPane(index)
|
||||
{
|
||||
while(_dynamicFields.hasChildNodes())
|
||||
_dynamicFields.removeChild(_dynamicFields.firstChild);
|
||||
if(_loaded[index])
|
||||
return;
|
||||
_loaded[index] = true;
|
||||
|
||||
for(var i = 0, len = _itemTypeMenu.firstChild.childNodes.length; i < len; i++)
|
||||
if(_itemTypeMenu.firstChild.childNodes[i].value == _itemBeingEdited.getType())
|
||||
_itemTypeMenu.selectedIndex = i;
|
||||
|
||||
var fieldNames = new Array("title","dateAdded","dateModified");
|
||||
var fields = Scholar.ItemFields.getItemTypeFields(_itemBeingEdited.getField("itemTypeID"));
|
||||
for(var i = 0; i<fields.length; i++)
|
||||
fieldNames.push(Scholar.ItemFields.getName(fields[i]));
|
||||
|
||||
for(var i = 0; i<fieldNames.length; i++)
|
||||
if(index == 0)
|
||||
{
|
||||
var editable = (!_itemBeingEdited.isPrimaryField(fieldNames[i]) || _itemBeingEdited.isEditableField(fieldNames[i]));
|
||||
|
||||
var valueElement = createValueElement(_itemBeingEdited.getField(fieldNames[i]), editable ? fieldNames[i] : null);
|
||||
|
||||
var label = document.createElement("label");
|
||||
label.setAttribute("value",Scholar.getString("itemFields."+fieldNames[i])+":");
|
||||
label.setAttribute("onclick","this.nextSibling.blur();");
|
||||
|
||||
addDynamicRow(label,valueElement);
|
||||
}
|
||||
Scholar.debug('loading FIELDS');
|
||||
while(_dynamicFields.hasChildNodes())
|
||||
_dynamicFields.removeChild(_dynamicFields.firstChild);
|
||||
|
||||
//CREATORS:
|
||||
_beforeRow = _dynamicFields.firstChild.nextSibling;
|
||||
_creatorCount = 0;
|
||||
if(_itemBeingEdited.numCreators() > 0)
|
||||
{
|
||||
for(var i = 0, len=_itemBeingEdited.numCreators(); i<len; i++)
|
||||
for(var i = 0, len = _itemTypeMenu.firstChild.childNodes.length; i < len; i++)
|
||||
if(_itemTypeMenu.firstChild.childNodes[i].value == _itemBeingEdited.getType())
|
||||
_itemTypeMenu.selectedIndex = i;
|
||||
|
||||
var fieldNames = new Array("title","dateAdded","dateModified");
|
||||
var fields = Scholar.ItemFields.getItemTypeFields(_itemBeingEdited.getField("itemTypeID"));
|
||||
for(var i = 0; i<fields.length; i++)
|
||||
fieldNames.push(Scholar.ItemFields.getName(fields[i]));
|
||||
|
||||
for(var i = 0; i<fieldNames.length; i++)
|
||||
{
|
||||
var creator = _itemBeingEdited.getCreator(i);
|
||||
addCreatorRow(creator['firstName'], creator['lastName'], creator['creatorTypeID']);
|
||||
var editable = (!_itemBeingEdited.isPrimaryField(fieldNames[i]) || _itemBeingEdited.isEditableField(fieldNames[i]));
|
||||
|
||||
var valueElement = createValueElement(_itemBeingEdited.getField(fieldNames[i]), editable ? fieldNames[i] : null);
|
||||
|
||||
var label = document.createElement("label");
|
||||
label.setAttribute("value",Scholar.getString("itemFields."+fieldNames[i])+":");
|
||||
label.setAttribute("onclick","this.nextSibling.blur();");
|
||||
|
||||
addDynamicRow(label,valueElement);
|
||||
}
|
||||
|
||||
//CREATORS:
|
||||
_beforeRow = _dynamicFields.firstChild.nextSibling;
|
||||
_creatorCount = 0;
|
||||
if(_itemBeingEdited.numCreators() > 0)
|
||||
{
|
||||
for(var i = 0, len=_itemBeingEdited.numCreators(); i<len; i++)
|
||||
{
|
||||
var creator = _itemBeingEdited.getCreator(i);
|
||||
addCreatorRow(creator['firstName'], creator['lastName'], creator['creatorTypeID']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addCreatorRow('', '', 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(index == 1)
|
||||
{
|
||||
addCreatorRow('', '', 1);
|
||||
}
|
||||
|
||||
//NOTES:
|
||||
while(_notesList.hasChildNodes())
|
||||
_notesList.removeChild(_notesList.firstChild);
|
||||
Scholar.debug('loading NOTES');
|
||||
//NOTES:
|
||||
while(_notesList.hasChildNodes())
|
||||
_notesList.removeChild(_notesList.firstChild);
|
||||
|
||||
var notes = Scholar.Items.get(_itemBeingEdited.getNotes());
|
||||
if(notes.length)
|
||||
{
|
||||
for(var i = 0; i < notes.length; i++)
|
||||
var notes = Scholar.Items.get(_itemBeingEdited.getNotes());
|
||||
if(notes.length)
|
||||
{
|
||||
var icon = document.createElement('image');
|
||||
icon.setAttribute('src','chrome://scholar/skin/treeitem-note.png');
|
||||
for(var i = 0; i < notes.length; i++)
|
||||
{
|
||||
var icon = document.createElement('image');
|
||||
icon.setAttribute('src','chrome://scholar/skin/treeitem-note.png');
|
||||
|
||||
var label = document.createElement('label');
|
||||
label.setAttribute('value',_noteToTitle(notes[i].getNote()));
|
||||
label.setAttribute('crop','end');
|
||||
var label = document.createElement('label');
|
||||
label.setAttribute('value',_noteToTitle(notes[i].getNote()));
|
||||
label.setAttribute('crop','end');
|
||||
|
||||
var box = document.createElement('box');
|
||||
box.setAttribute('onclick',"ScholarPane.openNoteWindow("+notes[i].getID()+");");
|
||||
box.setAttribute('class','clicky');
|
||||
box.appendChild(icon);
|
||||
box.appendChild(label);
|
||||
var box = document.createElement('box');
|
||||
box.setAttribute('onclick',"ScholarPane.openNoteWindow("+notes[i].getID()+");");
|
||||
box.setAttribute('class','clicky');
|
||||
box.appendChild(icon);
|
||||
box.appendChild(label);
|
||||
|
||||
var removeButton = document.createElement('label');
|
||||
removeButton.setAttribute("value","-");
|
||||
removeButton.setAttribute("class","clicky");
|
||||
removeButton.setAttribute("onclick","ScholarItemPane.removeNote("+notes[i].getID()+")");
|
||||
var removeButton = document.createElement('label');
|
||||
removeButton.setAttribute("value","-");
|
||||
removeButton.setAttribute("class","clicky");
|
||||
removeButton.setAttribute("onclick","ScholarItemPane.removeNote("+notes[i].getID()+")");
|
||||
|
||||
var row = document.createElement('row');
|
||||
row.appendChild(box);
|
||||
row.appendChild(removeButton);
|
||||
var row = document.createElement('row');
|
||||
row.appendChild(box);
|
||||
row.appendChild(removeButton);
|
||||
|
||||
_notesList.appendChild(row);
|
||||
_notesList.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
_updateNoteCount();
|
||||
}
|
||||
else if(index == 2)
|
||||
{
|
||||
Scholar.debug('loading FILES');
|
||||
//FILES
|
||||
}
|
||||
else if(index == 3)
|
||||
{
|
||||
Scholar.debug('loading TAGS');
|
||||
//TAGS:
|
||||
_tagsBox.item = _itemBeingEdited;
|
||||
}
|
||||
else if(index == 4)
|
||||
{
|
||||
Scholar.debug('loading RELATED');
|
||||
//RELATED
|
||||
_relatedBox.item = _itemBeingEdited;
|
||||
}
|
||||
|
||||
_updateNoteCount();
|
||||
|
||||
//TAGS:
|
||||
_linksBox.item = _itemBeingEdited;
|
||||
}
|
||||
|
||||
function changeTypeTo(id)
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script src="itemPane.js"/>
|
||||
<tabbox id="scholar-view-item" flex="1">
|
||||
<tabs>
|
||||
<tab label="&tabs.info.label;"/>
|
||||
<tab label="&tabs.notes.label;"/>
|
||||
<tab label="&tabs.files.label;"/>
|
||||
</tabs>
|
||||
<tabpanels flex="1">
|
||||
<deck id="scholar-view-item" flex="1" onselect="ScholarItemPane.loadPane(this.selectedIndex);">
|
||||
<vbox id="scholar-info" flex="1">
|
||||
<popupset>
|
||||
<popup id="creatorTypeMenu" position="after_start" oncommand="ScholarItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1],'typeID',event.explicitOriginalTarget.getAttribute('typeid'));"/>
|
||||
|
@ -43,9 +37,7 @@
|
|||
<vbox align="center" pack="center">
|
||||
<label value="Coming soon"/>
|
||||
</vbox>
|
||||
</tabpanels>
|
||||
<hbox>
|
||||
<linksbox id="editpane-links" flex="1"/>
|
||||
</hbox>
|
||||
</tabbox>
|
||||
<tagsbox id="editpane-tags" flex="1"/>
|
||||
<seealsobox id="editpane-related" flex="1"/>
|
||||
</deck>
|
||||
</overlay>
|
|
@ -33,10 +33,6 @@ var ScholarPane = new function()
|
|||
*/
|
||||
function onLoad()
|
||||
{
|
||||
//Initialize collections view
|
||||
collectionsView = new Scholar.CollectionTreeView();
|
||||
document.getElementById('collections-tree').view = collectionsView;
|
||||
|
||||
if(Scholar.Prefs.get("scholarPaneOnTop"))
|
||||
{
|
||||
var oldPane = document.getElementById('scholar-pane');
|
||||
|
@ -61,6 +57,10 @@ var ScholarPane = new function()
|
|||
appContent.insertBefore(newSplitter, document.getElementById('content'));
|
||||
}
|
||||
|
||||
//Initialize collections view
|
||||
collectionsView = new Scholar.CollectionTreeView();
|
||||
document.getElementById('collections-tree').view = collectionsView;
|
||||
|
||||
//Create the add menu with each item type
|
||||
var addMenu = document.getElementById('tb-add').firstChild;
|
||||
var itemTypes = Scholar.ItemTypes.getTypes();
|
||||
|
@ -167,16 +167,19 @@ var ScholarPane = new function()
|
|||
noteEditor.note = item.ref;
|
||||
document.getElementById('scholar-view-note').lastChild.setAttribute('noteID',item.ref.getID());
|
||||
document.getElementById('item-pane').selectedIndex = 2;
|
||||
document.getElementById('scholar-view-tabs').setAttribute('hidden',true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ScholarItemPane.viewItem(item.ref);
|
||||
document.getElementById('item-pane').selectedIndex = 1;
|
||||
document.getElementById('scholar-view-tabs').setAttribute('hidden',false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById('item-pane').selectedIndex = 0;
|
||||
document.getElementById('scholar-view-tabs').setAttribute('hidden',true);
|
||||
|
||||
var label = document.getElementById('scholar-view-selected-label');
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<vbox id="appcontent">
|
||||
<!-- Changes to attributes of scholar-splitter and scholar-pane must be mirrored on overlay.js's onLoad() function -->
|
||||
<splitter id="scholar-splitter" resizebefore="closest" resizeafter="closest" collapsed="true"/>
|
||||
<hbox id="scholar-pane" collapsed="true" flex="1">
|
||||
<hbox id="scholar-pane" persist="height" collapsed="true">
|
||||
<popupset>
|
||||
<popup id="scholar-collectionmenu" onpopupshowing="ScholarPane.buildCollectionContextMenu();">
|
||||
<menuitem label="&toolbar.newCollection.label;" command="cmd_scholar_newCollection"/>
|
||||
|
@ -146,16 +146,27 @@
|
|||
<toolbarbutton id="tb-fullscreen" label="Toggle Fullscreen" oncommand="ScholarPane.fullScreen();"/>
|
||||
<toolbarbutton class="tabs-closebutton" oncommand="ScholarPane.toggleDisplay()"/>
|
||||
</toolbar>
|
||||
<deck id="item-pane" selectedIndex="0" flex="1">
|
||||
<box pack="center" align="center">
|
||||
<label id="scholar-view-selected-label"/>
|
||||
</box>
|
||||
<tabbox id="scholar-view-item" flex="1"/>
|
||||
<vbox id="scholar-view-note" flex="1">
|
||||
<noteeditor id="scholar-note-editor" flex="1"/>
|
||||
<button label="Edit in a separate window" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID'));"/>
|
||||
</vbox>
|
||||
</deck>
|
||||
<groupbox flex="1">
|
||||
<caption>
|
||||
<tabs id="scholar-view-tabs" onselect="document.getElementById('scholar-view-item').selectedIndex = this.selectedIndex;" hidden="true">
|
||||
<tab label="&tabs.info.label;"/>
|
||||
<tab label="&tabs.notes.label;"/>
|
||||
<tab label="&tabs.files.label;"/>
|
||||
<tab label="&tabs.tags.label;"/>
|
||||
<tab label="&tabs.related.label;"/>
|
||||
</tabs>
|
||||
</caption>
|
||||
<deck id="item-pane" selectedIndex="0" flex="1">
|
||||
<box pack="center" align="center">
|
||||
<label id="scholar-view-selected-label"/>
|
||||
</box>
|
||||
<deck id="scholar-view-item" flex="1"/>
|
||||
<vbox id="scholar-view-note" flex="1">
|
||||
<noteeditor id="scholar-note-editor" flex="1"/>
|
||||
<button label="Edit in a separate window" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID'));"/>
|
||||
</vbox>
|
||||
</deck>
|
||||
</groupbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
<!ENTITY tabs.info.label "Info">
|
||||
<!ENTITY tabs.notes.label "Notes">
|
||||
<!ENTITY tabs.tags.label "Tags">
|
||||
<!ENTITY tabs.files.label "Files">
|
||||
<!ENTITY tabs.tags.label "Tags">
|
||||
<!ENTITY tabs.related.label "Related">
|
||||
|
||||
<!ENTITY scholar.minus "-">
|
||||
<!ENTITY scholar.plus "+">
|
||||
|
|
|
@ -97,7 +97,6 @@
|
|||
#scholar-view-item vbox
|
||||
{
|
||||
overflow: auto;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
#editpane-dynamic-fields row > label:first-child
|
||||
|
|
Loading…
Reference in a new issue