[open-ils-commits] r9559 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
public/oils/media/ui_js/oils/default/acq/financial
templates/oils/default/acq/financial
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon May 12 16:14:17 EDT 2008
Author: erickson
Date: 2008-05-12 16:14:13 -0400 (Mon, 12 May 2008)
New Revision: 9559
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
Log:
moved fund js to external file
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_fund.js 2008-05-12 20:14:13 UTC (rev 9559)
@@ -0,0 +1,77 @@
+dojo.require("dijit.Dialog");
+dojo.require('dijit.layout.TabContainer');
+dojo.require('dijit.layout.ContentPane');
+dojo.require('dojox.grid.Grid');
+
+dojo.require("fieldmapper.OrgUtils");
+dojo.require('openils.acq.Fund');
+dojo.require('openils.acq.FundingSource');
+dojo.require('openils.Event');
+dojo.require('openils.User');
+
+var fund = null;
+
+function getSummaryInfo(rowIndex) {
+ switch(this.index) {
+ case 4: return new String(fund.summary().combined_balance);
+ case 5: return new String(fund.summary().allocation_total);
+ case 6: return new String(fund.summary().spent_balance);
+ case 7: return new String(fund.summary().debit_total);
+ case 8: return new String(fund.summary().spent_total);
+ case 9: return new String(fund.summary().encumberance_total);
+ }
+}
+
+function getOrgInfo(rowIndex) {
+ data = fundGrid.model.getRow(rowIndex);
+ if(!data) return;
+ return fieldmapper.aou.findOrgUnit(data.org).shortname();
+}
+
+
+function loadFundGrid() {
+ var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData([fund])});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ fundGrid.setModel(model);
+ fundGrid.update();
+}
+
+function loadAllocationGrid() {
+ if(fundAllocationGrid.isLoaded) return;
+ var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ fundAllocationGrid.setModel(model);
+ fundAllocationGrid.update();
+ fundAllocationGrid.isLoaded = true;
+}
+
+function loadDebitGrid() {
+ if(fundDebitGrid.isLoaded) return;
+ var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())});
+ var model = new dojox.grid.data.DojoData(
+ null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ fundDebitGrid.setModel(model);
+ fundDebitGrid.update();
+ fundDebitGrid.isLoaded = true;
+}
+
+function fetchFund() {
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.fund.retrieve'],
+ { async: true,
+ params: [
+ openils.User.authtoken, fundID,
+ {flesh_summary:1, flesh_allocations:1, flesh_debits:1}
+ /* TODO grab allocations and debits only on as-needed basis */
+ ],
+ oncomplete: function(r) {
+ fund = r.recv().content();
+ loadFundGrid(fund);
+ }
+ }
+ );
+}
+
+dojo.addOnLoad(fetchFund);
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html 2008-05-12 20:09:58 UTC (rev 9558)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html 2008-05-12 20:14:13 UTC (rev 9559)
@@ -4,37 +4,7 @@
<%def name="block_content()">
<script>
- dojo.require("dijit.Dialog");
- dojo.require('dijit.layout.TabContainer');
- dojo.require('dijit.layout.ContentPane');
- dojo.require('dojox.grid.Grid');
-
- dojo.require("fieldmapper.OrgUtils");
- dojo.require('openils.acq.Fund');
- dojo.require('openils.acq.FundingSource');
- dojo.require('openils.Event');
- dojo.require('openils.User');
-
var fundID = ${c.oils.acq.fund_id};
- var fund = null;
-
- function getSummaryInfo(rowIndex) {
- switch(this.index) {
- case 4: return new String(fund.summary().combined_balance);
- case 5: return new String(fund.summary().allocation_total);
- case 6: return new String(fund.summary().spent_balance);
- case 7: return new String(fund.summary().debit_total);
- case 8: return new String(fund.summary().spent_total);
- case 9: return new String(fund.summary().encumberance_total);
- }
- }
-
- function getOrgInfo(rowIndex) {
- data = fundGrid.model.getRow(rowIndex);
- if(!data) return;
- return fieldmapper.aou.findOrgUnit(data.org).shortname();
- }
-
function getFundingSource(rowIndex) {
data = fundAllocationGrid.model.getRow(rowIndex);
if(data) {
@@ -42,55 +12,11 @@
return '<a href="${c.oils.acq.prefix.value}/funding_source/view/'+fs.id()+'">'+fs.name()+'</a>';
}
}
+</script>
- function loadFundGrid() {
- var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData([fund])});
- var model = new dojox.grid.data.DojoData(
- null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- fundGrid.setModel(model);
- fundGrid.update();
- }
+<!-- load the page-specific JS -->
+<script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/financial/view_fund.js'> </script>
- function loadAllocationGrid() {
- if(fundAllocationGrid.isLoaded) return;
- var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())});
- var model = new dojox.grid.data.DojoData(
- null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- fundAllocationGrid.setModel(model);
- fundAllocationGrid.update();
- fundAllocationGrid.isLoaded = true;
- }
-
- function loadDebitGrid() {
- if(fundDebitGrid.isLoaded) return;
- var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())});
- var model = new dojox.grid.data.DojoData(
- null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- fundDebitGrid.setModel(model);
- fundDebitGrid.update();
- fundDebitGrid.isLoaded = true;
- }
-
- function fetchFund() {
- fieldmapper.standardRequest(
- ['open-ils.acq', 'open-ils.acq.fund.retrieve'],
- { async: true,
- params: [
- openils.User.authtoken, fundID,
- {flesh_summary:1, flesh_allocations:1, flesh_debits:1}
- /* TODO grab allocations and debits only on as-needed basis */
- ],
- oncomplete: function(r) {
- fund = r.recv().content();
- loadFundGrid(fund);
- }
- }
- );
- }
-
- dojo.addOnLoad(fetchFund);
-</script>
-
<div id='oils-acq-list-header' class='container'>
<div id='oils-acq-list-header-label'>${_('Fund Details')}</div>
</div>
More information about the open-ils-commits
mailing list