From 803bfe7e91035e00818f8c609f8c59c633048e48 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 3 Sep 2015 15:47:21 +0000 Subject: [PATCH] webstaff: implement Create New MARC Record Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../src/templates/staff/cat/catalog/t_new_bib.tt2 | 13 +++++ Open-ILS/src/templates/staff/navbar.tt2 | 6 +++ .../web/js/ui/default/staff/cat/catalog/app.js | 62 ++++++++++++++++++++++ .../js/ui/default/staff/cat/services/marcedit.js | 7 +++ 4 files changed, 88 insertions(+) create mode 100644 Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 new file mode 100644 index 0000000000..fdc9757bb0 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/catalog/t_new_bib.tt2 @@ -0,0 +1,13 @@ +
+
+
+ + +
+ + +
+
+
+ +
diff --git a/Open-ILS/src/templates/staff/navbar.tt2 b/Open-ILS/src/templates/staff/navbar.tt2 index 52b44489ce..0c8748bde3 100644 --- a/Open-ILS/src/templates/staff/navbar.tt2 +++ b/Open-ILS/src/templates/staff/navbar.tt2 @@ -222,6 +222,12 @@
  • + + + [% l('Create New MARC Record') %] + +
  • +
  • [% l('Import Record from Z39.50') %] diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 3dcea572e5..2608418a1e 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -45,6 +45,12 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod' resolve : resolver }); + $routeProvider.when('/cat/catalog/new_bib', { + templateUrl: './cat/catalog/t_new_bib', + controller: 'NewBibCtrl', + resolve : resolver + }); + // create some catalog page-specific mappings $routeProvider.when('/cat/catalog/record/:record_id', { templateUrl: './cat/catalog/t_catalog', @@ -163,6 +169,62 @@ function($scope , $routeParams , $location , $q , egCore ) { }]) +.controller('NewBibCtrl', + ['$scope','$routeParams','$location','$window','$q','egCore', + 'egGridDataProvider','egHoldGridActions','$timeout','holdingsSvc', +function($scope , $routeParams , $location , $window , $q , egCore) { + + $scope.have_template = false; + $scope.marc_template = ''; + $scope.stop_unload = false; + $scope.template_list = []; + $scope.template_name = ''; + $scope.new_bib_id = 0; + + egCore.net.request( + 'open-ils.cat', + 'open-ils.cat.marc_template.types.retrieve' + ).then(function(resp) { + angular.forEach(resp, function(name) { + $scope.template_list.push(name); + }); + $scope.template_list.sort(); + }); + egCore.hatch.getItem('cat.default_bib_marc_template').then(function(template) { + $scope.template_name = template; + }); + + $scope.loadTemplate = function() { + if ($scope.template_name) { + egCore.net.request( + 'open-ils.cat', + 'open-ils.cat.biblio.marc_template.retrieve', + $scope.template_name + ).then(function(template) { + $scope.marc_template = template; + $scope.have_template = true; + }); + } + } + + $scope.setDefaultTemplate = function() { + var hatch_key = "cat.default_bib_marc_template"; + if ($scope.template_name) { + egCore.hatch.setItem(hatch_key, $scope.template_name); + } else { + egCore.hatch.removeItem(hatch_key); + } + } + + $scope.$watch('new_bib_id', function(newVal, oldVal) { + if (newVal) { + $location.path('/cat/catalog/record/' + $scope.new_bib_id); + } + }); + + +}]) + .controller('CatalogCtrl', ['$scope','$routeParams','$location','$window','$q','egCore','egHolds','egCirc', 'egGridDataProvider','egHoldGridActions','$timeout','holdingsSvc', diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js index f45376aa35..b420749ce0 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js @@ -1026,6 +1026,13 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) } } ); + $scope.$watch('marcXml', + function(newVal, oldVal) { + if (newVal && newVal !== oldVal) { + loadRecord(); + } + } + ); var unregister = $scope.$watch(function() { return egTagTable.initialized(); -- 2.11.0