From a08bbe5347a7749e43cf36f66865e70d4fc78dd1 Mon Sep 17 00:00:00 2001 From: David Norton Date: Wed, 26 Jul 2006 14:03:54 +0000 Subject: [PATCH] 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. --- .../content/scholar/customControls.xml | 8 +- .../chromeFiles/content/scholar/itemPane.js | 166 +++++++++++------- .../chromeFiles/content/scholar/itemPane.xul | 16 +- chrome/chromeFiles/content/scholar/overlay.js | 11 +- .../chromeFiles/content/scholar/overlay.xul | 33 ++-- .../locale/en-US/scholar/scholar.dtd | 3 +- .../skin/default/scholar/overlay.css | 1 - 7 files changed, 138 insertions(+), 100 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/customControls.xml b/chrome/chromeFiles/content/scholar/customControls.xml index bebbff150..196231d92 100644 --- a/chrome/chromeFiles/content/scholar/customControls.xml +++ b/chrome/chromeFiles/content/scholar/customControls.xml @@ -195,10 +195,10 @@ - + - + @@ -212,6 +212,7 @@ @@ -291,7 +292,6 @@ if(t && this.item) { this.item.addTag(t); - this.parentNode.parentNode.parentNode.parentNode.updateTagsSummary(); } ]]> @@ -360,6 +360,7 @@ @@ -443,7 +444,6 @@ { this.item.addSeeAlso(io.dataOut[i]); } - this.parentNode.parentNode.parentNode.parentNode.updateSeeAlsoSummary(); } ]]> diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js index 9cfd2ab54..59912721e 100644 --- a/chrome/chromeFiles/content/scholar/itemPane.js +++ b/chrome/chromeFiles/content/scholar/itemPane.js @@ -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 0) - { - for(var i = 0, len=_itemBeingEdited.numCreators(); i 0) + { + for(var i = 0, len=_itemBeingEdited.numCreators(); i