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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue May 26 17:39:59 EDT 2009


Author: erickson
Date: 2009-05-26 17:39:54 -0400 (Tue, 26 May 2009)
New Revision: 13240

Modified:
   trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
   trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2
Log:
more work toword support circ mod groups

Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js	2009-05-26 20:52:34 UTC (rev 13239)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js	2009-05-26 21:39:54 UTC (rev 13240)
@@ -5,6 +5,7 @@
 dojo.require('openils.PermaCrud');
 
 var circModEditor = null;
+var circModGroupTables = [];
 
 function load(){
     cmGrid.loadAll({order_by:{ccmm:'circ_modifier'}});
@@ -19,6 +20,7 @@
 function buildEditPaneAdditions(editPane) {
     var node = circModEditor.cloneNode(true);
     var tableTmpl = node.removeChild(byName('circ-mod-group-table', node));
+    circModGroupTables = [];
 
     byName('add-circ-mod-group', node).onclick = function() {
         addCircModGroup(node, tableTmpl)
@@ -32,26 +34,24 @@
     editPane.domNode.appendChild(node);
 }
 
+
 function addCircModGroup(node, tableTmpl, group) {
 
     var table = tableTmpl.cloneNode(true);
     var circModRowTmpl = byName('circ-mod-entry-tbody', table).removeChild(byName('circ-mod-entry-row', table));
+    circModGroupTables.push(table);
 
-    // loop over mods
-    //
-    
-    function addMod(mod) {
+    function addMod(code, name) {
         var row = circModRowTmpl.cloneNode(true);
-        byName('circ-mod', row).innerHTML = mod;
+        byName('circ-mod', row).innerHTML = name;
+        byName('circ-mod', row).setAttribute('code', code);
         byName('circ-mod-entry-tbody', table).appendChild(row);
+        byName('remove-circ-mod', row).onclick = function() {
+            byName('circ-mod-entry-tbody', table).removeChild(row);
+        }
     }
 
-    new openils.widget.AutoFieldWidget({
-        fmClass : 'ccmcmt',
-        fmField : 'items_out',
-        fmObject : group,
-        parentNode : byName('circ-mod-count', table)
-    }).build();
+    byName('circ-mod-count', table).value = (group) ? group.items_out() : 0;
 
     var selector = new openils.widget.AutoFieldWidget({
         fmClass : 'ccmcmtm',
@@ -61,12 +61,27 @@
     selector.build();
 
     byName('add-circ-mod', table).onclick = function() {
-        addMod(selector.widget.attr('value'));
+        addMod(selector.widget.attr('value'), selector.widget.attr('displayedValue'));
     }
 
-    node.insertBefore(table, byName('add-circ-mod-group', node));
-    node.insertBefore(dojo.create('hr'), byName('add-circ-mod-group', node));
+    node.insertBefore(table, byName('add-circ-mod-group-span', node));
+    node.insertBefore(dojo.create('hr'), byName('add-circ-mod-group-span', node));
 }
 
+function applyCircModChanges() {
+
+    for(var idx in circModGroupTables) {
+        var table = circModGroupTables[idx];
+
+        var count = byName('circ-mod-count', table).value;
+        var mods = [];
+        dojo.forEach(dojo.query('[name=circ-mod]', table), function(td) { 
+            mods.push(td.getAttribute('code'));
+        });
+
+        alert(count + ' : ' + mods);
+    }
+}
+
 openils.Util.addOnLoad(load);
 

Modified: trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2	2009-05-26 20:52:34 UTC (rev 13239)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2	2009-05-26 21:39:54 UTC (rev 13240)
@@ -23,15 +23,16 @@
 
 <div class='hidden'>
     <div id='circ-mod-editor' style='border:1px solid #aaa'>
-        <h3>Circ Mod Count Groups</h3>
+        <h3>Circ Modifier Count Groups</h3>
         <table class='oils-generic-table' name='circ-mod-group-table'>
             <tbody><tr>
                 <td>Total items out</td>
-                <td><div name='circ-mod-count'></div></td>
+                <td><input type='text' size='3' name='circ-mod-count'></div></td>
             </tr><tbody>
             <tbody name='circ-mod-entry-tbody'>
                 <tr name='circ-mod-entry-row'>
-                    <td colspan='2' name='circ-mod'/>
+                    <td name='circ-mod'/>
+                    <td><a name='remove-circ-mod' href='javascript:void(0);'>Remove</a></td>
                 </tr>
             </tbody>
             <tbody>
@@ -41,7 +42,11 @@
                 </tr>
             </tbody>
         </table>
+        <span name='add-circ-mod-group-span'>
         <a href='javascript:void(0);' name='add-circ-mod-group'>Create New Group</a>
+        </span>&nbsp;&nbsp;<span>
+        <a href='javascript:void(0);' onclick='applyCircModChanges()'>Apply Circ Modifier Changes</a>
+        </span>
     </div>
 </div>
 



More information about the open-ils-commits mailing list