[open-ils-commits] r10037 - 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 Jul 14 20:43:43 EDT 2008


Author: erickson
Date: 2008-07-14 20:43:42 -0400 (Mon, 14 Jul 2008)
New Revision: 10037

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html
Log:
added year filter

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js	2008-07-15 00:12:11 UTC (rev 10036)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/acq/financial/list_funds.js	2008-07-15 00:43:42 UTC (rev 10037)
@@ -8,8 +8,6 @@
 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;
@@ -31,9 +29,34 @@
                 {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
             fundListGrid.setModel(model);
             fundListGrid.update();
+
+            var yearStore = {identifier:'year', name:'year', items:[]};
+
+            var added = [];
+            for(var i = 0; i < storeData.items.length; i++) {
+                var year = storeData.items[i].year;
+                if(added.indexOf(year) == -1) {
+                    yearStore.items.push({year:year});
+                    added.push(year);
+                }
+            }
+            yearStore.items = yearStore.items.sort().reverse();
+            fundFilterYearSelect.store = new dojo.data.ItemFileReadStore({data:yearStore});
+            var today = new Date().getFullYear().toString();
+            fundFilterYearSelect.setValue((added.indexOf(today != -1)) ? today : added[0]);
         }
     );
 }
 
+function filterGrid() {
+    var year = fundFilterYearSelect.getValue();
+    if(year) 
+        fundListGrid.model.query = {year:year};
+    else
+        fundListGrid.model.query = {id:'*'};
+    fundListGrid.model.refresh();
+    fundListGrid.update();
+}
+
 dojo.addOnLoad(loadFundGrid);
 

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html	2008-07-15 00:12:11 UTC (rev 10036)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funds.html	2008-07-15 00:43:42 UTC (rev 10037)
@@ -36,7 +36,7 @@
         <div dojoType="dijit.TooltipDialog" execute="createFund(arguments[0]);">
             <script type='dojo/connect' event='onOpen'>
                 openils.acq.CurrencyType.loadSelectWidget(fundCurrencySelector);
-                globalUser.buildPermOrgSelector('ADMIN_FUND', fundOwnerSelect);
+                new openils.User().buildPermOrgSelector('ADMIN_FUND', fundOwnerSelect);
             </script>
 
             <table class='dijitTooltipTable'>
@@ -81,6 +81,10 @@
                 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>
 </div>
 
 <!-- The main grid lives here -->



More information about the open-ils-commits mailing list