[open-ils-commits] r9558 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
public/oils/media public/oils/media/ui_js
public/oils/media/ui_js/oils public/oils/media/ui_js/oils/default
public/oils/media/ui_js/oils/default/acq
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:10:01 EDT 2008
Author: erickson
Date: 2008-05-12 16:09:58 -0400 (Mon, 12 May 2008)
New Revision: 9558
Added:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_funding_source.js
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html
Log:
added the UI js directory for page-specific javascript.
created the view_funding_source Js page and moved JS over
Added: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_funding_source.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_funding_source.js (rev 0)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/view_funding_source.js 2008-05-12 20:09:58 UTC (rev 9558)
@@ -0,0 +1,103 @@
+dojo.require("dijit.Dialog");
+dojo.require('dijit.layout.TabContainer');
+dojo.require('dijit.layout.ContentPane');
+dojo.require("dijit.form.FilteringSelect");
+dojo.require("dijit.form.Textarea");
+dojo.require("dijit.form.CurrencyTextBox");
+dojo.require('dojox.grid.Grid');
+
+dojo.require("fieldmapper.OrgUtils");
+dojo.require('openils.acq.FundingSource');
+dojo.require('openils.acq.Fund');
+dojo.require('openils.Event');
+
+var ses = new OpenSRF.ClientSession('open-ils.acq');
+var fundingSource = null;
+
+function resetPage() {
+ fundingSource = null;
+ fsCreditGrid.isLoaded = false;
+ fsAllocationGrid.isLoaded = false;
+ loadFS();
+}
+
+/** creates a new funding_source_credit from the dialog ----- */
+function applyFSCredit(fields) {
+ fields.funding_source = fundingSourceID;
+ openils.acq.FundingSource.createCredit(fields, resetPage);
+}
+
+function applyFSAllocation(fields) {
+ fields.funding_source = fundingSourceID;
+ if(isNaN(fields.percent)) fields.percent = null;
+ if(isNaN(fields.amount)) fields.amount = null;
+ openils.acq.Fund.createAllocation(fields, resetPage);
+}
+
+/** fetch the fleshed funding source ----- */
+function loadFS() {
+ var req = ses.request(
+ 'open-ils.acq.funding_source.retrieve',
+ openils.User.authtoken, fundingSourceID,
+ {flesh_summary:1, flesh_credits:1,flesh_allocations:1}
+ );
+
+ req.oncomplete = function(r) {
+ var msg = req.recv();
+ fundingSource = msg.content();
+ var evt = openils.Event.parse(fundingSource);
+ if(evt) {
+ alert(evt);
+ return;
+ }
+ loadFSGrid();
+ }
+ req.send();
+}
+
+/** Some grid rendering accessor functions ----- */
+function getOrgInfo(rowIndex) {
+ data = fundingSourceGrid.model.getRow(rowIndex);
+ if(!data) return;
+ return fieldmapper.aou.findOrgUnit(data.owner).shortname();
+}
+
+function getSummaryInfo(rowIndex) {
+ switch(this.index) {
+ case 2: return new String(fundingSource.summary().balance);
+ case 3: return new String(fundingSource.summary().credit_total);
+ case 4: return new String(fundingSource.summary().allocation_total);
+ }
+}
+
+/** builds the credits grid ----- */
+function loadFSGrid() {
+ if(!fundingSource) return;
+ var store = new dojo.data.ItemFileReadStore({data:acqfs.toStoreData([fundingSource])});
+ var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ fundingSourceGrid.setModel(model);
+ fundingSourceGrid.update();
+}
+
+
+/** builds the credits grid ----- */
+function loadCreditGrid() {
+ if(fsCreditGrid.isLoaded) return;
+ var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.credits())});
+ var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ fsCreditGrid.setModel(model);
+ fsCreditGrid.update();
+ fsCreditGrid.isLoaded = true;
+}
+
+/** builds the allocations grid ----- */
+function loadAllocationGrid() {
+ if(fsAllocationGrid.isLoaded) return;
+ var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.allocations())});
+ var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+ fsAllocationGrid.setModel(model);
+ fsAllocationGrid.update();
+ fsAllocationGrid.isLoaded = true;
+}
+
+dojo.addOnLoad(loadFS);
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html 2008-05-12 20:03:17 UTC (rev 9557)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html 2008-05-12 20:09:58 UTC (rev 9558)
@@ -5,79 +5,7 @@
<%def name="block_content()">
<script>
- dojo.require("dijit.Dialog");
- dojo.require('dijit.layout.TabContainer');
- dojo.require('dijit.layout.ContentPane');
- dojo.require("dijit.form.FilteringSelect");
- dojo.require("dijit.form.Textarea");
- dojo.require("dijit.form.CurrencyTextBox");
- dojo.require('dojox.grid.Grid');
-
- dojo.require("fieldmapper.OrgUtils");
- dojo.require('openils.acq.FundingSource');
- dojo.require('openils.acq.Fund');
- dojo.require('openils.Event');
-
- var ses = new OpenSRF.ClientSession('open-ils.acq');
var fundingSourceID = ${c.oils.acq.funding_source_id};
- var fundingSource = null;
-
- function resetPage() {
- fundingSource = null;
- fsCreditGrid.isLoaded = false;
- fsAllocationGrid.isLoaded = false;
- loadFS();
- }
-
- /** creates a new funding_source_credit from the dialog ----- */
- function applyFSCredit(fields) {
- fields.funding_source = fundingSourceID;
- openils.acq.FundingSource.createCredit(fields, resetPage);
- }
-
- function applyFSAllocation(fields) {
- fields.funding_source = fundingSourceID;
- if(isNaN(fields.percent)) fields.percent = null;
- if(isNaN(fields.amount)) fields.amount = null;
- openils.acq.Fund.createAllocation(fields, resetPage);
- }
-
- /** fetch the fleshed funding source ----- */
- function loadFS() {
- var req = ses.request(
- 'open-ils.acq.funding_source.retrieve',
- openils.User.authtoken, fundingSourceID,
- {flesh_summary:1, flesh_credits:1,flesh_allocations:1}
- );
-
- req.oncomplete = function(r) {
- var msg = req.recv();
- fundingSource = msg.content();
- var evt = openils.Event.parse(fundingSource);
- if(evt) {
- alert(evt);
- return;
- }
- loadFSGrid();
- }
- req.send();
- }
-
- /** Some grid rendering accessor functions ----- */
- function getOrgInfo(rowIndex) {
- data = fundingSourceGrid.model.getRow(rowIndex);
- if(!data) return;
- return fieldmapper.aou.findOrgUnit(data.owner).shortname();
- }
-
- function getSummaryInfo(rowIndex) {
- switch(this.index) {
- case 2: return new String(fundingSource.summary().balance);
- case 3: return new String(fundingSource.summary().credit_total);
- case 4: return new String(fundingSource.summary().allocation_total);
- }
- }
-
function getFund(rowIndex) {
data = fsAllocationGrid.model.getRow(rowIndex);
if(data) {
@@ -85,42 +13,11 @@
return '<a href="${c.oils.acq.prefix.value}/fund/view/'+fund.id()+'">'+fund.name()+'</a>';
}
}
-
- /** builds the credits grid ----- */
- function loadFSGrid() {
- if(!fundingSource) return;
- var store = new dojo.data.ItemFileReadStore({data:acqfs.toStoreData([fundingSource])});
- var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- fundingSourceGrid.setModel(model);
- fundingSourceGrid.update();
- }
-
-
- /** builds the credits grid ----- */
- function loadCreditGrid() {
- if(fsCreditGrid.isLoaded) return;
- var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.credits())});
- var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- fsCreditGrid.setModel(model);
- fsCreditGrid.update();
- fsCreditGrid.isLoaded = true;
- }
-
- /** builds the allocations grid ----- */
- function loadAllocationGrid() {
- if(fsAllocationGrid.isLoaded) return;
- var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.allocations())});
- var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
- fsAllocationGrid.setModel(model);
- fsAllocationGrid.update();
- fsAllocationGrid.isLoaded = true;
- }
-
- dojo.addOnLoad(loadFS);
</script>
+<!-- load the page-specific JS -->
+<script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/financial/view_funding_source.js'> </script>
-
<div id='oils-acq-list-header' class='container'>
<div id='oils-acq-list-header-label'>${_('Funding Source Details')}</div>
</div>
More information about the open-ils-commits
mailing list