LP#1812389: make Group Penalty Threshold admin page accessible again
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 23 Jan 2019 15:52:24 +0000 (10:52 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 8 Mar 2019 15:03:14 +0000 (10:03 -0500)
As a consequence of the patch for bug 1744756 adding a new
admin/local/permission AngularJS app, the routing for
admin/local/permission/grp_penalty_threshold got broken, making the
embdeded Conify interface for group penalty thresholds inaccessible
from the web staff client. This patch fixes that.

To test
-------
[1] From Administration | Local Administration, go to Group Penalty
    Thresholds. Note that the embedded Conify admin interface
    is not displayed and the URL changes to .../permission/grp_tree.
[2] Apply the patch and repeat step 1. This time, the admin interface
    should appear.
[3] Verify that the Permission Group Tree Entries interface remains
    accessible from Local Administration.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/admin/local/permission/index.tt2
Open-ILS/web/js/ui/default/staff/admin/local/permission/app.js

index 6b63ed5..9e110ef 100644 (file)
@@ -6,6 +6,7 @@
 
 [% BLOCK APP_JS %]
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/eframe.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/admin/local/permission/app.js"></script>
 <link rel="stylesheet" href="[% ctx.base_path %]/staff/css/admin.css" />
 <script>
@@ -23,4 +24,4 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
 
 <div ng-view></div>
 
-[% END %]
\ No newline at end of file
+[% END %]
index 3b7f19a..185ad33 100644 (file)
@@ -14,6 +14,15 @@ angular.module('egAdminPermGrpTreeApp',
         resolve : resolver
     });
 
+    // catch admin/local/permission/grp_penalty_threshold
+    var eframe_template = 
+        '<eg-embed-frame allow-escape="true" min-height="min_height" url="local_admin_url" handlers="funcs"></eg-embed-frame>';
+    $routeProvider.when('/admin/local/:schema/:page', {
+        template: eframe_template,
+        controller: 'EmbedConifyCtl',
+        resolve : resolver
+    });
+
     $routeProvider.otherwise({redirectTo : '/admin/local/permission/grp_tree'});
 })
 
@@ -433,4 +442,26 @@ function($scope , $q , $timeout , $location , $uibModal , egCore , egPermGrpTree
     egCore.startup.go(function() {
         $scope.refreshTree(egCore.auth.user().ws_ou());
     });
-}])
\ No newline at end of file
+}])
+
+.controller('EmbedConifyCtl', 
+       ['$scope','$routeParams','$location','egCore',
+function($scope , $routeParams , $location , egCore) {
+
+    $scope.funcs = {
+        ses : egCore.auth.token(),
+    }
+
+    var conify_path = '/eg/conify/global/' + 
+        $routeParams.schema + '/' + $routeParams.page;
+
+    $scope.min_height = 800;
+
+    // embed URL must include protocol/domain or it will be loaded via
+    // push-state, resulting in an infinitely nested pages.
+    $scope.local_admin_url = 
+        $location.absUrl().replace(/\/eg\/staff.*/, conify_path);
+
+    console.log('Loading local admin URL: ' + $scope.local_admin_url);
+
+}])