<%Links::Tools::template_editor%>
<%Links::Tools::tpl_dir_select($tpl_dir, '(?:browser|admin)')%>
<%Links::Tools::tpl_file_select($tpl_dir, '(?:\..*|.*\.eml|globals\.txt|language\.txt)')%>
<%set font_tag = '<font face="Tahoma,Arial,Helvetica" size="2">'%>
<html>

<head>
<title>Gossamer Links - Build - Templates</title>
<base target="_self">
</head>

<body bgcolor="#FFFFFF">
<table border="1" cellpadding="0" cellspacing="0"><tr><td>
	<table bgColor="#ffffff" border="0" cellPadding="3" cellSpacing="3" width="500" valign="top">
	  <tr>
		<td align="left" bgColor="navy"><b><font color="#ffffff" size="2" face="Tahoma,Arial,Helvetica">Edit
          Templates</font></b></td>
	  </tr>
	  <tr>
		<td>
		  <p align="center"><b><font color="#000000" size="2" face="Tahoma,Arial,Helvetica">Edit
          Templates</font></b></p>
		  <p><%font_tag%>From here you can quickly edit any of your user templates. <b>Note:</b> If you edit your
		     templates manually, be sure to read the <a href="admin.cgi?do=help&topic=help_templates.html" target="_blank">template
			 help</a> for where to save your templates!</font>
			  <%if success_message%>
			  	  <p><%font_tag%><font color="green"><b><%success_message%></b></font></font></p>
			  <%endif%>
			  <%if error_message%>
				  <p><%font_tag%><font color="red"><b><%error_message%></b></font></font></p>
			  <%endif%>      
          </td>
	  </tr>
	</table>
	</td></tr>
</table>

<br>
<form action="admin.cgi" method="POST">
<input type="hidden" name="do" value="page">
<input type="hidden" name="page" value="build_tpl.html">

<table border="1" cellpadding="0" cellspacing="0"><tr><td>
	<table bgColor="#ffffff" border="0" cellPadding="3" cellSpacing="3" width="500" valign="top">
	  <tr><td>

    <p><%font_tag%>Currently working on template set: <select name="tpl_dir"><%loop template_set_loop%><option<%if dir_selected%> selected<%endif%>><%directory%></option><%endloop%></select> <input type="submit" value="Change" name="change"></font></p>

    <p><%font_tag%>Available templates: <select name="tpl_file"><option value="">---</option><%loop template_loop%><option value="<%filename%>"<%if filename eq $tpl_file%> selected<%set tpl_local = $local%><%set tpl_new_local = $new_local%><%endif%>><%filename%><%if local and new_local%> *<%elsif local%> +<%endif%></option><%endloop%></select> <input type="submit" value="Load" name="load"></font></p>
    <p><%font_tag%>* modified template<br>
    + non-default template</font></p>

<%if tpl_file%>
	  <table cellpadding=0 cellspacing=0 bgcolor=black border=0 width="100%"><tr><td>
		<table border=0 cellspacing=1 cellpadding=3 width="100%">
		  <tr>
			<td colspan="2"><%font_tag%><font color=white><b><u>File information:</u></b></font></font></td>
		  </tr>
			<td bgcolor="#AAAAAA" width="1%"><%font_tag%>Admin&nbsp;path:</font></td>
			<td bgcolor="white"><%font_tag%><%file_path%></font></td>
		  </tr>
		  <tr>
			<td bgcolor="#AAAAAA"><%font_tag%>File&nbsp;size:</font></td>
			<td bgcolor="white" id="size"><%font_tag%><%file_size%> bytes</font></td>
		  </tr>
		  <tr>
			<td bgcolor="#AAAAAA"><%font_tag%>Status:</font></td>
			<td bgcolor="white" id="status"><%font_tag%>
<%if file_local%>
<%  if file_restore%>Modified from system default (<a href="admin.cgi?do=fileman_diff;template=<%tpl_dir%>;file=<%tpl_file%>" target="_blank">diff</a>) - <a href="admin.cgi?do=page;page=build_tpl.html;restore=<%escape_url tpl_file%>;tpl_dir=<%escape_url tpl_dir%>;tpl_file=<%escape_url tpl_file%>" onClick="return confirm('Are you sure you want to restore the <%tpl_file%> template?')">Restore</a>
<%  else%>Custom template - <a href="admin.cgi?do=page;page=build_tpl.html;delete=<%escape_url tpl_file%>;tpl_dir=<%escape_url tpl_dir%>" onClick="return confirm('Are you sure you want to delete the <%tpl_file%> template?')">Delete</a>
<%  endif%>
<%else%>Default system template
<%endif%>
			</font></td>
		  </tr>
		  <tr>
			<td bgcolor="#AAAAAA"><%font_tag%>Last&nbsp;modified:</font></td>
			<td bgcolor="white" id="last_mod"><%font_tag%><%file_mod_time%></font></td>
		  </tr>
		</table>
	  </td></tr></table>
<%endif%>

  <p><textarea rows="<%editor_rows%>" name="tpl_text" cols="<%editor_cols%>" wrap="off"><%tpl_text%></textarea>
  </p>
  <p><%font_tag%>Save template as: <input type="text" name="tpl_name" value="<%tpl_name%>" size="20">
 <input type="submit" value="Save" name="saveas"></font></p>
  <p><%font_tag%>Resize Textarea to: <input type="text" name="cookie-editor_rows" value="<%editor_rows%>" size="3"> rows, <input type="text" name="cookie-editor_cols" value="<%editor_cols%>" size=3> columns <input type="submit" name="set-cookie" value="Change"></font></p>
		</td></tr>
	</table>
	</td></tr>
</table>
</form>

</body>
</html>
