5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha › Tools › MARC modification templates</title>
7 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="tools_marc_modification_templates" class="tools">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'cat-search.inc' %]
25 [% IF ( TemplatesLoop ) %]
26 [% FOREACH TemplatesLoo IN TemplatesLoop %]
27 [% IF ( TemplatesLoo.selected ) %]
28 [% SET template_name = TemplatesLoo.name %]
33 <div id="breadcrumbs">
34 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
35 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
36 [% IF ( template_name ) %]
37 <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">MARC modification templates</a>
38 › [% template_name | html %]
40 MARC modification templates
44 <div class="main container-fluid">
46 <div class="col-sm-10 col-sm-push-2">
49 <div id="toolbar" class="btn-toolbar">
50 <a href="#" data-toggle="modal" data-template_id="" data-target="#createTemplate" id="new_template" class="btn btn-default duplicate_template"><i class="fa fa-plus"></i> New template</a>
51 [% IF ( template_id != '' ) %]
52 <a href="#" id="new_action" class="btn btn-default"><i class="fa fa-plus"></i> New action</a>
53 <a class="btn btn-default delete_template" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% template_id | html %]&op=delete_template"><i class="fa fa-fw fa-trash"></i> Delete template</a>
58 [% IF error == 'no_from_field' %]
59 <div class="dialog message">Error: no field value specified.</div>
63 [% IF ( TemplatesLoop ) %]
65 [% IF ( template_id == '' ) %]
67 <h2>MARC modification templates [% template_id | html %]</h2>
69 <table id="templatest">
77 [% FOREACH TemplatesLoo IN TemplatesLoop %]
79 <td>[% TemplatesLoo.name | html %]</td>
81 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id | html %]&op=select_template" ><i class="fa fa-fw fa-pencil"></i> Edit actions</a>
82 <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>
83 <a class="btn btn-default btn-xs delete_template" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% TemplatesLoo.template_id | html %]&op=delete_template"><i class="fa fa-fw fa-trash"></i> Delete</a>
92 <h2>Actions for <em>[% template_name | html %]</em></h2>
94 [% IF ( ActionsLoop ) %]
96 <table id="template_actions" class="template_actions">
108 [% FOREACH ActionsLoo IN ActionsLoop %]
111 <a title="Move action up" href="marc_modification_templates.pl?op=move_action&where=up&template_id=[% ActionsLoo.template_id | html %]&mmta_id=[% ActionsLoo.mmta_id | html %]">
112 <i class="fa fa-arrow-up fa-lg order-control"></i>
115 <a title="Move action to top" href="marc_modification_templates.pl?op=move_action&where=top&template_id=[% ActionsLoo.template_id | html %]&mmta_id=[% ActionsLoo.mmta_id | html %]">
116 <i class="fa fa-arrow-up fa-lg overline order-control"></i>
119 <a title="Move action to bottom" href="marc_modification_templates.pl?op=move_action&where=bottom&template_id=[% ActionsLoo.template_id | html %]&mmta_id=[% ActionsLoo.mmta_id | html %]">
120 <i class="fa fa-arrow-down fa-lg underline order-control"></i>
123 <a title="Move action down" href="marc_modification_templates.pl?op=move_action&where=down&template_id=[% ActionsLoo.template_id | html %]&mmta_id=[% ActionsLoo.mmta_id | html %]">
124 <i class="fa fa-arrow-down fa-lg order-control"></i>
128 <td>[% ActionsLoo.ordering | html %]</td>
130 [% IF ( ActionsLoo.action_delete_field ) %] Delete [% END %]
131 [% IF ( ActionsLoo.action_add_field ) %] Add new [% END %]
132 [% IF ( ActionsLoo.action_update_field ) %] Update existing or add new [% END %]
133 [% IF ( ActionsLoo.action_move_field ) %] Move [% END %]
134 [% IF ( ActionsLoo.action_copy_field ) %] Copy [% END %]
135 [% IF ( ActionsLoo.action_copy_and_replace_field ) %] Copy and replace [% END %]
137 [% UNLESS ( ActionsLoo.action_update_field ) %]
138 [% IF ( ActionsLoo.field_number ) %]
145 [% ActionsLoo.from_field | html %][% IF ( ActionsLoo.from_subfield.length ) %]$[% ActionsLoo.from_subfield | html %][% END %]
147 [% IF ( ActionsLoo.field_value ) %]
148 with value <em>[% ActionsLoo.field_value | html %]</em>
151 [% IF ( ActionsLoo.to_field ) %]
152 to [% ActionsLoo.to_field | html %][% IF ( ActionsLoo.to_subfield.length ) %]$[% ActionsLoo.to_subfield | html %][% END %]
154 [% IF ( ActionsLoo.to_regex_search ) %]
155 using RegEx s<strong>/[% ActionsLoo.to_regex_search | html %]/[% ActionsLoo.to_regex_replace | html %]/[% ActionsLoo.to_regex_modifiers | html %]</strong>
159 [% IF ( ActionsLoo.conditional ) %]
160 [% IF ( ActionsLoo.conditional_if ) %] if [% END %]
161 [% IF ( ActionsLoo.conditional_unless ) %] unless [% END %]
163 [% ActionsLoo.conditional_field | html %][% IF ( ActionsLoo.conditional_subfield.length ) %]$[% ActionsLoo.conditional_subfield | html %][% END %]
165 [% IF ( ActionsLoo.conditional_comparison_exists ) %] exists [% END %]
166 [% IF ( ActionsLoo.conditional_comparison_not_exists ) %] does not exist [% END %]
167 [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %]
168 [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %]
170 [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]<strong>[% ActionsLoo.conditional_value | html %]</strong>[% IF ( ActionsLoo.conditional_regex ) %]/[% END %]
173 <td>[% ActionsLoo.description | html %]</td>
175 <a class="btn btn-default btn-xs edit_action" href="#modaction" data-mmta_id="[% ActionsLoo.mmta_id | html %]"><i class="fa fa-pencil"></i> Edit</a>
178 <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>
181 [% END # /FOREACH ActionsLoo %]
185 <div class="dialog message template_actions"><p>There are no defined actions for this template.</p></div>
186 [% END # /IF ActionsLoop %]
188 <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_action" >
189 <a name="modaction"></a>
191 <legend id="modaction_legend">Add a new action</legend>
192 <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>
194 <div class="action_line">
195 <select name="action" id="action" onchange="onActionChange(this);">
196 <option value="delete_field">Delete</option>
197 <option value="add_field">Add new</option>
198 <option value="update_field">Update existing or add new</option>
199 <option value="move_field">Move</option>
200 <option value="copy_field">Copy</option>
201 <option value="copy_and_replace_field">Copy and replace</option>
204 <span id="field_number_block">
205 <select name="field_number" id="field_number">
206 <option value="0">All</option>
207 <option value="1">1st</option>
211 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" />
213 <span name="with_value_block" id="with_value_block" style="display:none;">
214 with value <input type="text" name="field_value" id="field_value" />
217 <span name="to_field_block" id="to_field_block" style="display:none;">
218 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" />
220 <span name="to_field_regex_block" id="to_field_regex_block">
222 <label for="to_field_regex">RegEx</label>
223 <input type="checkbox" name="to_field_regex" id="to_field_regex" onchange="onToFieldRegexChange(this);" />
225 <span name="to_field_regex_value_block" id="to_field_regex_value_block" style="display:none;">
226 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" />
233 <div class="action_line">
234 <select name="conditional" id="conditional" onchange="onConditionalChange(this);">
235 <option value="" selected="selected" />
236 <option value="if">if</option>
237 <option value="unless">unless</option>
240 <span name="conditional_block" id="conditional_block" style="display:none;">
241 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" />
243 <select name="conditional_comparison" id="conditional_comparison" onchange="onConditionalComparisonChange(this);">
245 <option value="exists">exists</option>
246 <option value="not_exists">doesn't exist</option>
247 <option value="equals">matches</option>
248 <option value="not_equals">doesn't match</option>
251 <span name="conditional_comparison_block" id="conditional_comparison_block" style="display:none;">
253 <span class="match_regex_prefix">m/</span><input type="text" id="conditional_value" name="conditional_value" /><span class="match_regex_suffix">/</span>
256 <label for="conditional_regex">RegEx</label>
257 <input type="checkbox" name="conditional_regex" id="conditional_regex" onchange="onConditionalRegexChange(this);" />
264 <div class="action_line">
265 <label for="description">Description:</label>
266 <input type="text" name="description" id="description" size="60" />
269 <fieldset class="action">
270 <input type="hidden" name="template_id" value="[% template_id | html %]" />
271 <input type="hidden" name="mmta_id" id="mmta_id" />
272 <input type="hidden" name="op" value="add_action" />
273 <input id="action_submit" type="submit" value="Add action" />
274 <a href="#modaction" class="cancel" id="cancel_edit" onclick="cancelEditAction();">Cancel</a>
283 <div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div>
284 [% END # /IF TemplatesLoop %]
286 <!-- Modal to create new template -->
287 <div class="modal" id="createTemplate" tabindex="-1" role="dialog" aria-labelledby="LabelcreateTemplate" aria-hidden="true">
288 <div class="modal-dialog">
289 <div class="modal-content">
290 <div class="modal-header">
291 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
292 <h3 id="LabelcreateTemplate">Create a new template</h3>
294 <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated">
295 <div class="modal-body">
298 <label for="template_name" class="required">Name: </label>
299 <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" />
300 <span class="required">Required</span>
303 <input type="hidden" name="op" value="create_template" />
306 <label for="duplicate_a_template">Duplicate a template:</label>
307 <select name="template_id" id="duplicate_a_template">
308 <option value=""> -- None --</option>
309 [% FOREACH TemplatesLoo IN TemplatesLoop %]
310 <option value="[% TemplatesLoo.template_id | html %]"> [% TemplatesLoo.name | html %]</option>
313 <input type="hidden" name="duplicate_current_template" id="duplicate_current_template" />
317 <div class="modal-footer">
318 <button type="submit" class="btn btn-default">Submit</button>
319 <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
327 </div> <!-- /.col-sm-10.col-sm-push-2 -->
329 <div class="col-sm-2 col-sm-pull-10">
331 [% INCLUDE 'tools-menu.inc' %]
333 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
334 </div> <!-- /.row -->
336 [% MACRO jsinclude BLOCK %]
337 [% Asset.js("js/tools-menu.js") | $raw %]
338 [% Asset.js("js/marc_modification_templates.js") | $raw %]
340 var mmtas = [% ActionsLoop.json | $raw %]
344 [% INCLUDE 'intranet-bottom.inc' %]