more external file JSing
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 May 2008 20:34:38 +0000 (20:34 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 May 2008 20:34:38 +0000 (20:34 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9562 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funding_sources.js [new file with mode: 0644]
Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js [new file with mode: 0644]
Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html
Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html

diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funding_sources.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funding_sources.js
new file mode 100644 (file)
index 0000000..24d1ece
--- /dev/null
@@ -0,0 +1,36 @@
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.FilteringSelect");
+dojo.require('openils.acq.FundingSource');
+dojo.require('openils.acq.CurrencyType');
+dojo.require('openils.widget.OrgUnitFilteringSelect');
+dojo.require('dijit.form.Button');
+dojo.require('dojox.grid.Grid');
+dojo.require('openils.Event');
+
+var globalUser = new openils.User();
+
+function getOrgInfo(rowIndex) {
+    data = fundingSourceListGrid.model.getRow(rowIndex);
+    if(!data) return;
+    return fieldmapper.aou.findOrgUnit(data.owner).shortname();
+}
+
+function getBalanceInfo(rowIndex) {
+    data = fundingSourceListGrid.model.getRow(rowIndex);
+    if(!data) return;
+    return new String(openils.acq.FundingSource.cache[data.id].summary().balance);
+}
+
+function loadFSGrid() {
+    openils.acq.FundingSource.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:'*'}});
+            fundingSourceListGrid.setModel(model);
+            fundingSourceListGrid.update();
+        }
+    );
+}
+
+dojo.addOnLoad(loadFSGrid);
diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js
new file mode 100644 (file)
index 0000000..0f059f9
--- /dev/null
@@ -0,0 +1,39 @@
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.FilteringSelect");
+dojo.require('dijit.form.Button');
+dojo.require('dojox.grid.Grid');
+
+dojo.require('openils.widget.OrgUnitFilteringSelect');
+dojo.require('openils.acq.CurrencyType');
+dojo.require('openils.Event');
+dojo.require('openils.acq.Fund');
+
+var globalUser = new openils.User();
+
+function getOrgInfo(rowIndex) {
+    data = fundListGrid.model.getRow(rowIndex);
+    if(!data) return;
+    return fieldmapper.aou.findOrgUnit(data.org).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 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();
+        }
+    );
+}
+
+dojo.addOnLoad(loadFundGrid);
+
index 79c2824..4aa5dd9 100644 (file)
@@ -7,21 +7,10 @@
     <div id='oils-acq-list-header-label'>${_('Funding Sources')}</div>
 </div>
 
-<script src='/oils/media/js/dojo/fieldmapper/OrgUtils.js'> </script>
-<script src='/oils/media/js/dojo/openils/widget/OrgUnitFilteringSelect.js'> </script>
+<!-- load the page-specific JS -->
+<script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/financial/list_funding_sources.js'> </script>
 
 <script type="text/javascript">
-    dojo.require("dijit.Dialog");
-    dojo.require("dijit.form.FilteringSelect");
-    dojo.require('openils.acq.FundingSource');
-    dojo.require('openils.acq.CurrencyType');
-    dojo.require('openils.widget.OrgUnitFilteringSelect');
-    dojo.require('dijit.form.Button');
-    dojo.require('dojox.grid.Grid');
-    dojo.require('openils.Event');
-
-    var globalUser = new openils.User();
-
     function createFS(fields) {
         /** Creates a new funding source */
         openils.acq.FundingSource.create(
 </div>
 
 <!-- The main grid lives here -->
-<div id="oils-acq-funding-source-list-grid" jsId='fundingSourceListGrid' dojoType="dojox.Grid"></div>
-
 <script>
-
-    function loadFSGrid() {
-        globalUser.getBySession();
-
-        /** define how the primary grid is rendered */
-
-        function getOrgInfo(rowIndex) {
-            data = fundingSourceListGrid.model.getRow(rowIndex);
-            if(!data) return;
-            return fieldmapper.aou.findOrgUnit(data.owner).shortname();
-        }
-
-        function getBalanceInfo(rowIndex) {
-            data = fundingSourceListGrid.model.getRow(rowIndex);
-            if(!data) return;
-            return new String(openils.acq.FundingSource.cache[data.id].summary().balance);
-        }
-
-        function getName(rowIndex) {
-            data = fundingSourceListGrid.model.getRow(rowIndex);
-            if(!data) return;
-            return '<a href="${c.oils.acq.prefix.value}/funding_source/view/'+data.id+'">'+data.name+'</a>';
-        }
-    
-        var gridStructure = [{
-            cells : [[
-                {name: '${_("ID")}', field: 'id'},
-                {name: '${_("Name")}', width:'auto', get:getName}, 
-                {name: '${_("Owner")}', width:'auto', get:getOrgInfo}, 
-                {name: '${_("Currency Type")}', field: "currency_type"},
-                {name: '${_("Balance")}', get:getBalanceInfo}
-            ]]
-        }];
-
-        openils.acq.FundingSource.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:'*'}});
-                fundingSourceListGrid.setStructure(gridStructure);
-                fundingSourceListGrid.setModel(model);
-                fundingSourceListGrid.update();
-            }
-        );
+    function getName(rowIndex) {
+        data = fundingSourceListGrid.model.getRow(rowIndex);
+        if(!data) return;
+        return '<a href="${c.oils.acq.prefix.value}/funding_source/view/'+data.id+'">'+data.name+'</a>';
     }
 
