<!--#include file="conn.asp"-->
<!--#include file="Admin_Chkpass.asp"-->
<html>
<head>
<title>系统模版管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css">
</head>
<%
dim action
Action=trim(request("Action"))

select case Action
	case "saveconfig" 
		call saveconfig()
	case "showconfig"
		call showconfig()
	case "modiconfig"
		call modiconfig()
	case "savedefault"
		call savedefault()
	case "modiviceconfig"
		call modiviceconfig()
	case "saveviceconfig"
		call saveviceconfig()
	case "addconfig"
		call addconfig()
	case "delconfig"
		call delconfig()	
end select

sub showconfig()
dim rs
set rs=conn.execute("select * from sysskin ")
%>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<br>
<table cellpadding="2" cellspacing="1" border="0" width="98%" class="border" align=center>
  <tr align="center">
    <td width="300" height=25 class="topbg"><div align="left"><strong>系统模版管理</strong></div>
  </tr>
</table>
<form name="form2" method="post" action="admin_sysskin.asp?action=savedefault">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" Class="border">
  <tr class="topbg"> 
      <td width="10%" height="25" >
<div align="center">ID</div></td>
    <td width="20%" > <div align="center">名称</div></td>
    <td width="20%" ><div align="center">作者</div></td>
      <td width="10%" >
<div align="center">默认模版</div></td>
      <td width="40%" > 
        <div align="center">模版管理</div></td>
  </tr>

 <% 
while not rs.eof	  
%> 
          <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> 
          <td width="10%"> 
              <div align="center"><%= rs("id") %>&nbsp;</div></td>
          <td width="20%" > <div align="center"><%= rs("sysskinname") %></div></td>
          <td width="20%" ><div align="center"><%= rs("skinauthor") %></div></td>
            <td width="10%">              <div align="center"> 
                <input name="radiobutton" type="radio" class="tdbg" value='<%=rs("id")%>' <%if rs("isdefault")="true" then response.Write "checked" %>>
            </div></td>
            <td width="40%"> 
                <div align="center"><a href="admin_sysskin.asp?action=modiconfig&id=<%=rs("id")%>">修改主模版</a> 
                        　<a href="admin_sysskin.asp?action=modiviceconfig&id=<%=rs("id")%>">修改副模版</a> 　<a href="admin_sysskin.asp?action=delconfig&id=<%=rs("id")%>" onclick=return(confirm("确定要删除这个模版吗？"))>删除模版</a></div></td>
        </tr>
      
      <%
rs.movenext
wend
%>   
    <tr> 
    <td height="40" colspan="5" align="center" class="tdbg"> <div align="center"> 
          <input type="submit" name="Submit" value="保存设置">
        </div></td>
  </tr>
</table>
</form>
<%call copyright()%>
<%
	set rs=nothing
	call closeconn
end sub

sub savedefault()
	dim rs,isdefaultID
	isdefaultID=clng(trim(request("radiobutton")))
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select id,isdefault from sysskin",conn,1,3
	while not rs.eof
		if isdefaultID=rs("id") then
			rs("isdefault")="true"
		else
			rs("isdefault")="false"
		end if
		rs.update
		rs.movenext
	wend
	rs.close
	set rs=nothing
	call PutApplicationValue()
	call closeconn()
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""修改成功！"");"
	Response.Write"window.history.go(-1);"
	Response.Write"</script>"
end sub


sub saveconfig()
	dim rs,sql
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from sysskin where id="&clng(request.QueryString("id"))
	rs.open sql,conn,1,3
	'rs.addnew
	rs("sysskinname")=trim(request("sysskinname"))
	rs("skinauthor")=trim(request("skinauthor"))
	rs("skinmain")=request("skinmain")
	rs.update
	rs.close
	set rs=nothing
	call PutApplicationValue()
	call closeconn
	response.Redirect "admin_sysskin.asp?action=modiconfig&id="&clng(request.QueryString("id"))
end sub

sub saveviceconfig()
	dim rs,sql
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from sysskin where id="&clng(request.QueryString("id"))
	rs.open sql,conn,1,3
	rs("sysskinname")=trim(request("sysskinname"))
	rs("skinauthor")=trim(request("skinauthor"))
	rs("skinshowlog")=request("skinshowlog")
	rs.update
	rs.close
	set rs=nothing
	call PutApplicationValue()
	call closeconn
	response.Redirect "admin_sysskin.asp?action=modiviceconfig&id="&clng(request.QueryString("id"))
end sub

sub delconfig()
	conn.execute("delete from sysskin where id="&clng(request.QueryString("id")))
	call closeconn
	response.Redirect "admin_sysskin.asp?action=showconfig"
