[open-ils-commits] r11746 - in trunk/Open-ILS/web: js/ui/default/conify/global/config templates/default/conify/global/config

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jan 5 16:03:05 EST 2009


Author: erickson
Date: 2009-01-05 16:03:00 -0500 (Mon, 05 Jan 2009)
New Revision: 11746

Modified:
   trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js
   trunk/Open-ILS/web/templates/default/conify/global/config/hold_matrix_matchpoint.tt2
Log:
fleshing more objects (marc type/form video form)

Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js	2009-01-05 20:40:03 UTC (rev 11745)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js	2009-01-05 21:03:00 UTC (rev 11746)
@@ -3,19 +3,131 @@
 dojo.require('dojo.data.ItemFileWriteStore');
 dojo.require('dijit.form.CheckBox');
 dojo.require('dijit.form.FilteringSelect');
+dojo.require('fieldmapper.OrgUtils');
+//dojo.require('openils.widget.OrgUnitFilteringSelect');
+dojo.require('openils.PermGrp');
+dojo.require('openils.PermaCrud');
 
+var marcType = {};
+var marcForm = {};
+var vrForm = {};
+var pcrud = new openils.PermaCrud();
+
+
+function getOrgInfo(rowIndex, item) {
+    if(!item) return '';
+    var orgId = this.grid.store.getValue(item, this.field);
+    if(orgId != null) {
+        return fieldmapper.aou.findOrgUnit(orgId).shortname();
+    }
+    return '';
+}
+function getGroupName (rowIndex, item) {
+    if(!item) return '';
+    var grpId = this.grid.store.getValue(item, this.field);
+    if (grpId != null) {
+        grpName = openils.PermGrp.groupIdMap[grpId].name();
+        return grpName;
+    }
+    return '';
+}
+function getMarcType(rowIndex, item) {
+    if(!item) return '';
+    var mt = this.grid.store.getValue(item, this.field);
+    if(mt != null){
+        mtObject = marcType[mt];
+        return mtObject.value();
+    }
+    return'';
+}
+function getMarcForm(rowIndex, item){
+    if(!item) return '';
+    var mf = this.grid.store.getValue(item, this.field);
+    if(mf != null){
+        mfObject = marcForm[mf];
+        return mfObject.value();
+    }
+    return'';
+}
+function getVrForm(rowIndex, item){
+    if(!item) return '';
+    var vr = this.grid.store.getValue(item, this.field);
+    console.log(vr);
+    if(vr != null){
+        vrObject = vrForm[vr];
+        return vrObject.value();
+    }
+    return'';
+}
+function formatReference(inDatum) {
+    switch (inDatum) {
+        case 't':
+            return "<span style='color:green;'>&#x2713;</span>";
+        case 'f':
+            return "<span style='color:red;'>&#x2717;</span>";
+    default:
+        return '';
+    }
+}
+
+function init() {
+    var pending = 4
+
+    pcrud.retrieveAll(
+        'citm',
+        { async : true,
+          oncomplete: function (r) {
+             var list = openils.Util.readResponse(r);
+              marcType = openils.Util.mapList(list, 'code', true);
+              if(--pending == 0) {
+                  buildHMGrid();
+              }
+          }
+        }
+    );
+    pcrud.retrieveAll(
+        'cifm',
+        { async : true,
+          oncomplete: function (r) {
+              var list = openils.Util.readResponse(r);
+              marcForm = openils.Util.mapList(list, 'code', true);
+              if(--pending == 0) {
+                  buildHMGrid();
+              }
+          }
+        }
+    );
+    pcrud.retrieveAll(
+        'cvrfm',
+        { async : true,
+          oncomplete: function (r) {
+              var list = openils.Util.readResponse(r);
+              vrForm = openils.Util.mapList(list, 'code', true);
+              if(--pending == 0) {
+                  buildHMGrid();
+              }
+          }
+        }
+    );
+    openils.PermGrp.fetchGroupTree(
+        function() {
+            openils.PermGrp.flatten();
+            if(--pending == 0) {
+                  buildHMGrid();
+              }
+        }
+    );
+}
 function buildHMGrid() {
-    var store = new dojo.data.ItemFileWriteStore({data:chmm.initStoreData('id', {identifier:'id'})})
+    var store = new dojo.data.ItemFileWriteStore({data:chmm.initStoreData('id', {identifier:'id'})});
     hmGrid.setStore(store);
     hmGrid.render();
-    // dojo.connect(store, 'onSet', cmGridChanged);
-    console.log(js2JSON(store));
+
     fieldmapper.standardRequest(
         ['open-ils.pcrud', 'open-ils.pcrud.search.chmm'],
         {   async: true,
             params: [openils.User.authtoken, {id:{'!=':null}}],
             onresponse: function (r) {
-                console.log('blah');
                 if(obj = openils.Util.readResponse(r)) {
                     store.newItem(chmm.itemToStoreData(obj));
                     // cmCache[obj.code()] = obj;
@@ -25,4 +137,4 @@
     );
 }
 
-openils.Util.addOnLoad(buildHMGrid);
\ No newline at end of file
+openils.Util.addOnLoad(init);
\ No newline at end of file

Modified: trunk/Open-ILS/web/templates/default/conify/global/config/hold_matrix_matchpoint.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/hold_matrix_matchpoint.tt2	2009-01-05 20:40:03 UTC (rev 11745)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/hold_matrix_matchpoint.tt2	2009-01-05 21:03:00 UTC (rev 11746)
@@ -14,28 +14,28 @@
                     <th field="active" width='auto' editable='true' 
                         cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Active?</th>
                     <th field="user_home_ou" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>User Home Library</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getOrgInfo'>User Home Library</th>
                     <th field="request_ou" width='auto' editable='true' 
-                        cellType='dojox.grid.cells.Select'>Request Library</th>
-                    <th field="pickup_ou" editable='true' cellType='dojox.grid.cells.Select'>Pickup Library</th>
+                        cellType='dojox.grid.cells.Select' get='getOrgInfo'>Request Library</th>
+                    <th field="pickup_ou" editable='true' cellType='dojox.grid.cells.Select' get='getOrgInfo'>Pickup Library</th>
                     <th field="item_owning_ou" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Owning Library</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getOrgInfo'>Owning Library</th>
                          <th field="item_circ_ou" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Item Circ Library</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getOrgInfo'>Item Circ Library</th>
                          <th field="usr_grp" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>User Permission Group</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getGroupName'>User Permission Group</th>
                          <th field="requestor_grp" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Requestor Permission Group</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getGroupName'>Requestor Permission Group</th>
                         <th field="circ_modifier" width='auto' editable='true' 
                         cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Circulation Modifier</th>
                          <th field="marc_type" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>MARC Type</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getMarcType'>MARC Type</th>
                          <th field="marc_form" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>MARC Format</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getMarcForm'>MARC Format</th>
                          <th field="marc_vr_format" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Videorecording Format</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' get='getVrForm'>Videorecording Format</th>
                          <th field="ref_flag" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Reference?</th>
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' formatter='formatReference'>Reference?</th>
                         
                 </tr>
             </thead>



More information about the open-ils-commits mailing list