From 2fb9b57a8d4c8b365f5fc305e4df6cc416ad402f Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 28 Feb 2017 18:30:14 +0000 Subject: [PATCH] add admin interface for authority.heading_field Signed-off-by: Galen Charlton --- Open-ILS/examples/fm_IDL.xml | 8 +++ .../staff/admin/server/authority/heading_field.tt2 | 40 +++++++++++ .../src/templates/staff/admin/server/t_splash.tt2 | 1 + .../staff/admin/server/authority/heading_field.js | 79 ++++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 Open-ILS/src/templates/staff/admin/server/authority/heading_field.tt2 create mode 100644 Open-ILS/web/js/ui/default/staff/admin/server/authority/heading_field.js diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 7949f02756..0a9135a3c2 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2683,6 +2683,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + diff --git a/Open-ILS/src/templates/staff/admin/server/authority/heading_field.tt2 b/Open-ILS/src/templates/staff/admin/server/authority/heading_field.tt2 new file mode 100644 index 0000000000..51a7047d2c --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/server/authority/heading_field.tt2 @@ -0,0 +1,40 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Authority Heading Fields"); + ctx.page_app = "egAdminConfig"; + ctx.page_ctrl = 'AuthorityHeadingField'; +%] + +[% BLOCK APP_JS %] + + + + + +[% END %] + +
+
+ [% l('Authority Heading Fields') %] +
+
+ + + + + + + + + + + + + + +[% 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 193212030b..0e0306a1ff 100644 --- a/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 +++ b/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 @@ -14,6 +14,7 @@ ,[ l('Asset Stat Cat Sip Fields'), "./admin/server/config/asset_sip_fields" ] ,[ l('Authority Browse Axes'), "./admin/server/cat/authority/browse_axis" ] ,[ l('Authority Control Sets'), "./admin/server/cat/authority/control_set" ] + ,[ l('Authority Heading Fields'), "./admin/server/authority/heading_field" ] ,[ l('Authority Thesauri'), "./admin/server/cat/authority/thesaurus" ] ,[ l('Best-Hold Selection Sort Order'), "./admin/server/config/best_hold_order" ] ,[ l('Billing Types'), "./admin/server/config/billing_type" ] diff --git a/Open-ILS/web/js/ui/default/staff/admin/server/authority/heading_field.js b/Open-ILS/web/js/ui/default/staff/admin/server/authority/heading_field.js new file mode 100644 index 0000000000..1542219eb6 --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/server/authority/heading_field.js @@ -0,0 +1,79 @@ +angular.module('egAdminConfig', + ['ngRoute','ui.bootstrap','egCoreMod','egUiMod','egGridMod','egFmRecordEditorMod']) + +.controller('AuthorityHeadingField', + ['$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.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('ahf', 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() { + return { + 'id' : { '!=' : null } + } + } + + $scope.gridControls = { + setQuery : function() { + return generateQuery(); + }, + setSort : function() { + return ['heading_type','heading_purpose']; + } + } +}]) -- 2.11.0