From dee6b60d1ba4c467ba7b7926fb0a1ed62bfc1ed4 Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 12 Mar 2010 10:46:33 +0000 Subject: [PATCH] some actions on user request list, and toward a user request detail page git-svn-id: svn://svn.open-ils.org/ILS/trunk@15824 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/ui/default/acq/picklist/user_request.js | 85 +++++++++++++++++++++- .../default/acq/picklist/user_request.tt2 | 84 ++++++++++++--------- 2 files changed, 134 insertions(+), 35 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/picklist/user_request.js b/Open-ILS/web/js/ui/default/acq/picklist/user_request.js index 052e42bac7..2459152fd4 100644 --- a/Open-ILS/web/js/ui/default/acq/picklist/user_request.js +++ b/Open-ILS/web/js/ui/default/acq/picklist/user_request.js @@ -3,6 +3,9 @@ dojo.require('openils.User'); dojo.require('openils.widget.AutoGrid'); dojo.require('fieldmapper.OrgUtils'); dojo.require('openils.widget.OrgUnitFilteringSelect'); +dojo.require('openils.widget.EditPane'); +dojo.require("dijit.layout.StackContainer"); +dojo.require('openils.PermaCrud'); var contextOrg; @@ -12,16 +15,47 @@ function setup() { drawRequest(); } else { drawList(); + rGrid.cancelSelected = function() { doSelected('open-ils.acq.user_request.cancel.batch') }; + rGrid.setNoHoldSelected = function() { doSelected('open-ils.acq.user_request.set_no_hold.batch') }; } } function drawRequest() { + var pcrud = new openils.PermaCrud({ authtoken : openils.User.authtoken }); + var aur_obj = pcrud.retrieve('aur',reqId); + // hide the grid and the context selector + dijit.byId('stackContainer').forward(); + // draw a detail page for a particular request + var div = document.getElementById('detail_content_pane'); + while (div.lastChild) { div.removeChild( div.lastChild ); } + var pane = new openils.widget.EditPane({ + fmObject : aur_obj, + readOnly : true + }); + pane.domNode = div; + pane.hideActionButtons = true; + pane.startup(); + // including ability to add request to a picklist // and to "reject" it (aka apply a cancel reason) } +function addToPicklist() { + // reqId + alert('stub'); +} + +function setNoHold() { + // reqId + alert('stub'); +} + +function cancelRequest() { + // reqId + alert('stub'); +} // format the title data as id:title function getTitle(idx, item) { @@ -29,7 +63,7 @@ function getTitle(idx, item) { return this.grid.store.getValue(item, 'id') + ':' + this.grid.store.getValue(item, 'title'); } - return '' + return ''; } // turn id:title into a url @@ -77,6 +111,55 @@ function buildGrid() { ); } +function doSelected(method) { + try { + var ids = []; + dojo.forEach( + rGrid.getSelectedItems(), + function(item) { + ids.push( rGrid.store.getValue(item,'id') ); + } + ); + fieldmapper.standardRequest( + [ 'open-ils.acq', method ], + { async: true, + params: [openils.User.authtoken, ids], + onresponse: function(r) { + try { + var result = openils.Util.readResponse(r); + if (typeof result.ilsevent != 'undefined') { throw(result); } + } catch(E) { + //dump('Error in acq/events.js, doSelected(), onresponse(): ' + E); + throw(E); + } + }, + onerror: function(r) { + try { + var result = openils.Util.readResponse(r); + throw(result); + } catch(E) { + //dump('Error in acq/events.js, doSelected(), onerror(): ' + E); + throw(E); + } + }, + oncomplete: function(r) { + try { + var result = openils.Util.readResponse(r); + rGrid.resetStore(); + buildGrid(); + } catch(E) { + //dump('Error in acq/events.js, doSelected(), oncomplete(): ' + E); + throw(E); + } + } + } + ); + } catch(E) { + //dump('Error in acq/events.js, doSelected(): ' + E); + throw(E); + } +} + openils.Util.addOnLoad(setup); diff --git a/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 b/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 index 6fe8cbe378..0917e8c922 100644 --- a/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 +++ b/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 @@ -3,40 +3,56 @@ -
-
-
[% ctx.page_title %]
-
- +
+
+
+
[% ctx.page_title %]
+
+ + +
+
+
+ Context Org Unit + +
+ + + + + +
+
+
+
+
+
Patron Request
+
+ + + + +
+
+
-
- Context Org Unit - -
- - - - - -
-
-
[% END %] -- 2.11.0