Bug 25744: Replace <i> with <em> in staff interface
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / marc_modification_templates.tt
1 [% USE raw %]
2 [% USE JSON.Escape %]
3 [% USE Asset %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; MARC modification templates</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <style>
9     #add_action { display: none; }
10 </style>
11 </head>
12
13 <body id="tools_marc_modification_templates" class="tools">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
16
17 [% IF ( TemplatesLoop ) %]
18     [% FOREACH TemplatesLoo IN TemplatesLoop %]
19         [% IF ( TemplatesLoo.selected ) %]
20             [% SET template_name = TemplatesLoo.name %]
21         [% END %]
22     [% END %]
23 [% END %]
24
25 <div id="breadcrumbs">
26     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
27     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
28     [% IF ( template_name ) %]
29         <a href="/cgi-bin/koha/tools/marc_modification_templates.pl">MARC modification templates</a>
30         &rsaquo; [% template_name | html %]
31     [% ELSE %]
32         MARC modification templates
33     [% END %]
34 </div>
35
36 <div class="main container-fluid">
37     <div class="row">
38         <div class="col-sm-10 col-sm-push-2">
39             <main>
40
41             <div id="toolbar" class="btn-toolbar">
42                 <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>
43                 [% IF ( template_id != '' ) %]
44                     <a href="#" id="new_action" class="btn btn-default"><i class="fa fa-plus"></i> New action</a>
45                     <a class="btn btn-default delete_template" href="/cgi-bin/koha/tools/marc_modification_templates.pl?template_id=[% template_id | html %]&amp;op=delete_template"><i class="fa fa-fw fa-trash"></i> Delete template</a>
46                 [% END %]
47             </div>
48
49             [% IF error %]
50                 [% IF error == 'no_from_field' %]
51                     <div class="dialog message">Error: no field value specified.</div>
52                 [% END %]
53             [% END %]
54
55             [% IF ( TemplatesLoop ) %]
56
57                 [% IF ( template_id == '' ) %]
58
59                     <h2>MARC modification templates [% template_id | html %]</h2>
60
61                     <table id="templatest">
62                         <thead>
63                             <tr>
64                                 <th>Template</th>
65                                 <th>Actions</th>
66                             </tr>
67                         </thead>
68                         <tbody>
69                             [% FOREACH TemplatesLoo IN TemplatesLoop %]
70                                 <tr>
71                                     <td>[% TemplatesLoo.name | html %]</td>
72                                     <td class="actions">
73                                         <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>
74                                         <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>
75                                         <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>
76                                     </td>
77                                 </tr>
78                             [% END %]
79                         </tbody>
80                     </table>
81
82                 [% ELSE %]
83
84                     <h2>Actions for <em>[% template_name | html %]</em></h2>
85
86                     [% IF ( ActionsLoop ) %]
87
88                         <table id="template_actions" class="template_actions">
89                             <thead>
90                                 <tr>
91                                     <th>Change order</th>
92                                     <th>Rank</th>
93                                     <th>Action</th>
94                                     <th>Description</th>
95                                     <th>&nbsp;</th>
96                                     <th>&nbsp;</th>
97                                 </tr>
98                             </thead>
99                             <tbody>
100                                 [% FOREACH ActionsLoo IN ActionsLoop %]
101                                     <tr>
102                                         <td class="actions">
103                                             <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 %]">
104                                                 <i class="fa fa-arrow-up fa-lg order-control"></i>
105                                             </a>
106
107                                             <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 %]">
108                                                 <i class="fa fa-arrow-up fa-lg overline order-control"></i>
109                                             </a>
110
111                                             <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 %]">
112                                                 <i class="fa fa-arrow-down fa-lg underline order-control"></i>
113                                             </a>
114
115                                             <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 %]">
116                                                 <i class="fa fa-arrow-down fa-lg order-control"></i>
117                                             </a>
118                                         </td>
119
120                                         <td>[% ActionsLoo.ordering | html %]</td>
121                                         <td>
122                                             [% IF ( ActionsLoo.action_delete_field ) %] Delete [% END %]
123                                             [% IF ( ActionsLoo.action_add_field ) %] Add new [% END %]
124                                             [% IF ( ActionsLoo.action_update_field ) %] Update existing or add new [% END %]
125                                             [% IF ( ActionsLoo.action_move_field ) %] Move [% END %]
126                                             [% IF ( ActionsLoo.action_copy_field ) %] Copy [% END %]
127                                             [% IF ( ActionsLoo.action_copy_and_replace_field ) %] Copy and replace [% END %]
128
129                                             [% UNLESS ( ActionsLoo.action_update_field ) %]
130                                                 [% IF ( ActionsLoo.field_number ) %]
131                                                     1st
132                                                 [% END %]
133                                             [% END %]
134
135                                             field
136
137                                             [% ActionsLoo.from_field | html %][% IF ( ActionsLoo.from_subfield.length ) %]$[% ActionsLoo.from_subfield | html %][% END %]
138
139                                             [% IF ( ActionsLoo.field_value ) %]
140                                                 with value <em>[% ActionsLoo.field_value | html %]</em>
141                                             [% END %]
142
143                                             [% IF ( ActionsLoo.to_field ) %]
144                                                 to [% ActionsLoo.to_field | html %][% IF ( ActionsLoo.to_subfield.length ) %]$[% ActionsLoo.to_subfield | html %][% END %]
145
146                                                 [% IF ( ActionsLoo.to_regex_search ) %]
147                                                      using RegEx s<strong>/[% ActionsLoo.to_regex_search | html %]/[% ActionsLoo.to_regex_replace | html %]/[% ActionsLoo.to_regex_modifiers | html %]</strong>
148                                                 [% END %]
149                                             [% END %]
150
151                                             [% IF ( ActionsLoo.conditional ) %]
152                                                 [% IF ( ActionsLoo.conditional_if ) %] if [% END %]
153                                                 [% IF ( ActionsLoo.conditional_unless ) %] unless [% END %]
154
155                                                 [% ActionsLoo.conditional_field | html %][% IF ( ActionsLoo.conditional_subfield.length ) %]$[% ActionsLoo.conditional_subfield | html %][% END %]
156
157                                                 [% IF ( ActionsLoo.conditional_comparison_exists ) %] exists [% END %]
158                                                 [% IF ( ActionsLoo.conditional_comparison_not_exists ) %] does not exist [% END %]
159                                                 [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %]
160                                                 [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %]
161
162                                                 [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]<strong>[% ActionsLoo.conditional_value | html %]</strong>[% IF ( ActionsLoo.conditional_regex ) %]/[% END %]
163                                             [% END %]
164                                         </td>
165                                         <td>[% ActionsLoo.description | html %]</td>
166                                         <td>
167                                             <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>
168                                         </td>
169                                         <td>
170                                             <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>
171                                         </td>
172                                     </tr>
173                                 [% END # /FOREACH ActionsLoo %]
174                             </tbody>
175                         </table>
176                     [% ELSE %]
177                         <div class="dialog message template_actions"><p>There are no defined actions for this template.</p></div>
178                     [% END # /IF ActionsLoop %]
179
180                     <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_action" >
181                         <a name="modaction"></a>
182                         <fieldset>
183                             <legend id="modaction_legend">Add a new action</legend>
184                             <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>
185
186                             <select name="action" id="action" onchange="onActionChange(this);">
187                                 <option value="delete_field">Delete</option>
188                                 <option value="add_field">Add new</option>
189                                 <option value="update_field">Update existing or add new</option>
190                                 <option value="move_field">Move</option>
191                                 <option value="copy_field">Copy</option>
192                                 <option value="copy_and_replace_field">Copy and replace</option>
193                             </select>
194
195                             <span id="field_number_block">
196                                 <select name="field_number" id="field_number">
197                                     <option value="0">All</option>
198                                     <option value="1">1st</option>
199                                 </select>
200                             </span>
201
202                             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" />
203
204                             <span name="with_value_block" id="with_value_block" style="display:none;">
205                                 with value <input type="text" name="field_value" id="field_value" />
206                             </span>
207
208                             <span name="to_field_block" id="to_field_block" style="display:none;">
209                                 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" />
210
211                                 <span name="to_field_regex_block" id="to_field_regex_block">
212                                     <sup>
213                                         <label for="to_field_regex">RegEx</label>
214                                         <input type="checkbox" name="to_field_regex" id="to_field_regex" onchange="onToFieldRegexChange(this);" />
215
216                                         <span name="to_field_regex_value_block" id="to_field_regex_value_block" style="display:none;">
217                                             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" />
218                                         </span>
219                                     </sup>
220                                 </span>
221                             </span>
222
223                             <p/>
224
225                             <select name="conditional" id="conditional" onchange="onConditionalChange(this);">
226                                 <option value="" selected="selected" />
227                                 <option value="if">if</option>
228                                 <option value="unless">unless</option>
229                             </select>
230
231                             <span name="conditional_block" id="conditional_block" style="display:none;">
232                                 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" />
233
234                                 <select name="conditional_comparison" id="conditional_comparison" onchange="onConditionalComparisonChange(this);">
235                                     <option value="" />
236                                     <option value="exists">exists</option>
237                                     <option value="not_exists">doesn't exist</option>
238                                     <option value="equals">matches</option>
239                                     <option value="not_equals">doesn't match</option>
240                                 </select>
241
242                                 <span name="conditional_comparison_block" id="conditional_comparison_block" style="display:none;">
243
244                                     <span class="match_regex_prefix">m/</span><input type="text" id="conditional_value" name="conditional_value" /><span class="match_regex_suffix">/</span>
245
246                                     <sup>
247                                         <label for="conditional_regex">RegEx</label>
248                                         <input type="checkbox" name="conditional_regex" id="conditional_regex" onchange="onConditionalRegexChange(this);" />
249                                     </sup>
250
251                                 </span>
252                             </span>
253
254                             <input type="hidden" name="template_id" value="[% template_id | html %]" />
255                             <input type="hidden" name="mmta_id" id="mmta_id" />
256                             <input type="hidden" name="op" value="add_action" />
257
258                             <br/><br/>
259                             <label for="description">Description:</label>
260                             <input type="text" name="description" id="description" size="60" />
261
262                             <br/><br/>
263                             <input id="action_submit" type="submit" value="Add action" /> <a href="#modaction" id="cancel_edit" onclick="cancelEditAction();">Cancel</a>
264
265                         </fieldset>
266                     </form>
267
268                 [% END %]
269
270             [% ELSE %]
271                 <div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div>
272             [% END # /IF TemplatesLoop %]
273
274             <!-- Modal to create new template -->
275             <div class="modal" id="createTemplate" tabindex="-1" role="dialog" aria-labelledby="LabelcreateTemplate" aria-hidden="true">
276                 <div class="modal-dialog">
277                 <div class="modal-content">
278                 <div class="modal-header">
279                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
280                     <h3 id="LabelcreateTemplate">Create a new template</h3>
281                 </div>
282                 <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated">
283                     <div class="modal-body">
284                         <fieldset>
285                             <p>
286                                 <label for="template_name" class="required">Name: </label>
287                                 <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" />
288                                 <span class="required">Required</span>
289                             </p>
290
291                             <input type="hidden" name="op" value="create_template" />
292
293                             <p>
294                                 <label for="duplicate_a_template">Duplicate a template:</label>
295                                 <select name="template_id" id="duplicate_a_template">
296                                     <option value=""> -- None --</option>
297                                     [% FOREACH TemplatesLoo IN TemplatesLoop %]
298                                         <option value="[% TemplatesLoo.template_id | html %]"> [% TemplatesLoo.name | html %]</option>
299                                     [% END %]
300                                 </select>
301                                 <input type="hidden" name="duplicate_current_template" id="duplicate_current_template" />
302                             </p>
303                         </fieldset>
304                     </div>
305                     <div class="modal-footer">
306                         <button type="submit" class="btn btn-default">Submit</button>
307                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
308                     </div>
309                 </form>
310                 </div>
311                 </div>
312             </div>
313
314             </main>
315         </div> <!-- /.col-sm-10.col-sm-push-2 -->
316
317         <div class="col-sm-2 col-sm-pull-10">
318             <aside>
319                 [% INCLUDE 'tools-menu.inc' %]
320             </aside>
321         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
322      </div> <!-- /.row -->
323
324 [% MACRO jsinclude BLOCK %]
325     [% Asset.js("js/tools-menu.js") | $raw %]
326     [% Asset.js("js/marc_modification_templates.js") | $raw %]
327     <script>
328         var mmtas = [% ActionsLoop.json | $raw %]
329     </script>
330 [% END %]
331
332 [% INCLUDE 'intranet-bottom.inc' %]