<!-- $Id: manage_template.tt2 12726 2016-03-09 04:01:24Z sikeda $ -->

<h2>[%|loc%]Modify or delete existing rejection messages[%END%]</h2>
<p>

[% IF available_files %]

<table border="1">
<table  class="responsive listOfItems">
<caption>[%|loc%]Listing rejection messages[%END%]</caption>
	<tr><th colspan="4">[%|loc%]Listing rejection messages[%END%]</th></tr>
	<tr><th>[%|loc%]Use as default[%END%]</th><th>[%|loc%]Message name[%END%]</th><th colspan="2">[%|loc%]Operation[%END%]</th></tr>

        <form action="[% path_cgi %]" method="post" name="manage_templates">
        <fieldset>
        <input type="hidden" name="action" value="manage_template">
        <input type="hidden" name="list" value="[% list %]">
        <input type="hidden" name="new_default" value="[% default_reject_template %]">

	[% SET dark = 1 %]
	[% FOREACH file = available_files %]
		[% IF dark == '1' %]
			  [% dark = '0' %]
			  <tr>
		[% ELSE %]
			  [% dark = '1' %]
        		  <tr class="color0">
		[% END %]
                <td align="center">
                <input type="radio" name="subaction_setdefault" value="[% file %]" [% IF file == default_reject_template %] checked="checked" [% ELSE %]  onchange="this.form.new_default.value = '[%file%]' ; this.form.submit();" [% END %]>
	        </td> 
       		<td>
		[% file %]
		</td>
                <td  align="center">
		<a href="[% 'manage_template/modify' | url_rel([list,file]) %]" class="MainMenuLinks">[%|loc%]Edit[%END%]</a>
		</td>
		<td align="center">
		<a href="[% 'manage_template/delete' | url_rel([list,file]) %]" class="MainMenuLinks" onclick="return request_confirm('[% | escape_quote %][%|loc(file)%]Do you really want to delete message %1?[%END%][%END%]')">[%|loc%]Delete[%END%]</a>
		</td>
		</tr>
	[% END %]
</fieldset>
</form>

[% ELSE %]
<tr><td colspan="4">[%|loc%]There are currently no Rejection Messages available[%END%]<td>
[% END %]

</table>
</table>

[%IF content %] 

<form action="[% path_cgi %]" method="post" name="edit_templates">
<p>
<h2>[%|loc%]Edit[%END%] [% message_template %]</h2>
</p>
<p>
<!-- [%|loc()%]Message Name:[%END%]<input type="text" name="message_template" value="[% message_template %]"> -->
<!-- <input class="MainMenuLinks" type="submit" name="subaction_default" value="[%|loc%]Default Message[%END%]" /> -->

<textarea name="template_content" cols="50" rows="10" wrap="soft">
  [%~ content ~%]
</textarea>
</p>
<p>
<input class="MainMenuLinks" type="submit" name="subaction_save" value="[%|loc%]Save Message[%END%]" />
<input class="MainMenuLinks" type="submit" name="action_manage_template" value="[%|loc%]Cancel[%END%]" />
<input type="hidden" name="message_template" value="[% message_template %]"/>
<input type="hidden" name="list" value="[% list %]"/>
<input type="hidden" name="action" value="manage_template"/>
</p>
</fieldset>
</form>

[% ELSE %]

<h2>[%|loc%]Create new rejection messages[%END%]</h2>

<form action="[% path_cgi %]" method="post" name="edit_templates">
<fieldset>
<input type="hidden" name="list" value="[%list%]">
<input type="hidden" name="action" value="manage_template">

<label for="new_template_name">[%|loc%]New message name:[%END%]</label> <input id="new_template_name" type="text" name="new_template_name"> <input type="submit" name="subaction_create_new" value="[%|loc%]create[%END%]" class="MainMenuLinks">

</fieldset>
</form>

[% END %]

<!-- end manage_template.tt2 -->
