From: senator Date: Wed, 27 Oct 2010 14:52:36 +0000 (+0000) Subject: Acq: Make the distribution formula UI page like it was supposed to X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b4403754c1ca246b9707cca391e83c3643c328b8;p=contrib%2FConifer.git Acq: Make the distribution formula UI page like it was supposed to git-svn-id: svn://svn.open-ils.org/ILS/trunk@18489 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm index 34b61a68ac..8a4d2e77c3 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm @@ -456,13 +456,19 @@ __PACKAGE__->register_method( desc => 'Ranged distribution formulas, fleshed with entries', params => [ {desc => 'Authentication token', type => 'string'}, + {desc => "offset", type => "number"}, + {desc => "limit", type => "number"} ], return => {desc => 'List of distribution formulas'} } ); sub ranged_distrib_formulas { - my($self, $conn, $auth, $org) = @_; + my ($self, $conn, $auth, $offset, $limit) = @_; + + $offset ||= 0; + $limit ||= 10; + my $e = new_editor(authtoken=>$auth); return $e->event unless $e->checkauth; my $orgs = $U->user_has_work_perm_at($e, 'CREATE_PICKLIST', {descendants =>1}); @@ -472,9 +478,11 @@ sub ranged_distrib_formulas { { flesh => 1, flesh_fields => {acqdf => ['entries']}, - order_by => {acqdfe => ['position']} + order_by => {acqdf => "name"}, + limit => $limit, + offset => $offset } - ]); + ]) or return $e->die_event; for (@$forms) { 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 b992d26006..69e39323d1 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 @@ -8,12 +8,35 @@ dojo.requireLocalization('openils.conify', 'conify'); var localeStrings = dojo.i18n.getLocalization('openils.conify', 'conify'); -var formCache = []; +var formCache = {}; var formula, entryTbody, entryTemplate, dndSource; var virtualId = -1; var pcrud; +function gridDataLoader() { + fListGrid.resetStore(); + fListGrid.showLoadProgressIndicator(); + fieldmapper.standardRequest( + ["open-ils.acq", "open-ils.acq.distribution_formula.ranged.retrieve"], { + "async": true, + "params": [ + openils.User.authtoken, + fListGrid.displayOffset, + fListGrid.displayLimit + ], + "onresponse": function(r) { + var form = openils.Util.readResponse(r); + formCache[form.id()] = form; + fListGrid.store.newItem(form.toStoreItem()); + }, + "oncomplete": function() { + fListGrid.hideLoadProgressIndicator(); + } + } + ); +} + function draw() { pcrud = new openils.PermaCrud(); @@ -28,21 +51,8 @@ function draw() { 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()); - }, - oncomplete: function() { - fListGrid.hideLoadProgressIndicator(); - } - } - ); - + fListGrid.dataLoader = gridDataLoader; + gridDataLoader(); } }