From 4e93a8bd0d240a10ec545c927ca92864efba95e9 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 10 Jun 2016 18:21:31 -0400 Subject: [PATCH] webstaff: add admin interface for MARC tag tables This is a simple interface using eg-edit-fm-record to start; more work will be required to better deal with the semantics for overriding tag definitions at various levels of the OU hierarchy. Signed-off-by: Galen Charlton --- .../staff/admin/server/config/marc_field.tt2 | 53 +++++++++++++ .../src/templates/staff/admin/server/t_splash.tt2 | 3 +- .../staff/admin/server/config/marc_field.js | 88 ++++++++++++++++++++++ 3 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/templates/staff/admin/server/config/marc_field.tt2 create mode 100644 Open-ILS/web/js/ui/default/staff/admin/server/config/marc_field.js diff --git a/Open-ILS/src/templates/staff/admin/server/config/marc_field.tt2 b/Open-ILS/src/templates/staff/admin/server/config/marc_field.tt2 new file mode 100644 index 0000000000..3316ab61e0 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/server/config/marc_field.tt2 @@ -0,0 +1,53 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("MARC Tag Tables"); + ctx.page_app = "egAdminConfig"; + ctx.page_ctrl = 'MarcField'; +%] + +[% BLOCK APP_JS %] + + + + + +[% END %] + +
+
+ [% l('MARC Tag Tables') %] +
+
+ +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + +[% END %] diff --git a/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 b/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 index 14319421c6..231dd5c679 100644 --- a/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 +++ b/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 @@ -44,6 +44,7 @@ ,[ l('MARC Search/Facet Classes'), "./admin/server/config/metabib_class" ] ,[ l('MARC Search/Facet Field FTS Maps'), "./admin/server/config/metabib_field_ts_map" ] ,[ l('MARC Search/Facet Fields'), "./admin/server/config/metabib_field" ] + ,[ l('MARC Tag Tables'), "./admin/server/config/marc_field" ] ,[ l('Org Unit Proximity Adjustments'), "./admin/server/config/org_unit_proximity_adjustment" ] ,[ l('Organization Types'), "./admin/server/legacy/actor/org_unit_type" ] ,[ l('Org Unit Setting Types'), "./admin/server/config/org_unit_setting_type" ] @@ -59,7 +60,7 @@ ,[ l('Z39.50 Servers'), "./admin/server/config/z3950_source" ] ]; - USE table(interfaces, rows=16); + USE table(interfaces, rows=17); %] [% FOREACH row = table.rows %] diff --git a/Open-ILS/web/js/ui/default/staff/admin/server/config/marc_field.js b/Open-ILS/web/js/ui/default/staff/admin/server/config/marc_field.js new file mode 100644 index 0000000000..fe6f93ff4a --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/server/config/marc_field.js @@ -0,0 +1,88 @@ +angular.module('egAdminConfig', + ['ngRoute','ui.bootstrap','egCoreMod','egUiMod','egGridMod','egFmRecordEditorMod']) + +.controller('MarcField', + ['$scope','$q','$timeout','$location','$window','$uibModal','egCore','egGridDataProvider', + 'egConfirmDialog', +function($scope , $q , $timeout , $location , $window , $uibModal , egCore , egGridDataProvider , + egConfirmDialog) { + + egCore.startup.go(); // standalone mode requires manual startup + + $scope.marc_record_type = 'biblio'; + $scope.$watch('marc_record_type', function(newVal, oldVal) { + if (newVal != oldVal) { + $scope.gridControls.setQuery(generateQuery($scope.marc_record_type)); + $scope.gridControls.refresh(); + } + }); + + $scope.new_record = function() { + spawn_editor(); + } + + $scope.edit_record = function(items) { + if (items.length != 1) return; + spawn_editor(items[0].id); + } + + spawn_editor = function(id) { + var templ; + if (arguments.length == 1) { + templ = ''; + } else { + templ = ''; + } + gridControls = $scope.gridControls; + $uibModal.open({ + template : templ, + controller : [ + '$scope', '$uibModalInstance', + function($scope , $uibModalInstance) { + $scope.id = id; + + $scope.ok = function($event) { + $uibModalInstance.close(); + gridControls.refresh(); + } + + $scope.cancel = function($event) { + $uibModalInstance.dismiss(); + } + } + ] + }); + } + + $scope.delete_record = function(selected) { + if (!selected || !selected.length) return; + + egCore.pcrud.retrieve('cmrcfld', selected[0].id).then(function(rec) { + egConfirmDialog.open( + egCore.strings.EG_CONFIRM_DELETE_RECORD_TITLE, + egCore.strings.EG_CONFIRM_DELETE_RECORD_BODY, + { id : rec.id() } // TODO replace with selector if available? + ).result.then(function() { + egCore.pcrud.remove(rec).then(function() { + $scope.gridControls.refresh(); + }); + }); + }); + } + + function generateQuery(marc_record_type) { + return { + 'id' : { '!=' : null }, + 'marc_record_type' : marc_record_type + } + } + + $scope.gridControls = { + setQuery : function() { + return generateQuery($scope.marc_record_type); + }, + setSort : function() { + return ['tag']; + } + } +}]) -- 2.11.0