diff --git a/chrome/chromeFiles/content/scholar/bindings/scholarsearch.xml b/chrome/chromeFiles/content/scholar/bindings/scholarsearch.xml new file mode 100644 index 000000000..5c2b03495 --- /dev/null +++ b/chrome/chromeFiles/content/scholar/bindings/scholarsearch.xml @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/collectionTreeView.js b/chrome/chromeFiles/content/scholar/collectionTreeView.js index 6a72193da..ae9286e55 100644 --- a/chrome/chromeFiles/content/scholar/collectionTreeView.js +++ b/chrome/chromeFiles/content/scholar/collectionTreeView.js @@ -61,11 +61,44 @@ Scholar.CollectionTreeView.prototype.refresh = function() var newRows = Scholar.getCollections(); for(var i = 0; i < newRows.length; i++) - this._showItem(new Scholar.ItemGroup('collection',newRows[i]), 0, this._dataItems.length); //item ref, level, beforeRow - + this._showItem(new Scholar.ItemGroup('collection',newRows[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow + + var savedSearches = Scholar.Searches.getAll(); + for(var i = 0; i < savedSearches.length; i++) + { + this._showItem(new Scholar.ItemGroup('search',savedSearches[i]), 0, this._dataItems.length); //itemgroup ref, level, beforeRow + Scholar.debug(i); + } + this._refreshHashMap(); } +/* + * Redisplay everything + */ +Scholar.CollectionTreeView.prototype.reload = function() +{ + var openCollections = new Array(); + + for(var i = 0; i < this.rowCount; i++) + if(this.isContainer(i) && this.isContainerOpen(i)) + openCollections.push(this._getItemAtRow(i).ref.getID()); + + var oldCount = this.rowCount; + this._treebox.beginUpdateBatch(); + this.refresh(); + this._treebox.rowCountChanged(0,this.rowCount - oldCount); + + for(var i = 0; i < openCollections.length; i++) + { + var row = this._collectionRowMap[openCollections[i]]; + if(row != null) + this.toggleOpenState(row); + } + this._treebox.invalidate(); + this._treebox.endUpdateBatch(); +} + /* * Called by Scholar.Notifier on any changes to collections in the data layer */ @@ -101,25 +134,7 @@ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) } else if(action == 'move') { - var openCollections = new Array(); - - for(var i = 0; i < this.rowCount; i++) - if(this.isContainer(i) && this.isContainerOpen(i)) - openCollections.push(this._getItemAtRow(i).ref.getID()); - - var oldCount = this.rowCount; - this._treebox.beginUpdateBatch(); - this.refresh(); - this._treebox.rowCountChanged(0,this.rowCount - oldCount); - - for(var i = 0; i < openCollections.length; i++) - { - var row = this._collectionRowMap[openCollections[i]]; - if(row != null) - this.toggleOpenState(row); - } - this._treebox.invalidate(); - this._treebox.endUpdateBatch(); + this.reload(); } else if(action == 'modify') { @@ -291,7 +306,11 @@ Scholar.CollectionTreeView.prototype.deleteSelection = function() for (var i=0; i + diff --git a/chrome/chromeFiles/content/scholar/searchDialog.js b/chrome/chromeFiles/content/scholar/searchDialog.js new file mode 100644 index 000000000..9cdd6aafa --- /dev/null +++ b/chrome/chromeFiles/content/scholar/searchDialog.js @@ -0,0 +1,44 @@ +/* + Scholar + Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA + http://chnm.gmu.edu/ + http://chnm.gmu.edu/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +var itemsView; +var collectionsView; +var io; + +function doLoad() +{ + io = window.arguments[0]; + + document.getElementById('search-box').search = io.dataIn.search; + document.getElementById('search-name').value = io.dataIn.name; +} + +function doUnload() +{ + +} + +function doAccept() +{ + document.getElementById('search-box').search.setName(document.getElementById('search-name').value); + document.getElementById('search-box').search.save(); + io.dataOut = true; +} \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/searchDialog.xul b/chrome/chromeFiles/content/scholar/searchDialog.xul new file mode 100644 index 000000000..c76fe108b --- /dev/null +++ b/chrome/chromeFiles/content/scholar/searchDialog.xul @@ -0,0 +1,44 @@ + + + + + + + + + +