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