<!--#include file="../Inc/conn.asp"-->
<!--#include file="admin_check.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="images/Admin_css.css" type=text/css rel=stylesheet>
<link rel="shortcut icon" href="<%=SitePath%>images/myfav.ico" type="image/x-icon" />
<script src="js/admin.js"></script>
</head>

<body>
<%
	if request("action") = "add" then 
		call add()
	elseif request("action")="edit" then
		call edit()
	elseif request("action")="savenew" then
		call savenew()
	elseif request("action")="savedit" then
		call savedit()
	elseif request("action")="del" then
		call del()
	else
		call List()
	end if
 
sub List()
	dim currentpage,page_count,Pcount
	dim totalrec,endpage
	currentPage=request("page")
	if currentpage="" or not IsNumeric(currentpage) then
		currentpage=1
	else
		currentpage=clng(currentpage)
		if err then
			currentpage=1
			err.clear
		end if
	end if
	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_Css"
	on error resume next
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		call add()
	else
%>
<table border="0"  align="center" cellpadding="3" cellspacing="2" bgcolor="#FFFFFF" class="admintable">
<tr> 
  <td colspan="12" align=left class="admintitle">风格列表　[<a href="?action=add">添加</a>]　　
    <%If Not IsObjInstalled("Scripting.FileSystemObject") Then%><font color="#FFFF00">你的空间不支持Fso,请直接修改Images目录下的Css文件。</font><%end if%></td>
</tr>
  <tr align="center"> 
    <td width="10%" class="ButtonList">风格ID</td>
    <td width="7%" class="ButtonList">色一</td>
    <td width="7%" class="ButtonList">色二</td>
    <td width="7%" class="ButtonList">色三</td>
    <td width="7%" class="ButtonList">色四</td>
    <td width="7%" class="ButtonList">色五</td>
    <td width="7%" class="ButtonList">色六</td>
    <td width="7%" class="ButtonList">色七</td>
    <td width="7%" class="ButtonList">色八</td>
    <td width="7%" class="ButtonList">色九</td>
    <td width="7%" class="ButtonList">色十</td>
    <td width="20%" class="ButtonList">操 作</td>
  </tr>
<%
		rs.PageSize = 20
		rs.AbsolutePage=currentpage
		page_count=0
		totalrec=rs.recordcount
		while (not rs.eof) and (not page_count = 20)
