1 angular.module('egAcquisitions',
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 allow-escape="true" min-height="min_height" url="acq_url" handlers="funcs"></eg-embed-frame>';
14 $routeProvider.when('/acq/legacy/:noun/:verb', {
15 template: eframe_template,
16 controller: 'EmbedAcqCtl',
20 $routeProvider.when('/acq/legacy/:noun/:verb/:record', {
21 template: eframe_template,
22 controller: 'EmbedAcqCtl',
27 $routeProvider.otherwise({
28 templateUrl : './t_splash',
33 .controller('EmbedAcqCtl',
34 ['$scope','$routeParams','$location','$window','$timeout','egCore',
35 function($scope , $routeParams , $location , $window , $timeout , egCore) {
37 var relay_url = function(url) {
38 if (url.match(/\/eg\/acq/)) {
39 var munged_url = egCore.env.basePath +
40 url.replace(/^.*?\/eg\/acq\//, "acq/legacy/");
41 $timeout(function() { $window.open(munged_url, '_blank') });
42 } else if (url.match(/\/eg\/vandelay/)) {
43 var munged_url = egCore.env.basePath +
44 url.replace(/^.*?\/eg\/vandelay\/vandelay/, "cat/catalog/vandelay");
45 $timeout(function() { $window.open(munged_url, '_blank') });
49 // minimal version sufficient to update copy barcodes
50 var volume_item_creator = function(params) {
53 'open-ils.actor.anon_cache.set_value',
54 null, 'edit-these-copies', {
55 copies: params.existing_copies.map(function(acp) { return acp.id(); }),
60 ).then(function(key) {
62 var url = egCore.env.basePath + 'cat/volcopy/' + key;
63 $timeout(function() { $window.open(url, '_blank') });
65 alert('Could not create anonymous cache key!');
71 ses : egCore.auth.token(),
72 relay_url : relay_url,
73 volume_item_creator : volume_item_creator
76 var acq_path = '/eg/acq/' +
77 $routeParams.noun + '/' + $routeParams.verb +
78 ((typeof $routeParams.record != 'undefined') ? '/' + $routeParams.record : '') +
81 $scope.min_height = 2000; // give lots of space to start
83 // embed URL must include protocol/domain or it will be loaded via
84 // push-state, resulting in an infinitely nested pages.
86 $location.absUrl().replace(/\/eg\/staff.*/, acq_path);
88 console.log('Loading Acq URL: ' + $scope.acq_url);