added a workstation registration wizard to selfcheck. this will come in handy when...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 9 Dec 2009 21:10:58 +0000 (21:10 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 9 Dec 2009 21:10:58 +0000 (21:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15127 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js
Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
Open-ILS/web/templates/default/circ/selfcheck/banner.tt2
Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2
Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2
Open-ILS/web/templates/default/circ/selfcheck/main.tt2

index 3296ec5..a3358ed 100644 (file)
@@ -15,6 +15,7 @@
     'UNKNOWN_ERROR' : 'An unhandled exception occurred with error code ${0}',
     'MAX_RENEWALS' : 'No more renewals allowed for item ${0}',
     'ITEM_NOT_CATALOGED' : 'Item ${0} was not found in the system.  Try re-scanning the item.',
-    'WORKSTATION_REQUIRED' : 'Workstation is required.  Set the workstation name with URL param "ws"'
+    'WORKSTATION_REQUIRED' : 'A workstation is required to log in to selfcheck.  You can set the  workstation name with URL param "ws".  \n\nWould you like to register a new workstation for this self-check interface?',
+    'WORKSTATION_EXISTS' : 'This workstation has already been registered.  Would you like to use it for this self-check station?'
 }
 
index 8b90980..be436f8 100644 (file)
@@ -5,6 +5,7 @@ dojo.require('openils.Util');
 dojo.require('openils.User');
 dojo.require('openils.Event');
 dojo.require('openils.widget.ProgressDialog');
+dojo.require('openils.widget.OrgUnitFilteringSelect');
 
 dojo.requireLocalization('openils.circ', 'selfcheck');
 var localeStrings = dojo.i18n.getLocalization('openils.circ', 'selfcheck');
@@ -83,7 +84,9 @@ SelfCheckManager.prototype.init = function() {
 
     // workstation is required but none provided
     if(this.orgSettings[SET_WORKSTATION_REQUIRED] && !this.workstation) {
-        alert(dojo.string.substitute(localeStrings.WORKSTATION_REQUIRED));
+        if(confirm(dojo.string.substitute(localeStrings.WORKSTATION_REQUIRED))) {
+            this.registerWorkstation();
+        }
         return;
     }
     
@@ -125,6 +128,54 @@ SelfCheckManager.prototype.init = function() {
     }
 }
 
+
+/**
+ * Registers a new workstion
+ */
+SelfCheckManager.prototype.registerWorkstation = function() {
+    
+    oilsSelfckWsDialog.show();
+
+    new openils.User().buildPermOrgSelector(
+        'REGISTER_WORKSTATION', 
+        oilsSelfckWsLocSelector, 
+        this.staff.home_ou()
+    );
+
+
+    var self = this;
+    dojo.connect(oilsSelfckWsSubmit, 'onClick', 
+
+        function() {
+            oilsSelfckWsDialog.hide();
+            var name = oilsSelfckWsLocSelector.attr('displayedValue') + '-' + oilsSelfckWsName.attr('value');
+
+            var res = fieldmapper.standardRequest(
+                ['open-ils.actor', 'open-ils.actor.workstation.register'],
+                { params : [
+                        self.authtoken, name, oilsSelfckWsLocSelector.attr('value')
+                    ]
+                }
+            );
+
+            if(evt = openils.Event.parse(res)) {
+                if(evt.textcode == 'WORKSTATION_NAME_EXISTS') {
+                    if(confirm(localeStrings.WORKSTATION_EXISTS)) {
+                        location.href = location.href.replace(/\?.*/, '') + '?ws=' + name;
+                    } else {
+                        self.registerWorkstation();
+                    }
+                    return;
+                } else {
+                    alert(evt);
+                }
+            } else {
+                location.href = location.href.replace(/\?.*/, '') + '?ws=' + name;
+            }
+        }
+    );
+}
+
 /**
  * Loads the org unit settings
  */
index cd409e6..cda4866 100644 (file)
@@ -4,7 +4,7 @@
 </div>
 <div id='oils-selfck-scan-div'>
     <div id='oils-selfck-scan-text'></div>
-    <input jsId='selfckScanBox' dojoType='dijit.form.TextBox'></input>
+    <input jsId='selfckScanBox' dojoType='dijit.form.TextBox'/>
 </div>
 <div id='oils-selfck-status-div'></div>
 
index 953b8ca..b1abfb4 100644 (file)
@@ -13,7 +13,7 @@
         </thead>
         <tbody id='oils-selfck-circ-tbody'>
             <tr id='oils-selfck-circ-row'>
-                <td><img class='oils-selfck-jacket' name='jacket'></img></td>
+                <td><img class='oils-selfck-jacket' name='jacket'/></td>
                 <td name='barcode'></td>
                 <td name='title'></td>
                 <td name='author'></td>
@@ -25,6 +25,6 @@
                 </td>
             </tr>
         </tbody>
-        <tbody id='oils-selfck-circ-out-tbody' class='oils-selfck-item-table'/>
+        <tbody id='oils-selfck-circ-out-tbody' class='oils-selfck-item-table'></tbody>
     </table>
 </div>
index c6af5af..3336249 100644 (file)
@@ -10,7 +10,7 @@
         </thead>
         <tbody id='oils-selfck-hold-tbody'>
             <tr id='oils-selfck-hold-row'>
-                <td><img class='oils-selfck-jacket' name='jacket'></img></td>
+                <td><img class='oils-selfck-jacket' name='jacket'/></td>
                 <td name='title'></td>
                 <td name='author'></td>
                 <td name='status'></td>
index ab74e07..8e4939c 100644 (file)
         [% INCLUDE 'default/circ/selfcheck/summary.tt2' %]
     </div>
 </div>
-<div dojoType='openils.widget.ProgressDialog' jsId='progressDialog'/>
+<div dojoType='openils.widget.ProgressDialog' jsId='progressDialog'></div>
+<div dojoType="dijit.Dialog" jsId='oilsSelfckWsDialog' class='oils-login-dialog' style='display:none;'>
+    <form>
+        <table>
+            <tr>
+                <td>Choose a location</td>
+                <td><div dojoType='openils.widget.OrgUnitFilteringSelect' jsId='oilsSelfckWsLocSelector' 
+                    searchAttr='shortname' labelAttr='shortname'/></td>
+            </tr>
+            <tr>
+                <td>Enter a workstation name</td>
+                <td><input dojoType='dijit.form.TextBox' jsId='oilsSelfckWsName'/></td>
+            </tr>
+            <tr>
+                <td colspan='2' align='center'>
+                    <button jsId='oilsSelfckWsSubmit' dojoType='dijit.form.Button'>Submit</button>
+                </td>
+            </tr>
+        </table>
+    </form>
+</div>
 [% END %]