]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/js/ui/default/staff/admin/local/app.js
webstaff: browser: closed dates / research missing dump() func
[Evergreen.git] / Open-ILS / web / js / ui / default / staff / admin / local / app.js
1 angular.module('egLocalAdmin',
2     ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
3
4 .config(['$routeProvider','$locationProvider','$compileProvider', 
5  function($routeProvider , $locationProvider , $compileProvider) {
6
7     $locationProvider.html5Mode(true);
8     $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); 
9     var resolver = {delay : function(egStartup) {return egStartup.go()}};
10
11     var eframe_template = 
12         '<eg-embed-frame url="local_admin_url" handlers="funcs"></eg-embed-frame>';
13
14     // non-conify routes come first
15     $routeProvider.when('/admin/local/money/cash_reports', {
16         template: eframe_template,
17         controller: 'EmbedXHTMLCtl', // non-conify
18         resolve : resolver
19     });
20    
21     // non-conify routes come first
22     $routeProvider.when('/admin/local/actor/closed_dates', {
23         template: eframe_template,
24         controller: 'EmbedXHTMLCtl', // non-conify
25         resolve : resolver
26     });
27
28     // Conify page handler
29     $routeProvider.when('/admin/local/:schema/:page', {
30         template: eframe_template,
31         controller: 'EmbedConifyCtl',
32         resolve : resolver
33     });
34
35     // default page 
36     $routeProvider.otherwise({
37         templateUrl : './admin/local/t_splash',
38         resolve : resolver
39     });
40 }])
41
42 .controller('EmbedConifyCtl', 
43        ['$scope','$routeParams','$location','egCore',
44 function($scope , $routeParams , $location , egCore) {
45
46     $scope.funcs = {
47         ses : egCore.auth.token(),
48     }
49
50     var conify_path = '/eg/conify/global/' + 
51         $routeParams.schema + '/' + $routeParams.page;
52
53     // embed URL must include protocol/domain or it will be loaded via
54     // push-state, resulting in an infinitely nested pages.
55     $scope.local_admin_url = 
56         $location.absUrl().replace(/\/eg\/staff.*/, conify_path);
57
58     console.log('Loading local admin URL: ' + $scope.local_admin_url);
59
60 }])
61
62 .controller('EmbedXHTMLCtl', 
63        ['$scope','$location','egCore','$timeout',
64 function($scope , $location , egCore , $timeout) {
65
66     $scope.funcs = {};
67
68     var xul_base = '/xul/server/admin/';
69     var page_parts = $location.path().split(/\//);
70     var url = xul_base + page_parts[page_parts.length - 1] + '.xhtml';
71
72     // old-school XUL admin UI's only want CGI ses values.
73     url += '?ses=' + egCore.auth.token();
74     
75     console.log('Loading local admin URL: ' + $scope.local_admin_url);
76
77     $scope.local_admin_url = $location.absUrl().replace(/\/.*/, url);
78 }])
79