--- /dev/null
+[%
+ WRAPPER "staff/base.tt2";
+ ctx.page_title = l("MARC Tag Tables");
+ ctx.page_app = "egAdminConfig";
+ ctx.page_ctrl = 'MarcField';
+%]
+
+[% BLOCK APP_JS %]
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/grid.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/fm_record_editor.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/admin/server/config/marc_field.js"></script>
+<link rel="stylesheet" href="[% ctx.base_path %]/staff/css/admin.css" />
+[% END %]
+
+<div class="container-fluid" style="text-align:center">
+ <div class="alert alert-info alert-less-pad strong-text-2">
+ [% l('MARC Tag Tables') %]
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-md-2">
+ <div class="form-group">
+ <label>[% l('MARC Record Type') %]</label>
+ <select class="form-control" ng-model="marc_record_type">
+ <option value="biblio">[% l('Bibliographic') %]</option>
+ <option value="authority">[% l('Authority') %]</option>
+ <option value="serial">[% l('Holdings') %]</option>
+ </select>
+ </div>
+ </div>
+</div>
+
+<eg-grid
+ id-field="id"
+ idl-class="cmrcfld"
+ grid-controls="gridControls"
+ features="-multiselect"
+ persist-key="admin.server.config.marc_field">
+
+ <eg-grid-menu-item handler="new_record" label="[% l('New Record') %]"></eg-grid-menu-item>
+ <eg-grid-action handler="edit_record" label="[% l('Edit Record') %]"></eg-grid-action>
+ <eg-grid-action handler="delete_record" label="[% l('Delete Record') %]"></eg-grid-action>
+
+ <eg-grid-field label="[% l('Tag') %]" path="tag"></eg-grid-field>
+ <eg-grid-field label="[% l('Name') %]" path="name"></eg-grid-field>
+ <eg-grid-field label="[% l('Description') %]" path="description"></eg-grid-field>
+ <eg-grid-field label="[% l('ID') %]" path='id' required hidden></eg-grid-field>
+ <eg-grid-field path='*' hidden></eg-grid-field>
+</eg-grid>
+
+[% END %]
,[ 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" ]
,[ l('Z39.50 Servers'), "./admin/server/config/z3950_source" ]
];
- USE table(interfaces, rows=16);
+ USE table(interfaces, rows=17);
%]
[% FOREACH row = table.rows %]
--- /dev/null
+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 = '<eg-edit-fm-record idl-class="cmrcfld" mode="update" record-id="id" on-save="ok" on-cancel="cancel"></eg-edit-fm-record>';
+ } else {
+ templ = '<eg-edit-fm-record idl-class="cmrcfld" mode="create" on-save="ok" on-cancel="cancel"></eg-edit-fm-record>';
+ }
+ 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'];
+ }
+ }
+}])