user permission editor from patron view
authorBill Erickson <berick@esilibrary.com>
Mon, 28 Jul 2014 15:51:50 +0000 (11:51 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 28 Jul 2014 15:51:50 +0000 (11:51 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/index.tt2
Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
Open-ILS/src/templates/staff/circ/patron/t_edit_perms.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/admin/user_perms.js
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
Open-ILS/web/js/ui/default/staff/services/eframe.js

index 9f08139..9048faa 100644 (file)
@@ -141,6 +141,11 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
             </a>
           </li>
           <li>
+            <a href="./circ/patron/{{patron().id()}}/edit_perms">
+              [% l('User Permission Editor') %]
+            </a>
+          </li>
+          <li>
             <a href="./circ/patron/{{patron().id()}}/credentials">
               [% l('Test Password') %]
             </a>
index 26cc766..3f85366 100644 (file)
@@ -1,3 +1,2 @@
-<!-- insert the patron registration UI -->
 <eg-embed-frame url="patron_edit_url" handlers="funcs"></eg-embed-frame>
 
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit_perms.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit_perms.tt2
new file mode 100644 (file)
index 0000000..76d10f6
--- /dev/null
@@ -0,0 +1 @@
+<eg-embed-frame url="user_perms_url" handlers="funcs"></eg-embed-frame>
index c93247d..460e8d1 100644 (file)
@@ -88,14 +88,11 @@ function($scope , $routeParams , $window , $location , egCore) {
     url += '?usr=' + encodeURIComponent(user_id);
 
     // user_edit does not load the session via cookie.  It uses URL 
-    // params or xulG instead.  We are forced to use URL params, 
-    // since xulG pass-thru's are not inserted until the iframe is
-    // loaded.  
-    // xulG instead.  Pass via xulG.
+    // params or xulG instead.  Pass via xulG.
     $scope.funcs = {
         ses : egCore.auth.token(),
         on_patron_save : function() {
-            $window.location.reload();
+            $scope.funcs.reload();
         }
     }
 
index 2291c0c..044a99b 100644 (file)
@@ -180,6 +180,12 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap',
         resolve : resolver
     });
 
+    $routeProvider.when('/circ/patron/:id/edit_perms', {
+        templateUrl: './circ/patron/t_edit_perms',
+        controller: 'PatronPermsCtrl',
+        resolve : resolver
+    });
+
     $routeProvider.when('/circ/patron/:id/group', {
         templateUrl: './circ/patron/t_group',
         controller: 'PatronGroupCtrl',
@@ -1497,3 +1503,25 @@ function($scope,  $routeParams,  $location , egCore , patronSvc) {
     $scope.funcs = {};
 }])
 
+.controller('PatronPermsCtrl',
+       ['$scope','$routeParams','$window','$location','egCore',
+function($scope , $routeParams , $window , $location , egCore) {
+    $scope.initTab('other', $routeParams.id);
+
+    var url = $location.absUrl().replace(
+        /\/eg\/staff.*/, '/xul/server/patron/user_edit.xhtml');
+
+    url += '?usr=' + encodeURIComponent($routeParams.id);
+
+    // user_edit does not load the session via cookie.  It uses URL 
+    // params or xulG instead.  Pass via xulG.
+    $scope.funcs = {
+        ses : egCore.auth.token(),
+        on_patron_save : function() {
+            $scope.funcs.reload();
+        }
+    }
+
+    $scope.user_perms_url = url;
+}])
+
index 5d4f94f..b706a50 100644 (file)
@@ -16,7 +16,7 @@ angular.module('egCoreMod')
             handlers : '=',
 
             // called after onload of each new iframe page
-            onchange : '='
+            onchange : '=',
         },
 
         templateUrl : './share/t_eframe',
@@ -68,7 +68,7 @@ angular.module('egCoreMod')
                 console.debug('egEmbedFrameLoader(): ' + page);
 
                 // reload ifram page w/o reloading the entire UI
-                $scope.reload_page = function() {
+                $scope.reload = function() {
                     iframe.contentWindow.location.replace(
                         iframe.contentWindow.location);
                 }
@@ -195,6 +195,7 @@ angular.module('egCoreMod')
                 }
 
                 if ($scope.handlers) {
+                    $scope.handlers.reload = $scope.reload;
                     angular.forEach($scope.handlers, function(val, key) {
                         iframe.contentWindow.xulG[key] = val;
                     });