www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 8d50874d6b483c76ac88babad993d3de93c1be80
parent c345b90b9a798793bbb1d12126637613daa347ea
Author: David Norton <david@nortoncrew.com>
Date:   Mon, 19 Jun 2006 15:45:32 +0000

[interface] You can now change an item's type via menu.

Diffstat:
Mchrome/chromeFiles/content/scholar/itemPane.js | 20++++++++++++++++++++
Mchrome/chromeFiles/content/scholar/itemPane.xul | 3+++
Mchrome/chromeFiles/content/scholar/overlay.js | 11-----------
Mchrome/chromeFiles/content/scholar/overlay.xul | 5+----
4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js @@ -13,6 +13,7 @@ ScholarItemPane = new function() this.onLoad = onLoad; this.viewItem = viewItem; + this.changeTypeTo = changeTypeTo; this.addCreatorRow = addCreatorRow; this.removeCreator = removeCreator; this.showEditor = showEditor; @@ -27,6 +28,7 @@ ScholarItemPane = new function() function onLoad() { _dynamicFields = document.getElementById('editpane-dynamic-fields'); + _itemTypeMenu = document.getElementById('editpane-type-menu'); _creatorTypeMenu = document.getElementById('creatorTypeMenu'); _notesMenu = document.getElementById('scholar-notes-menu'); _notesField = document.getElementById('scholar-notes-field'); @@ -43,6 +45,10 @@ ScholarItemPane = new function() _creatorTypeMenu.appendChild(menuitem); } + var itemTypes = Scholar.ItemTypes.getTypes(); + for(var i = 0; i<itemTypes.length; i++) + _itemTypeMenu.appendItem(Scholar.getString("itemTypes."+itemTypes[i]['name']),itemTypes[i]['id']); + return true; } @@ -67,6 +73,10 @@ ScholarItemPane = new function() while(_dynamicFields.hasChildNodes()) _dynamicFields.removeChild(_dynamicFields.firstChild); + 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++) @@ -117,6 +127,16 @@ ScholarItemPane = new function() onNoteSelected(); } + function changeTypeTo(id) + { + if(id != _itemBeingEdited.getType() && confirm('Are you sure you want to change the item type? Certain fields may be lost.')) + { + _itemBeingEdited.setType(id); + _itemBeingEdited.save(); + reloadFields(); + } + } + function addDynamicRow(label, value, beforeElement) { var row = document.createElement("row"); diff --git a/chrome/chromeFiles/content/scholar/itemPane.xul b/chrome/chromeFiles/content/scholar/itemPane.xul @@ -29,6 +29,9 @@ <popupset> <popup id="creatorTypeMenu" position="after_start" oncommand="ScholarItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1],'typeID',event.explicitOriginalTarget.getAttribute('typeid'));"/> </popupset> + <menulist id="editpane-type-menu" oncommand="ScholarItemPane.changeTypeTo(this.value)"> + <menupopup/> + </menulist> <grid flex="1"> <columns> <column/> diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js @@ -35,17 +35,6 @@ var ScholarPane = new function() //select Library collectionsView.selection.select(0); - - //Create the add menu with each item type - var addMenu = document.getElementById('tb-add').firstChild; - var itemTypes = Scholar.ItemTypes.getTypes(); - for(var i = 0; i<itemTypes.length; i++) - { - var menuitem = document.createElement("menuitem"); - menuitem.setAttribute("label", Scholar.getString("itemTypes."+itemTypes[i]['name'])); - menuitem.setAttribute("oncommand","ScholarPane.newItem("+itemTypes[i]['id']+")"); - addMenu.appendChild(menuitem); - } } /* diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul @@ -65,10 +65,7 @@ <splitter id="scholar-tree-splitter" resizebefore="closest" resizeafter="closest"/> <vbox persist="width" flex="1" style="min-width: 300px;"> <toolbar align="center"> - <toolbarbutton id="tb-add" label="&toolbar.newItem.label;" type="menu"> - <menupopup> - </menupopup> - </toolbarbutton> + <toolbarbutton id="tb-add" label="&toolbar.newItem.label;" command="cmd_scholar_newItem"/> <spacer flex="1"/> <label value="&toolbar.search.label;" control="tb-search"/> <textbox id="tb-search" type="timed" timeout="500" command="cmd_scholar_search"/>