From e41818e2bfe41f27b84738f1301c82e3b57ca50f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Sat, 25 Jul 2015 14:11:00 -0400 Subject: [PATCH] webstaff: browser client local admin re-org 2 Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- .../staff/admin/local/circ/age_to_lost.tt2 | 91 +++++++++++++++++++ .../src/templates/staff/admin/local/index.tt2 | 16 ++++ .../templates/staff/admin/local/t_splash.tt2 | 60 ++++++++++++ .../js/ui/default/staff/admin/local/app.js | 66 ++++++++++++++ .../staff/admin/local/circ/age_to_lost.js | 67 ++++++++++++++ 5 files changed, 300 insertions(+) create mode 100644 Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2 create mode 100644 Open-ILS/src/templates/staff/admin/local/index.tt2 create mode 100644 Open-ILS/src/templates/staff/admin/local/t_splash.tt2 create mode 100644 Open-ILS/web/js/ui/default/staff/admin/local/app.js create mode 100644 Open-ILS/web/js/ui/default/staff/admin/local/circ/age_to_lost.js diff --git a/Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2 b/Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2 new file mode 100644 index 0000000000..66bc9b4e3d --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/local/circ/age_to_lost.tt2 @@ -0,0 +1,91 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Age Circs to Lost"); + ctx.page_app = "egAdminCirc"; + ctx.page_ctrl = 'AgeToLostCtl'; +%] + +[% BLOCK APP_JS %] + + +[% END %] + +
+
+ [% l('Age Circulations to Lost') %] +
+
+ + +[% | l %] +Choose the user profile and circulation library for the overdue circulations +you wish to age to a Lost status. Note the descendants of these values +(sub-groups, sub-libraries) will also be affected. +[% END %] + + +
+
+
+ +
+ + +
+
+
+ + +
+
+ + +
+
+
+ +
+
+ +
+
+
+
+ [% l('Processing...') %] +
+
+
+ +
+
+
+ [% l('Chunks Processed: [_1]', '{{chunks_processed}}') %]
+
+ [% l('Events Created: [_1]', '{{events_created}}') %]
+
+ + +
+
+
+ +
+
+ + + + +[% END %] diff --git a/Open-ILS/src/templates/staff/admin/local/index.tt2 b/Open-ILS/src/templates/staff/admin/local/index.tt2 new file mode 100644 index 0000000000..02d604f887 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/local/index.tt2 @@ -0,0 +1,16 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Local Administration"); + ctx.page_app = "egLocalAdmin"; + #ctx.page_ctrl = "LocalAdminCtl"; +%] + +[% BLOCK APP_JS %] + + + +[% END %] + +
+ +[% END %] diff --git a/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 b/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 new file mode 100644 index 0000000000..9505bc3ef7 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 @@ -0,0 +1,60 @@ + +
+
+ [% l('Local Administration') %] +
+
+ + + diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/app.js b/Open-ILS/web/js/ui/default/staff/admin/local/app.js new file mode 100644 index 0000000000..e2ecfa860b --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/local/app.js @@ -0,0 +1,66 @@ +angular.module('egLocalAdmin', + ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod']) + +.config(['$routeProvider','$locationProvider','$compileProvider', + function($routeProvider , $locationProvider , $compileProvider) { + + $locationProvider.html5Mode(true); + $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); + var resolver = {delay : function(egStartup) {return egStartup.go()}}; + + var eframe_template = + ''; + + // non-conify routes come first + $routeProvider.when('/admin/local/money/cash_reports', { + template: eframe_template, + controller: 'CashReportsCtl', // non-conify + resolve : resolver + }); + + // Conify page handler + $routeProvider.when('/admin/local/:schema/:page', { + template: eframe_template, + controller: 'EmbedConifyCtl', + resolve : resolver + }); + + // default page + $routeProvider.otherwise({ + templateUrl : './admin/local/t_splash', + resolve : resolver + }); +}]) + +.controller('EmbedConifyCtl', + ['$scope','$routeParams','$location','egCore', +function($scope , $routeParams , $location , egCore) { + + $scope.funcs = { + ses : egCore.auth.token(), + } + + var conify_path = '/eg/conify/global/' + + $routeParams.schema + '/' + $routeParams.page; + + // embed URL must include protocol/domain or it will be loaded via + // push-state, resulting in an infinitely nested pages. + $scope.local_admin_url = + $location.absUrl().replace(/\/eg\/staff.*/, conify_path); + + console.log('Loading local admin URL: ' + $scope.local_admin_url); + +}]) + +.controller('CashReportsCtl', + ['$scope','$location','egCore', +function($scope , $location , egCore) { + $scope.local_admin_url = $location.absUrl().replace( + /\/.*/, '/xul/server/admin/cash_reports.xhtml'); + + // old-school XUL admin UI's only want CGI ses values. + $scope.local_admin_url += '?ses=' + egCore.auth.token(); + + console.log('Loading local admin URL: ' + $scope.local_admin_url); +}]) + diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/circ/age_to_lost.js b/Open-ILS/web/js/ui/default/staff/admin/local/circ/age_to_lost.js new file mode 100644 index 0000000000..5d68c7691c --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/local/circ/age_to_lost.js @@ -0,0 +1,67 @@ + +angular.module('egAdminCirc', + ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod']) + +.controller('AgeToLostCtl', + ['$scope','egCore', +function($scope , egCore) { + $scope.i_am_sure = false; + $scope.chunks_processed = 0; + $scope.events_created = 0; + + function fetch_data() { + + // fetch groups for the profile selector + egCore.pcrud.search('pgt', {parent : null}, + {flesh : -1, flesh_fields : {pgt : ['children']}} + ).then( + function(tree) { + egCore.env.absorbTree(tree, 'pgt') + $scope.profiles = egCore.env.pgt.list; + $scope.selected_profile = tree; + } + ); + + // determine the tree depth of the profile group + $scope.pgt_depth = function(grp) { + var d = 0; + while (grp = egCore.env.pgt.map[grp.parent()]) d++; + return d; + } + } + + // This is a standalone with page w/ no startup resolve. + // Run (well, attach to) startup locally then kick off the needed + // network calls. + egCore.startup.go().then(fetch_data); + + $scope.set_profile = function(g) {$scope.selected_profile = g} + + $scope.age_to_lost = function() { + $scope.in_progress = true; + $scope.i_am_sure = false; // reset + $scope.all_done = false; + + egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.circulation.age_to_lost', + egCore.auth.token(), { + user_profile : $scope.selected_profile.id(), + circ_lib : $scope.context_org.id() + } + ).then( + function() { + $scope.in_progress = false; + $scope.all_done = true; + }, + null, // on-error + function(response) { + if (!response) return; + if (response.progress) + $scope.chunks_processed = response.progress; + if (response.created) + $scope.events_created = response.created; + } + ); + } +}]) -- 2.43.2