1 angular.module('egLocalAdmin',
2 ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
4 .config(['$routeProvider','$locationProvider','$compileProvider',
5 function($routeProvider , $locationProvider , $compileProvider) {
7 $locationProvider.html5Mode(true);
8 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/);
9 var resolver = {delay : function(egStartup) {return egStartup.go()}};
12 '<eg-embed-frame allow-escape="true" min-height="min_height" url="local_admin_url" handlers="funcs"></eg-embed-frame>';
14 // non-conify routes come first
15 $routeProvider.when('/admin/local/money/cash_reports', {
16 template: eframe_template,
17 controller: 'EmbedXHTMLCtl', // non-conify
21 // non-conify routes come first
22 $routeProvider.when('/admin/local/actor/closed_dates', {
23 template: eframe_template,
24 controller: 'EmbedXHTMLCtl', // non-conify
28 // non-conify routes come first
29 $routeProvider.when('/admin/local/asset/copy_locations', {
30 template: eframe_template,
31 controller: 'EmbedXHTMLCtl', // non-conify
35 // non-conify routes come first
36 $routeProvider.when('/admin/local/asset/org_unit_settings', {
37 template: eframe_template,
38 controller: 'EmbedXHTMLCtl', // non-conify
42 $routeProvider.when('/admin/local/config/non_cat_types', {
43 template: eframe_template,
44 controller: 'EmbedXHTMLCtl', // non-conify
48 $routeProvider.when('/admin/local/asset/stat_cat_editor', {
49 template: eframe_template,
50 controller: 'EmbedXHTMLCtl', // non-conify
54 // Conify page handler
55 $routeProvider.when('/admin/local/:schema/:page', {
56 template: eframe_template,
57 controller: 'EmbedConifyCtl',
62 $routeProvider.otherwise({
63 templateUrl : './admin/local/t_splash',
68 .controller('EmbedConifyCtl',
69 ['$scope','$routeParams','$location','egCore',
70 function($scope , $routeParams , $location , egCore) {
73 ses : egCore.auth.token(),
76 var conify_path = '/eg/conify/global/' +
77 $routeParams.schema + '/' + $routeParams.page;
79 $scope.min_height = 800;
81 // embed URL must include protocol/domain or it will be loaded via
82 // push-state, resulting in an infinitely nested pages.
83 $scope.local_admin_url =
84 $location.absUrl().replace(/\/eg\/staff.*/, conify_path);
86 console.log('Loading local admin URL: ' + $scope.local_admin_url);
90 .controller('EmbedXHTMLCtl',
91 ['$scope','$location','egCore','$timeout',
92 function($scope , $location , egCore , $timeout) {
96 var xul_base = '/xul/server/admin/';
97 var page_parts = $location.path().split(/\//);
98 var url = xul_base + page_parts[page_parts.length - 1] + '.xhtml';
100 // old-school XUL admin UI's only want CGI ses values.
101 url += '?ses=' + egCore.auth.token();
103 console.log('Loading local admin URL: ' + $scope.local_admin_url);
105 $scope.local_admin_url = $location.absUrl().replace(/\/.*/, url);