From: erickson Date: Wed, 9 Dec 2009 21:10:58 +0000 (+0000) Subject: added a workstation registration wizard to selfcheck. this will come in handy when... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=51d52e18377cead7ce623b2ae3231f00782bfd13;p=evergreen%2Ftadl.git added a workstation registration wizard to selfcheck. this will come in handy when an org requires a workstation for selfcheck. some other minor cleanup git-svn-id: svn://svn.open-ils.org/ILS/trunk@15127 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js b/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js index 3296ec594d..a3358ed2c5 100644 --- a/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js +++ b/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js @@ -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?' } diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index 8b909800a7..be436f855f 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -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 */ diff --git a/Open-ILS/web/templates/default/circ/selfcheck/banner.tt2 b/Open-ILS/web/templates/default/circ/selfcheck/banner.tt2 index cd409e63a1..cda4866c91 100644 --- a/Open-ILS/web/templates/default/circ/selfcheck/banner.tt2 +++ b/Open-ILS/web/templates/default/circ/selfcheck/banner.tt2 @@ -4,7 +4,7 @@
- +
diff --git a/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2 b/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2 index 953b8ca163..b1abfb4c06 100644 --- a/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2 +++ b/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2 @@ -13,7 +13,7 @@ - + @@ -25,6 +25,6 @@ - + diff --git a/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 b/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 index c6af5afd49..333624948d 100644 --- a/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 +++ b/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 @@ -10,7 +10,7 @@ - + diff --git a/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 b/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 index ab74e07f43..8e4939cf00 100644 --- a/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 +++ b/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 @@ -29,7 +29,27 @@ [% INCLUDE 'default/circ/selfcheck/summary.tt2' %] -
+
+ [% END %]