started plugging in the abiliy to define circ mod groups for a circ matrix test....
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 May 2009 20:51:59 +0000 (20:51 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 May 2009 20:51:59 +0000 (20:51 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13238 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js [new file with mode: 0644]
Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2

diff --git a/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js b/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
new file mode 100644 (file)
index 0000000..c7a643f
--- /dev/null
@@ -0,0 +1,72 @@
+dojo.require('dijit.layout.ContentPane');
+dojo.require('dijit.form.Button');
+dojo.require('openils.widget.AutoGrid');
+dojo.require('openils.widget.AutoFieldWidget');
+dojo.require('openils.PermaCrud');
+
+var circModEditor = null;
+
+function load(){
+    cmGrid.loadAll({order_by:{ccmm:'circ_modifier'}});
+    cmGrid.onEditPane = buildEditPaneAdditions;
+    circModEditor = dojo.byId('circ-mod-editor').parentNode.removeChild(dojo.byId('circ-mod-editor'));
+}
+
+function byName(name, ctxt) {
+    return dojo.query('[name=' + name + ']', ctxt)[0];
+}
+
+function buildEditPaneAdditions(editPane) {
+    var node = circModEditor.cloneNode(true);
+    var tableTmpl = node.removeChild(byName('circ-mod-group-table', node));
+
+    byName('add-circ-mod-group', node).onclick = function() {
+        addCircModGroup(node, tableTmpl)
+    }
+
+    var group = null;
+    if(editPane.mode == 'update') {
+        //group = 
+    } 
+
+    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));
+
+    // loop over mods
+    //
+    
+    function addMod(mod) {
+        var row = circModRowTmpl.cloneNode(true);
+        byName('circ-mod', row).innerHTML = mod;
+        byName('circ-mod-entry-tbody', table).appendChild(row);
+    }
+
+    new openils.widget.AutoFieldWidget({
+        fmClass : 'ccmcmt',
+        fmField : 'items_out',
+        fmObject : group,
+        parentNode : byName('circ-mod-count', table)
+    }).build();
+
+    var selector = new openils.widget.AutoFieldWidget({
+        fmClass : 'ccmcmtm',
+        fmField : 'circ_mod',
+        parentNode : byName('circ-mod-selector', table)
+    });
+    selector.build();
+
+    byName('add-circ-mod', table).onclick = function() {
+        addMod(selector.widget.attr('value'));
+    }
+
+    node.insertBefore(table, byName('add-circ-mod-group', node));
+    node.insertBefore(dojo.create('hr'), byName('add-circ-mod-group', node));
+}
+
+openils.Util.addOnLoad(load);
+
index 7157e52..5884f15 100644 (file)
@@ -1,15 +1,6 @@
 [% ctc.page_title = 'Circulation Policy Configuration' %]
 [% WRAPPER default/base.tt2 %]
-<script>
-    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>
+<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/config/circ_matrix_matchpoint.js'> </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.showCreatePane()'>New</button></div>
             showColumnPicker='true'
             columnPickerPrefix='"conify.config.circ_matrix_matchpoint"'>
     </table>
-  </div>
+</div>
+
+<div class='hidden'>
+    <div id='circ-mod-editor' style='border:1px solid #aaa'>
+        <h3>Circ Mod 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>
+            </tr><tbody>
+            <tbody name='circ-mod-entry-tbody'>
+                <tr name='circ-mod-entry-row'>
+                    <td colspan='2' name='circ-mod'/>
+                </tr>
+            </tbody>
+            <tbody>
+                <tr>
+                    <td><div name='circ-mod-selector'></div></td>
+                    <td><a href='javascript:void(0);' name='add-circ-mod'>Add</a></td>
+                </tr>
+            </tbody>
+        </table>
+        <a href='javascript:void(0);' name='add-circ-mod-group'>Create New Group</a>
+    </div>
+</div>
+
 [% END %]
+