[open-ils-commits] r11606 - 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
Wed Dec 17 15:24:08 EST 2008


Author: erickson
Date: 2008-12-17 15:24:04 -0500 (Wed, 17 Dec 2008)
New Revision: 11606

Modified:
   trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js
   trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2
Log:
added delete functionality.  fixed some tabbing

Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js	2008-12-17 18:36:26 UTC (rev 11605)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js	2008-12-17 20:24:04 UTC (rev 11606)
@@ -11,15 +11,15 @@
     cmGrid.render();
 
     fieldmapper.standardRequest(
-       ['open-ils.permacrud', 'open-ils.permacrud.search.ccm'],
-       {   async: true,
-           params: [openils.User.authtoken, {code:{'!=':null}}],
-           onresponse: function (r) { 
+        ['open-ils.permacrud', 'open-ils.permacrud.search.ccm'],
+        {   async: true,
+            params: [openils.User.authtoken, {code:{'!=':null}}],
+            onresponse: function (r) { 
                 if(obj = openils.Util.readResponse(r)) {
                     store.newItem(ccm.itemToStoreData(obj));
                     cmCache[obj.code()] = obj;
                 }
-            }
+           }
         }
     );
 }
@@ -58,6 +58,32 @@
     );
 }
 
-    
+function deleteFromGrid() {
+    _deleteFromGrid(cmGrid.selection.getSelected(), 0);
+}   
+
+function _deleteFromGrid(list, idx) {
+    if(idx >= list.length) // we've made it through the list
+        return;
+
+    var item = list[idx];
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.delete.ccm'],
+        {   async: true,
+            params: [openils.User.authtoken, item.code],
+            oncomplete: function(r) {
+                if(stat = openils.Util.readResponse(r)) {
+                    // delete succeeded, remove it from the grid and the local cache
+                    cmGrid.store.deleteItem(item); 
+                    delete cmCache[item.code];
+                }
+                _deleteFromGrid(list, ++idx);
+            }
+        }
+    );
+}
+
 openils.Util.addOnLoad(buildCMGrid);
 
+

Modified: trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2	2008-12-17 18:36:26 UTC (rev 11605)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2	2008-12-17 20:24:04 UTC (rev 11606)
@@ -50,12 +50,15 @@
         </div>
     </div> 
 
+    <button dojoType='dijit.form.Button' onclick='deleteFromGrid();'>Delete Selected</button>
+
     <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
         <table jsId="cmGrid" dojoType="dojox.grid.DataGrid" query="{name: '*'}" rowSelector='20px'>
             <thead>
                 <tr>
                     <th field="code">Code</th>
-                    <th field="name" width='auto'>Name</th>
+                    <th field="name" width='auto' editable='true' 
+                        cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Name</th>
                     <th field="description" width='auto'>Description</th>
                     <th field="sip2_media_type" width='auto'>SIP2 Media Type</th>
                     <th field="magnetic_media" width='auto' get='getMagneticMedia'>Magnetic Media</th>



More information about the open-ils-commits mailing list