Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / marc_modification_templates.tt
index 198b029..d380a28 100644 (file)
@@ -1,23 +1,9 @@
+[% USE raw %]
+[% USE Asset %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; MARC modification templates</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript">
-    //<![CDATA[
-    var MSG_MMT_SUBFIELDS_MATCH = _("Both subfield values should be filled or empty.");
-    var MSG_MMT_DESTINATION_REQUIRED = _("The destination should be filled.");
-    var MSG_MMT_CONTROL_FIELD_EMPTY = _("If the field is a control field, the subfield should be empty");
-    var MSG_MMT_CONTROL_FIELD = _("A control field cannot be used with a regular field.");
-    var MSG_MMT_SOURCE_SUBFIELD = _("The source subfield should be filled for update.");
-    var MSG_MMT_SOURCE_FIELD = _("The source field should be filled.");
-    var MSG_MMT_EVERY = _("Every");
-    var MSG_MMT_ALL = _("All");
-    var MSG_MMT_CONFIRM_DEL_TEMPLATE = _("Are you sure you wish to delete this template?");
-    var MSG_MMT_CONFIRM_DEL_TEMPLATE_ACTION = _("Are you sure you wish to delete this template action?");
-    var MSG_MMT_EDIT_ACTION = _("Edit action %s");
-    var MSG_MMT_UPDATE_ACTION = _("Update action");
-    //]]>
-</script>
-<script type="text/javascript" src="[% interface %]/[% theme %]/js/marc_modification_templates.js"></script>
 <style type="text/css">
     #add_action { display: none; }
 </style>
@@ -40,7 +26,7 @@
     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
     [% IF ( template_name ) %]
         <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">MARC modification templates</a>
-        &rsaquo; [% template_name %]
+        &rsaquo; [% template_name | html %]
     [% ELSE %]
         MARC modification templates
     [% END %]
@@ -52,9 +38,9 @@
         <div class="yui-b">
 
             <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>
+                <a href="#" data-toggle="modal" data-template_id="" data-target="#createTemplate" id="new_template" class="btn btn-default btn-sm 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>
+                    <a href="#" id="new_action" class="btn btn-default btn-sm"><i class="fa fa-plus"></i> New action</a>
                 [% END %]
             </div>
 
@@ -68,7 +54,7 @@
 
                 [% IF ( template_id == '' ) %]
 
-                    <h2>MARC modification templates [% template_id %]</h2>
+                    <h2>MARC modification templates [% template_id | html %]</h2>
 
                     <table id="templatest">
                         <thead>
                         <tbody>
                             [% FOREACH TemplatesLoo IN TemplatesLoop %]
                                 <tr>
-                                    <td>[% TemplatesLoo.name %]</td>
+                                    <td>[% TemplatesLoo.name | html %]</td>
                                     <td class="actions">
-                                        <a class="btn btn-mini" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id %]&amp;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 delete_template" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id %]&amp;op=delete_template" onclick="return confirmDeleteAction();"><i class="fa fa-fw fa-trash"></i> Delete</a>
+                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id | html %]&amp;op=select_template" ><i class="fa fa-fw fa-pencil"></i> Edit actions</a>
+                                        <a class="btn btn-default btn-xs duplicate_template" href="#" data-toggle="modal" data-template_id="[% TemplatesLoo.template_id | html %]" data-target="#createTemplate"><i class="fa fa-fw fa-copy"></i> Duplicate</a>
+                                        <a class="btn btn-default btn-xs delete_template" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id | html %]&amp;op=delete_template"><i class="fa fa-fw fa-trash"></i> Delete</a>
                                     </td>
                                 </tr>
                             [% END %]
@@ -93,7 +79,7 @@
 
                 [% ELSE %]
 
-                    <h2>Actions for <i>[% template_name %]</i></h2>
+                    <h2>Actions for <i>[% template_name | html %]</i></h2>
 
                     [% IF ( ActionsLoop ) %]
 
                                 [% FOREACH ActionsLoo IN ActionsLoop %]
                                     <tr>
                                         <td class="actions">
-                                            <a title="Move action up" href="marc_modification_templates.pl?op=move_action&amp;where=up&amp;template_id=[% ActionsLoo.template_id %]&amp;mmta_id=[% ActionsLoo.mmta_id %]">
+                                            <a title="Move action up" href="marc_modification_templates.pl?op=move_action&amp;where=up&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
                                                 <i class="fa fa-arrow-up fa-lg order-control"></i>
                                             </a>
 
