Bug 12540: Display "Every" on editing a MMT action if previously selected
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / marc_modification_templates.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; MARC modification templates</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4
5 <script type="text/javascript">
6 //<![CDATA[
7 $(document).ready(function() {
8     $('#select_template').find("input:submit").hide();
9     $('#select_template').change(function() {
10         $('#select_template').submit();
11     });
12     $("span.match_regex_prefix" ).hide();
13     $("span.match_regex_suffix" ).hide();
14
15     $("#add_action").submit(function(){
16         var action = $("#action").val();
17         if ( action == 'move_field' || action == 'copy_field' || action == 'copy_and_replace_field') {
18             if ( $("#from_subfield").val().length != $("#to_subfield").val().length ) {
19                 alert(_("Both subfield values should be filled or empty."));
20                 return false;
21             }
22             if ( $("#to_field").val().length <= 0 ) {
23                 alert(_("The destination should be filled."));
24                 return false;
25             }
26             if ( ( $("#to_field").val()   < 10 && $("#to_subfield").val().length   > 0 ) ||
27                  ( $("#from_field").val() < 10 && $("#from_subfield").val().length > 0 ) ) {
28                  alert(_("If the field is a control field, the subfield should be empty"));
29                  return false;
30             }
31             if ( ( $("#from_field").val() < 10 && $("#to_subfield").val().length   == 0 ) ||
32                  ( $("#to_field").val()   < 10 && $("#from_subfield").val().length == 0 ) ) {
33                 alert(_("A control field cannot be used with a regular field."));
34                 return false;
35              }
36         }
37         if ( action == 'update_field' ) {
38             if ( $("#from_subfield").val().length <= 0 ) {
39                 alert(_("The source subfield should be filled for update."));
40                 return false;
41             }
42         }
43         if ( $("#from_field").val().length <= 0 ) {
44             alert(_("The source field should be filled."));
45             return false;
46         }
47     });
48
49     $("#conditional_field,#from_field").change(function(){
50         updateAllEvery();
51     });
52 });
53 //]]>
54 </script>
55
56 <script>
57 function updateAllEvery(){
58     if ( $("#conditional_field").is(":visible") ) {
59         if ( $("#conditional_field").val() == $("#from_field").val() && $("#from_field").val().length > 0 ) {
60             $("#field_number option[value='0']").html(_("Every"));
61         } else {
62             $("#field_number option[value='0']").html(_("All"));
63         }
64     }
65 }
66
67 function onActionChange(selectObj) {
68     // get the index of the selected option
69     var idx = selectObj.selectedIndex;
70
71     // get the value of the selected option
72     var action = selectObj.options[idx].value;
73
74     switch( action ) {
75         case 'delete_field':
76             show('field_number_block');
77             hide('with_value_block');
78             hide('to_field_block');
79             break;
80
81         case 'update_field':
82             hide('field_number_block');
83             show('with_value_block');
84             hide('to_field_block');
85             break;
86
87         case 'move_field':
88             show('field_number_block');
89             hide('with_value_block');
90             show('to_field_block');
91             break;
92
93         case 'copy_field':
94             show('field_number_block');
95             hide('with_value_block');
96             show('to_field_block');
97             break;
98
99         case 'copy_and_replace_field':
100             show('field_number_block');
101             hide('with_value_block');
102             show('to_field_block');
103             break;
104
105     }
106 }
107
108 function onConditionalChange(selectObj) {
109     // get the index of the selected option
110     var idx = selectObj.selectedIndex;
111
112     // get the value of the selected option
113     var action = selectObj.options[idx].value;
114
115     switch( action ) {
116         case '':
117             hide('conditional_block');
118             break;
119
120         case 'if':
121         case 'unless':
122             show('conditional_block');
123             break;
124     }
125 }
126
127 function onConditionalComparisonChange(selectObj) {
128     // get the index of the selected option
129     var idx = selectObj.selectedIndex;
130
131     // get the value of the selected option
132     var action = selectObj.options[idx].value;
133
134     switch( action ) {
135         case 'equals':
136         case 'not_equals':
137             show('conditional_comparison_block');
138             break;
139
140         default:
141             hide('conditional_comparison_block');
142             break;
143     }
144 }
145
146 function onToFieldRegexChange( checkboxObj ) {
147     if ( checkboxObj.checked ) {
148         show('to_field_regex_value_block');
149     } else {
150         hide('to_field_regex_value_block');
151     }
152 }
153
154 function onConditionalRegexChange( checkboxObj ) {
155     if ( checkboxObj.checked ) {
156         $("span.match_regex_prefix" ).show();
157         $("span.match_regex_suffix" ).show();
158     } else {
159         $("span.match_regex_prefix" ).hide();
160         $("span.match_regex_suffix" ).hide();
161     }
162 }
163
164 function show(eltId) {
165     elt = document.getElementById( eltId );
166     elt.style.display='inline';
167 }
168
169 function hide(eltId) {
170     clearFormElements( eltId );
171     elt = document.getElementById( eltId );
172     elt.style.display='none';
173 }
174
175 function clearFormElements(divId) {
176     myBlock = document.getElementById( divId );
177
178     var inputElements = myBlock.getElementsByTagName( "input" );
179     for (var i = 0; i < inputElements.length; i++) {
180         switch( inputElements[i].type ) {
181             case "text":
182                 inputElements[i].value = '';
183                 break;
184             case "checkbox":
185                 inputElements[i].checked = false;
186                 break;
187         }
188     }
189
190     var selectElements = myBlock.getElementsByTagName( "select" );
191     for (var i = 0; i < selectElements.length; i++) {
192         selectElements[i].selectedIndex = 0;
193     }
194
195 }
196
197 function confirmDelete() {
198     var agree = confirm(_("Are you sure you wish to delete this template?"));
199     return agree;
200 }
201
202 var modaction_legend_innerhtml;
203 var action_submit_value;
204
205 function editAction( mmta_id, ordering, action, field_number, from_field, from_subfield, field_value, to_field,
206     to_subfield, to_regex_search, to_regex_replace, to_regex_modifiers, conditional, conditional_field, conditional_subfield,
207     conditional_comparison, conditional_value, conditional_regex, description
208 ) {
209     document.getElementById('mmta_id').value = mmta_id;
210
211     setSelectByValue( 'action', action );
212     document.getElementById('action').onchange();
213
214     setSelectByValue( 'field_number', field_number );
215
216     document.getElementById('from_field').value = from_field;
217     document.getElementById('from_subfield').value = from_subfield;
218     document.getElementById('field_value').value = field_value;
219     document.getElementById('to_field').value = to_field;
220     document.getElementById('to_subfield').value = to_subfield;
221     $("#to_regex_search").val(to_regex_search);
222     $("#to_regex_replace").val(to_regex_replace);
223     $("#to_regex_modifiers").val(to_regex_modifiers);
224
225     document.getElementById('to_field_regex').checked = conditional_regex.length;
226     document.getElementById('to_field_regex').onchange();
227
228     setSelectByValue( 'conditional', conditional );
229     document.getElementById('conditional').onchange();
230
231     document.getElementById('conditional_field').value = conditional_field;
232     document.getElementById('conditional_subfield').value = conditional_subfield;
233
234     setSelectByValue( 'conditional_comparison', conditional_comparison );
235     document.getElementById('conditional_comparison').onchange();
236
237     document.getElementById('conditional_value').value = conditional_value;
238
239     document.getElementById('conditional_regex').checked = parseInt( conditional_regex );
240
241     document.getElementById('description').value = description;
242
243     window.modaction_legend_innerhtml = document.getElementById('modaction_legend').innerHTML;
244     document.getElementById('modaction_legend').innerHTML = _("Edit action %s").format(ordering);
245
246     window.action_submit_value = document.getElementById('action_submit').value;
247     document.getElementById('action_submit').value = _("Update action");
248
249     show('cancel_edit');
250 }
251
252 function cancelEditAction() {
253     document.getElementById('mmta_id').value = '';
254
255     setSelectByValue( 'action', 'delete_field' );
256     document.getElementById('action').onchange();
257
258     document.getElementById('from_field').value = '';
259     document.getElementById('from_subfield').value = '';
260     document.getElementById('field_value').value = '';
261     document.getElementById('to_field').value = '';
262     document.getElementById('to_subfield').value = '';
263     $("#to_regex_search").val("");
264     $("#to_regex_replace").val("");
265     $("#to_regex_modifiers").val("");
266
267     document.getElementById('to_field_regex').checked = false;
268     document.getElementById('to_field_regex').onchange();
269
270     setSelectByValue( 'conditional', '' );
271     document.getElementById('conditional').onchange();
272
273     document.getElementById('conditional_field').value = '';
274     document.getElementById('conditional_subfield').value = '';
275
276     setSelectByValue( 'conditional_comparison', '' );
277     document.getElementById('conditional_comparison').onchange();
278
279     document.getElementById('conditional_value').value = '';
280
281     document.getElementById('conditional_regex').checked = false;
282
283     document.getElementById('modaction_legend').innerHTML = window.modaction_legend_innerhtml;
284     document.getElementById('action_submit').value = window.action_submit_value;
285
286     hide('cancel_edit');
287 }
288
289 function setSelectByValue( selectId, value ) {
290     s = document.getElementById( selectId );
291
292     for ( i = 0; i < s.options.length; i++ ) {
293         if ( s.options[i].value == value ) {
294             s.selectedIndex = i;
295         }
296     }
297 }
298
299 </script>
300
301 </head>
302
303 <body id="tools_marc_modification_templates" class="tools">
304 [% INCLUDE 'header.inc' %]
305 [% INCLUDE 'cat-search.inc' %]
306
307 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; MARC modification templates</div>
308
309 <div id="doc3" class="yui-t2">
310   <div id="bd">
311     <div id="yui-main">
312         <div class="yui-b">
313             <h2>MARC modification templates</h2>
314             
315             [% IF error %]
316                 [% IF error == 'no_from_field' %]
317                     <div class="dialog message">Error: no field value specified.</div>
318                 [% END %]
319             [% END %]
320
321             [% IF ( TemplatesLoop ) %]
322
323                 <form method="get" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="select_template">
324                     <label for="select_template">Template: </label>
325                     <select name="template_id" id="select_template" style="width:20em;">
326                         [% FOREACH TemplatesLoo IN TemplatesLoop %]
327                                                     [% IF ( TemplatesLoo.selected ) %]
328                             <option value="[% TemplatesLoo.template_id %]" selected="selected"> [% TemplatesLoo.name %]</option>
329                                                     [% ELSE %]
330                             <option value="[% TemplatesLoo.template_id %]"> [% TemplatesLoo.name %]</option>
331                                                     [% END %]
332                         [% END %]
333                     </select>
334                     <input type="hidden" name="op" value="select_template">
335                     <input type="submit" value="Go" />
336                 </form>
337
338                 <form method="get" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="delete_template">
339                     <input type="hidden" name="template_id" value="[% template_id %]" />
340                     <input type="hidden" name="op" value="delete_template">
341                     <input type="submit" value="Delete template" onClick="return confirmDelete()" />
342                 </form>
343
344
345                 [% IF ( ActionsLoop ) %]
346                     <table>
347                         <caption>Actions for this template</caption>
348
349                         <tr>
350                             <th>Change order</th>
351                             <th>Order</th>
352                             <th>Action</th>
353                             <th>Description</th>
354                             <th>&nbsp</th>
355                             <th>&nbsp</th>
356                         </tr>
357
358                         [% FOREACH ActionsLoo IN ActionsLoop %]
359                             <tr>
360                                 <td style="white-space:nowrap;">
361                                     <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 %]">
362                                     <img src="[% interface %]/[% theme %]/img/go-up.png" border="0" alt="Go up" />
363                                         </a>
364
365                                 <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 %]">
366                                     <img src="[% interface %]/[% theme %]/img/go-top.png" border="0" alt="Go top" />
367                                         </a>
368
369                                         <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 %]">
370                                     <img src="[% interface %]/[% theme %]/img/go-bottom.png" border="0" alt="Go bottom" />
371                                         </a>
372
373                                         <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 %]">
374                                     <img src="[% interface %]/[% theme %]/img/go-down.png" border="0" alt="Go down" />
375                                         </a>
376                                 </td>
377
378                                 <td>[% ActionsLoo.ordering %]</td>
379                                 <td>
380                                     [% IF ( ActionsLoo.action_delete_field ) %] Delete [% END %]
381                                     [% IF ( ActionsLoo.action_update_field ) %] Update [% END %]
382                                     [% IF ( ActionsLoo.action_move_field ) %] Move [% END %]
383                                     [% IF ( ActionsLoo.action_copy_field ) %] Copy [% END %]
384                                     [% IF ( ActionsLoo.action_copy_and_replace_field ) %] Copy and replace [% END %]
385
386                                     [% UNLESS ( ActionsLoo.action_update_field ) %]
387                                         [% IF ( ActionsLoo.field_number ) %]
388                                             1st
389                                         [% END %]
390                                     [% END %]
391
392                                     field
393
394                                     [% ActionsLoo.from_field %][% IF ( ActionsLoo.from_subfield ) %]$[% ActionsLoo.from_subfield %][% END %]
395
396                                     [% IF ( ActionsLoo.field_value ) %]
397                                         with value <i>[% ActionsLoo.field_value %]</i>
398                                     [% END %]
399
400                                     [% IF ( ActionsLoo.to_field ) %]
401                                         to [% ActionsLoo.to_field %][% IF ( ActionsLoo.to_subfield ) %]$[% ActionsLoo.to_subfield %][% END %]
402
403                                         [% IF ( ActionsLoo.to_regex_search ) %]
404                                              using RegEx s<strong>/[% ActionsLoo.to_regex_search %]/[% ActionsLoo.to_regex_replace %]/[% ActionsLoo.to_regex_modifiers %]</strong>
405                                         [% END %]
406                                     [% END %]
407
408                                     [% IF ( ActionsLoo.conditional ) %]
409                                         [% IF ( ActionsLoo.conditional_if ) %] if [% END %]
410                                         [% IF ( ActionsLoo.conditional_unless ) %] unless [% END %]
411
412                                         [% ActionsLoo.conditional_field %][% IF ( ActionsLoo.conditional_subfield ) %]$[% ActionsLoo.conditional_subfield %][% END %]
413
414                                         [% IF ( ActionsLoo.conditional_comparison_exists ) %] exists [% END %]
415                                         [% IF ( ActionsLoo.conditional_comparison_not_exists ) %] does not exist [% END %]
416                                         [% IF ( ActionsLoo.conditional_comparison_equals ) %] matches [% END %]
417                                         [% IF ( ActionsLoo.conditional_comparison_not_equals ) %] does not match [% END %]
418
419                                         [% IF ( ActionsLoo.conditional_regex ) %] RegEx m/[% END %]
420                                         <strong>[% ActionsLoo.conditional_value %]</strong>
421                                         [% IF ( ActionsLoo.conditional_regex ) %]/[% END %]
422                                     [% END %]
423                                 </td>
424                                 <td>[% ActionsLoo.description %]</td>
425                                 <td><a href="#modaction" onclick='editAction(
426                                                     "[% ActionsLoo.mmta_id |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
427                                                     "[% ActionsLoo.ordering |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
428                                                     "[% ActionsLoo.action |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
429                                                     "[% ActionsLoo.field_number |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
430                                                     "[% ActionsLoo.from_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
431                                                     "[% ActionsLoo.from_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
432                                                     "[% ActionsLoo.field_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
433                                                     "[% ActionsLoo.to_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
434                                                     "[% ActionsLoo.to_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
435                                                     "[% ActionsLoo.to_regex_search |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
436                                                     "[% ActionsLoo.to_regex_replace |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
437                                                     "[% ActionsLoo.to_regex_modifiers |replace('\\\\', '\\\\') |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
438                                                     "[% ActionsLoo.conditional |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
439                                                     "[% ActionsLoo.conditional_field |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
440                                                     "[% ActionsLoo.conditional_subfield |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
441                                                     "[% ActionsLoo.conditional_comparison |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
442                                                     "[% ActionsLoo.conditional_value |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
443                                                     "[% ActionsLoo.conditional_regex |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
444                                                     "[% ActionsLoo.description |replace('\\\\', '\\\\') |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"
445                                                 );updateAllEvery();'>Edit</a></td>
446                                 <td><a href="marc_modification_templates.pl?template_id=[% ActionsLoo.template_id %]&op=delete_action&mmta_id=[% ActionsLoo.mmta_id %]">Delete</a></td>
447                             </tr>
448                         [% END %]
449                     </table>
450                 [% ELSE %]
451                     <div class="dialog message"><p>There are no defined actions for this template.</p></div>
452                 [% END %]
453
454                 <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_action" >
455                     <a name="modaction"></a>
456                     <fieldset>
457                         <legend id="modaction_legend">Add a new action</legend>
458                         <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>
459
460                         <select name="action" id="action" onchange="onActionChange(this);">
461                             <option value="delete_field">Delete</option>
462                             <option value="update_field">Add/Update</option>
463                             <option value="move_field">Move</option>
464                             <option value="copy_field">Copy</option>
465                             <option value="copy_and_replace_field">Copy and replace</option>
466                         </select>
467
468                         <span id="field_number_block">
469                             <select name="field_number" id="field_number">
470                                 <option value="0">All</option>
471                                 <option value="1">1st</option>
472                             </select>
473                         </span>
474
475                         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" />
476
477                         <span name="with_value_block" id="with_value_block" style="display:none;">
478                             with value <input type="text" name="field_value" id="field_value" />
479                         </span>
480
481                         <span name="to_field_block" id="to_field_block" style="display:none;">
482                             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" />
483
484                             <span name="to_field_regex_block" id="to_field_regex_block">
485                                 <sup>
486                                     <label for="to_field_regex">RegEx</label>
487                                     <input type="checkbox" name="to_field_regex" id="to_field_regex" onchange="onToFieldRegexChange(this);" />
488
489                                     <span name="to_field_regex_value_block" id="to_field_regex_value_block" style="display:none;">
490                                         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" />
491                                     </span>
492                                 </sup>
493                             </span>
494                         </span>
495
496                         <p/>
497
498                         <select name="conditional" id="conditional" onchange="onConditionalChange(this);">
499                             <option value="" selected="selected" />
500                             <option value="if">if</option>
501                             <option value="unless">unless</option>
502                         </select>
503
504                         <span name="conditional_block" id="conditional_block" style="display:none;">
505                             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" />
506
507                             <select name="conditional_comparison" id="conditional_comparison" onchange="onConditionalComparisonChange(this);">
508                                 <option value="" />
509                                 <option value="exists">exists</option>
510                                 <option value="not_exists">doesn't exist</option>
511                                 <option value="equals">matches</option>
512                                 <option value="not_equals">doesn't match</option>
513                             </select>
514
515                             <span name="conditional_comparison_block" id="conditional_comparison_block" style="display:none;">
516
517                                 <span class="match_regex_prefix">m/</span><input type="text" id="conditional_value" name="conditional_value" /><span class="match_regex_suffix">/</span>
518
519                                 <sup>
520                                     <label for="conditional_regex">RegEx</label>
521                                     <input type="checkbox" name="conditional_regex" id="conditional_regex" onchange="onConditionalRegexChange(this);" />
522                                 </sup>
523
524                             </span>
525                         </span>
526
527                         <input type="hidden" name="template_id" value="[% template_id %]" />
528                         <input type="hidden" name="mmta_id" id="mmta_id" />
529                         <input type="hidden" name="op" value="add_action" />
530
531                         <br/><br/>
532                         <label for="description">Description:</label>
533                         <input type="text" name="description" id="description" size="60" />
534
535                         <br/><br/>
536                         <input id="action_submit" type="submit" value="Add action" /> <a href="#modaction" id="cancel_edit" onclick="cancelEditAction();" style="display:none;">Cancel</a>
537
538                     </fieldset>
539                 </form>
540
541             [% ELSE %]
542                 <div class="dialog message"><p>There are no defined templates. Please create a template first.</p></div>
543             [% END %]
544
545             <form method="post" action="/cgi-bin/koha/tools/marc_modification_templates.pl" id="add_template" class="validated">
546                 <fieldset>
547                     <legend>Create a new template</legend>
548
549                     <label for="template_name" class="required">Name: </label>
550                     <input name="template_name" id="template_name" type="text" size="30" required="required" class="required" />
551                     <span class="required">Required</span>
552
553                     <input type="hidden" name="op" value="create_template" />
554                     <input type="submit" value="Create template" />
555
556                     [% IF ( template_id ) %]
557                         <input type="hidden" name="template_id" value="[% template_id %]" />
558                         <input type="checkbox" name="duplicate_current_template" id="duplicate_current_template" />
559                         <label for="duplicate_current_template">Duplicate current template</label>
560                     [% END %]
561                 </fieldset>
562             </form>
563         </div>
564     </div>
565
566     <div class="yui-b">
567         [% INCLUDE 'tools-menu.inc' %]
568     </div>
569   </div>
570 </div>
571 [% INCLUDE 'intranet-bottom.inc' %]