<%
dim fso
dim file_t
dim objFile

Set fso = CreateObject("Scripting.FileSystemObject")
if request("action")="backup" then
	file_t=Server.MapPath("../object/backup/"&MySys.object.object_template&".asp")
else
	file_t=Server.MapPath("../object/"&MySys.object.object_template&".asp")
end if

If Not fso.FileExists(file_t) then
	if request("action")="backup" then
		response.write "<center><br><br><a href='admin_object_edit.asp?id="&MySys.object.object_id&"&open=1'>模版文件的备份文件不存在，无法恢复！点击返回</a></center>"
	else
		response.write "<center><br><br>模版文件不存在！</center>"
	end if
else
	Set objFile = fso.GetFile(file_t)
	File_lasttime = objFile.DateLastModified
	set objFile = nothing
	Set sf = fso.OpenTextFile(file_t)
	File_source=sf.ReadAll
	set sf=nothing
	set fso=nothing
	'////////////////////////////////////////////////////////////
	File_source=replace(File_source,"<%=","{$")
	File_source=replace(File_source,"<%","{$=")
	File_source=replace(File_source,"%\>","$}")
	File_source=replace(File_source,"<","&lt;")
	File_source=replace(File_source,">","&gt;")
%>
<br>
<form name=edit_template target=admin_edit_template method=post><input type=hidden name=c value=''><input type=hidden name=formname value=''><input type=hidden name=inputname value=''></form>
<form name=object_template action="admin_object_edit_template_handle.asp?id=<%=MySys.object.object_id%>&template=<%=MySys.object.object_template%>" method=post>
<table cellpadding="3" cellspacing="4" width="90%" height="30" align=center style='border:1px solid #ebebeb' >
	<tr>
		<td width="2%" align=right><img alt='点击弹开编辑框' onclick="opencat(basic_open)" style='CURSOR: hand' src="Images/index_search.gif" width="8" height="16"></td>
		<td  width="98%" align=left>
		<font color="#ebebeb"> | </font>
		<img alt='点击弹开提示信息框' onclick="opencat(help_basic_open)" style='CURSOR: hand' src="Images/icon_info.gif" width="13" height="13" hspace="0" align="absmiddle">			
		<font color="#ebebeb"> | </font>
		网站栏目模版编辑
	    </td>
	</tr>		
	<tr id="help_basic_open" style="display:  ">
		<td colspan="10" align=left>
		<table cellpadding="4" cellspacing="2" width="99%" height="30" align=center style='border:1px dashed #B7B7B7' >
			<tr>
				<td colspan="8" width='100%' style="line-height:150% ">
				·您可以修改模版的源码<br>
				·如果您修改后的栏目出现问题请导入系统默认模版恢复！！<br>
				·注意：除非您对asp非常了解并熟练运用否则请不要修改<font color=blue>{$= ........ $}</font>标记中的内容！！<br>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	
	<tr id="basic_open" >
		<td colspan="10" align=left style='padding-bottom:5px'>
		<table cellpadding="4" cellspacing="2" bgcolor='#f7f7f7' width="99%" height="30" align=center style='border:1px dashed #808080;padding:20px' >
			<tr>
				<td  width="100%" align=left>模版路径:
				<font color=blue >/object/<%=MySys.object.object_template%>.asp</font> 
				</td>
			</tr>
			<tr>
				<td  width="100%" align=left>最后修改:<font color=blue ><%=File_lasttime%></font>
				</td>
			</tr>
			<tr>
				<td  width="100%" align=left><input type=button value='导入系统默认模版！' onclick='window.location="admin_object_edit.asp?id=<%=request("id")%>&action=backup&open=1"'> 注意：恢复后将丢失您当前修改的模版内容！！
				</td>
			</tr>
			<tr>
				<td  width="100%" align=left >
                <textarea id="object_content" name="object_content" cols="68" rows="16" wrap="off"><%=file_source%></textarea>
                <a title='点击进行详细编辑！' href="javascript:openedit_template('object_template','object_content','object,public,link','','<%=int(timer)%>','栏目源码编辑 > /object/<%=MySys.object.object_template%>.asp');" >
				<img border=0 src="Images/old.gif" width="21" height="20" align="top">
				</a>
				</td>
			</tr>
		</table>
		</td>
	</tr>

	<tr>
		<td height='1' colspan="9" background='images/dot03.gif'></td>
	</tr>
	
	<tr>
		<td height='30' colspan="8" width='100%' align=center >
	  <input type=submit value="提交设置！" >
	  <input type=reset value="重置" >
		</td>
	</tr>
</table>	
</form>
<%end if%>