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

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Nov 23 11:28:36 EST 2008


Author: erickson
Date: 2008-11-23 11:28:34 -0500 (Sun, 23 Nov 2008)
New Revision: 11313

Added:
   trunk/Open-ILS/web/js/ui/default/conify/global/permission/
   trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js
   trunk/Open-ILS/web/templates/default/conify/global/permission/
   trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2
Log:
adding initial grp penalty threshold UI

Added: trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js	                        (rev 0)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js	2008-11-23 16:28:34 UTC (rev 11313)
@@ -0,0 +1,60 @@
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileReadStore');
+dojo.require('dijit.form.NumberTextBox');
+dojo.require('dijit.form.FilteringSelect');
+
+var gptList;
+
+function gptBuildGrid() {
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.search.pgpt.atomic'],
+        {   async: true,
+            params: [openils.User.authtoken, {id:{'!=':null}}],
+            oncomplete: function(r) {
+                if(gptList = openils.Util.readResponse(r, false, true)) {
+                    gptList = gptList.sort(
+                        function(a, b) {
+                            if(a.id() > b.id()) 
+                                return 1;
+                            return -1;
+                        }
+                    );
+                    var store = new dojo.data.ItemFileReadStore({data:pgpt.toStoreData(gptList)});
+                    gptGrid.setStore(store);
+                    gptGrid.render();
+                }
+            }
+        }
+    );
+}
+
+function spCreate(args) {
+    return alert(js2JSON(args));
+
+    if(!(args.name && args.label)) return;
+
+    var penalty = new pgpt();
+    penalty.name(args.name);
+    penalty.label(args.label);
+
+    var str = '';
+    for(var idx in args.block_list)
+        str += args.block_list[idx] + '|';
+    str = str.replace(/\|$/, '');
+    penalty.block_list(str || null);
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.create.pgpt'],
+        {   async: true,
+            params: [openils.User.authtoken, penalty],
+            oncomplete: function(r) {
+                if(new String(openils.Util.readResponse(r)) != '0')
+                    gptBuildGrid();
+            }
+        }
+    );
+}
+
+openils.Util.addOnLoad(gptBuildGrid);
+
+

Added: trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2	                        (rev 0)
+++ trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2	2008-11-23 16:28:34 UTC (rev 11313)
@@ -0,0 +1,60 @@
+[% WRAPPER default/base.tt2 %]
+<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/permission/grp_penalty_threshold.js'> </script>
+<h1>Group Penalty Thresholds</h1><br/>
+
+<!-- grp, penalty, org_unit, threshold -->
+
+<div dojoType="dijit.form.DropDownButton">
+    <span>New Group Penalty Threshold</span>
+    <div dojoType="dijit.TooltipDialog" execute="gptCreate(arguments[0]);">
+        <table class='dijitTooltipTable'>
+            <tr>
+                <td><label for="name">Group: </label></td>
+                <td>
+                    <input dojoType="" name="name"/>
+                </td>
+            </tr>
+            <tr>
+                <td><label for="org_unit">Context Org Unit: </label></td>
+                <td>
+                    <input dojoType="" name="org_unit"/>
+                </td>
+            </tr>
+            <tr>
+                <td><label for="penalty">Penalty: </label></td>
+                <td>
+                    <select dojoType="" name="penalty"/>
+                </td>
+            </tr>
+            <tr>
+                <td><label for="threshold">Threshold: </label></td>
+                <td><input dojoType="dijit.form.NumberTextBox" name="threshold"/></td>
+            </tr>
+            <tr>
+                <td colspan='2' align='center'>
+                    <button dojoType='dijit.form.Button' type="submit">Create</button>
+                </td>
+            </tr>
+        </table>
+    </div>
+</div> 
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+        <table jsId="gptGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+            <thead>
+                <tr>
+                    <th field="id">ID</th>
+                    <th field="grp" width='auto'>Group</th>
+                    <th field="org_unit" width='auto'>Context Org Unit</th>
+                    <th field="penalty" width='auto'>Penalty</th>
+                    <th field="threshold" width='auto'>threshold</th>
+                </tr>
+            </thead>
+        </table>    
+    </div>
+</div>
+
+[% END %]
+
+



More information about the open-ils-commits mailing list