improve linking out of acquisitions upload page
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 6 Feb 2017 21:42:35 +0000 (16:42 -0500)
committerKathy Lussier <klussier@masslnc.org>
Sat, 18 Feb 2017 18:31:31 +0000 (13:31 -0500)
- cat/catalog/vandelay route no longer drops
  query parameters, permitting direct linking to import
  queues (e.g., /eg/staff/cat/catalog/vandelay?qtype=bib&qid=367)
- acq/legacy/:noun/:verb/:record now a valid acq route
- purchase order MARC loading now generates usable links
  back to PO, selection list, and/or import queue

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/acq/picklist/upload.js
Open-ILS/web/js/ui/default/staff/acq/app.js
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index df11b0f..6abdc69 100644 (file)
@@ -177,7 +177,11 @@ function acqHandlePostUpload(key, plId) {
                                 link.setAttribute('href', url); 
                             } else {
                                 link.setAttribute('href', 'javascript:;'); // for linky-ness
-                                link.onclick = function() { openils.XUL.newTabEasy(url, null, null, true) };
+                                if (window.IAMBROWSER) {
+                                    link.onclick = function() { xulG.relay_url(url) };
+                                } else {
+                                    link.onclick = function() { openils.XUL.newTabEasy(url, null, null, true) };
+                                }
                             }
                         }
                             
index b100c4f..b9e5b0f 100644 (file)
@@ -17,6 +17,12 @@ angular.module('egAcquisitions',
         resolve : resolver
     });
 
+    $routeProvider.when('/acq/legacy/:noun/:verb/:record', {
+        template: eframe_template,
+        controller: 'EmbedAcqCtl',
+        resolve : resolver
+    });
+
     // default page 
     $routeProvider.otherwise({
         templateUrl : './t_splash',
@@ -25,15 +31,30 @@ angular.module('egAcquisitions',
 }])
 
 .controller('EmbedAcqCtl', 
-       ['$scope','$routeParams','$location','egCore',
-function($scope , $routeParams , $location , egCore) {
+       ['$scope','$routeParams','$location','$window','$timeout','egCore',
+function($scope , $routeParams , $location , $window , $timeout , egCore) {
+
+    var relay_url = function(url) {
+        if (url.match(/\/eg\/acq/)) {
+            var munged_url = egCore.env.basePath + 
+                url.replace(/^.*?\/eg\/acq\//, "acq/legacy/");
+            $timeout(function() { $window.open(munged_url, '_blank') });
+        } else if (url.match(/\/eg\/vandelay/)) {
+            var munged_url = egCore.env.basePath + 
+                url.replace(/^.*?\/eg\/vandelay\/vandelay/, "cat/catalog/vandelay");
+            $timeout(function() { $window.open(munged_url, '_blank') });
+        }
+    }
 
     $scope.funcs = {
         ses : egCore.auth.token(),
+        relay_url : relay_url
     }
 
     var acq_path = '/eg/acq/' + 
-        $routeParams.noun + '/' + $routeParams.verb + location.search;
+        $routeParams.noun + '/' + $routeParams.verb +
+        ((typeof $routeParams.record != 'undefined') ? '/' + $routeParams.record : '')
+        location.search;
 
     $scope.min_height = 2000; // give lots of space to start
 
index 3b48469..0a1c01c 100644 (file)
@@ -1542,7 +1542,7 @@ function($scope , $location) {
 .controller('VandelayCtrl',
        ['$scope','$location',
 function($scope , $location) {
-    $scope.vandelay_url = $location.absUrl().replace(/\/staff.*/, '/vandelay/vandelay');
+    $scope.vandelay_url = $location.absUrl().replace(/\/staff\/cat\/catalog\/vandelay/, '/vandelay/vandelay');
 }])
 
 .controller('ManageAuthoritiesCtrl',