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