end sub

sub modiconfig()
	dim rs
	set rs=conn.execute("select * from sysskin where id="&clng(request.QueryString("id")))
%>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor" onLoad="oblog_Size(500);">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border" >
    <tr class="topbg"> 
      
    <td height="22" colspan=2 align=center><strong>修改系统模版</strong></td>
    </tr>
    <tr class="tdbg"> 
      
    <td width="253" height="30"><strong>现在修改的模版是<%=rs("sysskinname")%>的主模版</strong></td>
      
    <td width="516" height="30"><a href="admin_sysskin.asp?action=modiconfig&id=<%=rs("id")%>">修改主模版</a>　　　<a href="admin_sysskin.asp?action=modiviceconfig&id=<%=rs("id")%>">修改副模版</a>　　　<a href="admin_sysskin.asp?action=showconfig">返回管理菜单</a>　　 <a href="admin_skin_help.asp" target="_blank"><strong>模版标记帮助</strong></a></td>
    </tr>
</table>

<form method="POST" action="admin_sysskin.asp?id=<%=clng(request.QueryString("id"))%>" id="form1" name="form1" onSubmit="submits();">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
    <tr> 
      <td width="769" height="22" class="topbg"><strong>修改模版</strong></td>
    </tr>
    <tr>
      <td height="25" class="tdbg">模版名称： 
        <input name="sysskinname" type="text" id="sysskinname" value=<%=rs("sysskinname")%>>
        　　作者：
        <input name="skinauthor" type="text" id="skinauthor" value=<%=rs("skinauthor")%>></td>
    </tr>
    <tr> 
      <td height="25" class="tdbg"><INPUT type="hidden" id='edit' name="skinmain" value="<%=Server.HtmlEncode(rs("skinmain"))%>">
                <!--#include file="edit.asp"--></td>
    </tr>
    <tr> 
      <td class="tdbg"> <div align="center">
        <input name="Action" type="hidden" id="Action" value="saveconfig"> 
        <input name="cmdSave" type="submit" id="cmdSave" value=" 保存修改 " > 
      </div></td>
    </tr>
  </table>

</form>
<%call copyright()%>

<%
set rs=nothing
end sub

sub modiviceconfig()
	dim rs
	set rs=conn.execute("select * from sysskin where id="&clng(request.QueryString("id")))
%>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor" onLoad="oblog_Size(200);">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
    <tr class="topbg"> 
      
    <td height="22" colspan=2 align=center><strong>修改系统模版</strong></td>
    </tr>
    <tr class="tdbg"> 
      
    <td width="253" height="30"><strong>现在修改的模版是<%=rs("sysskinname")%>的副模版</strong></td>
      
    <td width="516" height="30"><a href="admin_sysskin.asp?action=modiconfig&id=<%=rs("id")%>">修改主模版</a>　　　<a href="admin_sysskin.asp?action=modiviceconfig&id=<%=rs("id")%>">修改副模版</a>　　　<a href="admin_sysskin.asp?action=showconfig">返回管理菜单　</a>　 <a href="admin_skin_help.asp" target="_blank"><strong>模版标记帮助</strong></a></td>
    </tr>
</table>

<form method="POST" action="admin_sysskin.asp?id=<%=clng(request.QueryString("id"))%>" id="form1" name="form1" onSubmit="submits();">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
    <tr> 
      <td width="769" height="22" class="topbg"><strong>修改模版</strong></td>
    </tr>
    <tr>
      <td height="25" class="tdbg">模版名称： 
        <input name="sysskinname" type="text" id="sysskinname" value=<%=rs("sysskinname")%>>
        　　作者：
        <input name="skinauthor" type="text" id="skinauthor" value=<%=rs("skinauthor")%>></td>
    </tr>
    <tr> 
      <td height="25" class="tdbg"><INPUT type="hidden" name="skinshowlog" id='edit' value="<%
	  if rs("skinshowlog")<>"" then
	 response.Write Server.HtmlEncode(rs("skinshowlog"))
	 else
	 response.Write ""
	 end if
	  %>">
               <!--#include file="edit.asp"--></td>
    </tr>
    <tr> 
      <td class="tdbg"> <div align="center">
        <input name="Action" type="hidden" id="Action" value="saveviceconfig"> 
        <input name="cmdSave" type="submit" id="cmdSave" value=" 保存修改 " > 
      </div></td>
    </tr>
  </table>

</form>
<%call copyright()%>
</body>
</html>
<%
set rs=nothing
end sub
%>