[open-ils-commits] r10508 - trunk/Open-ILS/web/vandelay

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Sep 2 13:30:30 EDT 2008


Author: erickson
Date: 2008-09-02 13:30:27 -0400 (Tue, 02 Sep 2008)
New Revision: 10508

Modified:
   trunk/Open-ILS/web/vandelay/vandelay.html
   trunk/Open-ILS/web/vandelay/vandelay.js
Log:
moved grid layout into the markup for easier i18nization.   added buttons to select all/none.  stub import button

Modified: trunk/Open-ILS/web/vandelay/vandelay.html
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.html	2008-09-02 16:10:14 UTC (rev 10507)
+++ trunk/Open-ILS/web/vandelay/vandelay.html	2008-09-02 17:30:27 UTC (rev 10508)
@@ -86,6 +86,18 @@
         </div>
         <div id='vl-queue-div' style='display:none;height:100%;'>
             <h1>Record Queue</h1><br/>
+            <script>
+                var vlQueueGridLayout = [{
+                    cells : [[
+                        {   name: 'Selected',
+                            get: vlQueueGridDrawSelectBox,
+                        }
+                    ]]
+                }];
+            </script>
+            <button dojoType='dijit.form.Button' onclick='vlSelectAllGridRecords'>Select All</button>
+            <button dojoType='dijit.form.Button' onclick='vlSelectNoGridRecords'>Select None</button>
+            <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords'>Import Selected</button>
             <div style='height:100%;'>
                 <div dojoType='dojox.Grid' jsId='vlQueueGrid'> </div>
             </div>

Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js	2008-09-02 16:10:14 UTC (rev 10507)
+++ trunk/Open-ILS/web/vandelay/vandelay.js	2008-09-02 17:30:27 UTC (rev 10508)
@@ -211,14 +211,6 @@
 function buildRecordGrid(type) {
     displayGlobalDiv('vl-queue-div');
 
-    /* test structure... */
-    var structure = [{
-        //noscroll : true,
-        cells : [[
-            //{name: 'ID', field: 'id'},
-        ]]
-    }];
-
     var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
     for(var i = 0; i < defs.length; i++) {
         var attr = defs[i]
@@ -229,10 +221,10 @@
             get: getAttrValue
         };
         if(attr.code().match(/title/i)) col.width = 'auto'; // this is hack.
-        structure[0].cells[0].push(col);
+        vlQueueGridLayout[0].cells[0].push(col);
     }
 
-    vlQueueGrid.setStructure(structure);
+    vlQueueGrid.setStructure(vlQueueGridLayout);
 
     var storeData;
     if(type == 'bib')
@@ -243,10 +235,38 @@
     var store = new dojo.data.ItemFileReadStore({data:storeData});
     var model = new dojox.grid.data.DojoData(
         null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
+
     vlQueueGrid.setModel(model);
     vlQueueGrid.update();
 }
 
+var selectableGridRecords = {};
+function vlQueueGridDrawSelectBox(rowIdx) {
+    var data = this.grid.model.getRow(rowIdx);
+    if(!data) return '';
+    var domId = 'vl-record-list-selected-' +data.id;
+    selectableGridRecords[domId] = data.id;
+    return "<input type='checkbox' id='"+domId+"'/>";
+}
+
+function vlSelectAllGridRecords() {
+    for(var id in selectableGridRecords) 
+        dojo.byId(id).checked = true;
+}
+function vlSelectNoGridRecords() {
+    for(var id in selectableGridRecords) 
+        dojo.byId(id).checked = false;
+}
+
+function vlImportSelectedRecords() {
+    for(var id in selectableGridRecords) {
+        if(dojo.byId(id).checked) {
+            var recId = selectableGridRecords[id];
+            alert(recId);
+        }
+    }
+}
+
 var handleRetrieveRecords = function() {
     buildRecordGrid(currentType);
 }



More information about the open-ils-commits mailing list