<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc/saveimage.asp"-->
<!--#include file="../Inc/Function_Page1.asp"-->
<!--#include file="Admin_check.asp"--><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equtv="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>
<SCRIPT src="<%=SitePath%>inc/Ajax.js" language="javascript"></SCRIPT>
<script language="JavaScript" src="js/Jquery.js"></script>
<script charset="utf-8" src="../KindEditor/kindeditor.js"></script>
<script>
        KE.show({
                id : 'Content',
				autoSetDataMode: false,
				afterCreate : function(id) {
					KE.event.add(KE.$('myform'), 'submit', function() {
						KE.sync(id);
					});
				},
				minWidth : 500,minHeight:300,allowUpload:false,
				items:[ 'title', 'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold',
'italic', 'underline', 'strikethrough', 'removeformat','|','justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', '|', 'selectall', '-','undo', 'redo', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|','image','flash', 'media', 'advtable', 'hr', 'emoticons', 'specialchar', 'link', 'unlink', '|','source', 'fullscreen', 'about', 'preview']
        });
</script>
</head>

<body>
<script language=javascript>
function CheckForm()
{
  if (document.myform.Title.value==""){
	alert("请填写标题！");
	document.myform.Title.focus();
	return false;
  }
}
</script>

<%
	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")="yn1" then
		call yn1()
	elseif request("action")="yn2" then
		call yn2()
	elseif request("action")="del" then
		call del()
	elseif request("action")="delAll" then
		call delAll()
	else
		call List()
	end if

sub List()
%>
<form name="myform" id="myform" method="POST" action="Admin_About.asp?action=delAll">
<table width="95%" border="0"  align=center cellpadding="3" cellspacing="1" bgcolor="#ffffff" class="admintable">
<tr>
  <td colspan="5" align=left class="admintitle">介绍类信息列表　[<a href="?action=add">添加</a>]</td></tr>
    <tr bgcolor="#f1f3f5" style="font-weight:bold;">
    <td width="5%" height="30" align="center" class="ButtonList">&nbsp;</td>
    <td width="80%" align="center" class="ButtonList">标题</td>
    <td width="15%" height="25" align="center" class="ButtonList">管理</td>
    </tr>
<%
Set mypage=new xdownpage
mypage.getconn=conn
mysql="select ID,Title from "&tbname&"_About"
mysql=mysql&" order by "
mysql=mysql&"ID desc"
mypage.getsql=mysql
mypage.pagesize=15
set rs=mypage.getrs()
for i=1 to mypage.pagesize
    if not rs.eof then
%>
    <tr bgcolor="#E2F4FE" onMouseOver="this.style.backgroundColor='#8FD5FB';" onMouseOut="this.style.backgroundColor='';this.style.color=''">
    <td height="25" width="5%" align="CENTER"><input type="checkbox" value="<%=rs(0)%>" name="ID" onClick="unselectall(this.form)" style="border:0;"></td>
    <td height="25" width="80%"><a href="<%=SitePath%><%If html=3 then Response.Write("About_"&rs(0)&".html") else Response.Write("About.asp?ID="&rs(0)&"") End if%>" target="_blank"><%=rs(1)%></a></td>
    <td align="center" width="15%"><a href="?action=edit&id=<%=rs(0)%>&page=1">编辑</a></td>
    </tr>
<%
        rs.movenext
    else
         exit for
    end if
next
%>
<tr><td align="center" bgcolor="f7f7f7"><input name="Action" type="hidden"  value="Del"><input name="chkAll" type="checkbox" id="chkAll" onClick=CheckAll(this.form) value="checkbox" style="border:0"></td>
  <td colspan="4" bgcolor="f7f7f7"><input name="Del" type="submit" class="bnt" id="Del" value="删除"></td>
  </tr><tr><td bgcolor="f7f7f7" colspan="5">
<div id="page">
	<ul style="text-align:left;">
    <%=mypage.showpage()%>
    </ul>
</div>
</td></tr></table>
</form>
<%
	rs.close
	set rs=nothing
end sub

sub add()
%>
<table width="95%" border="0"  align=center cellpadding="3" cellspacing="2" bgcolor="#FFFFFF" class="admintable">
<form onSubmit="return CheckForm();" action="?action=savenew" name="myform" method=post>
<tr>
    <td colspan="2" align=left class="admintitle">添加文章</td></tr>
<tr>
<td width="20%" class="b1_1">标题</td>
<td class="b1_1"><input name="Title" type="text" id="Title" size="40" maxlength="50" onBlur="CheckName();" onChange="CheckName();"></td>
</tr>

<tr>
  <td valign="top" class="b1_1"><p>内容</p></td>
  <td class="b1_1">
<textarea name="Content" style="width:100%;height:350px;" id="Content"></textarea>  
  </td>
</tr>
<tr>
<td width="20%" class="b1_1"></td>
<td class="b1_1"><input name="Submit" type="submit" class="bnt" value="添 加"></td>
</tr>
</form>
</table>
<%
end sub

sub savenew()
	Title			=Replace(trim(request.form("Title")),"'","")
	Content			=request.form("Content")

	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_About where Title='"&Title&"'"
	rs.open sql,conn,1,3
	if rs.eof and rs.bof then
		rs.AddNew
		rs("Title")				=Title
      	Rs("Content")=Content
		rs.update
		Call Alert ("添加成功！","Admin_About.asp")
	else
		Call Alert ("该内容已存在！",-1)
	end if
	rs.close
	set rs=nothing
end sub

sub edit()
id=request("id")
set rs = server.CreateObject ("adodb.recordset")
sql="select * from "&tbname&"_About where id="& id &""
rs.open sql,conn,1,1
%>
<table width="95%" border="0"  align=center cellpadding="3" cellspacing="2" bgcolor="#FFFFFF" class="admintable">
<form onSubmit="return CheckForm();" name="myform" action="?action=savedit" method=post>
<tr>
    <td colspan="5" class="admintitle">修改文章</td></tr>
<tr>
  <td width="20%" bgcolor="#FFFFFF" class="b1_1">标题</td>
  <td colspan=4 class=b1_1><input name="Title" type="text" value="<%=rs("Title")%>" size="40" maxlength="50"></td>
</tr>

<tr>
  <td valign="top" bgcolor="#FFFFFF" class="b1_1"><p>内容</p></td>
  <td colspan=4 class=b1_1>
  <textarea name="Content" cols="80" rows="10" id="Content" style="display:none;"><%=server.htmlencode(rs("Content"))%></textarea></td>
</tr>
<tr>
<td width="20%" class="b1_1"></td>
<td colspan=4 class=b1_1><input name="id" type="hidden" value="<%=rs("ID")%>"><input name="page" type="hidden" value="<%=page%>"><input name="Submit" type="submit" class="bnt" value="编 辑"></td>
</tr>
</form>
</table>
<%
rs.close
set rs=nothing
end sub

sub savedit()
	Dim Title
	id=request.form("id")
	Title			=trim(request.form("Title"))
	Content			=request.form("Content")

	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_About where ID="&id&""
	rs.open sql,conn,1,3
	if not(rs.eof and rs.bof) then
	
		rs("Title")	=Replace(Title,CHR(34),"&quot;")
      	Rs("Content")=Content
		
		rs.update
		Call Alert("修改成功！",-2)
	else
		Call Alert("修改错误！",-2)
	end if
	rs.close
	set rs=nothing
end sub


Sub delAll
ID=Trim(Request("ID"))
ytype=Request("ytype")
page=request("page")
If ID="" Then
	  Call Alert("请选择文章!",-1)
ElseIf Request("Del")="删除" Then
	'set rs=conn.execute("delete from "&tbname&"_Article where ID In(" & ID & ")")
			for i=1 to request("ID").count
				if request("ID").count=1 then
				ArticleID=request("ID")
				else
				ArticleID=replace(request("id")(i),"'","")
				end if
				'对用户分值操作
				Call EditUserMn(ArticleID,money3,0)
				'删除文章
				Conn.Execute("Delete From ["&tbname&"_About] where ID = "&ArticleID&"")
			next
End If
Dim Angel_aspOK
Angel_aspOK=request.servervariables("http_referer")
If Angel_aspOK="" then Angel_aspOK=-1
Call Alert("操作成功",Angel_aspOK)
End Sub
%>
<!--#include file="Admin_copy.asp"-->
</body>
</html>