From 78f40e4a371ef40a9eabeaccd023c9c08b7d5b81 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 11 May 2009 00:55:40 +0000 Subject: [PATCH] added some grid autoheight handling. small bug fixes on creation. other small cleanup git-svn-id: svn://svn.open-ils.org/ILS/trunk@13116 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../conify/global/acq/distribution_formula.js | 44 +++++++++------------- .../conify/global/acq/distribution_formula.tt2 | 11 ++++-- .../default/conify/global/acq/exchange_rate.tt2 | 4 +- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js b/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js index 61077af14d..eee01e4f02 100644 --- a/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js +++ b/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js @@ -3,40 +3,35 @@ dojo.require('dijit.form.FilteringSelect'); dojo.require('openils.PermaCrud'); var formula; var formCache = []; + function draw() { + if(formulaId) { openils.Util.hide('formula-list-div'); drawFormulaSummary(); } else { + openils.Util.hide('formula-entry-div'); fListGrid.onPostCreate = function(fmObject) { location.href = location.href + '/' + fmObject.id(); } - fieldmapper.standardRequest( - ['open-ils.acq', 'open-ils.acq.distribution_formula.ranged.retrieve'], - { async: true, - params: [openils.User.authtoken], - onresponse: function (r) { - var form = openils.Util.readResponse(r); - formCache[form.id()] = form; - fListGrid.store.newItem(form.toStoreItem()); - } - } - ); - + + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.distribution_formula.ranged.retrieve'], + { async: true, + params: [openils.User.authtoken], + onresponse: function (r) { + var form = openils.Util.readResponse(r); + formCache[form.id()] = form; + fListGrid.store.newItem(form.toStoreItem()); + } + } + ); + } } openils.Util.addOnLoad(draw); -/*function getFormulaId (rowIndex, item) { - if(!item) return ''; - var pcrud = new openils.PermaCrud; - var formulaName = pcrud.retrieve('acqdf', formulaId); - return formulaName.name(); - - -} -*/ function drawFormulaSummary() { openils.Util.show('formula-entry-div'); dfeListGrid.overrideEditWidgets.formula = new @@ -50,12 +45,9 @@ function drawFormulaSummary() { function getItemCount(rowIndex, item) { if(!item) return ''; var form = formCache[this.grid.store.getValue(item, "id")]; + if(!form) return 0; var count = 0; - dojo.forEach(form.entries(), - function(e) { - count = count + e.item_count(); - } - ); + dojo.forEach(form.entries(), function(e) { count = count + e.item_count(); }); return count; } diff --git a/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 b/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 index ae409405a1..a34fc1a0f0 100644 --- a/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 +++ b/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 @@ -5,7 +5,7 @@
-
+
Distribution Formulas
@@ -13,6 +13,7 @@
-
+
-
+
-
+
+
diff --git a/Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2 b/Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2 index e98ef07215..9a14771c4b 100644 --- a/Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2 +++ b/Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2 @@ -14,8 +14,9 @@
-
+
+
[% END %] -- 2.11.0