-                                            <a title="Move action to top" href="marc_modification_templates.pl?op=move_action&amp;where=top&amp;template_id=[% ActionsLoo.template_id %]&amp;mmta_id=[% ActionsLoo.mmta_id %]">
+                                            <a title="Move action to top" href="marc_modification_templates.pl?op=move_action&amp;where=top&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
                                                 <i class="fa fa-arrow-up fa-lg overline order-control"></i>
                                             </a>
 
-                                            <a title="Move action to bottom" href="marc_modification_templates.pl?op=move_action&amp;where=bottom&amp;template_id=[% ActionsLoo.template_id %]&amp;mmta_id=[% ActionsLoo.mmta_id %]">
+                                            <a title="Move action to bottom" href="marc_modification_templates.pl?op=move_action&amp;where=bottom&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
                                                 <i class="fa fa-arrow-down fa-lg underline order-control"></i>
                                             </a>
 
-                                            <a title="Move action down" href="marc_modification_templates.pl?op=move_action&amp;where=down&amp;template_id=[% ActionsLoo.template_id %]&amp;mmta_id=[% ActionsLoo.mmta_id %]">
+                                            <a title="Move action down" href="marc_modification_templates.pl?op=move_action&amp;where=down&amp;template_id=[% ActionsLoo.template_id | html %]&amp;mmta_id=[% ActionsLoo.mmta_id | html %]">
                                                 <i class="fa fa-arrow-down fa-lg order-control"></i>
                                             </a>
                                         </td>
 
-                                        <td>[% ActionsLoo.ordering %]</td>
+                                        <td>[% ActionsLoo.ordering | html %]</td>
                                         <td>
                                             [% IF ( ActionsLoo.action_delete_field ) %] Delete [% END %]
-                                            [% IF ( ActionsLoo.action_update_field ) %] Update [% END %]
+                                            [% IF ( ActionsLoo.action_add_field ) %] Add new [% END %]
+                                            [% IF ( ActionsLoo.action_update_field ) %] Update existing or add new [% 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 %]
 
                                             field
 
-                                            [% ActionsLoo.from_field %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield %][% END %]
+                                            [% ActionsLoo.from_field | html %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield | html %][% END %]
 
                                             [% IF ( ActionsLoo.field_value ) %]
-                                                with value <i>[% ActionsLoo.field_value %]</i>
+                                                with value <i>[% ActionsLoo.field_value | html %]</i>
                                             [% END %]
 
                                             [% IF ( ActionsLoo.to_field ) %]
-                                                to [% ActionsLoo.to_field %][% IF ( ActionsLoo.to_subfield ) %]$[% ActionsLoo.to_subfield %][% END %]
+                                                to [% ActionsLoo.to_field | html %][% IF ( ActionsLoo.to_subfield ) %]$[% ActionsLoo.to_subfield | html %][% END %]
 
                                                 [% IF ( ActionsLoo.to_regex_search ) %]
-                                                     using RegEx s<strong>/[% ActionsLoo.to_regex_search %]/[% ActionsLoo.to_regex_replace %]/[% ActionsLoo.to_regex_modifiers %]</strong>
+                                                     using RegEx s<strong>/[% ActionsLoo.to_regex_search | html %]/[% ActionsLoo.to_regex_replace | html %]/[% ActionsLoo.to_regex_modifiers | html %]</strong>
                                                 [% END %]
                                             [% END %]
 
                                                 [% IF ( ActionsLoo.conditional_if ) %] if [% END %]
                                                 [% IF ( ActionsLoo.conditional_unless ) %] unless [% END %]
 
-                                                [% ActionsLoo.conditional_field %][% IF ( ActionsLoo.conditional_subfield ) %]$[% ActionsLoo.conditional_subfield %][% END %]
+                                                [% ActionsLoo.conditional_field | html %][% IF ( ActionsLoo.conditional_subfield ) %]$[% ActionsLoo.conditional_subfield | html %][% END %]
 
                                                 [% IF ( ActionsLoo.conditional_comparison_exists ) %] exists [% END %]
                                                 [% IF ( ActionsLoo.conditional_comparison_not_exists ) %] does not exist [% END %]
                                                 [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %]
 
                                                 [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]
