From: Bill Erickson Date: Thu, 24 Apr 2014 15:10:25 +0000 (-0400) Subject: browser staff : new stored settings admin page X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d3cbcdf62f3bd831cf90c1745110156ff39e6c2f;p=working%2FEvergreen.git browser staff : new stored settings admin page Page lets staff view and delete stored preferences. TODO: permission Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/admin/workstation/index.tt2 b/Open-ILS/src/templates/staff/admin/workstation/index.tt2 index d20444f675..a33addea02 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/index.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/index.tt2 @@ -8,6 +8,13 @@ + [% END %]
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 ceb3cab6cf..0f91ec4684 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/t_splash.tt2 @@ -43,6 +43,10 @@ diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_stored_prefs.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_stored_prefs.tt2 new file mode 100644 index 0000000000..48ceea57d0 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/workstation/t_stored_prefs.tt2 @@ -0,0 +1,39 @@ + +
+
+ + +
+
+
{{$index + 1}}.
+
+ {{key}} +
+
+ +
+
+ +
+
+
+ + +
+
{{getCurrentKeyContent()}}
+
+ +
+
diff --git a/Open-ILS/src/templates/staff/css/style.css.tt2 b/Open-ILS/src/templates/staff/css/style.css.tt2 index 9f55306ffe..e9ebdf2cf9 100644 --- a/Open-ILS/src/templates/staff/css/style.css.tt2 +++ b/Open-ILS/src/templates/staff/css/style.css.tt2 @@ -59,6 +59,7 @@ * version 0.6.0 look right with Bootstrap CSS 3.0 */ .nav, .pagination, .carousel a { cursor: pointer; } +/* .modal { display: block; height: 0; @@ -74,6 +75,7 @@ display: table; content: " "; } +*/ /* -------------------------------------------------------------------------- /* Form Validation CSS - http://docs.angularjs.org/guide/forms 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 d2872becaf..265823a16e 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 @@ -4,7 +4,8 @@ * Splash Page */ -angular.module('egWorkstationAdmin', ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod']) +angular.module('egWorkstationAdmin', + ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'egUiMod']) .config(['$routeProvider','$locationProvider','$compileProvider', function($routeProvider , $locationProvider , $compileProvider) { @@ -19,6 +20,13 @@ angular.module('egWorkstationAdmin', ['ngRoute', 'ui.bootstrap', 'egCoreMod', 'e resolve : resolver }); + $routeProvider.when('/admin/workstation/stored_prefs', { + templateUrl: './admin/workstation/t_stored_prefs', + controller: 'StoredPrefsCtrl', + resolve : resolver + }); + + // default page $routeProvider.otherwise({ templateUrl : './admin/workstation/t_splash', @@ -137,6 +145,7 @@ function($scope , egPrintStore) { $scope.context, $scope.contentType, $scope.textPrintContent, + null, withDialog ); } else { @@ -157,3 +166,54 @@ function($scope , egPrintStore) { $scope.setContentType('text/plain'); }]) + +.controller('StoredPrefsCtrl', + ['$scope','egPrintStore','egConfirmDialog','egAppStrings', +function($scope , egPrintStore , egConfirmDialog , egAppStrings) { + console.log('StoredPrefsCtrl'); + + function refreshKeys() { + egPrintStore.getKeys() + .then(function(keys) { $scope.keys = keys.sort() }) + } + refreshKeys(); + + $scope.selectKey = function(key) { + $scope.currentKey = key; + $scope.currentKeyContent = null; + egPrintStore.getItem(key) + .then(function(content) { + $scope.currentKeyContent = content + }); + } + + $scope.getCurrentKeyContent = function() { + try { + // if the content is JSON-encoded (most), re-stringify + // with the pretty printer. + return JSON.stringify($scope.currentKeyContent, null, 2); + } catch(E) { + // otherwise, return the bare value + return $scope.currentKeyContent; + } + } + + $scope.removeKey = function(key) { + egConfirmDialog.open( + egAppStrings.PREFS_REMOVE_KEY_CONFIRM, '', + { deleteKey : key, + ok : function() { + egPrintStore.removeItem(key) + .then(function() { + // delete succeeded, remove item from list + $scope.keys = $scope.keys.filter( + function(k) { return k != key } + ); + }); + }, + cancel : function() {} // user canceled, nothing to do + } + ); + } +}]) + 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 f0de9e36b9..c53a2f0437 100644 --- a/Open-ILS/web/js/ui/default/staff/services/printstore.js +++ b/Open-ILS/web/js/ui/default/staff/services/printstore.js @@ -42,6 +42,7 @@ angular.module('egCoreMod') msg2[key] = val; }); console.debug("sending '" + msg.action + "' command to Hatch"); + console.debug("sending to Hatch: " + JSON.stringify(msg2,null,2)); service.socket.send(JSON.stringify(msg2)); }