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 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 // Conify page handler
29 $routeProvider.when('/admin/local/:schema/:page', {
30 template: eframe_template,
31 controller: 'EmbedConifyCtl',
36 $routeProvider.otherwise({
37 templateUrl : './admin/local/t_splash',
42 .controller('EmbedConifyCtl',
43 ['$scope','$routeParams','$location','egCore',
44 function($scope , $routeParams , $location , egCore) {
47 ses : egCore.auth.token(),
50 var conify_path = '/eg/conify/global/' +
51 $routeParams.schema + '/' + $routeParams.page;
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);
58 console.log('Loading local admin URL: ' + $scope.local_admin_url);
62 .controller('EmbedXHTMLCtl',
63 ['$scope','$location','egCore','$timeout',
64 function($scope , $location , egCore , $timeout) {
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';
72 // old-school XUL admin UI's only want CGI ses values.
73 url += '?ses=' + egCore.auth.token();
75 console.log('Loading local admin URL: ' + $scope.local_admin_url);
77 $scope.local_admin_url = $location.absUrl().replace(/\/.*/, url);