Bugzilla – Attachment 51575 Details for
Bug 16148
Revised layout and behavior of marc modification template management
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16148 - Revised layout and behavior of marc modification template management
Bug-16148---Revised-layout-and-behavior-of-marc-mo.patch (text/plain), 47.29 KB, created by
Owen Leonard
on 2016-05-17 14:30:11 UTC
(
hide
)
Description:
Bug 16148 - Revised layout and behavior of marc modification template management
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-05-17 14:30:11 UTC
Size:
47.29 KB
patch
obsolete
>From 66b9912c02a926653545e0f06d28e3b356dce215 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 25 Mar 2016 09:47:11 -0400 >Subject: [PATCH] Bug 16148 - Revised layout and behavior of marc modification > template management >Content-Type: text/plain; charset="utf-8" > >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" <select>. > >- When editing actions for a template: > - The breadcrumbs menu now reflects that a template is being modified. > - The template name has been added as a heading. > - A "New action" button appears in the toolbar > - The "Edit" and "Delete" links now have a Bootstrap button style. > - The add/edit form is now hidden by default. > - Clicking "New action" or "edit" shows the add or edit form. > - Clicking "Cancel" in the add/edit form hides the form. > >To test, apply the patch and clear your cache if necessary. > >- Got to Tools -> MARC modification templates >- Test the "New template" button. > - Confirm that new template creation works. > - Confirm that duplicating a template works. >- Test the menu items in the "Actions" menu: > - "Duplicate" should trigger the new template modal and preselect the > template you chose to duplicate. Confirm that the template is > successfully duplicated. > - "Delete" should prompt you to confirm the deletion. Test both > cancelling and confirming this operation. > - "Edit actions" should load the page for adding or editing actions to > a template. Test the operations on this page: New action, edit, > delete, changing action order. > > Note that this patch does not fix Bug 15814, so action descriptions > must still not contain single quotes. >--- > .../modules/tools/marc_modification_templates.tt | 484 ++++++++++++--------- > .../prog/js/marc_modification_templates.js | 39 +- > tools/marc_modification_templates.pl | 5 - > 3 files changed, 306 insertions(+), 222 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >index 8b28e90..082c77e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >@@ -18,19 +18,45 @@ > //]]> > </script> > <script type="text/javascript" src="[% interface %]/[% theme %]/js/marc_modification_templates.js"></script> >+<style type="text/css"> >+ #add_action { display: none; } >+</style> > </head> > > <body id="tools_marc_modification_templates" class="tools"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] > >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › MARC modification templates</div> >+[% IF ( TemplatesLoop ) %] >+ [% FOREACH TemplatesLoo IN TemplatesLoop %] >+ [% IF ( TemplatesLoo.selected ) %] >+ [% SET template_name = TemplatesLoo.name %] >+ [% END %] >+ [% END %] >+[% END %] >+ >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> › >+ <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › >+ [% IF ( template_name ) %] >+ <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">MARC modification templates</a> >+ › [% template_name %] >+ [% ELSE %] >+ MARC modification templates >+ [% END %] >+</div> > > <div id="doc3" class="yui-t2"> > <div id="bd"> > <div id="yui-main"> > <div class="yui-b"> >- <h2>MARC modification templates</h2> >+ >+ <div id="toolbar" class="btn-toolbar"> >+ <a href="#" data-toggle="modal" data-template_id="" data-target="#createTemplate" id="new_template" class="btn btn-small duplicate_template"><i class="fa fa-plus"></i> New template</a> >+ [% IF ( template_id != '' ) %] >+ <a href="#" id="new_action" class="btn btn-small"><i class="fa fa-plus"></i> New action</a> >+ [% END %] >+ </div> > > [% IF error %] > [% IF error == 'no_from_field' %] >@@ -40,246 +66,278 @@ > > [% IF ( TemplatesLoop ) %] > >- <form method="get" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="select_template"> >- <label for="select_template">Template: </label> >- <select name="template_id" id="select_template" style="width:20em;"> >- [% FOREACH TemplatesLoo IN TemplatesLoop %] >- [% IF ( TemplatesLoo.selected ) %] >- <option value="[% TemplatesLoo.template_id %]" selected="selected"> [% TemplatesLoo.name %]</option> >- [% ELSE %] >- <option value="[% TemplatesLoo.template_id %]"> [% TemplatesLoo.name %]</option> >- [% END %] >- [% END %] >- </select> >- <input type="hidden" name="op" value="select_template"> >- <input type="submit" value="Go" /> >- </form> >- >- <form method="get" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="delete_template"> >- <input type="hidden" name="template_id" value="[% template_id %]" /> >- <input type="hidden" name="op" value="delete_template"> >- <input type="submit" value="Delete template" onClick="return confirmDelete()" /> >- </form> >- >- >- [% IF ( ActionsLoop ) %] >- <table> >- <caption>Actions for this template</caption> >+ [% IF ( template_id == '' ) %] > >- <tr> >- <th>Change order</th> >- <th>Order</th> >- <th>Action</th> >- <th>Description</th> >- <th> </th> >- <th> </th> >- </tr> >+ <h2>MARC modification templates [% template_id %]</h2> > >- [% FOREACH ActionsLoo IN ActionsLoop %] >+ <table id="templatest"> >+ <thead> > <tr> >- <td style="white-space:nowrap;"> >- <a title="Move action up" href="marc_modification_templates.pl?op=move_action&where=up&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >- <img src="[% interface %]/[% theme %]/img/go-up.png" alt="Go up" /> >- </a> >- >- <a title="Move action to top" href="marc_modification_templates.pl?op=move_action&where=top&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >- <img src="[% interface %]/[% theme %]/img/go-top.png" alt="Go top" /> >- </a> >- >- <a title="Move action to bottom" href="marc_modification_templates.pl?op=move_action&where=bottom&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >- <img src="[% interface %]/[% theme %]/img/go-bottom.png" alt="Go bottom" /> >- </a> >- >- <a title="Move action down" href="marc_modification_templates.pl?op=move_action&where=down&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >- <img src="[% interface %]/[% theme %]/img/go-down.png" alt="Go down" /> >- </a> >- </td> >- >- <td>[% ActionsLoo.ordering %]</td> >- <td> >- [% 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 <i>[% ActionsLoo.field_value %]</i> >- [% 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<strong>/[% ActionsLoo.to_regex_search %]/[% ActionsLoo.to_regex_replace %]/[% ActionsLoo.to_regex_modifiers %]</strong> >- [% 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 %] >- <strong>[% ActionsLoo.conditional_value %]</strong> >- [% IF ( ActionsLoo.conditional_regex ) %]/[% END %] >- [% END %] >- </td> >- <td>[% ActionsLoo.description %]</td> >- <td><a href="#modaction" onclick='editAction( >- "[% ActionsLoo.mmta_id |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.ordering |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.action |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.field_number |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.from_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.from_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.field_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.to_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.to_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.to_regex_search |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.to_regex_replace |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.to_regex_modifiers |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.conditional |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.conditional_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.conditional_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.conditional_comparison |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.conditional_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.conditional_regex |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >- "[% ActionsLoo.description |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]" >- );updateAllEvery();'>Edit</a></td> >- <td><a href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id %]" onclick="return confirmDeleteAction();">Delete</a></td> >+ <th>Template</th> >+ <th>Actions</th> > </tr> >- [% END %] >+ </thead> >+ <tbody> >+ [% FOREACH TemplatesLoo IN TemplatesLoop %] >+ <tr> >+ <td>[% TemplatesLoo.name %]</td> >+ <td class="actions"> >+ <a class="btn btn-mini" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id %]&op=select_template" ><i class="fa fa-fw fa-pencil"></i> Edit actions</a> >+ <a class="btn btn-mini duplicate_template" href="#" data-toggle="modal" data-template_id="[% TemplatesLoo.template_id %]" data-target="#createTemplate"><i class="fa fa-fw fa-copy"></i> Duplicate</a> >+ <a class="btn btn-mini" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id %]&op=delete_template" class="delete_template" onclick="return confirmDeleteAction();"><i class="fa fa-fw fa-trash"></i> Delete</a> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> > </table> >+ > [% ELSE %] >- <div class="dialog message"><p>There are no defined actions for this template.</p></div> >- [% END %] > >- <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_action" > >- <a name="modaction"></a> >- <fieldset> >- <legend id="modaction_legend">Add a new action</legend> >- <div id="warning_multivalued" style="color:red; display:none;">You have chosen a condition on the same field as the original field. If your records contain multivalued fields it is highly recommended not to do that.</div> >- >- <select name="action" id="action" onchange="onActionChange(this);"> >- <option value="delete_field">Delete</option> >- <option value="update_field">Add/Update</option> >- <option value="move_field">Move</option> >- <option value="copy_field">Copy</option> >- <option value="copy_and_replace_field">Copy and replace</option> >- </select> >- >- <span id="field_number_block"> >- <select name="field_number" id="field_number"> >- <option value="0">All</option> >- <option value="1">1st</option> >+ <h2>Actions for <i>[% template_name %]</i></h2> >+ >+ [% IF ( ActionsLoop ) %] >+ >+ <table id="template_actions" class="template_actions"> >+ <thead> >+ <tr> >+ <th>Change order</th> >+ <th>Order</th> >+ <th>Action</th> >+ <th>Description</th> >+ <th> </th> >+ <th> </th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH ActionsLoo IN ActionsLoop %] >+ <tr> >+ <td class="actions"> >+ <a title="Move action up" href="marc_modification_templates.pl?op=move_action&where=up&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >+ <img src="[% interface %]/[% theme %]/img/go-up.png" alt="Move action up" /> >+ </a> >+ >+ <a title="Move action to top" href="marc_modification_templates.pl?op=move_action&where=top&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >+ <img src="[% interface %]/[% theme %]/img/go-top.png" alt="Move action to the top" /> >+ </a> >+ >+ <a title="Move action to bottom" href="marc_modification_templates.pl?op=move_action&where=bottom&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >+ <img src="[% interface %]/[% theme %]/img/go-bottom.png" alt="Move action to the bottom" /> >+ </a> >+ >+ <a title="Move action down" href="marc_modification_templates.pl?op=move_action&where=down&template_id=[% ActionsLoo.template_id %]&mmta_id=[% ActionsLoo.mmta_id %]"> >+ <img src="[% interface %]/[% theme %]/img/go-down.png" alt="Move action down" /> >+ </a> >+ </td> >+ >+ <td>[% ActionsLoo.ordering %]</td> >+ <td> >+ [% 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 <i>[% ActionsLoo.field_value %]</i> >+ [% 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<strong>/[% ActionsLoo.to_regex_search %]/[% ActionsLoo.to_regex_replace %]/[% ActionsLoo.to_regex_modifiers %]</strong> >+ [% 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 %] >+ <strong>[% ActionsLoo.conditional_value %]</strong> >+ [% IF ( ActionsLoo.conditional_regex ) %]/[% END %] >+ [% END %] >+ </td> >+ <td>[% ActionsLoo.description %]</td> >+ <td> >+ <a class="btn btn-mini" href="#modaction" onclick='editAction( >+ "[% ActionsLoo.mmta_id |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.ordering |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.action |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.field_number |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.from_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.from_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.field_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.to_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.to_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.to_regex_search |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.to_regex_replace |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.to_regex_modifiers |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.conditional |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.conditional_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.conditional_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.conditional_comparison |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.conditional_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.conditional_regex |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]", >+ "[% ActionsLoo.description |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]" >+ );updateAllEvery();'><i class="fa fa-pencil"></i> Edit</a> >+ </td> >+ <td> >+ <a class="btn btn-mini" href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id %]" onclick="return confirmDeleteAction();"><i class="fa fa-trash"></i> Delete</a> >+ </td> >+ </tr> >+ [% END # /FOREACH ActionsLoo %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <div class="dialog message template_actions"><p>There are no defined actions for this template.</p></div> >+ [% END # /IF ActionsLoop %] >+ >+ <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_action" > >+ <a name="modaction"></a> >+ <fieldset> >+ <legend id="modaction_legend">Add a new action</legend> >+ <div id="warning_multivalued" style="color:red; display:none;">You have chosen a condition on the same field as the original field. If your records contain multivalued fields it is highly recommended not to do that.</div> >+ >+ <select name="action" id="action" onchange="onActionChange(this);"> >+ <option value="delete_field">Delete</option> >+ <option value="update_field">Add/Update</option> >+ <option value="move_field">Move</option> >+ <option value="copy_field">Copy</option> >+ <option value="copy_and_replace_field">Copy and replace</option> > </select> >- </span> > >- field(s) <input type="text" name="from_field" id="from_field" size="3" maxlength="3" /> <input type="text" name="from_subfield" id="from_subfield" size="1" maxlength="1" title="let blank for the entire field" /> >+ <span id="field_number_block"> >+ <select name="field_number" id="field_number"> >+ <option value="0">All</option> >+ <option value="1">1st</option> >+ </select> >+ </span> >+ >+ field(s) <input type="text" name="from_field" id="from_field" size="3" maxlength="3" /> <input type="text" name="from_subfield" id="from_subfield" size="1" maxlength="1" title="let blank for the entire field" /> > >- <span name="with_value_block" id="with_value_block" style="display:none;"> >- with value <input type="text" name="field_value" id="field_value" /> >- </span> >+ <span name="with_value_block" id="with_value_block" style="display:none;"> >+ with value <input type="text" name="field_value" id="field_value" /> >+ </span> > >- <span name="to_field_block" id="to_field_block" style="display:none;"> >- to field <input type="text" name="to_field" id="to_field" size="3" maxlength="3" /> <input type="text" name="to_subfield" id="to_subfield" size="1" maxlength="1" title="let blank for the entire field" /> >+ <span name="to_field_block" id="to_field_block" style="display:none;"> >+ to field <input type="text" name="to_field" id="to_field" size="3" maxlength="3" /> <input type="text" name="to_subfield" id="to_subfield" size="1" maxlength="1" title="let blank for the entire field" /> > >- <span name="to_field_regex_block" id="to_field_regex_block"> >- <sup> >- <label for="to_field_regex">RegEx</label> >- <input type="checkbox" name="to_field_regex" id="to_field_regex" onchange="onToFieldRegexChange(this);" /> >+ <span name="to_field_regex_block" id="to_field_regex_block"> >+ <sup> >+ <label for="to_field_regex">RegEx</label> >+ <input type="checkbox" name="to_field_regex" id="to_field_regex" onchange="onToFieldRegexChange(this);" /> > >- <span name="to_field_regex_value_block" id="to_field_regex_value_block" style="display:none;"> >- s/<input type="text" name="to_regex_search" id="to_regex_search" placeholder="regex pattern" />/<input type="text" name="to_regex_replace" id="to_regex_replace" placeholder="regex replacement" />/<input type="text" name="to_regex_modifiers" id="to_regex_modifiers" placeholder="ig" size="3" /> >- </span> >- </sup> >+ <span name="to_field_regex_value_block" id="to_field_regex_value_block" style="display:none;"> >+ s/<input type="text" name="to_regex_search" id="to_regex_search" placeholder="regex pattern" />/<input type="text" name="to_regex_replace" id="to_regex_replace" placeholder="regex replacement" />/<input type="text" name="to_regex_modifiers" id="to_regex_modifiers" placeholder="ig" size="3" /> >+ </span> >+ </sup> >+ </span> > </span> >- </span> > >- <p/> >+ <p/> > >- <select name="conditional" id="conditional" onchange="onConditionalChange(this);"> >- <option value="" selected="selected" /> >- <option value="if">if</option> >- <option value="unless">unless</option> >- </select> >+ <select name="conditional" id="conditional" onchange="onConditionalChange(this);"> >+ <option value="" selected="selected" /> >+ <option value="if">if</option> >+ <option value="unless">unless</option> >+ </select> > >- <span name="conditional_block" id="conditional_block" style="display:none;"> >- field <input type="text" name="conditional_field" id="conditional_field" size="3" maxlength="3" /> <input type="text" name="conditional_subfield" id="conditional_subfield" size="1" maxlength="1" /> >+ <span name="conditional_block" id="conditional_block" style="display:none;"> >+ field <input type="text" name="conditional_field" id="conditional_field" size="3" maxlength="3" /> <input type="text" name="conditional_subfield" id="conditional_subfield" size="1" maxlength="1" /> > >- <select name="conditional_comparison" id="conditional_comparison" onchange="onConditionalComparisonChange(this);"> >- <option value="" /> >- <option value="exists">exists</option> >- <option value="not_exists">doesn't exist</option> >- <option value="equals">matches</option> >- <option value="not_equals">doesn't match</option> >- </select> >+ <select name="conditional_comparison" id="conditional_comparison" onchange="onConditionalComparisonChange(this);"> >+ <option value="" /> >+ <option value="exists">exists</option> >+ <option value="not_exists">doesn't exist</option> >+ <option value="equals">matches</option> >+ <option value="not_equals">doesn't match</option> >+ </select> > >- <span name="conditional_comparison_block" id="conditional_comparison_block" style="display:none;"> >+ <span name="conditional_comparison_block" id="conditional_comparison_block" style="display:none;"> > >- <span class="match_regex_prefix">m/</span><input type="text" id="conditional_value" name="conditional_value" /><span class="match_regex_suffix">/</span> >+ <span class="match_regex_prefix">m/</span><input type="text" id="conditional_value" name="conditional_value" /><span class="match_regex_suffix">/</span> > >- <sup> >- <label for="conditional_regex">RegEx</label> >- <input type="checkbox" name="conditional_regex" id="conditional_regex" onchange="onConditionalRegexChange(this);" /> >- </sup> >+ <sup> >+ <label for="conditional_regex">RegEx</label> >+ <input type="checkbox" name="conditional_regex" id="conditional_regex" onchange="onConditionalRegexChange(this);" /> >+ </sup> > >+ </span> > </span> >- </span> > >- <input type="hidden" name="template_id" value="[% template_id %]" /> >- <input type="hidden" name="mmta_id" id="mmta_id" /> >- <input type="hidden" name="op" value="add_action" /> >+ <input type="hidden" name="template_id" value="[% template_id %]" /> >+ <input type="hidden" name="mmta_id" id="mmta_id" /> >+ <input type="hidden" name="op" value="add_action" /> > >- <br/><br/> >- <label for="description">Description:</label> >- <input type="text" name="description" id="description" size="60" /> >+ <br/><br/> >+ <label for="description">Description:</label> >+ <input type="text" name="description" id="description" size="60" /> > >- <br/><br/> >- <input id="action_submit" type="submit" value="Add action" /> <a href="#modaction" id="cancel_edit" onclick="cancelEditAction();" style="display:none;">Cancel</a> >+ <br/><br/> >+ <input id="action_submit" type="submit" value="Add action" /> <a href="#modaction" id="cancel_edit" onclick="cancelEditAction();">Cancel</a> > >- </fieldset> >- </form> >+ </fieldset> >+ </form> >+ >+ [% END %] > > [% ELSE %] > <div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div> >- [% END %] >- >- <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated"> >- <fieldset> >- <legend>Create a new template</legend> >- >- <label for="template_name" class="required">Name: </label> >- <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" /> >- <span class="required">Required</span> >- >- <input type="hidden" name="op" value="create_template" /> >- <input type="submit" value="Create template" /> >- >- [% IF ( template_id ) %] >- <input type="hidden" name="template_id" value="[% template_id %]" /> >- <input type="checkbox" name="duplicate_current_template" id="duplicate_current_template" /> >- <label for="duplicate_current_template">Duplicate current template</label> >- [% END %] >- </fieldset> >- </form> >+ [% END # /IF TemplatesLoop %] >+ >+ <!-- Modal to create new template --> >+ <div class="modal hide" id="createTemplate" tabindex="-1" role="dialog" aria-labelledby="LabelcreateTemplate" aria-hidden="true"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">Ã</button> >+ <h3 id="LabelcreateTemplate">Create a new template</h3> >+ </div> >+ <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated"> >+ <div class="modal-body"> >+ <fieldset> >+ <p> >+ <label for="template_name" class="required">Name: </label> >+ <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" /> >+ <span class="required">Required</span> >+ </p> >+ >+ <input type="hidden" name="op" value="create_template" /> >+ >+ <p> >+ <label for="duplicate_a_template">Duplicate a template:</label> >+ <select name="template_id" id="duplicate_a_template"> >+ <option value=""> -- None --</option> >+ [% FOREACH TemplatesLoo IN TemplatesLoop %] >+ <option value="[% TemplatesLoo.template_id %]"> [% TemplatesLoo.name %]</option> >+ [% END %] >+ </select> >+ <input type="hidden" name="duplicate_current_template" id="duplicate_current_template" /> >+ </p> >+ </fieldset> >+ </div> >+ <div class="modal-footer"> >+ <button type="submit" class="btn">Submit</button> >+ <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> >+ </div> >+ </form> >+ </div> > </div> > </div> > >@@ -287,5 +345,5 @@ > [% INCLUDE 'tools-menu.inc' %] > </div> > </div> >-</div> >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js >index 9353637..3c1be0b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js >@@ -1,4 +1,7 @@ > $(document).ready(function() { >+ window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML; >+ window.action_submit_value = document.getElementById('action_submit').value; >+ > $('#select_template').find("input:submit").hide(); > $('#select_template').change(function() { > $('#select_template').submit(); >@@ -43,6 +46,35 @@ $(document).ready(function() { > $("#conditional_field,#from_field").change(function(){ > updateAllEvery(); > }); >+ >+ $("#new_action").on("click",function(){ >+ cancelEditAction(); >+ $("#add_action").show(); >+ $("#action").focus(); >+ }); >+ >+ $(".duplicate_template").on("click",function(){ >+ var template_id = $(this).data("template_id"); >+ $("#duplicate_a_template").val(template_id); >+ $("#duplicate_current_template").val(1); >+ }); >+ >+ $('#createTemplate').on('shown', function () { >+ $("#template_name").focus(); >+ }); >+ >+ $("#duplicate_a_template").on("change",function(){ >+ if( this.value == '' ){ >+ $("#duplicate_current_template").val(""); >+ } else { >+ $("#duplicate_current_template").val(1); >+ } >+ }); >+ >+ $(".delete_template").on("click",function(){ >+ return confirmDelete(); >+ }); >+ > }); > > function updateAllEvery(){ >@@ -200,6 +232,7 @@ function editAction( mmta_id, ordering, action, field_number, from_field, from_s > to_subfield, to_regex_search, to_regex_replace, to_regex_modifiers, conditional, conditional_field, conditional_subfield, > conditional_comparison, conditional_value, conditional_regex, description > ) { >+ $("#add_action").show(); > document.getElementById('mmta_id').value = mmta_id; > > setSelectByValue( 'action', action ); >@@ -239,8 +272,6 @@ function editAction( mmta_id, ordering, action, field_number, from_field, from_s > > window.action_submit_value = document.getElementById('action_submit').value; > document.getElementById('action_submit').value = MSG_MMT_UPDATE_ACTION; >- >- show('cancel_edit'); > } > > function cancelEditAction() { >@@ -257,6 +288,7 @@ function cancelEditAction() { > $("#to_regex_search").val(""); > $("#to_regex_replace").val(""); > $("#to_regex_modifiers").val(""); >+ $("#description").val(""); > > document.getElementById('to_field_regex').checked = false; > document.getElementById('to_field_regex').onchange(); >@@ -276,8 +308,7 @@ function cancelEditAction() { > > document.getElementById('modaction_legend').innerHTML = window.modaction_legend_innerhtml; > document.getElementById('action_submit').value = window.action_submit_value; >- >- hide('cancel_edit'); >+ $("#add_action").hide(); > } > > function setSelectByValue( selectId, value ) { >diff --git a/tools/marc_modification_templates.pl b/tools/marc_modification_templates.pl >index 3689684..4e477c0 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' ); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16148
:
49591
|
49603
|
51575
|
51977
|
52080
|
52373
|
52382
|
52383
|
52384
|
52385
|
52484
|
52485
|
52486