var contextOrg;
function setup() {
+
+ if(reqId) {
+ drawRequest();
+ } else {
+ drawList();
+ }
+}
+
+function drawRequest() {
+ // hide the grid and the context selector
+ // draw a detail page for a particular request
+ // including ability to add request to a picklist
+ // and to "reject" it (aka apply a cancel reason)
+}
+
+
+// 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 ''
+}
+
+// turn id:title into a url
+function formatTitle(value) {
+ if(value) {
+ var parts = value.split(/:/);
+ return '<a href="' + oilsBasePath +
+ '/acq/picklist/user_request/' + parts[0] + '">' + parts[1] + '</a>';
+ }
+}
+
+function drawList() {
buildGrid();
var connect = function() {
[% WRAPPER 'default/base.tt2' %]
[% ctx.page_title = 'Patron Requests' %]
<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>
</div>
<div>
<table jsId="rGrid"
dojoType="openils.widget.AutoGrid"
query="{id: '*'}"
- defaultCellWidth='"auto"'
+ 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'
showColumnPicker='true'
columnPickerPrefix='"acq.picklist.user_request"'
editOnEnter='true'>
+ <thead>
+ <tr>
+ <th field='title' get='getTitle' formatter='formatTitle'/>
+ </tr>
+ </thead>
</table>
</div>
[% END %]