-    dojo.addOnLoad(loadFSGrid);
+    var fsGridStructure = [{
+        cells : [[
+            {name: '${_("ID")}', field: 'id'},
+            {name: '${_("Name")}', width:'auto', get:getName}, 
+            {name: '${_("Owner")}', width:'auto', get:getOrgInfo}, 
+            {name: '${_("Currency Type")}', field: "currency_type"},
+            {name: '${_("Balance")}', get:getBalanceInfo}
+        ]]
+    }];
 </script>
-
+<div id="oils-acq-funding-source-list-grid" jsId='fundingSourceListGrid' dojoType="dojox.Grid" structure='fsGridStructure'></div>
 </%def>
index ca52199..94879be 100644 (file)
@@ -7,19 +7,10 @@
     <div id='oils-acq-list-header-label'>${_('Funds')}</div>
 </div>
 
-<script type="text/javascript">
-    dojo.require("dijit.Dialog");
-    dojo.require("dijit.form.FilteringSelect");
-    dojo.require('dijit.form.Button');
-    dojo.require('dojox.grid.Grid');
-
-    dojo.require('openils.widget.OrgUnitFilteringSelect');
-    dojo.require('openils.acq.CurrencyType');
-    dojo.require('openils.Event');
-    dojo.require('openils.acq.Fund');
-
-    var globalUser = new openils.User();
+<!-- load the page-specific JS -->
+<script src='${c.oils.core.media_prefix.value}/ui_js/oils/default/acq/financial/list_funds.js'> </script>
 
+<script type="text/javascript">
     function createFund(fields) {
         /** Creates a new fund source */
         openils.acq.Fund.create(
 </div>
 
 <!-- The main grid lives here -->
-<div jsId='fundListGrid' dojoType="dojox.Grid"></div>
-
 <script>
-
-    function loadFundGrid() {
-        globalUser.getBySession();
-
-        /** define how the primary grid is rendered */
-
-        function getOrgInfo(rowIndex) {
-            data = fundListGrid.model.getRow(rowIndex);
-            if(!data) return;
-            return fieldmapper.aou.findOrgUnit(data.org).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 getName(rowIndex) {
-            data = fundListGrid.model.getRow(rowIndex);
-            if(!data) return;
-            return '<a href="${c.oils.acq.prefix.value}/fund/view/'+data.id+'">'+data.name+'</a>';
-        }
-    
-        var gridStructure = [{
-            cells : [[
-                {name: '${_("ID")}', field: 'id'},
-                {name: '${_("Name")}', width:'auto', get:getName}, 
-                {name: '${_("Year")}', field: "year"}, 
-                {name: '${_("Location")}', get:getOrgInfo}, 
-                {name: '${_("Currency Type")}', field: "currency_type"},
-                {name: '${_("Combined Balance")}', get:getBalanceInfo}
-            ]]
-        }];
-
-        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.setStructure(gridStructure);
-                fundListGrid.setModel(model);
-                fundListGrid.update();
-            }
-        );
+    function getName(rowIndex) {
+        data = fundListGrid.model.getRow(rowIndex);
+        if(!data) return;
+        return '<a href="${c.oils.acq.prefix.value}/fund/view/'+data.id+'">'+data.name+'</a>';
     }
 
-    dojo.addOnLoad(loadFundGrid);
+    var fundListGridStructure = [{
+        cells : [[
+            {name: '${_("ID")}', field: 'id'},
+            {name: '${_("Name")}', width:'auto', get:getName}, 
+            {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>
 
 </%def>