[open-ils-commits] r12658 - in trunk/Open-ILS/web: css/skin js/ui/default/acq/picklist templates/default templates/default/acq/picklist (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 24 16:50:07 EDT 2009
Author: erickson
Date: 2009-03-24 16:50:01 -0400 (Tue, 24 Mar 2009)
New Revision: 12658
Added:
trunk/Open-ILS/web/js/ui/default/acq/picklist/upload.js
trunk/Open-ILS/web/templates/default/acq/picklist/upload.tt2
Modified:
trunk/Open-ILS/web/css/skin/default.css
trunk/Open-ILS/web/templates/default/menu.tt2
Log:
added a marc order record upload form for creating picklists and/or purchase orders from vendor records
Modified: trunk/Open-ILS/web/css/skin/default.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default.css 2009-03-24 20:48:43 UTC (rev 12657)
+++ trunk/Open-ILS/web/css/skin/default.css 2009-03-24 20:50:01 UTC (rev 12658)
@@ -50,7 +50,10 @@
.label { margin: 1px; }
+.oils-generic-table th { padding:5px; font-weight: bold; }
+.oils-generic-table td { padding:5px; }
+
/* local dojo style enhancements ----------------------------------- */
/*
.dojoxGrid {border: 1px solid #333; height: 90%;}
Added: trunk/Open-ILS/web/js/ui/default/acq/picklist/upload.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/picklist/upload.js (rev 0)
+++ trunk/Open-ILS/web/js/ui/default/acq/picklist/upload.js 2009-03-24 20:50:01 UTC (rev 12658)
@@ -0,0 +1,118 @@
+dojo.require('dojo.data.ItemFileReadStore');
+dojo.require('dijit.ProgressBar');
+dojo.require('dijit.form.CheckBox');
+dojo.require('dijit.form.TextBox');
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('dijit.form.ComboBox');
+dojo.require('dijit.form.Button');
+dojo.require("dojo.io.iframe");
+dojo.require('openils.User');
+dojo.require('openils.widget.AutoFieldWidget');
+dojo.require('openils.acq.Picklist');
+
+var VANDELAY_URL = '/vandelay-upload';
+var providerWidget;
+var orderAgencyWidget;
+
+function init() {
+ dojo.byId('acq-pl-upload-ses').value = openils.User.authtoken;
+
+ new openils.widget.AutoFieldWidget({
+ fmClass : 'acqpo',
+ fmField : 'provider',
+ limitPerms : ['CREATE_PICKLIST'],
+ parentNode : dojo.byId('acq-pl-upload-provider'),
+ }).build(
+ function(w) { providerWidget = w }
+ );
+
+ new openils.widget.AutoFieldWidget({
+ fmClass : 'acqpo',
+ fmField : 'ordering_agency',
+ limitPerms : ['CREATE_PURCHASE_ORDER'],
+ parentNode : dojo.byId('acq-pl-upload-agency'),
+ }).build(
+ function(w) { orderAgencyWidget = w }
+ );
+
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.picklist.user.retrieve.atomic'],
+ { async: true,
+ params: [openils.User.authtoken],
+ oncomplete : function(r) {
+ var list = openils.Util.readResponse(r);
+ acqPlUploadPlSelector.store =
+ new dojo.data.ItemFileReadStore({data:acqpl.toStoreData(list)});
+ }
+ }
+ );
+}
+
+function acqUploadRecords() {
+ openils.Util.show('acq-pl-upload-progress');
+ var picklist = acqPlUploadPlSelector.attr('value');
+ if(picklist) {
+ // ComboBox value is the display string. find the actual picklist
+ // and create a new one if necessary
+ acqPlUploadPlSelector.store.fetch({
+ query : {name:picklist},
+ onComplete : function(items) {
+ if(items.length == 0) {
+ // create a new picklist for these items
+ openils.acq.Picklist.create(
+ {name:picklist, org_unit: orderAgencyWidget.attr('value')},
+ function(plId) { acqSendUploadForm({picklist:plId}) }
+ );
+ } else {
+ acqSendUploadForm({picklist:items[0].id});
+ }
+ }
+ });
+ } else {
+ acqSendUploadForm({});
+ }
+}
+
+function acqSendUploadForm(args) {
+ dojo.io.iframe.send({
+ url: VANDELAY_URL,
+ method: "post",
+ handleAs: "html",
+ form: dojo.byId('acq-pl-upload-form'),
+ content : {
+ picklist : args.picklist,
+ provider : providerWidget.attr('value'),
+ ordering_agency : orderAgencyWidget.attr('value')
+ },
+ handle: function(data, ioArgs){
+ acqHandlePostUpload(data.documentElement.textContent);
+ }
+ });
+}
+
+
+function acqHandlePostUpload(key) {
+ openils.Util.hide('acq-pl-upload-progress');
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.process_upload_records'],
+ { async: true,
+ params: [openils.User.authtoken, key],
+ onresponse : function(r) {
+ var resp = openils.Util.readResponse(r);
+ if(resp.complete) {
+ if(resp.picklist) {
+ location.href = location.href + '/../view/' + resp.picklist.id();
+ } else {
+ location.href = location.href + '/../../po/view/' + resp.purchase_order.id;
+ }
+ } else {
+ dojo.byId('acq-pl-upload-count').innerHTML = resp.count;
+ }
+ },
+ }
+ );
+}
+
+
+openils.Util.addOnLoad(init);
+
Added: trunk/Open-ILS/web/templates/default/acq/picklist/upload.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/picklist/upload.tt2 (rev 0)
+++ trunk/Open-ILS/web/templates/default/acq/picklist/upload.tt2 2009-03-24 20:50:01 UTC (rev 12658)
@@ -0,0 +1,51 @@
+[% WRAPPER 'default/base.tt2' %]
+<script src='[% ctx.media_prefix %]/js/ui/default/acq/picklist/upload.js'> </script>
+
+<h1>Upload</h1><br/>
+<form id="acq-pl-upload-form" enctype="multipart/form-data">
+ <input type='hidden' name='ses' id='acq-pl-upload-ses'/>
+ <table class='oils-generic-table'>
+ <tbody>
+ <tr>
+ <td>Create Purchase Order</td>
+ <td>
+ <input dojoType='dijit.form.CheckBox' jsId='acqPlUploadToPo' name='create_po'></input>
+ </td>
+ </tr>
+ <tr>
+ <td>Provider</td>
+ <td><div id='acq-pl-upload-provider'></div></td>
+ </tr>
+ <tr id='acq-pl-upload-agency-row'>
+ <td>Context Org Unit</td>
+ <td><div id='acq-pl-upload-agency'></div></td>
+ </tr>
+ <tr id='acq-pl-upload-picklist'>
+ <td>Add to Picklist</td>
+ <td>
+ <select jsId='acqPlUploadPlSelector' dojoType='dijit.form.ComboBox'></select>
+ </td>
+ </tr>
+ <tr>
+ <td>Records File</td>
+ <td><input size='36' type="file" name="marc_upload"></input></td>
+ </tr>
+ <tr>
+ <td align='center' colspan='2'>
+ <button dojoType="dijit.form.Button" onClick="acqUploadRecords()">Upload</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <br/>
+ <br/>
+ <div id="acq-pl-upload-progress" class='hidden'>
+ <div>
+ <span>Processing...</span>
+ <span id='acq-pl-upload-count'></span>
+ </div>
+ <div dojoType="dijit.ProgressBar" style="width:300px" indeterminate="true"></div>
+ </div>
+</form>
+[% END %]
Modified: trunk/Open-ILS/web/templates/default/menu.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/menu.tt2 2009-03-24 20:48:43 UTC (rev 12657)
+++ trunk/Open-ILS/web/templates/default/menu.tt2 2009-03-24 20:50:01 UTC (rev 12658)
@@ -25,6 +25,10 @@
onClick="location.href = '[% ctx.base_uri %]/acq/picklist/bib_search';">
Title Search
</div>
+ <div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy"
+ onClick="location.href = '[% ctx.base_uri %]/acq/picklist/upload';">
+ Load Records
+ </div>
</div>
</div>
More information about the open-ils-commits
mailing list