[open-ils-commits] r15824 - in trunk/Open-ILS/web: js/ui/default/acq/picklist templates/default/acq/picklist (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 12 05:46:39 EST 2010
Author: phasefx
Date: 2010-03-12 05:46:33 -0500 (Fri, 12 Mar 2010)
New Revision: 15824
Modified:
trunk/Open-ILS/web/js/ui/default/acq/picklist/user_request.js
trunk/Open-ILS/web/templates/default/acq/picklist/user_request.tt2
Log:
some actions on user request list, and toward a user request detail page
Modified: trunk/Open-ILS/web/js/ui/default/acq/picklist/user_request.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/picklist/user_request.js 2010-03-12 10:45:58 UTC (rev 15823)
+++ trunk/Open-ILS/web/js/ui/default/acq/picklist/user_request.js 2010-03-12 10:46:33 UTC (rev 15824)
@@ -3,6 +3,9 @@
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,24 +15,55 @@
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) {
if(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 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);
Modified: trunk/Open-ILS/web/templates/default/acq/picklist/user_request.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 2010-03-12 10:45:58 UTC (rev 15823)
+++ trunk/Open-ILS/web/templates/default/acq/picklist/user_request.tt2 2010-03-12 10:46:33 UTC (rev 15824)
@@ -3,40 +3,56 @@
<script src='[% ctx.media_prefix %]/js/ui/default/acq/picklist/user_request.js'> </script>
<script>var reqId = '[% ctx.page_args.0 %]';</script>
-<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
- <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
- <div>[% ctx.page_title %]</div>
- <div>
- <!-- TODO: add reject-selection operation -->
+ <div dojoType="dijit.layout.StackContainer" id="stackContainer" doLayout="false">
+ <div dojoType="dijit.layout.ContentPane">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>[% ctx.page_title %]</div>
+ <div>
+ <button dojoType="dijit.form.Button" onClick="rGrid.setNoHoldSelected()">Set No Hold on Selected</button>
+ <button dojoType="dijit.form.Button" onClick="rGrid.cancelSelected()">Cancel Selected</button>
+ </div>
+ </div>
+ <div>
+ <span>Context Org Unit</span>
+ <select
+ dojoType="openils.widget.OrgUnitFilteringSelect"
+ jsId='contextOrgSelector'
+ searchAttr='shortname'
+ labelAttr='shortname'>
+ </select>
+ </div>
+ <table jsId="rGrid"
+ dojoType="openils.widget.AutoGrid"
+ query="{id: '*'}"
+ suppressFields='["id", "usr", "pickup_lib", "holdable_formats", "phone_notify", "email_notify", "lineitem", "eg_bib", "max_fee", "cancel_reason"]'
+ fieldOrder='["title", "author", "isxn", "article_title", "article_pages", "request_type", "volume", "pubdate", "publisher", "location", "other_info", "mentioned"]'
+ fmClass='aur'
+ editStyle='pane'
+ autoHeight='true'
+ autoWidth='true'
+ suppressFields="['id']"
+ showPaginator='true'
+ showColumnPicker='true'
+ columnPickerPrefix='"acq.picklist.user_request"'
+ editOnEnter='true'>
+ <thead>
+ <tr>
+ <th field='title' get='getTitle' formatter='formatTitle'/>
+ </tr>
+ </thead>
+ </table>
</div>
+ <div dojoType="dijit.layout.ContentPane" style="height: 100%;">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>Patron Request</div>
+ <div>
+ <button dojoType="dijit.form.Button" onClick="location.href=oilsBasePath+'/acq/picklist/user_request'">[% ctx.page_title %]</button>
+ <button dojoType="dijit.form.Button" onClick="addToPicklist()">Add to Picklist</button>
+ <button dojoType="dijit.form.Button" onClick="setNoHold()">Set No Hold</button>
+ <button dojoType="dijit.form.Button" onClick="cancelRequest()">Cancel Request with Reason</button>
+ </div>
+ </div>
+ <div id="detail_content_pane" />
+ </div>
</div>
- <div>
- <span>Context Org Unit</span>
- <select
- dojoType="openils.widget.OrgUnitFilteringSelect"
- jsId='contextOrgSelector'
- searchAttr='shortname'
- labelAttr='shortname'>
- </select>
- </div>
- <table jsId="rGrid"
- dojoType="openils.widget.AutoGrid"
- query="{id: '*'}"
- suppressFields='["id", "usr", "pickup_lib", "holdable_formats", "phone_notify", "email_notify", "lineitem", "eg_bib", "max_fee", "cancel_reason"]'
- fieldOrder='["title", "author", "isxn", "article_title", "article_pages", "request_type", "volume", "pubdate", "publisher", "location", "other_info", "mentioned"]'
- fmClass='aur'
- editStyle='pane'
- autoHeight='true'
- suppressFields="['id']"
- showPaginator='true'
- showColumnPicker='true'
- columnPickerPrefix='"acq.picklist.user_request"'
- editOnEnter='true'>
- <thead>
- <tr>
- <th field='title' get='getTitle' formatter='formatTitle'/>
- </tr>
- </thead>
- </table>
-</div>
[% END %]
More information about the open-ils-commits
mailing list