--- /dev/null
+[%
+ WRAPPER "staff/base.tt2";
+ ctx.page_title = l("Copy Tags");
+ ctx.page_app = "egAdminConfig";
+ ctx.page_ctrl = 'CopyTag';
+%]
+
+[% 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/local/asset/copy_tag.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('Copy Tags') %]
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-md-4">
+ <div class="form-group">
+ <label>[% l('Filter by Owning Library:') %]</label>
+ <eg-org-selector selected="context_org" onchange="org_changed"></eg-org-selector>
+ </div>
+ </div>
+</div>
+
+<eg-grid
+ id-field="id"
+ idl-class="acpt"
+ grid-controls="gridControls"
+ features="-multiselect"
+ persist-key="admin.server.asset.copy_tag">
+
+ <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('Owner') %]" flesher="orgById" path="owner.name"></eg-grid-field>
+ <eg-grid-field label="[% l('Tag Type') %]" path="tag_type.label"></eg-grid-field>
+ <eg-grid-field label="[% l('Label') %]" path="label"></eg-grid-field>
+ <eg-grid-field label="[% l('Is OPAC Visible?') %]" path="pub"></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('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" ]
--- /dev/null
+[%
+ WRAPPER "staff/base.tt2";
+ ctx.page_title = l("Copy Tag Types");
+ ctx.page_app = "egAdminConfig";
+ ctx.page_ctrl = 'CopyTagType';
+%]
+
+[% 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/copy_tag_type.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('Copy Tag Types') %]
+ </div>
+</div>
+
+<eg-grid
+ id-field="code"
+ idl-class="cctt"
+ grid-controls="gridControls"
+ features="-multiselect"
+ persist-key="admin.server.config.copy_tag_type">
+
+ <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('Code') %]" path="code"></eg-grid-field>
+ <eg-grid-field label="[% l('Label') %]" path="label"></eg-grid-field>
+ <eg-grid-field label="[% l('Owner') %]" flesher="orgById" path="owner.name"></eg-grid-field>
+</eg-grid>
+
+[% END %]
,[ 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" ]
--- /dev/null
+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 = '<eg-edit-fm-record idl-class="acpt" mode="update" record-id="id" on-save="ok" on-cancel="cancel"></eg-edit-fm-record>';
+ } else {
+ templ = '<eg-edit-fm-record idl-class="acpt" 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('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();
+ }
+
+}])
--- /dev/null
+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 = '<eg-edit-fm-record idl-class="cctt" mode="update" record-id="code" on-save="ok" on-cancel="cancel"></eg-edit-fm-record>';
+ } else {
+ templ = '<eg-edit-fm-record idl-class="cctt" 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.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'];
+ }
+ }
+}])