From dc9e355f669f7f7d889fa10ff71c691b44b0c927 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 6 Apr 2009 13:06:54 +0000 Subject: [PATCH] more autogridding git-svn-id: svn://svn.open-ils.org/ILS/trunk@12794 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../default/acq/financial/list_funding_sources.js | 9 +- .../web/js/ui/default/acq/financial/list_funds.js | 15 +-- .../conify/global/config/standing_penalty.js | 110 ++----------------- .../default/conify/global/config/z3950_source.js | 41 +------ .../default/acq/financial/list_funding_sources.tt2 | 120 ++++++--------------- .../templates/default/acq/financial/list_funds.tt2 | 110 ++++++------------- .../conify/global/config/standing_penalty.tt2 | 61 ++++------- .../default/conify/global/config/z3950_source.tt2 | 78 +++----------- 8 files changed, 115 insertions(+), 429 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js b/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js index ae76f21df9..8d095764be 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js +++ b/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js @@ -8,6 +8,7 @@ dojo.require('dojo.data.ItemFileWriteStore'); dojo.require('dojox.grid.DataGrid'); dojo.require('openils.Event'); dojo.require('openils.Util'); +dojo.require('openils.widget.AutoGrid'); function getOrgInfo(rowIndex, item) { if(!item) return ''; @@ -23,18 +24,14 @@ function getBalanceInfo(rowIndex, item) { } function loadFSGrid() { - var store = new dojo.data.ItemFileWriteStore({data:acqfs.initStoreData()}); - fundingSourceListGrid.setStore(store); - fundingSourceListGrid.render(); - fieldmapper.standardRequest( ['open-ils.acq', 'open-ils.acq.funding_source.org.retrieve'], { async: true, params: [openils.User.authtoken, null, {flesh_summary:1}], - onresponse : function(r) { /* request object */ + onresponse : function(r) { /* request object*/ if(fs = openils.Util.readResponse(r)) { openils.acq.FundingSource.cache[fs.id()] = fs; - store.newItem(acqfs.toStoreItem(fs)); + fsGrid.store.newItem(acqfs.toStoreItem(fs)); } } } diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js index 5245ae4f01..11bb2ba84c 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js +++ b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js @@ -8,6 +8,7 @@ dojo.require('openils.acq.CurrencyType'); dojo.require('openils.Event'); dojo.require('openils.Util'); dojo.require('openils.acq.Fund'); +dojo.require('openils.widget.AutoGrid'); function getOrgInfo(rowIndex, item) { @@ -24,9 +25,6 @@ function getBalanceInfo(rowIndex, item) { } function loadFundGrid() { - var store = new dojo.data.ItemFileWriteStore({data:acqf.initStoreData()}); - fundListGrid.setStore(store); - fundListGrid.render(); var yearStore = {identifier:'year', name:'year', items:[]}; var yearsAdded = {}; /* don't duplicate the years in the selector */ @@ -37,7 +35,7 @@ function loadFundGrid() { onresponse : function(r) { if(lf = openils.Util.readResponse(r)) { openils.acq.Fund.cache[lf.id()] = lf; - store.newItem(acqf.toStoreItem(lf)); + lfGrid.store.newItem(acqf.toStoreItem(lf)); var year = lf.year(); if(!(year in yearsAdded)) { yearStore.items.push({year:year}); @@ -58,12 +56,15 @@ function loadFundGrid() { } function filterGrid() { + console.log('filtergrid called'); var year = fundFilterYearSelect.getValue(); + console.log(year); if(year) - fundListGrid.query = {year:year}; + lfGrid.setQuery({year:year}); else - fundListGrid.query = {id:'*'}; - fundListGrid.update(); + lfGrid.setQuery({id:'*'}); + + lfGrid.update(); } openils.Util.addOnLoad(loadFundGrid); diff --git a/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js b/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js index d51417a5e8..172bb09b64 100644 --- a/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js +++ b/Open-ILS/web/js/ui/default/conify/global/config/standing_penalty.js @@ -3,85 +3,18 @@ dojo.require('dojo.data.ItemFileWriteStore'); dojo.require('dojox.form.CheckedMultiSelect'); dojo.require('dijit.form.TextBox'); dojo.require('dojox.grid.cells.dijit'); +dojo.require('openils.widget.AutoGrid'); var spCache = {}; function spBuildGrid() { - var store = new dojo.data.ItemFileWriteStore({data:csp.initStoreData()}); - spGrid.setStore(store); - spGrid.render(); - dojo.connect(store, 'onSet', spGridChanged); - - fieldmapper.standardRequest( - ['open-ils.pcrud', 'open-ils.pcrud.search.csp'], - { async: true, - params: [openils.User.authtoken, {id:{'!=':null}}, {order_by:{csp:'id'}}], - onresponse: function(r) { - if(sp = openils.Util.readResponse(r)) - store.newItem(csp.toStoreItem(sp)); - spCache[sp.id()] = sp; - } - } - ); -} - -function spCreate(args) { - if(!(args.name && args.label)) return; - - var penalty = new csp(); - penalty.name(args.name); - penalty.label(args.label); - penalty.block_list(args.block_list); - - fieldmapper.standardRequest( - ['open-ils.permacrud', 'open-ils.permacrud.create.csp'], - { async: true, - params: [openils.User.authtoken, penalty], - oncomplete: function(r) { - if(obj = openils.Util.readResponse(r)) - spGrid.store.newItem(csp.toStoreItem(obj)); - } - } - ); -} -function spGridChanged(item, attr, oldVal, newVal) { - var sp = spCache[spGrid.store.getValue(item, 'id')]; - console.log("changing cm " + sp.id() + " object: " + attr + " = " + newVal); - sp[attr](newVal); - sp.ischanged(true); - spSaveButton.setDisabled(false); -} -function saveChanges() { - spGrid.doclick(0); - var changedObjects = []; - for(var i in spCache){ - var sp = spCache[i]; - if(sp.ischanged()) - changedObjects.push(sp); - } - _saveChanges(changedObjects, 0); -} -function _saveChanges(changedObjects, idx) { - - if(idx >= changedObjects.length) { - // we've made it through the list - spSaveButton.setDisabled(true); - return; + spGrid.disableWidgetTest = function(field, obj) { + if(field == 'name') return true; + if(obj.id() > 100) return false; + return false; } - - var item = changedObjects[idx]; - - fieldmapper.standardRequest( - ['open-ils.permacrud', 'open-ils.permacrud.update.csp'], - { async: true, - params: [openils.User.authtoken, item], - oncomplete: function(r) { - if(stat = openils.Util.readResponse(r)) { - _saveChanges(changedObjects, ++idx); - } - } - } - ); + spGrid.loadAll({order_by:{csp : 'name'}}); + } function formatId(inDatum) { @@ -91,35 +24,6 @@ function formatId(inDatum) { return inDatum; } -function deleteFromGrid() { - _deleteFromGrid(spGrid.selection.getSelected(), 0); -} - -function _deleteFromGrid(list, idx) { - if(idx >= list.length) // we've made it through the list - return; - - var item = list[idx]; - var id = spGrid.store.getValue(item, 'id'); - - if(id < 100) { // don't delete system penalties - _deleteFromGrid(list, ++idx); - return; - } - - fieldmapper.standardRequest( - ['open-ils.permacrud', 'open-ils.permacrud.delete.csp'], - { async: true, - params: [openils.User.authtoken, id], - oncomplete: function(r) { - if(obj = openils.Util.readResponse(r)) { - spGrid.store.deleteItem(item); - } - _deleteFromGrid(list, ++idx); - } - } - ); -} openils.Util.addOnLoad(spBuildGrid); diff --git a/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js b/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js index 79622f0f70..ff2de109a0 100644 --- a/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js +++ b/Open-ILS/web/js/ui/default/conify/global/config/z3950_source.js @@ -4,48 +4,11 @@ dojo.require('dijit.form.NumberTextBox'); dojo.require('dijit.form.CheckBox'); dojo.require('fieldmapper.OrgUtils'); dojo.require('openils.widget.OrgUnitFilteringSelect'); - +dojo.require('openils.widget.AutoGrid'); var zsList; function buildZSGrid() { - fieldmapper.standardRequest( - ['open-ils.pcrud', 'open-ils.pcrud.search.czs.atomic'], - { async: true, - params: [openils.User.authtoken, {name:{'!=':null}}], - oncomplete: function(r) { - if(zsList = openils.Util.readResponse(r)) { - var store = new dojo.data.ItemFileReadStore( - {data:czs.toStoreData(zsList, 'name',{identifier:'name'})}); - zsGrid.setStore(store); - zsGrid.render(); - } - } - } - ); -} - -function zsCreate(args) { - return alert(js2JSON(args)); - if(!args.name || args.owner == null) - return; - if(args.default_price == '' || isNaN(args.default_price)) - args.default_price = null; - - var zsype = new czs(); - zsype.name(args.name); - zsype.owner(args.owner); - zsype.default_price(args.default_price); - - fieldmapper.standardRequest( - ['open-ils.permacrud', 'open-ils.permacrud.create.czs'], - { async: true, - params: [openils.User.authtoken, zsype], - oncomplete: function(r) { - if(new String(openils.Util.readResponse(r)) != '0') - buildBTGrid(); - } - } - ); + zsGrid.loadAll({order_by:{czs : 'name'}}); } openils.Util.addOnLoad(buildZSGrid); diff --git a/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2 b/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2 index 5df3cf17ed..63bb10af39 100644 --- a/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/list_funding_sources.tt2 @@ -1,104 +1,44 @@ [% WRAPPER 'default/base.tt2' %] -
-
Funding Sources
-
- - -
-
- New Funding Source - -
- - - - - - - - - - - - - - - - - - - - - - -
- - -
- -
- -
-
-
- - -
- -
-
- - - - - - - - - - - -
IDNameOwnerCodeCurrency TypeBalance
-
-
- + +
+
+
Funding Sources
+
+ +
+
+ + + + + + +
+ + +
+
+ + + + [% END %] diff --git a/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 b/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 index f4834b4509..31cb284db2 100644 --- a/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 @@ -1,9 +1,5 @@ [% WRAPPER 'default/base.tt2' %] -
-
Funds
-
- @@ -26,65 +22,7 @@ } -
-
- New Fund - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- -
- -
-
-
- - - - - -
- - + -
-
- - - - - - - - - - - - -
IDNameCodeYearLocationCurrency TypeCombined Balance
-
-
+ +
+
+
Funding Types
+
+ +
+
+ + + + + + + + +
+
+
+ + + [% END %] diff --git a/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2 b/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2 index 22d6332e3f..83dcfdd08d 100644 --- a/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2 +++ b/Open-ILS/web/templates/default/conify/global/config/standing_penalty.tt2 @@ -6,6 +6,7 @@

Standing Penalty Types


+
+
+
Standing Penalty Types
+
+ +
+
-
- New Standing Penalty -
- - - - - - - - - - - - - - - - -
-
- -
-
-
- - - -
-
- +
- - - - + + -
IDNameLabelBlock List
+
- [% END %] diff --git a/Open-ILS/web/templates/default/conify/global/config/z3950_source.tt2 b/Open-ILS/web/templates/default/conify/global/config/z3950_source.tt2 index 343ef621c8..8cd3ff3ed1 100644 --- a/Open-ILS/web/templates/default/conify/global/config/z3950_source.tt2 +++ b/Open-ILS/web/templates/default/conify/global/config/z3950_source.tt2 @@ -1,69 +1,23 @@ [% WRAPPER default/base.tt2 %] -

Z39.50 Servers


-
- Z39.50 Servers -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
+
-
-
- - - - - - - - - - - - - -
NameLabelHostPortDatabaseRecord FormatTransmission FormatRequires Authentication
-
+
+
Z39.50 Servers
+
+ +
+
+ + +
[% END %] -- 2.11.0