%>
    <tr bgcolor="#f7f7f7">
    <td height="25" align="center"><%=rs("ID")%>.<%=rs("title")%></td>
    <td height="25" style="background:<%=Replace(rs("Color1"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color2"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color3"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color4"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color5"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color6"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color7"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color8"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color9"),"url(","url(../images/")%>;"></td>
    <td height="25" style="background:<%=Replace(rs("Color10"),"url(","url(../images/")%>;"></td>
    <td align="center"><a href="?action=edit&id=<%=rs("ID")%>">编辑</a>|<a href="?action=del&id=<%=rs("ID")%>" onClick="JavaScript:return confirm('确定删除风格“<%=rs("title")%>”？')">删除</a>|<a href="Admin_CssHtml.asp?ID=<%=rs("ID")%>">生成Css</a></td>
    </tr>
<%
		page_count = page_count + 1
		rs.movenext
		wend
%>
</table>
<%
	end if
	rs.close
	set rs=nothing
end sub

sub del()
	id=request("id")
	set rs=conn.execute("delete from "&tbname&"_Css where id="&id)
	Call Alert ("删除成功！","Admin_Css.asp")
end sub

sub add()
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="2" bgcolor="#FFFFFF" class="admintable">
<tr> 
  <td colspan="5" class="admintitle">添加风格</tr>
<form action="?action=savenew" method=post>
<tr>
<td width="20%" bgcolor="#f7f7f7" class=tdleft>风格名称</td>
<td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Title" id="Title"></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>内容位于</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><select name="content" id="content">
    <option value="left">左边</option>
    <option value="right">右边</option>
  </select></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>背景颜色</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="bodybg" id="bodybg">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'bodybg');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">网站背景色</span></td>
</tr>
<tr>
<td width="20%" bgcolor="#f7f7f7" class=tdleft>颜色一</td>
<td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color1" id="Color1">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color1');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">顶部菜单背景色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色二</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color2" id="Color2">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color2');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">右边边框色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色三</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color3" id="Color3">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color3');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">右边背景色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色四</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color4" id="Color4">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color4');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">顶部菜单色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色五</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color5" id="Color5">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color5');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">文章列表标题色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色六</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color6" id="Color6">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color6');" title="选取标题颜色" align="absmiddle" ID="ColorBG6">　<span class="note">列表摘要文字颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色七</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color7" id="Color7">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color7');" title="选取标题颜色" align="absmiddle" ID="ColorBG7">　<span class="note">首页文字链接颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色八</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color8" id="Color8">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color8');" title="选取标题颜色" align="absmiddle" ID="ColorBG8">　<span class="note">下拉菜单背景颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色九</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color9" id="Color9">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color9');" title="选取标题颜色" align="absmiddle" ID="ColorBG9">　<span class="note">下拉菜单边框颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色十</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color10" id="Color10">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'Color10');" title="选取标题颜色" align="absmiddle" ID="ColorBG10">　<span class="note">下拉菜单文字颜色</span></td>
</tr>
<tr> 
<td width="20%" bgcolor="#f7f7f7" class=tdleft></td>
<td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Submit" type="submit" class="bnt" value="添 加"></td>
</tr></form>
</table>
<%
end sub

sub savenew()
	Dim Color1,Color2,Color3,Color4,Color5,title,bodybg
	Title=trim(request.form("Title"))
	Content=trim(request.form("Content"))
	bodybg=trim(request.form("bodybg"))
	Color1=trim(request.form("Color1"))
	Color2=trim(request.form("Color2"))
	Color3=trim(request.form("Color3"))
	Color4=trim(request.form("Color4"))
	Color5=trim(request.form("Color5"))
	Color6=trim(request.form("Color6"))
	Color7=trim(request.form("Color7"))
	Color8=trim(request.form("Color8"))
	Color9=trim(request.form("Color9"))
	Color10=trim(request.form("Color10"))
	If Title="" or Content="" or bodybg="" or Color1="" or Color2="" or Color3="" or Color4="" or Color5="" or Color6="" or Color7="" or Color8="" or Color9="" or Color10="" then
		Call Alert ("各选项均不能为空",-1)
	End if
	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_Css"
	rs.open sql,conn,1,3
	'if rs.eof and rs.bof then
		rs.AddNew
		rs("Title")=Title
		rs("Content")=Content
		rs("bodybg")=bodybg
		rs("Color1")=Color1
		rs("Color2")=Color2
		rs("Color3")=Color3
		rs("Color4")=Color4
		rs("Color5")=Color5
		rs("Color6")=Color6
		rs("Color7")=Color7
		rs("Color8")=Color8
		rs("Color9")=Color9
		rs("Color10")=Color10
		rs.update
		Call Alert ("恭喜,添加成功！","Admin_Css.asp")
	'end if
	rs.close
	set rs=nothing
end sub

sub edit()
id=request("id")
set rs = server.CreateObject ("adodb.recordset")
sql="select * from "&tbname&"_Css where id="& id &""
rs.open sql,conn,1,1
on error resume next
%>
<table width="95%" border="0"  align=center cellpadding="3" cellspacing="2" bgcolor="#FFFFFF" class="admintable">
<form action="?action=savedit" method=post>
<tr> 
    <td colspan="5" class="admintitle">修改风格</td>
</tr>
<tr>
<td width="20%" bgcolor="#f7f7f7" class=tdleft>风格名称</td>
<td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Title" id="Title" value="<%=rs("Title")%>"></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>内容位于</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><select name="content" id="content">
    <option value="left"<%if rs("content")="left" then Response.Write(" selected") end if%>>左边</option>
    <option value="right"<%if rs("content")="right" then Response.Write(" selected") end if%>>右边</option>
  </select>  </td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>背景颜色</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="bodybg" id="bodybg" value="<%=rs("bodybg")%>">
    <img src="../images/Rect.gif" name="ColorBG" border=0 align="absmiddle" ID="ColorBG2" style="cursor:pointer;" title="选取标题颜色" onClick="Getcolor(this,'bodybg');">　<span class="note">网站背景色</span></td>
</tr>
<tr>
  <td width="20%" bgcolor="#f7f7f7" class=tdleft>颜色一</td> 
<td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color1" id="Color1" value="<%=rs("Color1")%>">
  <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color1")%>" onClick="Getcolor(this,'Color1');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">顶部菜单背景色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色二</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color2" id="Color2" value="<%=rs("Color2")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color2")%>" onClick="Getcolor(this,'Color2');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">右边边框色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色三</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color3" id="Color3" value="<%=rs("Color3")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color3")%>" onClick="Getcolor(this,'Color3');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">右边背景色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色四</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color4" id="Color4" value="<%=rs("Color4")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color4")%>" onClick="Getcolor(this,'Color4');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">顶部菜单色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色五</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color5" id="Color5" value="<%=rs("Color5")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color5")%>" onClick="Getcolor(this,'Color5');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">文章列表标题色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色六</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color6" id="Color6" value="<%=rs("Color6")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=Server.HTMLEncode(rs("Color6"))%>" onClick="Getcolor(this,'Color6');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">列表摘要文字颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色七</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color7" id="Color7" value="<%=rs("Color7")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color7")%>" onClick="Getcolor(this,'Color7');" title="选取标题颜色" align="absmiddle" ID="ColorBG">　<span class="note">首页文字链接颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色八</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color8" id="Color8" value="<%=rs("Color8")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color8")%>" onClick="Getcolor(this,'Color8');" title="选取标题颜色" align="absmiddle" ID="ColorBG8">　<span class="note">下拉菜单背景颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色九</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color9" id="Color9" value="<%=rs("Color9")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color9")%>" onClick="Getcolor(this,'Color9');" title="选取标题颜色" align="absmiddle" ID="ColorBG9">　<span class="note">下拉菜单边框颜色</span></td>
