[open-ils-commits] r11344 - 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 11:10:09 EST 2008


Author: erickson
Date: 2008-11-25 11:10:06 -0500 (Tue, 25 Nov 2008)
New Revision: 11344

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 penalty name display to grid

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 15:59:43 UTC (rev 11343)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js	2008-11-25 16:10:06 UTC (rev 11344)
@@ -25,18 +25,21 @@
     },
 
     buildGrid  : function() {
-        openils.PermGrp.fetchGroupTree(
-            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
-                    }
-                );
-            }
-        );
+        var postPenaltyFunc = function() {
+            openils.PermGrp.fetchGroupTree(
+                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.loadCsp(postPenaltyFunc);
     },
 
     create : function(args) {
@@ -68,28 +71,34 @@
         return openils.PermGrp.groupIdMap[grpId].name();
     },
 
-    _loadCspComplete : function(r) {
-        if(list = openils.Util.readResponse(r, false, true)) {
-            list = list.sort(
-                function(a, b) {
-                    if(a.id() > b.id()) 
-                        return 1;
-                    return -1;
-                }
-            );
-            GPT.penaltySelector.store = 
-                new dojo.data.ItemFileReadStore({data:csp.toStoreData(list)});
-            GPT.penaltySelector.startup();
-
-        }
+    drawCspSelector : function() {
+        GPT.penaltySelector.store = 
+            new dojo.data.ItemFileReadStore({data:csp.toStoreData(GPT.standingPenalties)});
+        GPT.penaltySelector.startup();
     },
 
-    loadCsp : function() {
+    loadCsp : function(onload) {
+        GPT.penaltyMap = {};
         fieldmapper.standardRequest(
             ['open-ils.permacrud', 'open-ils.permacrud.search.csp.atomic'],
             {   async: true,
                 params: [openils.User.authtoken, {id:{'!=':null}}],
-                oncomplete: GPT._loadCspComplete
+                oncomplete: function(r) {
+                    if(list = openils.Util.readResponse(r, false, true)) {
+                        list = list.sort(
+                            function(a, b) {
+                                // why not take this opportunity to do some other stuff? ;)
+                                GPT.penaltyMap[a.id()] = a;
+                                GPT.penaltyMap[b.id()] = b;
+                                if(a.id() > b.id()) 
+                                    return 1;
+                                return -1;
+                            }
+                        );
+                        GPT.standingPenalties = list;
+                        if(onload) onload(list);
+                    }
+                }
             }
         );
     }, 
@@ -99,6 +108,13 @@
             var orgId = this.grid.store.getValue(item, this.field);
             return fieldmapper.aou.findOrgUnit(orgId).shortname();
         }
+    },
+
+    getPenaltyInfo : function(rowIndex, item) {
+        if(item) {
+            var pId = this.grid.store.getValue(item, this.field);
+            return GPT.penaltyMap[pId].name();
+        }
     }
 };
 

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 15:59:43 UTC (rev 11343)
+++ trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2	2008-11-25 16:10:06 UTC (rev 11344)
@@ -9,7 +9,7 @@
     <div dojoType="dijit.TooltipDialog" execute="GPT.create(arguments[0]);">
         <script type='dojo/connect' event='onOpen'>
             new openils.User().buildPermOrgSelector('CREATE_GROUP_PENALTY_THRESHOLD', gptOwningOrg);
-            GPT.loadCsp();
+            GPT.drawCspSelector();
             GPT.grpSelector.drawGroups();
         </script>
         <table class='dijitTooltipTable'>
@@ -53,7 +53,7 @@
                     <th field="id">ID</th>
                     <th field="grp" width='auto' get='GPT.getGroupName'>Group</th>
                     <th field="org_unit" width='auto' get='GPT.getOrgInfo'>Context Org Unit</th>
-                    <th field="penalty" width='auto'>Penalty</th>
+                    <th field="penalty" width='auto' get='GPT.getPenaltyInfo'>Penalty</th>
                     <th field="threshold" width='auto'>threshold</th>
                 </tr>
             </thead>



More information about the open-ils-commits mailing list