<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<!--#include file="inc/function.asp" -->
<HTML>
<HEAD>
<TITLE>修改模板</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {	color: #FFFFFF;
	font-weight: bold;
}
</style>

</HEAD>
<BODY>
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p03")
'''''''''''''''''''''''''''''''''''''''''''''''
'获得大类
dim id,classid,TempletArr
%>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
dim act,TempName,TempContent,newsclass,catalogName
act=request.QueryString("act")
if(act="modi") then
	id=Cint(request("id"))
	newsclass=Cint(request.Form("newsclass"))
	TempName=trim(request.Form("tempname"))
	TempContent = TempContent & Request.Form("content1")
	if(len(TempContent)<1) then
		response.Write("<script>alert(""模板内容不能为空!"");history.back();</script>")
		response.End()
	end if
	call ModiTemplet()
	response.Write("<br><p align=""center"">成功修改模板~!</p><p align=""center""><a href=""javascript:history.go(-2)"">继续修改</a><p>")
else
	id=cint(request("id"))
	set rs=server.CreateObject("adodb.recordset")
	sql="select templetname,content,classid from templet where id="&id
	rs.open sql,conn,3,1
	if not rs.eof and not rs.bof then
		TempletArr=rs.GetRows()
		rs.close
		set rs=nothing
	else
		response.Write("没有找到记录")
		rs.close
		set rs=nothing
		response.End()
	end if
	if(Clng(TempletArr(2,0))=0) then
		catalogName="根栏目"
	else
		catalogName=getCatalogName(TempletArr(2,0))
	end if
%>
<FORM method="POST" name="form1" action="?act=modi" style="margin:0 0 0 0; " onSubmit="return check(this);">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="22" colspan="2"><div align="center"><span class="style1">◆ 模板修改 ◆</span></div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD><div align="center">所 属 类 别：</div></TD>
  <TD>
  <select name="newsclass" >
  <%  
	response.Write("<option value="&TempletArr(2,0)&">"&catalogName&"</option>"&Chr(10))	
  %>
        
    </select>
	&nbsp;&nbsp;<a href="#" onClick="addParentOption();">＋</a>
	</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD><div align="center">模 板 标 题：</div></TD>
  <TD><input name="tempname" type="text" size="60" value="<%=TempletArr(0,0)%>"></TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD><div align="center">模 板 内 容：</div></TD>
	<TD>		
		<textarea name="content1" cols="100" rows="25"><%=replace(replace(TempletArr(1,0),"<","&lt;"),">","&gt;")%></textarea>
		<!--<IFRAME ID="eWebEditor1" src="webedit/ewebeditor.asp?id=content1&style=standard_coolblue" frameborder="0" scrolling="no" width="550" height="350"></IFRAME>	-->
	  </TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD align=right><div align="left">
		<input type="hidden" name="id" value="<%=id%>">
        <input type=submit name=b1 value="提交">
        <input type=reset name=b2 value="重填">        
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
end if
sub ModiTemplet
	set rs=server.createobject("adodb.recordset")
	sql="select * from templet where id="&id
	rs.open sql,conn,3,3	
	rs("classid")=newsclass
	rs("templetname")=TempName
	rs("content")=TempContent
	rs("moditime")=now
	rs.update
	rs.close
	set rs=nothing
end sub
%>
<script language="JavaScript">
function check(obj)
{
	if(obj.tempname.value==""){
		alert("模板名称不能为空!");
		obj.tempname.select();
		obj.tempname.focus();
		return false;
	}	
}
function addParentOption()
{
	var arr = showModalDialog("tree_container.asp", "", "dialogWidth:410px; dialogHeight:420px; status:0");
  	if (arr != null){  
   		document.form1.newsclass.options[0]=new Option(arr[1],arr[0]);
  	}
	
}
</script>
</BODY>
</HTML>
<%
call connclose()
%>