[open-ils-commits] r11504 - in trunk/Open-ILS/web: js/ui/default/acq/financial templates/default/acq/financial
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Dec 10 14:27:35 EST 2008
Author: erickson
Date: 2008-12-10 14:27:32 -0500 (Wed, 10 Dec 2008)
New Revision: 11504
Modified:
trunk/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js
trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
trunk/Open-ILS/web/js/ui/default/acq/financial/list_providers.js
trunk/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2
trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2
trunk/Open-ILS/web/templates/default/acq/financial/list_providers.tt2
Log:
more movement toward markup-based grids
Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js 2008-12-10 18:44:00 UTC (rev 11503)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js 2008-12-10 19:27:32 UTC (rev 11504)
@@ -1,6 +1,7 @@
dojo.require("dijit.Dialog");
dojo.require('dijit.form.Button');
-dojo.require('dojox.grid.Grid');
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileReadStore');
dojo.require('openils.acq.CurrencyType');
dojo.require('openils.Event');
dojo.require('openils.Util');
@@ -13,10 +14,9 @@
function(types) {
var store = new dojo.data.ItemFileReadStore(
{data:acqct.toStoreData(types, 'code', {identifier:'code'})});
- var model = new dojox.grid.data.DojoData(null, store,
- {rowsPerPage: 20, clientSort: true, query:{code:'*'}});
- currencyTypeListGrid.setModel(model);
- currencyTypeListGrid.update();
+
+ currencyTypeListGrid.setStore(store);
+ currencyTypeListGrid.render();
}
);
}
Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js 2008-12-10 18:44:00 UTC (rev 11503)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js 2008-12-10 19:27:32 UTC (rev 11504)
@@ -1,35 +1,35 @@
dojo.require("dijit.Dialog");
dojo.require("dijit.form.FilteringSelect");
dojo.require('dijit.form.Button');
-dojo.require('dojox.grid.Grid');
-
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileReadStore');
dojo.require('openils.widget.OrgUnitFilteringSelect');
dojo.require('openils.acq.CurrencyType');
dojo.require('openils.Event');
dojo.require('openils.Util');
dojo.require('openils.acq.Fund');
-function getOrgInfo(rowIndex) {
- data = fundListGrid.model.getRow(rowIndex);
- if(!data) return;
- return fieldmapper.aou.findOrgUnit(data.org).shortname();
+function getOrgInfo(rowIndex, item) {
+
+ if(!item) return '';
+ var owner = this.grid.store.getValue(item, 'org');
+ return fieldmapper.aou.findOrgUnit(owner).shortname();
+
}
-function getBalanceInfo(rowIndex) {
- data = fundListGrid.model.getRow(rowIndex);
- if(!data) return;
- return new String(openils.acq.Fund.cache[data.id].summary().combined_balance);
+function getBalanceInfo(rowIndex, item) {
+ if(!item) return '';
+ var data = this.grid.store.getValue( item, 'id');
+ return new String(openils.acq.Fund.cache[data].summary().combined_balance);
}
-
function loadFundGrid() {
openils.acq.Fund.createStore(
function(storeData) {
var store = new dojo.data.ItemFileReadStore({data:storeData});
- var model = new dojox.grid.data.DojoData(null, store,
- {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- fundListGrid.setModel(model);
- fundListGrid.update();
+
+ fundListGrid.setStore(store);
+ fundListGrid.render();
var yearStore = {identifier:'year', name:'year', items:[]};
@@ -53,11 +53,10 @@
function filterGrid() {
var year = fundFilterYearSelect.getValue();
if(year)
- fundListGrid.model.query = {year:year};
+ fundListGrid.query = {year:year};
else
- fundListGrid.model.query = {id:'*'};
- fundListGrid.model.refresh();
- fundListGrid.update();
+ fundListGrid.query = {id:'*'};
+ fundListGrid.update();
}
openils.Util.addOnLoad(loadFundGrid);
Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/list_providers.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/list_providers.js 2008-12-10 18:44:00 UTC (rev 11503)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/list_providers.js 2008-12-10 19:27:32 UTC (rev 11504)
@@ -1,8 +1,8 @@
dojo.require("dijit.Dialog");
dojo.require("dijit.form.FilteringSelect");
dojo.require('dijit.form.Button');
-dojo.require('dojox.grid.Grid');
-
+dojo.require('dojox.grid.DataGrid');
+dojo.require('dojo.data.ItemFileReadStore');
dojo.require('openils.acq.CurrencyType');
dojo.require('openils.Event');
dojo.require('openils.Util');
@@ -10,23 +10,23 @@
dojo.require("fieldmapper.OrgUtils");
dojo.require('openils.widget.OrgUnitFilteringSelect');
-function getOrgInfo(rowIndex) {
- data = providerListGrid.model.getRow(rowIndex);
- if(!data) return;
- return fieldmapper.aou.findOrgUnit(data.owner).shortname();
+function getOrgInfo(rowIndex, item) {
+ if(!item) return '';
+ var owner = this.grid.store.getValue(item, 'owner');
+ return fieldmapper.aou.findOrgUnit(owner).shortname();
}
function loadProviderGrid() {
openils.acq.Provider.createStore(
function(storeData) {
var store = new dojo.data.ItemFileReadStore({data:storeData});
- var model = new dojox.grid.data.DojoData(null, store,
- {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- providerListGrid.setModel(model);
- providerListGrid.update();
+
+ providerListGrid.setStore(store);
+ providerListGrid.render();
}
);
}
+
function createProvider(fields) {
openils.acq.Provider.create(fields, function(){loadProviderGrid()});
}
Modified: trunk/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2 2008-12-10 18:44:00 UTC (rev 11503)
+++ trunk/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2 2008-12-10 19:27:32 UTC (rev 11504)
@@ -35,13 +35,18 @@
</div>
<!-- The main grid lives here -->
-<script>
- var currencyTypeListGridStructure = [{
- cells : [[
- {name: 'Code', field:'code'},
- {name: 'Label', field:'label', width:'auto'}
- ]]
- }];
-</script>
-<div jsId='currencyTypeListGrid' dojoType="dojox.Grid" structure='currencyTypeListGridStructure'></div>
+</script>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+ <table jsId="currencyTypeListGrid" dojoType="dojox.grid.DataGrid" query="{code: '*'}" rowSelector='20px'>
+ <thead>
+ <tr>
+ <th field="code">Code</th>
+ <th field="label" width='auto'>Label</th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+</div>
+
[% END %]
Modified: trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 2008-12-10 18:44:00 UTC (rev 11503)
+++ trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 2008-12-10 19:27:32 UTC (rev 11504)
@@ -19,7 +19,7 @@
return;
} else {
location.href = /* go to the details page for this fund */
- '[% ctx.base_uri %]/acq/fund/view/'+fundId;
+ '[% ctx.base_uri %]/acq/fund/view/'+fundId;
}
}
);
@@ -53,7 +53,7 @@
<td><label for="currency_type">Currency Type: </label></td>
<td>
<input jsId='fundCurrencySelector' name="currency_type"
- dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
+ dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
</input>
</td>
</tr>
@@ -61,7 +61,7 @@
<td valign='top'><label for="org">Owning Location: </label></td>
<td>
<input dojoType="openils.widget.OrgUnitFilteringSelect" jsId='fundOwnerSelect'
- searchAttr="shortname" name="org" autocomplete="true" labelAttr='shortname'> </input>
+ searchAttr="shortname" name="org" autocomplete="true" labelAttr='shortname'> </input>
</td>
</tr>
<tr>
@@ -75,35 +75,40 @@
<button dojoType="dijit.form.Button"
onclick="openils.acq.Fund.deleteFromGrid(
- fundListGrid, function(){location.href = location.href})">
+ fundListGrid, function(){location.href = location.href})">
Delete Selected
</button>
<label>Year</label>
<select dojoType='dijit.form.FilteringSelect' onchange='filterGrid();' style='width:100px;'
- jsId='fundFilterYearSelect' labelAttr='year' searchAttr='year'> </select>
+ jsId='fundFilterYearSelect' labelAttr='year' searchAttr='year'> </select>
</div>
<!-- The main grid lives here -->
<script>
- function getName(rowIndex) {
- data = fundListGrid.model.getRow(rowIndex);
- if(!data) return;
- return '<a href="[% ctx.base_uri %]/acq/fund/view/'+data.id+'">'+data.name+'</a>';
+ function getName(rowIndex, item) {
+ if(!item) return;
+ var name = this.grid.store.getValue(item, 'name');
+ var id = this.grid.store.getValue(item, 'id');
+ return '<a href="[% ctx.base_uri %]/acq/fund/view/'+id+'">'+name+'</a>';
}
-
- var fundListGridStructure = [{
- cells : [[
- {name: 'ID', field: 'id'},
- {name: 'Name', width:'auto', get:getName},
- {name: 'Code', field:'code'},
- {name: 'Year', field: "year"},
- {name: 'Location', get:getOrgInfo},
- {name: 'Currency Type', field: "currency_type"},
- {name: 'Combined Balance', get:getBalanceInfo}
- ]]
- }];
-</script>
-<div jsId='fundListGrid' dojoType="dojox.Grid" structure='fundListGridStructure'></div>
+</script>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+ <table jsId="fundListGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+ <thead>
+ <tr>
+ <th field="id">ID</th>
+ <th field="name" width='auto' get='getName'>Name</th>
+ <th field="code">Code</th>
+ <th field="year">Year</th>
+ <th field="org" get='getOrgInfo'>Location</th>
+ <th field="currency_type">Currency Type</th>
+ <th field="combined_balance" get='getBalanceInfo'>Combined Balance</th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+</div>
[% END %]
Modified: trunk/Open-ILS/web/templates/default/acq/financial/list_providers.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/list_providers.tt2 2008-12-10 18:44:00 UTC (rev 11503)
+++ trunk/Open-ILS/web/templates/default/acq/financial/list_providers.tt2 2008-12-10 19:27:32 UTC (rev 11504)
@@ -28,7 +28,7 @@
<td><label for="currency_type">Currency Type:</label></td>
<td>
<input jsId='providerCurrencySelector' name="currency_type"
- dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
+ dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
</input>
</td>
</tr>
@@ -36,7 +36,7 @@
<td valign='top'><label for="owner">Owning Location:</label></td>
<td>
<input dojoType="openils.widget.OrgUnitFilteringSelect" jsId='providerOwnerSelect'
- searchAttr="shortname" name="owner" autocomplete="true" labelAttr='shortname'> </input>
+ searchAttr="shortname" name="owner" autocomplete="true" labelAttr='shortname'> </input>
</td>
</tr>
<tr>
@@ -54,22 +54,28 @@
<!-- The main grid lives here -->
<script>
- function getName(rowIndex) {
- data = providerListGrid.model.getRow(rowIndex);
- if(!data) return;
- return '<a href="[% ctx.base_uri %]/acq/provider/view/'+data.id+'">'+data.name+'</a>';
+ function getName(rowIndex, item) {
+ if(!item) return;
+ var name = this.grid.store.getValue(item, 'name');
+ var id = this.grid.store.getValue(item, 'id');
+ return '<a href="[% ctx.base_uri %]/acq/provider/view/'+id+'">'+name+'</a>';
}
+</script>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
+ <table jsId="providerListGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
+ <thead>
+ <tr>
+ <th field="id">ID</th>
+ <th field="name" width='auto' get='getName'>Name</th>
+ <th field="code">Code</th>
+ <th field="owner" get='getOrgInfo'>Owner</th>
+ <th field="currency_type">Currency Type</th>
+ </tr>
+ </thead>
+ </table>
+ </div>
+</div>
- var providerGridStructure = [{
- cells : [[
- {name: 'ID', field: 'id'},
- {name: 'Name', get:getName, width:'auto'},
- {name: 'Code', field:'code'},
- {name: 'Owner', get:getOrgInfo},
- {name: 'Currency Type', field: "currency_type"}
- ]]
- }];
-</script>
-<div jsId='providerListGrid' dojoType="dojox.Grid" structure='providerGridStructure'></div>
[% END %]
More information about the open-ils-commits
mailing list