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 // non-conify routes come first
29 $routeProvider.when('/admin/local/asset/copy_locations', {
30 template: eframe_template,
31 controller: 'EmbedXHTMLCtl', // non-conify
35 // Conify page handler
36 $routeProvider.when('/admin/local/:schema/:page', {
37 template: eframe_template,
38 controller: 'EmbedConifyCtl',
43 $routeProvider.otherwise({
44 templateUrl : './admin/local/t_splash',
49 .controller('EmbedConifyCtl',
50 ['$scope','$routeParams','$location','egCore',
51 function($scope , $routeParams , $location , egCore) {
54 ses : egCore.auth.token(),
57 var conify_path = '/eg/conify/global/' +
58 $routeParams.schema + '/' + $routeParams.page;
60 // embed URL must include protocol/domain or it will be loaded via
61 // push-state, resulting in an infinitely nested pages.
62 $scope.local_admin_url =
63 $location.absUrl().replace(/\/eg\/staff.*/, conify_path);
65 console.log('Loading local admin URL: ' + $scope.local_admin_url);
69 .controller('EmbedXHTMLCtl',
70 ['$scope','$location','egCore','$timeout',
71 function($scope , $location , egCore , $timeout) {
75 var xul_base = '/xul/server/admin/';
76 var page_parts = $location.path().split(/\//);
77 var url = xul_base + page_parts[page_parts.length - 1] + '.xhtml';
79 // old-school XUL admin UI's only want CGI ses values.
80 url += '?ses=' + egCore.auth.token();
82 console.log('Loading local admin URL: ' + $scope.local_admin_url);
84 $scope.local_admin_url = $location.absUrl().replace(/\/.*/, url);