webstaff: add support for editing authority records
authorGalen Charlton <gmc@esilibrary.com>
Fri, 28 Aug 2015 00:45:23 +0000 (00:45 +0000)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:16 +0000 (15:44 -0400)
This adds basic support for invoking the MARC editor on
authority records, and fixes a couple bugs discovered
along the way. The route currently supported is

/cat/catalog/authority/:authority_id/marc_edit

In the future, some sort of summary view of an authority
record might be added, in which case the route
"/cat/catalog/authority/:authority_id" is available.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/templates/staff/cat/catalog/t_authority.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js
Open-ILS/web/js/ui/default/staff/cat/services/tagtable.js

diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_authority.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_authority.tt2
new file mode 100644 (file)
index 0000000..cfacc96
--- /dev/null
@@ -0,0 +1,3 @@
+<div ng-show="authority_id" class="row col-md-12">
+  <eg-marc-edit-record dirty-flag="stop_unload" record-id="authority_id" record-type="are" />
+</div>
index 68a9ac5..f450316 100644 (file)
             <eg-marc-edit-fixed-field fixed-field="SubjUse" record="record"></eg-marc-edit-fixed-field>
             <eg-marc-edit-fixed-field fixed-field="SerUse" record="record"></eg-marc-edit-fixed-field>
             <eg-marc-edit-fixed-field fixed-field="TypeSubd" record="record"></eg-marc-edit-fixed-field>
-            <eg-marc-edit-fixed-field fixed-field="GovAgn" record="record"></eg-marc-edit-fixed-field>
+            <eg-marc-edit-fixed-field fixed-field="GovtAgn" record="record"></eg-marc-edit-fixed-field>
             <eg-marc-edit-fixed-field fixed-field="RefStatus" record="record"></eg-marc-edit-fixed-field>
             <eg-marc-edit-fixed-field fixed-field="UpdStatus" record="record"></eg-marc-edit-fixed-field>
         </div>
index 358e97e..c31adcc 100644 (file)
@@ -78,6 +78,12 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod'
         resolve : resolver
     });
 
+    $routeProvider.when('/cat/catalog/authority/:authority_id/marc_edit', {
+        templateUrl: './cat/catalog/t_authority',
+        controller: 'AuthorityCtrl',
+        resolve : resolver
+    });
+
     $routeProvider.otherwise({redirectTo : '/cat/catalog/index'});
 })
 
@@ -562,6 +568,19 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
 
 }])
 
+.controller('AuthorityCtrl',
+       ['$scope','$routeParams','$location','$window','$q','egCore',
+function($scope , $routeParams , $location , $window , $q , egCore) {
+
+    // set record ID on page load if available...
+    $scope.authority_id = $routeParams.authority_id;
+
+    if ($routeParams.authority_id) $scope.from_route = true;
+    else $scope.from_route = false;
+
+    $scope.stop_unload = false;
+}])
+
 .controller('URLVerifyCtrl',
        ['$scope','$location',
 function($scope , $location) {
index 8f52306..1345415 100644 (file)
@@ -469,7 +469,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                 $scope.controlfields = [];
                 $scope.datafields = [];
 
-                egTagTable.loadTagTable();
+                egTagTable.loadTagTable({ marcRecordType : $scope.record_type });
 
                 $scope.saveFlatTextMARC = function () {
                     $scope.record = new MARC21.Record({ marcbreaker : $scope.flat_text_marc });
index f4d5e97..f726f2e 100644 (file)
@@ -36,7 +36,7 @@ function($q,   egCore,   egAuth) {
                 fields.marcFormat = args.marcFormat;
             }
             if (args.marcRecordType) {
-                fields.marcFormat = service.normalizeRecordType(args.marcFormat);
+                fields.marcRecordType = service.normalizeRecordType(args.marcRecordType);
             }
         }
         var tt_key = 'current_tag_table_' + fields.marcFormat + '_' +