rename main.list to util.list
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Dec 2005 16:28:22 +0000 (16:28 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 9 Dec 2005 16:28:22 +0000 (16:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2302 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/main/list.js [deleted file]
Open-ILS/xul/staff_client/chrome/content/evergreen/util/list.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/circ/checkout.js

diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/main/list.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/main/list.js
deleted file mode 100644 (file)
index 17a3916..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-dump('entering main/list.js\n');
-
-if (typeof main == 'undefined') main = {};
-main.list = function (id) {
-
-       this.node = document.getElementById(id);
-
-       if (!this.node) throw('Could not find element ' + id);
-       switch(this.node.nodeName) {
-               case 'tree' : break;
-               case 'richlistbox' :
-               case 'listbox' : 
-                       throw(this.node.nodeName + ' not yet supported'); break;
-               default: throw(this.node.nodeName + ' not supported'); break;
-       }
-
-       JSAN.use('util.error'); this.error = new util.error();
-
-       return this;
-};
-
-main.list.prototype = {
-
-       'init' : function (params) {
-
-               if (typeof params.map_row_to_column == 'function') this.map_row_to_column = params.map_row_to_column;
-
-               this.prebuilt = false;
-               if (typeof params.prebuilt != 'undefined') this.prebuilt = params.prebuilt;
-
-               if (typeof params.columns == 'undefined') throw('main.list.init: No columns');
-               this.columns = params.columns;
-
-               if (this.prebuilt) {
-               
-                       this.treechildren = this.node.lastChild;        
-               
-               } else {
-                       var treecols = document.createElement('treecols');
-                       this.node.appendChild(treecols);
-
-                       for (var i = 0; i < this.columns.length; i++) {
-                               var treecol = document.createElement('treecol');
-                               for (var j in this.columns[i]) {
-                                       treecol.setAttribute(j,this.columns[i][j]);
-                               }
-                               treecols.appendChild(treecol);
-                               var splitter = document.createElement('splitter');
-                               splitter.setAttribute('class','tree-splitter');
-                               treecols.appendChild(splitter);
-                       }
-
-                       var treechildren = document.createElement('treechildren');
-                       this.node.appendChild(treechildren);
-                       this.treechildren = treechildren;
-               }
-       },
-
-       'append' : function (params) {
-               switch (this.node.nodeName) {
-                       case 'tree' : this.append_to_tree(params); break;
-                       default: throw('NYI: Need .append() for ' + this.node.nodeName); break;
-               }
-       },
-
-       'append_to_tree' : function (params) {
-
-               if (typeof params.row == 'undefined') throw('main.list.append: Object must contain a row');
-
-               dump('main.list.append: params = ' + js2JSON(params) + '\n');
-
-               var treeitem = document.createElement('treeitem');
-               this.treechildren.appendChild( treeitem );
-               var treerow = document.createElement('treerow');
-               treeitem.appendChild( treerow );
-
-               dump('tree = ' + this.node + '  treechildren = ' + this.treechildren + '\n');
-               dump('treeitem = ' + treeitem + '  treerow = ' + treerow + '\n');
-
-               for (var i = 0; i < this.columns.length; i++) {
-                       var treecell = document.createElement('treecell');
-                       var label = '';
-                       if (typeof params.map_row_to_column == 'function')  {
-
-                               label = params.map_row_to_column(params.row,this.columns[i]);
-
-                       } else {
-
-                               if (typeof this.map_row_to_column == 'function') {
-
-                                       label = this.map_row_to_column(params.row,this.columns[i]);
-                               }
-                       }
-                       treecell.setAttribute('label',label);
-                       treerow.appendChild( treecell );
-                       dump('treecell = ' + treecell + ' with label = ' + label + '\n');
-               }
-
-               return treeitem;
-       }
-
-}
-dump('exiting main/list.js\n');
diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/list.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/list.js
new file mode 100644 (file)
index 0000000..ae42f0a
--- /dev/null
@@ -0,0 +1,103 @@
+dump('entering util.list.js\n');
+
+if (typeof main == 'undefined') main = {};
+util.list = function (id) {
+
+       this.node = document.getElementById(id);
+
+       if (!this.node) throw('Could not find element ' + id);
+       switch(this.node.nodeName) {
+               case 'tree' : break;
+               case 'richlistbox' :
+               case 'listbox' : 
+                       throw(this.node.nodeName + ' not yet supported'); break;
+               default: throw(this.node.nodeName + ' not supported'); break;
+       }
+
+       JSAN.use('util.error'); this.error = new util.error();
+
+       return this;
+};
+
+util.list.prototype = {
+
+       'init' : function (params) {
+
+               if (typeof params.map_row_to_column == 'function') this.map_row_to_column = params.map_row_to_column;
+
+               this.prebuilt = false;
+               if (typeof params.prebuilt != 'undefined') this.prebuilt = params.prebuilt;
+
+               if (typeof params.columns == 'undefined') throw('util.list.init: No columns');
+               this.columns = params.columns;
+
+               if (this.prebuilt) {
+               
+                       this.treechildren = this.node.lastChild;        
+               
+               } else {
+                       var treecols = document.createElement('treecols');
+                       this.node.appendChild(treecols);
+
+                       for (var i = 0; i < this.columns.length; i++) {
+                               var treecol = document.createElement('treecol');
+                               for (var j in this.columns[i]) {
+                                       treecol.setAttribute(j,this.columns[i][j]);
+                               }
+                               treecols.appendChild(treecol);
+                               var splitter = document.createElement('splitter');
+                               splitter.setAttribute('class','tree-splitter');
+                               treecols.appendChild(splitter);
+                       }
+
+                       var treechildren = document.createElement('treechildren');
+                       this.node.appendChild(treechildren);
+                       this.treechildren = treechildren;
+               }
+       },
+
+       'append' : function (params) {
+               switch (this.node.nodeName) {
+                       case 'tree' : this.append_to_tree(params); break;
+                       default: throw('NYI: Need .append() for ' + this.node.nodeName); break;
+               }
+       },
+
+       'append_to_tree' : function (params) {
+
+               if (typeof params.row == 'undefined') throw('util.list.append: Object must contain a row');
+
+               dump('util.list.append: params = ' + js2JSON(params) + '\n');
+
+               var treeitem = document.createElement('treeitem');
+               this.treechildren.appendChild( treeitem );
+               var treerow = document.createElement('treerow');
+               treeitem.appendChild( treerow );
+
+               dump('tree = ' + this.node + '  treechildren = ' + this.treechildren + '\n');
+               dump('treeitem = ' + treeitem + '  treerow = ' + treerow + '\n');
+
+               for (var i = 0; i < this.columns.length; i++) {
+                       var treecell = document.createElement('treecell');
+                       var label = '';
+                       if (typeof params.map_row_to_column == 'function')  {
+
+                               label = params.map_row_to_column(params.row,this.columns[i]);
+
+                       } else {
+
+                               if (typeof this.map_row_to_column == 'function') {
+
+                                       label = this.map_row_to_column(params.row,this.columns[i]);
+                               }
+                       }
+                       treecell.setAttribute('label',label);
+                       treerow.appendChild( treecell );
+                       dump('treecell = ' + treecell + ' with label = ' + label + '\n');
+               }
+
+               return treeitem;
+       }
+
+}
+dump('exiting util.list.js\n');
index 6ffb1b7..4cb4205 100644 (file)
@@ -19,7 +19,7 @@ circ.checkout.prototype = {
                obj.session = params['session'];
                obj.patron_id = params['patron_id'];
 
-               JSAN.use('main.list'); obj.list = new main.list('checkout_list');
+               JSAN.use('util.list'); obj.list = new util.list('checkout_list');
                //FIXME//getString used to wrap StringBundles, but we need to do the entity/div thing
                function getString(s) { return obj.OpenILS.data.entities[s]; }
                obj.list.init(