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