From 3e63c9fbb843073f5d12996de6b361b8606494d7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 29 Apr 2014 17:07:09 -0400 Subject: [PATCH] UI for toggling hatch requried.. Signed-off-by: Bill Erickson --- .../templates/staff/admin/workstation/t_splash.tt2 | 22 ++++++++++++++++++ .../js/ui/default/staff/admin/workstation/app.js | 27 ++++++++++++++++++++-- .../web/js/ui/default/staff/services/printstore.js | 11 +++++---- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 index c3bc7c07c6..1fd75916a2 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 @@ -1,5 +1,27 @@
+
+
+
+ +
+
+
+
+
+ +
+
+ +

diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index 743c9af803..e786506cc7 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -30,11 +30,34 @@ angular.module('egWorkstationAdmin', // default page $routeProvider.otherwise({ templateUrl : './admin/workstation/t_splash', - controller : function() {}, + controller : 'SplashCtrl', resolve : resolver }); }]) +.controller('SplashCtrl', + ['$scope','egPrintStore','egUser', +function($scope , egPrintStore , egUser) { + + $scope.userHasAdminPerm = false; + egUser.hasPermHere('ADMIN_WORKSTATION') + .then(function(bool) { $scope.userHasAdminPerm = bool }); + + $scope.hatchURL = egPrintStore.hatchURL(); + $scope.hatchRequired = + egPrintStore.getLocalItem('eg.conf.hatch.required'); + + $scope.updateHatchRequired = function() { + egPrintStore.setLocalItem( + 'eg.conf.hatch.required', $scope.hatchRequired); + } + + $scope.updateHatchURL = function() { + egPrintStore.setLocalItem( + 'eg.conf.hatch.url', $scope.hatchURL); + } +}]) + .controller('PrintingCtrl', ['$scope','egPrintStore', function($scope , egPrintStore) { @@ -179,7 +202,7 @@ function($scope , egUser , egPrintStore , egConfirmDialog , egAppStrings , $q) { // grab the edit perm $scope.userHasDeletePerm = false; - egUser.hasPermHere('DELETE_WORKSTATION_PREFS') + egUser.hasPermHere('ADMIN_WORKSTATION') .then(function(bool) { $scope.userHasDeletePerm = bool }); // fetch the keys diff --git a/Open-ILS/web/js/ui/default/staff/services/printstore.js b/Open-ILS/web/js/ui/default/staff/services/printstore.js index 6dadbf35bf..a537de317e 100644 --- a/Open-ILS/web/js/ui/default/staff/services/printstore.js +++ b/Open-ILS/web/js/ui/default/staff/services/printstore.js @@ -137,6 +137,11 @@ angular.module('egCoreMod') service.onHatchClose(); } + service.hatchURL = function() { + return service.getLocalItem('eg.conf.hatch.url') + || service.defaultHatchURL; + } + service.hatchConnect = function() { if (service.socket && @@ -149,9 +154,7 @@ angular.module('egCoreMod') console.debug("connecting to Hatch..."); try { - var url = service.getLocalItem('eg.hatch.url') - || service.defaultHatchURL; - service.socket = new WebSocket(url); + service.socket = new WebSocket(service.hatchURL()); } catch(e) { service.hatchAvailable = false; service.hatchClosed(); @@ -181,7 +184,7 @@ angular.module('egCoreMod') if (service.hatchAvailable === false) return; // already registered service.hatchAvailable = false; console.debug( - "unable to connect to Hatch server at " + service.hatchURL); + "unable to connect to Hatch server at " + service.hatchURL()); service.hatchClosed(); } -- 2.11.0