[open-ils-commits] r12952 - in trunk/Open-ILS/web: css/skin/default js/ui/default/acq/po templates/default/acq/po (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Apr 21 16:24:07 EDT 2009
Author: erickson
Date: 2009-04-21 16:24:01 -0400 (Tue, 21 Apr 2009)
New Revision: 12952
Modified:
trunk/Open-ILS/web/css/skin/default/acq.css
trunk/Open-ILS/web/js/ui/default/acq/po/search.js
trunk/Open-ILS/web/templates/default/acq/po/search.tt2
Log:
by default, load the most recently accessed 'local' purchase orders. made filters non-required, horizonatalized filter layout. ported to autogrid
Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css 2009-04-21 20:22:59 UTC (rev 12951)
+++ trunk/Open-ILS/web/css/skin/default/acq.css 2009-04-21 20:24:01 UTC (rev 12952)
@@ -7,7 +7,7 @@
*/
.oils-acq-detail-content-pane {height:600px;width:100%}
-.oils-acq-basic-form-table td {padding:4px;}
+.oils-acq-basic-form-div {padding:4px; width:95%;}
/* bib search */
#oils-acq-search-container { width:100%; }
@@ -49,6 +49,7 @@
/* list of pos */
#oils-acq-po-list-table {width: 100%;}
#oils-acq-po-list-table td {padding: 3px;}
+#oils-acq-po-search-form .dijit {width:130px;}
/* a single po */
#oils-acq-po-table { width: 100%; }
Modified: trunk/Open-ILS/web/js/ui/default/acq/po/search.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/search.js 2009-04-21 20:22:59 UTC (rev 12951)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/search.js 2009-04-21 20:24:01 UTC (rev 12952)
@@ -2,80 +2,63 @@
dojo.require('dijit.form.Button');
dojo.require('dijit.form.FilteringSelect');
dojo.require('dijit.form.NumberTextBox');
-dojo.require('dojox.grid.DataGrid');
dojo.require('dojo.data.ItemFileWriteStore');
-dojo.require('openils.acq.Provider');
-dojo.require('fieldmapper.OrgUtils');
dojo.require('dojo.date.locale');
dojo.require('dojo.date.stamp');
dojo.require('openils.User');
dojo.require('openils.Util');
-dojo.require('openils.acq.PO');
-dojo.require('openils.widget.OrgUnitFilteringSelect');
+dojo.require('openils.widget.AutoGrid');
+dojo.require('openils.widget.AutoFieldWidget');
+dojo.require('openils.PermaCrud');
-function getOrgInfo(rowIndex, item) {
- if(!item) return '';
- var data = this.grid.store.getValue(item, 'ordering_agency')
- return fieldmapper.aou.findOrgUnit(data).shortname();
-}
-
-function getProvider(rowIndex, item) {
- if(!item) return '';
- var data = this.grid.store.getValue(item, 'provider');
- return openils.acq.Provider.retrieve(data).code();
-}
-
function getPOOwner(rowIndex, item) {
if(!item) return '';
var data = this.grid.store.getValue(item, 'owner');
return new openils.User({id:data}).user.usrname();
}
-function getDateTimeField(rowIndex, item) {
- if(!item) return '';
- var data = this.grid.store.getValue(item, this.field);
- var date = dojo.date.stamp.fromISOString(data);
- return dojo.date.locale.format(date, {formatLength:'medium'});
-}
-
function doSearch(fields) {
- if(!isNaN(fields.id))
- fields = {id:fields.id};
- else
+
+ if(isNaN(fields.id)) {
delete fields.id;
+ for(var k in fields) {
+ if(fields[k] == '' || fields[k] == null)
+ delete fields[k];
+ }
+ } else {
+ // ID search trumps other searches
+ fields = {id:fields.id};
+ }
- var store = new dojo.data.ItemFileWriteStore({data:acqpo.initStoreData()});
- poGrid.setStore(store);
- poGrid.render();
+ // no search fields
+ var some = false;
+ for(var k in fields) some = true;
+ if(!some) fields.id = {'!=' : null};
- fieldmapper.standardRequest(
- ['open-ils.acq', 'open-ils.acq.purchase_order.search'],
- { async:1,
- params: [openils.User.authtoken, fields],
- onresponse : function(r) {
- if(po = openils.Util.readResponse(r)) {
- openils.acq.PO.cache[po.id()] = po;
- store.newItem(acqpo.toStoreItem(po));
- }
- dojo.style('po-grid', 'visibility', 'visible');
- }
- }
- );
+ poGrid.resetStore();
+ poGrid.loadAll({order_by:{acqpo : 'edit_time DESC'}, limit: 30}, fields);
}
function loadForm() {
- /* load the providers */
- openils.acq.Provider.createStore(
- function(store) {
- providerSelector.store =
- new dojo.data.ItemFileReadStore({data:store});
- },
- 'MANAGE_PROVIDER'
- );
+ new openils.widget.AutoFieldWidget({
+ fmClass : 'acqpo',
+ fmField : 'provider',
+ parentNode : dojo.byId('po-search-provider-selector'),
+ orgLimitPerms : ['VIEW_PURCHASE_ORDER'],
+ dijitArgs : {name:'provider', required:false}
+ }).build();
- new openils.User().buildPermOrgSelector('VIEW_PURCHASE_ORDER', poSearchOrderingAgencySelect);
+ new openils.widget.AutoFieldWidget({
+ fmClass : 'acqpo',
+ fmField : 'ordering_agency',
+ parentNode : dojo.byId('po-search-agency-selector'),
+ orgLimitPerms : ['VIEW_PURCHASE_ORDER'],
+ dijitArgs : {name:'ordering_agency', required:false}
+ }).build();
+
+ doSearch({ordering_agency : openils.User.user.ws_ou()});
}
openils.Util.addOnLoad(loadForm);
Modified: trunk/Open-ILS/web/templates/default/acq/po/search.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/po/search.tt2 2009-04-21 20:22:59 UTC (rev 12951)
+++ trunk/Open-ILS/web/templates/default/acq/po/search.tt2 2009-04-21 20:24:01 UTC (rev 12952)
@@ -15,65 +15,55 @@
</script>
-<form dojoType='dijit.form.Form' action='' method=''>
+<form dojoType='dijit.form.Form' action='' method='' id='oils-acq-po-search-form'>
+
<script type="dojo/method" event="onSubmit">
- fields = this.getValues();
- if(fields.provider == '')
- delete fields.provider;
- if(isNaN(fields.id))
- delete fields.id;
- doSearch(fields);
+ doSearch(this.getValues());
return false; /* don't redirect */
</script>
- <table class='oils-acq-basic-form-table'>
- <tr>
- <td><label for='id'>ID</label></td>
- <td><input dojoType='dijit.form.NumberTextBox' name='id'> </input></td>
- </tr>
- <tr>
- <td><label for='provider'>Provider</label></td>
- <td><select labelAttr='code' searchAttr='code' name='provider'
- style='overflow-y:auto;' jsId="providerSelector" dojoType="dijit.form.FilteringSelect"> </select></td>
- </tr>
- <tr>
- <td><label for='state'>State</label></td>
- <td>
- <select dojoType='dijit.form.FilteringSelect' name='state' value=''>
- <option value='new'>New</option>
- <option value='in-process'>In Process</option>
- </select>
- </td>
- </tr>
- <tr>
- <td><label for='ordering_agency'>Ordering Agency</label></td>
- <td><select jsId='poSearchOrderingAgencySelect' labelAttr='shortname' searchAttr='shortname'
- dojoType='openils.widget.OrgUnitFilteringSelect' name='ordering_agency'>
- </select>
- </td>
- </tr>
- <tr>
- <td style='text-align:center;'><div dojoType='dijit.form.Button' type='submit'>Search</div></td>
- </tr>
- </table>
+
+ <div class='oils-acq-basic-form-div'>
+
+ <label for='id'>ID</label>
+ <input dojoType='dijit.form.NumberTextBox' name='id'> </input>
+
+ <label for='provider'>Provider</label>
+ <input id='po-search-provider-selector'/>
+
+ <label for='state'>State</label></td>
+ <select dojoType='dijit.form.FilteringSelect' name='state' required='false'>
+ <option value='new'>New</option>
+ <option value='in-process'>In Process</option>
+ </select>
+
+ <label for='ordering_agency'>Ordering Agency</label>
+ <input id='po-search-agency-selector'/>
+
+ <span dojoType='dijit.form.Button' type='submit'>Search</span>
+ </div>
</form>
+<br/>
<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
- <table id="po-grid" jsId="poGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+ <table
+ id="po-grid"
+ jsId="poGrid"
+ dojoType="openils.widget.AutoGrid"
+ query="{id: '*'}"
+ fieldOrder="['id', 'owner', 'ordering_agency', 'provider', 'create_time', 'edit_time', 'state']"
+ suppressFields="['editor', 'creator']"
+ query="{id: '*'}"
+ defaultCellWidth='"auto"'
+ showSequenceFields='true'
+ fmClass='acqpo'>
<thead>
<tr>
<th field="id" get='getId'>ID</th>
- <th field="owner" get='getPOOwner'>Owner</th>
- <th field="ordering_agency" get='getOrgInfo'>Ordering Agency</th>
- <th field="create_time" get='getDateTimeField' width='auto'>Create Time</th>
- <th field="edit_time" get='getDateTimeField' width ='auto'>Edit Time</th>
- <th field="provider" get='getProvider' width='auto'>Provider</th>
- <th field="state">State</th>
+ <th field="owner" get='getPOOwner'/>
</tr>
</thead>
</table>
</div>
</div>
-
-<script>dojo.style('po-grid', 'visibility', 'hidden');</script>
[% END %]
More information about the open-ils-commits
mailing list