basic circ/hold matrix config ui
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 5 Mar 2009 21:30:59 +0000 (21:30 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 5 Mar 2009 21:30:59 +0000 (21:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12433 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/conify/global/config/hold_matrix_matchpoint.js
Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2
Open-ILS/web/templates/default/conify/global/config/hold_matrix_matchpoint.tt2

index 6175e7c..e69de29 100644 (file)
@@ -1,166 +0,0 @@
-dojo.require('dojox.grid.DataGrid');
-dojo.require('dojox.grid.cells.dijit');
-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();
-var hmCache = [];
-
-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'})});
-    hmGrid.setStore(store);
-    hmGrid.render();
-
-    fieldmapper.standardRequest(
-        ['open-ils.pcrud', 'open-ils.pcrud.search.chmm'],
-        {   async: true,
-            params: [openils.User.authtoken, {id:{'!=':null}}],
-            onresponse: function (r) {
-                if(obj = openils.Util.readResponse(r)) {
-                    store.newItem(chmm.toStoreItem(obj));
-                    // cmCache[obj.code()] = obj;
-                }
-           }
-        }
-    );
-}
-function deleteFromGrid() {
-    _deleteFromGrid(hmGrid.selection.getSelected(), 0);
-}   
-
-function _deleteFromGrid(list, idx) {
-    if(idx >= list.length) // we've made it through the list
-        return;
-
-    var item = list[idx];
-    var id = hmGrid.store.getValue(item, 'id');
-
-    fieldmapper.standardRequest(
-        ['open-ils.permacrud', 'open-ils.permacrud.delete.chmm'],
-        {   async: true,
-            params: [openils.User.authtoken, id],
-            oncomplete: function(r) {
-                if(stat = openils.Util.readResponse(r)) {
-                    // delete succeeded, remove it from the grid and the local cache
-                    hmGrid.store.deleteItem(item); 
-                    delete hmCache[item.code];
-                }
-                _deleteFromGrid(list, ++idx);
-            }
-        }
-    );
-}
-
-openils.Util.addOnLoad(init);
index f39d718..e18d30b 100644 (file)
@@ -4,18 +4,24 @@
     dojo.require('dijit.layout.ContentPane');
     dojo.require('dijit.form.Button');
     dojo.require('openils.widget.AutoGrid');
+    openils.Util.addOnLoad(
+        function(){
+            cmGrid.loadAll({order_by:{ccmm:'circ_modifier'}});
+        }
+    );
 </script>
 <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
     <div>Circulation Policy Configuration</div>
-    <div><button dojoType='dijit.form.Button' onClick='cmGrid.showCreateDialog()'>New</button></div>
+    <div><button dojoType='dijit.form.Button' onClick='cmGrid.showCreatePane()'>New</button></div>
 </div>
 <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
     <table  jsId="cmGrid" 
             dojoType="openils.widget.AutoGrid" 
-            fieldOrder="['id', 'active', 'org_unit', 'grp', 'circ_modifier', 'marc_type', 'marc_form', 'marc_vr_format', 'ref_flag', 'usr_age_lower_bound', 'usr_age_upper_bound']"
+            fieldOrder="['id', 'active', 'org_unit', 'grp', 'circ_modifier', 'marc_type', 'marc_form', 'marc_vr_format']"
             defaultCellWidth='12'
             query="{id: '*'}" 
             fmClass='ccmm' 
+            editStyle='pane'
             editOnEnter='true'>
     </table>
 </div>
index 7820791..f92924f 100644 (file)
@@ -1,46 +1,27 @@
+[% ctc.page_title = 'Hold Policy Configuration' %]
 [% WRAPPER default/base.tt2 %]
-<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/config/hold_matrix_matchpoint.js'> </script>
-<h1>Hold Matrix Matchpoint</h1> <br/>
-
-<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
-
-    <button dojoType='dijit.form.Button' onclick='deleteFromGrid();'>Delete Selected</button>
-     
-    <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
-        <table jsId="hmGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
-            <thead>
-                <tr>
-                    <th field="id">Matchpoint ID</th>
-                    <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' get='getOrgInfo'>User Home Library</th>
-                    <th field="request_ou" width='auto' editable='true' 
-                        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' get='getOrgInfo'>Owning Library</th>
-                         <th field="item_circ_ou" width='auto' editable='true' 
-                        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' get='getGroupName'>User Permission Group</th>
-                         <th field="requestor_grp" width='auto' editable='true' 
-                        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' get='getMarcType'>MARC Type</th>
-                         <th field="marc_form" width='auto' editable='true' 
-                        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' get='getVrForm'>Videorecording Format</th>
-                         <th field="ref_flag" width='auto' editable='true' 
-                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox' formatter='formatReference'>Reference?</th>
-                        
-                </tr>
-            </thead>
-        </table>    
-    </div>
+<script>
+    dojo.require('dijit.layout.ContentPane');
+    dojo.require('dijit.form.Button');
+    dojo.require('openils.widget.AutoGrid');
+    openils.Util.addOnLoad(
+        function(){
+            hmGrid.loadAll({order_by:{chmm:'circ_modifier'}});
+        }
+    );
+</script>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+    <div>Hold Policy Configuration</div>
+    <div><button dojoType='dijit.form.Button' onClick='hmGrid.showCreatePane()'>New</button></div>
+</div>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+    <table  jsId="hmGrid" 
+            dojoType="openils.widget.AutoGrid" 
+            fieldOrder="['id', 'user_home_ou', 'request_ou', 'pickup_ou', 'item_owning_ou', 'item_circ_ou', 'usr_grp', 'requestor_grp', 'circ_modifier']"
+            query="{id: '*'}" 
+            fmClass='chmm' 
+            editStyle='pane'
+            editOnEnter='true'>
+    </table>
 </div>
-
 [% END %]