</tr>
<tr>
  <td bgcolor="#f7f7f7" class=tdleft>颜色十</td>
  <td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="Color10" id="Color10" value="<%=rs("Color10")%>">
    <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("Color10")%>" onClick="Getcolor(this,'Color10');" title="选取标题颜色" align="absmiddle" ID="ColorBG10">　<span class="note">下拉菜单文字颜色</span></td>
</tr>
<tr> 
<td width="20%" bgcolor="#f7f7f7" class="tdleft"></td>
<td colspan=4 bgcolor="#f7f7f7" class=tdleft><input name="id" type="hidden" value="<%=rs("ID")%>"><input name="Submit" type="submit" class="bnt" value="提 交"></td>
</tr>
</form>
</table>
<%
rs.close
set rs=nothing
end sub

sub savedit()
	id=request.form("id")
	Title=trim(request.form("Title"))
	Content=trim(request.form("Content"))
	bodybg=trim(request.form("bodybg"))
	Color1=trim(request.form("Color1"))
	Color2=trim(request.form("Color2"))
	Color3=trim(request.form("Color3"))
	Color4=trim(request.form("Color4"))
	Color5=trim(request.form("Color5"))
	Color6=trim(request.form("Color6"))
	Color7=trim(request.form("Color7"))
	Color8=trim(request.form("Color8"))
	Color9=trim(request.form("Color9"))
	Color10=trim(request.form("Color10"))
	If Title="" or Content="" or bodybg="" or Color1="" or Color2="" or Color3="" or Color4="" or Color5="" or Color6="" or Color7="" or Color8="" or Color9="" or Color10="" then
		Call Alert ("各选项均不能为空",-1)
	End if
	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_Css where ID="&id&""
	rs.open sql,conn,1,3
	if not(rs.eof and rs.bof) then
		rs("Title")=Title
		rs("Content")=Content
		rs("bodybg")=bodybg
		rs("Color1")=Color1
		rs("Color2")=Color2
		rs("Color3")=Color3
		rs("Color4")=Color4
		rs("Color5")=Color5
		rs("Color6")=Color6
		rs("Color7")=Color7
		rs("Color8")=Color8
		rs("Color9")=Color9
		rs("Color10")=Color10
		rs.update
		Response.Write "<iframe marginheight=0 marginwidth=0 frameborder=0 width='0' height='0' scrolling=NO src='Admin_CssHtml.asp?id="&ID&"'></iframe>"
		'Response.Redirect "Admin_Css.asp"
		Call Alert ("修改成功","Admin_Css.asp")
	end if
	rs.close
	set rs=nothing
end sub

Function IsObjInstalled(strClassString)
	On Error Resume Next
	IsObjInstalled = False
	Err = 0
	Dim xTestObj
	Set xTestObj = Server.CreateObject(strClassString)
	If Err = 0 Then IsObjInstalled = True
	If Err = -2147352567 Then IsObjInstalled = True
	Set xTestObj = Nothing
	Err = 0
End Function
%>
<p style="text-align:left;width:95%;">注：所有填背景颜色的地方也可以写入图片地址,如 url(xx.gif)</p>
<!--#include file="Admin_copy.asp"-->
</body>
</html>