From d824baab48cc547de85fd586e85a6aef7dd784ce Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 25 Mar 2016 09:47:11 -0400 Subject: [PATCH] Bug 16148 - Revised layout and behavior of marc modification template management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes changes to the layout and behavior of the marc modification template management page to make it adhere better to common interaction patterns in Koha. - The initial view shows a list of templates rather than pre-selecting the first available template for editing. - A toolbar has been added with a "New template" button. - The initial view of existing templates has an actions menu containing menu items for 'Edit actions,' 'Duplicate,' and 'Delete.' It doesn't appear to be possible to edit an existing template's name. - The "Create template" form is no longer shown all the time. - Clicking the "New template" toolbar button triggers a modal with the form for creating a template. An existing template can be chosen to duplicate. - Choosing "Duplicate" from one of the template menus triggers the "New template" modal and preselects the corresponding template in the "duplicate" - [% FOREACH TemplatesLoo IN TemplatesLoop %] - [% IF ( TemplatesLoo.selected ) %] - - [% ELSE %] - - [% END %] - [% END %] - - - - - -
- - - -
- - - [% IF ( ActionsLoop ) %] - - + [% IF ( template_id == '' ) %] - - - - - - - - +

MARC modification templates [% template_id %]

- [% FOREACH ActionsLoo IN ActionsLoop %] +
Actions for this template
Change orderOrderActionDescription  
+ - - - - - - - + + - [% END %] + + + [% FOREACH TemplatesLoo IN TemplatesLoop %] + + + + + [% END %] +
- - Go up - - - - Go top - - - - Go bottom - - - - Go down - - [% ActionsLoo.ordering %] - [% IF ( ActionsLoo.action_delete_field ) %] Delete [% END %] - [% IF ( ActionsLoo.action_update_field ) %] Update [% END %] - [% IF ( ActionsLoo.action_move_field ) %] Move [% END %] - [% IF ( ActionsLoo.action_copy_field ) %] Copy [% END %] - [% IF ( ActionsLoo.action_copy_and_replace_field ) %] Copy and replace [% END %] - - [% UNLESS ( ActionsLoo.action_update_field ) %] - [% IF ( ActionsLoo.field_number ) %] - 1st - [% END %] - [% END %] - - field - - [% ActionsLoo.from_field %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield %][% END %] - - [% IF ( ActionsLoo.field_value ) %] - with value [% ActionsLoo.field_value %] - [% END %] - - [% IF ( ActionsLoo.to_field ) %] - to [% ActionsLoo.to_field %][% IF ( ActionsLoo.to_subfield ) %]$[% ActionsLoo.to_subfield %][% END %] - - [% IF ( ActionsLoo.to_regex_search ) %] - using RegEx s/[% ActionsLoo.to_regex_search %]/[% ActionsLoo.to_regex_replace %]/[% ActionsLoo.to_regex_modifiers %] - [% END %] - [% END %] - - [% IF ( ActionsLoo.conditional ) %] - [% IF ( ActionsLoo.conditional_if ) %] if [% END %] - [% IF ( ActionsLoo.conditional_unless ) %] unless [% END %] - - [% ActionsLoo.conditional_field %][% IF ( ActionsLoo.conditional_subfield ) %]$[% ActionsLoo.conditional_subfield %][% END %] - - [% IF ( ActionsLoo.conditional_comparison_exists ) %] exists [% END %] - [% IF ( ActionsLoo.conditional_comparison_not_exists ) %] does not exist [% END %] - [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %] - [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %] - - [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %] - [% ActionsLoo.conditional_value %] - [% IF ( ActionsLoo.conditional_regex ) %]/[% END %] - [% END %] - [% ActionsLoo.description %]EditDeleteTemplateActions
[% TemplatesLoo.name %] +
+ + +
+
+ [% ELSE %] -

There are no defined actions for this template.

- [% END %] -
- -
- Add a new action - - - - - - + + + + + - - field(s) + + + + + field(s) - + - -

+

- + -

-
+ + + + [% END %] [% ELSE %]

There are no defined templates. Please create a template first.

- [% END %] - -
-
- Create a new template - - - - Required - - - - - [% IF ( template_id ) %] - - - - [% END %] -
-
+ [% END # /IF TemplatesLoop %] + + + @@ -287,5 +356,5 @@ [% INCLUDE 'tools-menu.inc' %] - + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/tools/marc_modification_templates.pl b/tools/marc_modification_templates.pl index 10589e4..b2cc3f1 100755 --- a/tools/marc_modification_templates.pl +++ b/tools/marc_modification_templates.pl @@ -113,11 +113,6 @@ if ( $op eq "create_template" ) { my @templates = GetModificationTemplates( $template_id ); -unless ( $template_id ) { - $template_id = $templates[0]->{'template_id'}; - @templates = GetModificationTemplates( $template_id ); -} - my @actions = GetModificationTemplateActions( $template_id ); foreach my $action ( @actions ) { $action->{'action_delete_field'} = ( $action->{'action'} eq 'delete_field' ); -- 1.7.10.4