-                                                <strong>[% ActionsLoo.conditional_value %]</strong>
+                                                <strong>[% ActionsLoo.conditional_value | html %]</strong>
                                                 [% IF ( ActionsLoo.conditional_regex ) %]/[% END %]
                                             [% END %]
                                         </td>
-                                        <td>[% ActionsLoo.description %]</td>
+                                        <td>[% ActionsLoo.description | html %]</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') %]"
+                                            <a class="btn btn-default btn-xs" href="#modaction" onclick='editAction(
+                                                            "[% ActionsLoo.mmta_id |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.ordering |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.action |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.field_number |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.from_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.from_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.field_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.to_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.to_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.to_regex_search |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.to_regex_replace |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.to_regex_modifiers |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.conditional |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.conditional_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.conditional_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.conditional_comparison |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.conditional_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.conditional_regex |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
+                                                            "[% ActionsLoo.description |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]"
                                                         );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>
+                                            <a class="btn btn-default btn-xs" href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id | html %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id | html %]" onclick="return confirmDeleteAction();"><i class="fa fa-trash"></i> Delete</a>
                                         </td>
                                     </tr>
                                 [% END # /FOREACH ActionsLoo %]
 
                             <select name="action" id="action" onchange="onActionChange(this);">
                                 <option value="delete_field">Delete</option>
-                                <option value="update_field">Add/Update</option>
+                                <option value="add_field">Add new</option>
+                                <option value="update_field">Update existing or add new</option>
                                 <option value="move_field">Move</option>
                                 <option value="copy_field">Copy</option>
                                 <option value="copy_and_replace_field">Copy and replace</option>
                                 </span>
                             </span>
 
-                            <input type="hidden" name="template_id" value="[% template_id %]" />
+                            <input type="hidden" name="template_id" value="[% template_id | html %]" />
                             <input type="hidden" name="mmta_id" id="mmta_id" />
                             <input type="hidden" name="op" value="add_action" />
 
             [% 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" id="createTemplate" tabindex="-1" role="dialog" aria-labelledby="LabelcreateTemplate" aria-hidden="true">
+                <div class="modal-dialog">
+                <div class="modal-content">
                 <div class="modal-header">
                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
                     <h3 id="LabelcreateTemplate">Create a new template</h3>
                                 <select name="template_id" id="duplicate_a_template">
                                     <option value=""> -- None --</option>
                                     [% FOREACH TemplatesLoo IN TemplatesLoop %]
-                                        <option value="[% TemplatesLoo.template_id %]"> [% TemplatesLoo.name %]</option>
+                                        <option value="[% TemplatesLoo.template_id | html %]"> [% TemplatesLoo.name | html %]</option>
                                     [% END %]
                                 </select>
                                 <input type="hidden" name="duplicate_current_template" id="duplicate_current_template" />
                         </fieldset>
                     </div>
                     <div class="modal-footer">
-                        <button type="submit" class="btn">Submit</button>
+                        <button type="submit" class="btn btn-default">Submit</button>
                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
                     </div>
                 </form>
+                </div>
+                </div>
             </div>
         </div>
     </div>
     </div>
   </div>
 
+[% MACRO jsinclude BLOCK %]
+    [% Asset.js("js/tools-menu.js") | $raw %]
+    <script type="text/javascript">
+        var MSG_MMT_SUBFIELDS_MATCH = _("Both subfield values should be filled or empty.");
+        var MSG_MMT_DESTINATION_REQUIRED = _("The destination should be filled.");
+        var MSG_MMT_CONTROL_FIELD_EMPTY = _("If the field is a control field, the subfield should be empty");
+        var MSG_MMT_CONTROL_FIELD = _("A control field cannot be used with a regular field.");
+        var MSG_MMT_SOURCE_SUBFIELD = _("The source subfield should be filled for update.");
+        var MSG_MMT_SOURCE_FIELD = _("The source field should be filled.");
+        var MSG_MMT_EVERY = _("Every");
+        var MSG_MMT_ALL = _("All");
+        var MSG_MMT_CONFIRM_DEL_TEMPLATE = _("Are you sure you wish to delete this template?");
+        var MSG_MMT_CONFIRM_DEL_TEMPLATE_ACTION = _("Are you sure you wish to delete this template action?");
+        var MSG_MMT_EDIT_ACTION = _("Edit action %s");
+        var MSG_MMT_UPDATE_ACTION = _("Update action");
+    </script>
+    [% Asset.js("js/marc_modification_templates.js") | $raw %]
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]