From 8f6e436a78efc5aa11164dadb5c868f34b0f2d19 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 30 Mar 2017 17:08:19 -0400 Subject: [PATCH] LP#1673857: admin interfaces for copy tag types and copy tags This patch adds standard administration interfaces to manage copy tag types (Server Administration) and copy tags (Local Administration) Signed-off-by: Galen Charlton Signed-off-by: Josh Stompro Signed-off-by: Galen Charlton --- .../staff/admin/local/asset/copy_tag.tt2 | 50 +++++++++++ .../templates/staff/admin/local/t_splash.tt2 | 1 + .../admin/server/config/copy_tag_type.tt2 | 38 ++++++++ .../templates/staff/admin/server/t_splash.tt2 | 1 + .../staff/admin/local/asset/copy_tag.js | 90 +++++++++++++++++++ .../admin/server/config/copy_tag_type.js | 73 +++++++++++++++ 6 files changed, 253 insertions(+) create mode 100644 Open-ILS/src/templates/staff/admin/local/asset/copy_tag.tt2 create mode 100644 Open-ILS/src/templates/staff/admin/server/config/copy_tag_type.tt2 create mode 100644 Open-ILS/web/js/ui/default/staff/admin/local/asset/copy_tag.js create mode 100644 Open-ILS/web/js/ui/default/staff/admin/server/config/copy_tag_type.js diff --git a/Open-ILS/src/templates/staff/admin/local/asset/copy_tag.tt2 b/Open-ILS/src/templates/staff/admin/local/asset/copy_tag.tt2 new file mode 100644 index 0000000000..82d93bc441 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/local/asset/copy_tag.tt2 @@ -0,0 +1,50 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Copy Tags"); + ctx.page_app = "egAdminConfig"; + ctx.page_ctrl = 'CopyTag'; +%] + +[% BLOCK APP_JS %] + + + + + +[% END %] + +
+
+ [% l('Copy Tags') %] +
+
+ +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + +[% END %] diff --git a/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 b/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 index 22878a1365..cdcccb7967 100644 --- a/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 +++ b/Open-ILS/src/templates/staff/admin/local/t_splash.tt2 @@ -20,6 +20,7 @@ ,[ l('Copy Location Groups'), "./admin/local/asset/copy_location_group" ] ,[ l('Copy Location Order'), "./admin/local/asset/copy_location_order" ] ,[ l('Copy Locations Editor'), "./admin/local/asset/copy_locations" ] + ,[ l('Copy Tags'), "./admin/local/asset/copy_tag" ] ,[ l('Field Documentation'), "./admin/local/config/idl_field_doc" ] ,[ l('Group Penalty Thresholds'), "./admin/local/permission/grp_penalty_threshold" ] ,[ l('Hold Policies'), "./admin/local/config/hold_matrix_matchpoint" ] diff --git a/Open-ILS/src/templates/staff/admin/server/config/copy_tag_type.tt2 b/Open-ILS/src/templates/staff/admin/server/config/copy_tag_type.tt2 new file mode 100644 index 0000000000..676083d316 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/server/config/copy_tag_type.tt2 @@ -0,0 +1,38 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Copy Tag Types"); + ctx.page_app = "egAdminConfig"; + ctx.page_ctrl = 'CopyTagType'; +%] + +[% BLOCK APP_JS %] + + + + + +[% END %] + +
+
+ [% l('Copy Tag Types') %] +
+
+ + + + + + + + + + + + +[% 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 5d8bf43107..36faae3d98 100644 --- a/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 +++ b/Open-ILS/src/templates/staff/admin/server/t_splash.tt2 @@ -26,6 +26,7 @@ ,[ l('Circulation Modifiers'), "./admin/server/config/circ_modifier" ] ,[ l('Circulation Recurring Fine Rules'), "./admin/server/config/rule_recurring_fine" ] ,[ l('Copy Statuses'), "./admin/server/legacy/config/copy_status" ] + ,[ l('Copy Tag Types'), "./admin/server/config/copy_tag_type" ] ,[ l('Custom Org Unit Trees'), "./admin/server/actor/org_unit_custom_tree" ] ,[ l('Floating Groups'), "./admin/server/config/floating_groups" ] ,[ l('Global Flags'), "./admin/server/config/global_flag" ] diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/asset/copy_tag.js b/Open-ILS/web/js/ui/default/staff/admin/local/asset/copy_tag.js new file mode 100644 index 0000000000..3d9ca2ce81 --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/local/asset/copy_tag.js @@ -0,0 +1,90 @@ +angular.module('egAdminConfig', + ['ngRoute','ui.bootstrap','egCoreMod','egUiMod','egGridMod','egFmRecordEditorMod']) + +.controller('CopyTag', + ['$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('acpt', 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() } + ).result.then(function() { + egCore.pcrud.remove(rec).then(function() { + $scope.gridControls.refresh(); + }); + }); + }); + } + + function generateQuery(orgId) { + + // because the orgId is coming from a selector, + // it should always have a value unless the selector + // hasn't been fully initialized yet, in which case + // we want to abort to avoid fetching anything. + if (!orgId) return; + + return { + 'id' : { '!=' : null }, + 'owner' : egCore.org.descendants(orgId, true) + }; + } + $scope.gridControls = { + setQuery : function() { return generateQuery(); }, + setSort : function() { + return ['owner.name', 'label']; + } + } + + $scope.org_changed = function(org) { + $scope.gridControls.setQuery(generateQuery(org.id())); + $scope.gridControls.refresh(); + } + +}]) diff --git a/Open-ILS/web/js/ui/default/staff/admin/server/config/copy_tag_type.js b/Open-ILS/web/js/ui/default/staff/admin/server/config/copy_tag_type.js new file mode 100644 index 0000000000..5d367eba05 --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/server/config/copy_tag_type.js @@ -0,0 +1,73 @@ +angular.module('egAdminConfig', + ['ngRoute','ui.bootstrap','egCoreMod','egUiMod','egGridMod','egFmRecordEditorMod']) + +.controller('CopyTagType', + ['$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].code); + } + + spawn_editor = function(code) { + var templ; + if (arguments.length == 1) { + templ = ''; + } else { + templ = ''; + } + gridControls = $scope.gridControls; + $uibModal.open({ + template : templ, + controller : [ + '$scope', '$uibModalInstance', + function($scope , $uibModalInstance) { + $scope.code = code; + + $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('cctt', selected[0].code).then(function(rec) { + egConfirmDialog.open( + egCore.strings.EG_CONFIRM_DELETE_RECORD_TITLE, + egCore.strings.EG_CONFIRM_DELETE_RECORD_BODY, + { code : rec.code() } + ).result.then(function() { + egCore.pcrud.remove(rec).then(function() { + $scope.gridControls.refresh(); + }); + }); + }); + } + + $scope.gridControls = { + setQuery : function() { + return { 'code' : { '!=' : null } }; + }, + setSort : function() { + return ['code']; + } + } +}]) -- 2.43.2