<!--#include file="inc/inc_syssite.asp"-->
<!--#include file="inc/inc_ubb.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>站点配置</title>
<%If Session("adminname")<>"" Then%>
	<link rel="stylesheet" href="admin/images/style.css" type="text/css" />
<%
Else
%>
<link rel="stylesheet" href="manager/images/style.css" type="text/css" />
<%End If%>
<script src="admin/images/menu.js" type="text/javascript"></script>
<%Call oblog.MakeEditorJs("",1)%>
</head>
<%
if Session("adminname")="" And  Session("m_name")="" then
	response.Write("无权限")
	response.end
end if
dim action,skintype,skinorder,t,ActionText,ActionField,actionid
t=0
Action=trim(request("Action"))
skintype=trim(request("skintype"))
skinorder=trim(request("skinorder"))
actionid=trim(request("do"))
select case actionid
	Case "1"
		ActionText="修改友情连接(htm代码)"
		ActionField="site_friends"
	Case "2"
		ActionText="修改网站公告(htm代码)"
		ActionField="site_placard"
	Case "3"
		ActionText="修改注册条款(htm代码)"
		ActionField="reg_text"
	Case "4"
		'前台管理员仅可操作此选项
		ActionText="修改用户管理后台通知(htm代码)"
		ActionField="user_placard"
end select
select case request("Actionsave")
	case "saveskin"
		call saveskin()
	case "savemodi"
		call savemodi()
end select

select case Action
	case "modiskin"
		call modiskin()
	Case Else
		call modi()
end select

sub savemodi()
	dim rs,strNote
	strNote=request("myTextArea")
	if not IsObject(conn) then link_database
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select "& ActionField &" from oblog_setup",conn,1,3
	rs(0)=strNote
	rs.update
	rs.close
	set rs=nothing
	oblog.reloadsetup
	oblog.showok "保存成功",""
end sub

sub saveskin()
	dim rs,sql,table
	if trim(request("skinname"))="" then response.Write("模板名不能为空"):response.End()
	if trim(request("myTextArea"))="" then response.Write("模板内容不能为空"):response.End()
	if skintype="user" then
		table="oblog_userskin"
	elseif skintype="sys" then
		table="oblog_sysskin"
	else
		response.Write("参数错误")
		response.end
	end if	
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from "&table&" where id="&clng(request.QueryString("id"))
	if not IsObject(conn) then link_database
	rs.open sql,conn,1,3
	if skintype="sys" then
		rs("sysskinname")=trim(request("skinname"))
	else
		rs("userskinname")=trim(request("skinname"))
		rs("skinpic")=trim(request("skinpic"))
		rs("skinauthorurl")=trim(request("skinauthorurl"))
	end if
	rs("skinauthor")=trim(request("skinauthor"))
	if skinorder="0" then
		rs("skinmain")=request("myTextArea")
	else
		rs("skinshowlog")=request("myTextArea")
	end if
	rs.update
	rs.close
	set rs=nothing
	oblog.reloadsetup
	Application(oblog.cache_name&"index_update")=true
	oblog.showok "保存成功",""
end Sub
sub modiskin()
	dim rs,table
	if skintype="user" then
		table="oblog_userskin"
	elseif skintype="sys" then
		table="oblog_sysskin"
	else
		response.Write("参数错误")
		response.end
	end if	
	set rs=oblog.execute("select * from "&table&" where id="&clng(request.QueryString("id")))
	if rs.eof then
		response.write("无记录")
		response.End()
	end if
%>
<body>
<div id="main_body">
	<ul class="main_top">
		<li class="main_top_left left">网站配置</li>
		<li class="main_top_right right"> </li>
	</ul>
	<div class="main_content_rightbg">
		<div class="main_content_leftbg">
<form method="POST" action="" id="oblogform" name="oblogform" onSubmit="submits();">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" >
    <tr>
      <td width="769" height="22"><strong>修改模板</strong></td>
    </tr>
    <tr>
      <td height="25">模板名称：
        <input name="skinname" type="text" id="skinname" value=<%if skintype="sys" then response.Write rs("sysskinname") else response.Write rs("userskinname")%>>
        　　作者：
        <input name="skinauthor" type="text" id="skinauthor" value=<%=rs("skinauthor")%>>
<%if skintype="user" then%>
<br>
        模板作者连接：
        <input name="skinauthorurl" type="text" id="skinauthorurl" size="50" value="<%=rs("skinauthorurl")%>">
         <br>
        模板预览图片：
        <input name="skinpic" type="text" id="skinpic" size="50" value="<%=rs("skinpic")%>">
<%end if%>
		</td>
    </tr>
    <tr>
      <td>
      	<%
      	Dim sValue
      	if skinorder="0" then
			if rs("skinmain")<>"" then sValue = Server.HtmlEncode(filtskinpath(rs("skinmain")))
		else
			if rs("skinshowlog")<>"" then sValue = Server.HtmlEncode(filtskinpath(rs("skinshowlog")))
		end if
      	%>
		<div id="textarea"><textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px; display:none"><%=sValue%></textarea ></div>
		
		<% sValue=""%>
</td>
    </tr>
    <tr>
      <td> <div align="center">
        <input name="Actionsave" type="hidden" id="Action" value="saveskin">
        <input name="cmdSave" type="submit" id="cmdSave" value=" 保存修改 " >
      </div></td>
    </tr>
  </table>
</form>
		</div>
	</div>
	<ul class="main_end">
		<li class="main_end_left left"></li>
		<li class="main_end_right right"></li>
	</ul>
</div>
<%
set rs=nothing
end sub

sub modi()
	dim rs
	if ActionField="" then
		response.write("错误的参数")
		response.end
	end if
	set rs=oblog.execute("select "& ActionField &" from oblog_setup")
%>
<body>
<div id="main_body">
	<ul class="main_top">
		<li class="main_top_left left"><%=ActionText%></li>
		<li class="main_top_right right"> </li>
	</ul>
	<div class="main_content_rightbg">
		<div class="main_content_leftbg">
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr>
    <td>
	<div id="textarea">
	<form name="oblogform" method="post" onSubmit="submits();">
            	<textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px; display:none"><%=Server.HtmlEncode(filtskinpath(OB_IIF(rs(0),"")))%></textarea >
				<br>
				<input name="Actionsave" type="hidden" id="Action" value="savemodi">
                <input type="submit" name="Submit" value="提交修改">
      </form>
	  </div>
	  </td>
  </tr>
</table>
		</div>
	</div>
	<ul class="main_end">
		<li class="main_end_left left"></li>
		<li class="main_end_right right"></li>
	</ul>
</div>
</body>
</html>
<%
set rs=nothing
end sub
%>
</body>
</html>