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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 25 12:42:24 EST 2008


Author: erickson
Date: 2008-11-25 12:42:22 -0500 (Tue, 25 Nov 2008)
New Revision: 11347

Modified:
   trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js
   trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2
Log:
plugged in context selector.  implemented create

Modified: 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	2008-11-25 17:41:30 UTC (rev 11346)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js	2008-11-25 17:42:22 UTC (rev 11347)
@@ -25,41 +25,54 @@
     },
 
     buildGrid  : function() {
-        var postPenaltyFunc = function() {
-            openils.PermGrp.fetchGroupTree(
+        fieldmapper.standardRequest(
+            ['open-ils.actor', 'open-ils.actor.grp_penalty_threshold.ranged.retrieve'],
+            {   async: true,
+                params: [openils.User.authtoken, GPT.contextOrg],
+                oncomplete: GPT._gridComplete
+            }
+        );
+    },
+
+    init : function() {
+        GPT.contextOrg = openils.User.user.ws_ou();
+
+        var connect = function() {
+            dojo.connect(GPT.contextOrgSelector, 'onChange',
                 function() {
-                    openils.PermGrp.flatten();
-                    fieldmapper.standardRequest(
-                        ['open-ils.permacrud', 'open-ils.permacrud.search.pgpt.atomic'],
-                        {   async: true,
-                            params: [openils.User.authtoken, {id:{'!=':null}}],
-                            oncomplete: GPT._gridComplete
-                        }
-                    );
+                    GPT.contextOrg = this.getValue();
+                    GPT.buildGrid();
                 }
             );
         };
-        GPT.loadCsp(postPenaltyFunc);
+        new openils.User().buildPermOrgSelector('VIEW_GROUP_PENALTY_THRESHOLD', GPT.contextOrgSelector, null, connect);
+
+        GPT.loadCsp(
+            function() {
+                openils.PermGrp.fetchGroupTree(
+                    function() { openils.PermGrp.flatten(); GPT.buildGrid(); }
+                );
+            }
+        );
     },
 
     create : function(args) {
+        if(!(args.grp && args.org_unit && args.penalty && args.threshold))
+            return;
 
-        return alert(js2JSON(args));
+        var thresh = new pgpt();
+        thresh.grp(args.grp);
+        thresh.org_unit(args.org_unit);
+        thresh.penalty(args.penalty);
+        thresh.threshold(args.threshold);
 
-        if(!(args.name && args.label)) return;
-
-        var penalty = new pgpt();
-        penalty.name(args.name);
-        penalty.label(args.label);
-
-
         fieldmapper.standardRequest(
             ['open-ils.permacrud', 'open-ils.permacrud.create.pgpt'],
             {   async: true,
-                params: [openils.User.authtoken, penalty],
+                params: [openils.User.authtoken, thresh],
                 oncomplete: function(r) {
                     if(new String(openils.Util.readResponse(r)) != '0')
-                        gptBuildGrid();
+                        GPT.buildGrid();
                 }
             }
         );
@@ -82,7 +95,7 @@
         fieldmapper.standardRequest(
             ['open-ils.permacrud', 'open-ils.permacrud.search.csp.atomic'],
             {   async: true,
-                params: [openils.User.authtoken, {id:{'!=':null}}],
+                params: [openils.User.authtoken, {id:{'<':100}}],
                 oncomplete: function(r) {
                     if(list = openils.Util.readResponse(r, false, true)) {
                         list = list.sort(
@@ -118,4 +131,4 @@
     }
 };
 
-openils.Util.addOnLoad(GPT.buildGrid);
+openils.Util.addOnLoad(GPT.init);

Modified: 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	2008-11-25 17:41:30 UTC (rev 11346)
+++ trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2	2008-11-25 17:42:22 UTC (rev 11347)
@@ -14,9 +14,9 @@
         </script>
         <table class='dijitTooltipTable'>
             <tr>
-                <td><label for="name">Group: </label></td>
+                <td><label for="grp">Group: </label></td>
                 <td>
-                    <select dojoType="openils.widget.PermGrpFilteringSelect" name="name" jsId='GPT.grpSelector'/>
+                    <select dojoType="openils.widget.PermGrpFilteringSelect" name="grp" jsId='GPT.grpSelector'/>
                 </td>
             </tr>
             <tr>
@@ -44,6 +44,9 @@
         </table>
     </div>
 </div> 
+<span>Context Org Unit</span>
+<select dojoType="openils.widget.OrgUnitFilteringSelect" jsId='GPT.contextOrgSelector' 
+    searchAttr='shortname' labelAttr='shortname'> </select>
 
 <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
     <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>



More information about the open-ils-commits mailing list