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?|mailto|blob):/);
10 var resolver = {delay : function(egStartup) {return egStartup.go()}};
13 '<eg-embed-frame allow-escape="true" min-height="min_height" url="local_admin_url" handlers="funcs"></eg-embed-frame>';
15 // non-conify routes come first
16 $routeProvider.when('/admin/local/money/cash_reports', {
17 template: eframe_template,
18 controller: 'EmbedXHTMLCtl', // non-conify
22 // non-conify routes come first
23 $routeProvider.when('/admin/local/actor/closed_dates', {
24 template: eframe_template,
25 controller: 'EmbedXHTMLCtl', // non-conify
29 // non-conify routes come first
30 $routeProvider.when('/admin/local/asset/copy_locations', {
31 template: eframe_template,
32 controller: 'EmbedXHTMLCtl', // non-conify
36 // non-conify routes come first
37 $routeProvider.when('/admin/local/asset/org_unit_settings', {
38 template: eframe_template,
39 controller: 'EmbedXHTMLCtl', // non-conify
43 $routeProvider.when('/admin/local/config/non_cat_types', {
44 template: eframe_template,
45 controller: 'EmbedXHTMLCtl', // non-conify
49 $routeProvider.when('/admin/local/asset/stat_cat_editor', {
50 template: eframe_template,
51 controller: 'EmbedXHTMLCtl', // non-conify
55 // Conify page handler
56 $routeProvider.when('/admin/local/:schema/:page', {
57 template: eframe_template,
58 controller: 'EmbedConifyCtl',
63 $routeProvider.otherwise({
64 templateUrl : './admin/local/t_splash',
69 .controller('EmbedConifyCtl',
70 ['$scope','$routeParams','$location','egCore',
71 function($scope , $routeParams , $location , egCore) {
74 ses : egCore.auth.token(),
77 var conify_path = '/eg/conify/global/' +
78 $routeParams.schema + '/' + $routeParams.page;
80 $scope.min_height = 800;
82 // embed URL must include protocol/domain or it will be loaded via
83 // push-state, resulting in an infinitely nested pages.
84 $scope.local_admin_url =
85 $location.absUrl().replace(/\/eg\/staff.*/, conify_path);
87 console.log('Loading local admin URL: ' + $scope.local_admin_url);
91 .controller('EmbedXHTMLCtl',
92 ['$scope','$location','egCore','$timeout',
93 function($scope , $location , egCore , $timeout) {
97 var xul_base = '/xul/server/admin/';
98 var page_parts = $location.path().split(/\//);
99 var url = xul_base + page_parts[page_parts.length - 1] + '.xhtml';
101 // old-school XUL admin UI's only want CGI ses values.
102 url += '?ses=' + egCore.auth.token();
104 console.log('Loading local admin URL: ' + $scope.local_admin_url);
106 $scope.local_admin_url = $location.absUrl().replace(/\/.*/, url);