[open-ils-commits] r11329 - 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
Mon Nov 24 23:53:18 EST 2008
Author: erickson
Date: 2008-11-24 23:53:16 -0500 (Mon, 24 Nov 2008)
New Revision: 11329
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:
fleshing grid bits. plugged in group and penalty selector for the create dialog
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 04:52:22 UTC (rev 11328)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/permission/grp_penalty_threshold.js 2008-11-25 04:53:16 UTC (rev 11329)
@@ -2,59 +2,95 @@
dojo.require('dojo.data.ItemFileReadStore');
dojo.require('dijit.form.NumberTextBox');
dojo.require('dijit.form.FilteringSelect');
+dojo.require('openils.widget.OrgUnitFilteringSelect');
+dojo.require('openils.widget.PermGrpFilteringSelect');
-var gptList;
+var GPT = {
-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();
+ _gridComplete : function(r) {
+ if(GPT.list = openils.Util.readResponse(r, false, true)) {
+ GPT.list = GPT.list.sort(
+ function(a, b) {
+ if(a.id() > b.id())
+ return 1;
+ return -1;
}
- }
+ );
+ var store = new dojo.data.ItemFileReadStore({data:pgpt.toStoreData(GPT.list)});
+ gptGrid.setStore(store);
+ gptGrid.render();
}
- );
-}
+ },
-function spCreate(args) {
- return alert(js2JSON(args));
+ buildGrid : function() {
+ GPT.grpSelector.fetchGroups(
+ function() {
+ GPT.grpSelector.flatten();
+ fieldmapper.standardRequest(
+ ['open-ils.permacrud', 'open-ils.permacrud.search.pgpt.atomic'],
+ { async: true,
+ params: [openils.User.authtoken, {id:{'!=':null}}],
+ oncomplete: GPT._gridComplete
+ }
+ );
+ }
+ );
+ },
- if(!(args.name && args.label)) return;
+ create : function(args) {
- var penalty = new pgpt();
- penalty.name(args.name);
- penalty.label(args.label);
+ return alert(js2JSON(args));
- var str = '';
- for(var idx in args.block_list)
- str += args.block_list[idx] + '|';
- str = str.replace(/\|$/, '');
- penalty.block_list(str || null);
+ if(!(args.name && args.label)) return;
- 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();
+ 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],
+ oncomplete: function(r) {
+ if(new String(openils.Util.readResponse(r)) != '0')
+ gptBuildGrid();
+ }
}
+ );
+ },
+
+ getGroupName : function(rowIdx, item) {
+ if(!item) return '';
+ var grpId = this.grid.store.getValue(item, this.field);
+ return GPT.grpSelector.groupMap[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();
+
}
- );
-}
+ },
-openils.Util.addOnLoad(gptBuildGrid);
+ loadCsp : function() {
+ fieldmapper.standardRequest(
+ ['open-ils.permacrud', 'open-ils.permacrud.search.csp.atomic'],
+ { async: true,
+ params: [openils.User.authtoken, {id:{'!=':null}}],
+ oncomplete: GPT._loadCspComplete
+ }
+ );
+ }
+};
-
+openils.Util.addOnLoad(GPT.buildGrid);
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 04:52:22 UTC (rev 11328)
+++ trunk/Open-ILS/web/templates/default/conify/global/permission/grp_penalty_threshold.tt2 2008-11-25 04:53:16 UTC (rev 11329)
@@ -6,24 +6,30 @@
<div dojoType="dijit.form.DropDownButton">
<span>New Group Penalty Threshold</span>
- <div dojoType="dijit.TooltipDialog" execute="gptCreate(arguments[0]);">
+ <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.grpSelector.drawGroups();
+ </script>
<table class='dijitTooltipTable'>
<tr>
<td><label for="name">Group: </label></td>
<td>
- <input dojoType="" name="name"/>
+ <select dojoType="openils.widget.PermGrpFilteringSelect" name="name" jsId='GPT.grpSelector'/>
</td>
</tr>
<tr>
<td><label for="org_unit">Context Org Unit: </label></td>
<td>
- <input dojoType="" name="org_unit"/>
+ <select dojoType="openils.widget.OrgUnitFilteringSelect" name="org_unit"
+ jsId='gptOwningOrg' searchAttr='shortname' labelAttr='shortname'/>
</td>
</tr>
<tr>
<td><label for="penalty">Penalty: </label></td>
<td>
- <select dojoType="" name="penalty"/>
+ <select dojoType="dijit.form.FilteringSelect" jsId='GPT.penaltySelector' name="penalty"/>
</td>
</tr>
<tr>
@@ -45,7 +51,7 @@
<thead>
<tr>
<th field="id">ID</th>
- <th field="grp" width='auto'>Group</th>
+ <th field="grp" width='auto' get='GPT.getGroupName'>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>
More information about the open-ils-commits
mailing list