diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js index 6e4aabd2b..65740662e 100644 --- a/chrome/chromeFiles/content/scholar/itemTreeView.js +++ b/chrome/chromeFiles/content/scholar/itemTreeView.js @@ -196,7 +196,7 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) if(this._itemGroup.isLibrary() || item.inCollection(this.getCollectionID())) { this._showItem(item,this.rowCount); - this._treebox.rowCountChanged(this.rowCount,1); + this._treebox.rowCountChanged(this.rowCount-1,1); } madeChanges = true; @@ -209,6 +209,10 @@ Scholar.ItemTreeView.prototype.notify = function(action, type, ids) if(madeChanges) this._refreshHashMap(); + + //Select last add + if(action == 'add' && item) + this.selection.select(this._itemRowMap[item.getID()]); } Scholar.ItemTreeView.prototype.canDrop = function(index, orient) diff --git a/chrome/chromeFiles/content/scholar/metadataPane.js b/chrome/chromeFiles/content/scholar/metadataPane.js index 2b68bb4e1..3c2ec364f 100644 --- a/chrome/chromeFiles/content/scholar/metadataPane.js +++ b/chrome/chromeFiles/content/scholar/metadataPane.js @@ -3,6 +3,9 @@ MetadataPane = new function() var _dynamicFields; var _dynamicCreators; var _editButton; + var _cancelButton; + var _saveButton; + var _creatorsToolbar; var _itemBeingEdited; var _creatorTypes = Scholar.CreatorTypes.getTypes(); @@ -20,20 +23,35 @@ MetadataPane = new function() _dynamicFields = document.getElementById('editpane-dynamic-fields'); _dynamicCreators = document.getElementById('editpane-dynamic-creators'); _editButton = document.getElementById('metadata-pane-edit-button'); + _cancelButton = document.getElementById('metadata-pane-cancel-button'); + _saveButton = document.getElementById('metadata-pane-save-button'); + _creatorsToolbar = document.getElementById('metadata-creators-toolbar'); return true; } /* - * Dynamically loads an item + * Loads an item */ function viewItem(thisItem) - { + { + if(_editButton.hidden) + toggleEdit(confirm("Save changes to '"+_itemBeingEdited.getField('title')+"'?")); + + _itemBeingEdited = thisItem; + + reloadFields(); + + } + + function reloadFields() + { removeDynamicRows(_dynamicFields); removeDynamicRows(_dynamicCreators); + thisItem = _itemBeingEdited; var fieldNames = getFullFieldList(thisItem); - var editingMode = _editButton.checked; + var editingMode = _editButton.hidden; for(var i = 0; i 0) { - var creator = thisItem.getCreator(i); - if(_editButton.checked) + for(var i = 0, len=thisItem.numCreators(); i