<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc/saveimage.asp"-->
<!--#include file="../Inc/Function_Page.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>
</head>

<body>
<script language=javascript>
function CheckForm()
{ 
  if (document.myform.Title.value==""){
	alert("请填写标题！");
	document.myform.Title.focus();
	return false;
  }
  if (document.myform.ClassID.value==""){
	alert("请选择分类！");
	document.myform.ClassID.focus();
	return false;
  }
  if (document.myform.Hits.value==""){
	alert("请填写浏览次数！");
	document.myform.Hits.focus();
	return false;
  }
  var filter=/^\s*[0-9]{1,6}\s*$/;
  if (!filter.test(document.myform.Hits.value)) { 
	alert("浏览次数填写不正确,请重新填写！"); 
	document.myform.Hits.focus();
	return false; 
  }
}
			function ResumeError()
			{return true;}
			window.onerror = ResumeError;
			$(document).ready(function(){
				$(parent.frames["main"].document).find("#Button1").attr("disabled",false);
			  $('#KeyLinkByTitle').click(function(){
			    GetKeyTags();
			  });
			});
			function GetKeyTags()
			{
			  var text=escape($('input[name=Title]').val());
			  if (text!=''){
				  $('#KeyWord').val('稍等,老Y正在自动获取...');
				  $("#KeyWord").attr("disabled",true);
				  $.get("ajaxs.asp", { action: "GetTags", text: text,maxlen: 20 },
				  function(data){
					$('#KeyWord').val(unescape(data));
					$('#KeyWord').attr("disabled",false);
				  });
			  }else{
			   alert('请先输入标题!');
			  }
			}
</script>
<table width="95%" border="0" cellspacing="2" cellpadding="3"  align=center class="admintable" style="margin-bottom:5px;">
    <tr><form name="form1" method="get" action="Admin_Article.asp?page=<%=page%>">
      <td height="25" bgcolor="f7f7f7">快速查找：
        <SELECT onChange="javascript:window.open(this.options[this.selectedIndex].value,'main')"  size="1" name="s">
        <OPTION value="" selected>-=请选择=-</OPTION>
        <OPTION value="?s=all">所有文章</OPTION>
        <OPTION value="?s=yn0">已审的文章</OPTION>
        <OPTION value="?s=yn1">未审的文章</OPTION>
        <OPTION value="?s=yn2">会员私有文章</OPTION>
          <OPTION value="?s=istop">固顶文章</OPTION>
        <OPTION value="?s=ishot">推荐文章</OPTION>
        <OPTION value="?s=img">有缩略图文章</OPTION>
        <OPTION value="?s=url">转向链接文章</OPTION>
        <OPTION value="?s=user">会员发表的文章</OPTION>
        <OPTION value="?hits=1">按浏览次数排序</OPTION>
      </SELECT>      </td>
      <td align="center" bgcolor="f7f7f7">
        <a href="?hits=1"></a>
        <input name="keyword" type="text" id="keyword" value="<%=request("keyword")%>" class="s26">
        <input type="submit" name="Submit2" class="bnt" value="搜索">
      </form></td>
      <td align="right" bgcolor="f7f7f7">跳转到：
        <select name="ClassID" id="ClassID" onChange="javascript:window.open(this.options[this.selectedIndex].value,'main')">
    <%
   Dim Sqlp,Rsp,TempStr
   Sqlp ="select * from "&tbname&"_Class Where TopID = 0 and link=0 order by num"   
   Set Rsp=server.CreateObject("adodb.recordset")   
   rsp.open sqlp,conn,1,1 
   Response.Write("<option value="""">请选择分类</option>") 
   If Rsp.Eof and Rsp.Bof Then
      Response.Write("<option value="""">请先添加分类</option>")
   Else
      Do while not Rsp.Eof   
         Response.Write("<option value=" & """?ClassID=" & Rsp("ID") & """" & "")
		 If int(request("ClassID"))=Rsp("ID") then
				Response.Write(" selected" ) 
		 End if
         Response.Write(">|-" & Rsp("ClassName") & " ("&Mydb("Select Count([ID]) From ["&tbname&"_Article] Where ClassID="&rsp("ID")&"",1)(0)&")</option>")  & VbCrLf
		 
		    Sqlpp ="select * from "&tbname&"_Class Where TopID="&Rsp("ID")&" and link=0 order by num"   
   			Set Rspp=server.CreateObject("adodb.recordset")   
   			rspp.open sqlpp,conn,1,1
			Do while not Rspp.Eof 
				Response.Write("<option value=" & """?ClassID=" & Rspp("ID") & """" & "")
				If int(request("ClassID"))=Rspp("ID") then
				Response.Write(" selected" ) 
				End if
         		Response.Write(">　|-" & Rspp("ClassName") & " ("&Mydb("Select Count([ID]) From ["&tbname&"_Article] Where ClassID="&rspp("ID")&"",1)(0)&")")
				Response.Write("</option>" )   & VbCrLf
			Rspp.Movenext   
      		Loop
			rspp.close
			set rspp=nothing
      Rsp.Movenext   
      Loop   
   End if
	rsp.close
	set rsp=nothing
	%>
        </select></td>
    </tr>
</table>
<%
	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_Article.asp?action=delAll">
<table width="95%" border="0"  align=center cellpadding="3" cellspacing="1" bgcolor="#F2F9E8" 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="53%" align="center" class="ButtonList">文章名称</td>
    <td width="20%" height="25" align="center" class="ButtonList">发布时间</td>
    <td width="7%" height="25" align="center" class="ButtonList">浏览</td>
    <td width="15%" height="25" align="center" class="ButtonList">管理</td>    
    </tr>
<%
Hits=request("hits")
s=Request("s")
Articleclass=request("ClassID")
keyword=request("keyword")
Set mypage=new xdownpage
mypage.getconn=conn
mysql="select ID,Title,Author,ClassID,DateAndTime,Hits,Yn,IsTop,IsHot,IsFlash,Images,UserID,UserName from "&tbname&"_Article"
	if s="yn0" then
	mysql=mysql&" Where yn=0"
	elseif s="yn1" then
	mysql=mysql&" Where yn=1"
	elseif s="yn2" then
	mysql=mysql&" Where yn=2"
	elseif s="istop" then
	mysql=mysql&" Where istop=1"
	elseif s="ishot" then
	mysql=mysql&" Where ishot=1"
	elseif s="img" then
	mysql=mysql&" Where images<>''"
	elseif s="url" then
	mysql=mysql&" Where LinkUrl<>''"
	elseif s="user" then
	mysql=mysql&" Where UserID<>0"
	elseif Articleclass<>"" then
	mysql=mysql&" Where ClassID="&Articleclass&""
	elseif keyword<>"" then
	mysql=mysql&" Where Title like '%"&keyword&"%'"
	End if
mysql=mysql&" order by "
If Hits=1 then
mysql=mysql&"Hits desc"
Else
mysql=mysql&"DateAndTime desc"
End if
mypage.getsql=mysql
mypage.pagesize=15
set rs=mypage.getrs()
for i=1 to mypage.pagesize
    if not rs.eof then 
%>
    <tr bgcolor="#ffffff" onMouseOver="this.style.backgroundColor='#EAFCD5';" onMouseOut="this.style.backgroundColor='';this.style.color=''">
    <td height="25" align="CENTER"><input type="checkbox" value="<%=rs(0)%>" name="ID" onClick="unselectall(this.form)" style="border:0;"></td>
    <td height="25">[<a href="?ClassID=<%=rs(3)%>"><%=Classlist(rs(3))%></a>]<a href="<%=SitePath%><%If html=1 then Response.Write("List.asp?ID="&rs(0)&"") else Response.Write("Html/?"&rs(0)&".html") End if%>" target="_blank"><%=rs(1)%></a> <%if rs(7)=1 then Response.Write("<font color=red>[顶]</font>") end if%><%if rs(8)=1 then Response.Write("<font color=green>[荐]</font>") end if%><%if rs(10)<>"" then Response.Write("<font color=blue>[图]</font>") end if%><%if rs(9)=1 then Response.Write("<font color=orange>[幻]</font>") end if%><%If rs(11)<>0 then Response.Write(" <font color=blue>["&rs(12)&"]</font>") end if%></td>
    <td height="25" align="center"><%=rs(4)%></td>
    <td height="25" align="center"><%=rs(5)%></td>
    <td align="center"><%If rs(6)=0 then Response.Write("已审") end if:If rs(6)=1 then Response.Write("<font color=red>未审</font>") end if:If rs(6)=2 then Response.Write("<font color=blue>私有</font>") end if%>|<a href="?action=edit&id=<%=rs(0)%>&page=<%=page%>">编辑</a>|<%If Mydb("Select Count([ID]) From ["&tbname&"_Pl] Where ArticleID="&rs(0)&"",1)(0)>0 Then Response.Write("<a href=""Admin_pl.asp?id="&rs(0)&""">评论</a>") else Response.Write("<a href=""#""><font style='color:#ccc;'>评论</font></a>") End if%></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"><font color=red>移动到：</font>
    <select id="ytype" name="ytype">
      <%call Admin_ShowClass_Option()%>
    </select>
    &nbsp;
    <input name="Del" type="submit" class="bnt" id="Del" value="移动">
	<input name="Del" type="submit" class="bnt" id="Del" value="更新时间">
    <input name="Del" type="submit" class="bnt" id="Del" value="删除">
    <input name="Del" type="submit" class="bnt" id="Del" value="批量未审">
    <input name="Del" type="submit" class="bnt" id="Del" value="批量审核">
    <input name="Del" type="submit" class="bnt" id="Del" value="推荐">
    <input name="Del" type="submit" class="bnt" id="Del" value="解除推荐">
    <input name="Del" type="submit" class="bnt" id="Del" value="固顶">
    <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();">
		<input name="TitleFontColor" type="hidden" id="TitleFontColor" onClick="Getcolor(ColorBG,'TitleFontColor');" Readonly>
	  <img border=0 src="../images/Rect.gif" style="cursor:pointer;" onClick="Getcolor(this,'TitleFontColor');" title="选取标题颜色" align="absmiddle" ID="ColorBG">&nbsp;<span class="note">注：最多50个字符</span></td>
</tr>
<tr>
  <td class="b1_1">关键字【<a href="#" id="KeyLinkByTitle" style="color:green">根据标题自动获取</a>】</td>
  <td class="b1_1"><input name="KeyWord" type="text" id="KeyWord" size="40" maxlength="50">&nbsp;<span class="note">多个关键字用|隔开</span></td>
</tr>
<tr>
  <td class="b1_1">作者</td>
  <td class="b1_1">
    <input name="Author" type="text" id="Author" value="不详" size="40" maxlength="200">    </td>
</tr>
<tr>
  <td class="b1_1">来源</td>
  <td class="b1_1"><span class="td">
    <input name="CopyFrom" type="text" id="CopyFrom" value="网络" size="40" maxlength="200">
  </span></td>
</tr>
<tr>
  <td class="b1_1">分类</td>
  <td class="b1_1"><select ID="ClassID" name="ClassID">
    <%call Admin_ShowClass_Option()%></select>&nbsp;<span class="note">如果有二级分类,请选择二级分类.</span></td>
</tr>
<tr>
  <td class="b1_1">转向链接</td>
  <td class="b1_1"><input name="LinkUrl" type="text" size="50" disabled>
		  <INPUT name="UseLinkUrl" type="checkbox" class="noborder" id="UseLinkUrl" onClick="if(this.checked){
			  LinkUrl.disabled = false;
		  }else{
			  LinkUrl.disabled = true;
		  }" value="Yes">
      使用转向链接		</td>
</tr>
<tr>
  <td class="b1_1">浏览次数</td>
  <td class="b1_1"><input name="Hits" type="text" id="Hits" value="0" size="6" maxlength="10"></td>
</tr>
<tr>
  <td rowspan="2" class="b1_1">图片上传</td>
  <td class="b1_1"><input name="Images" type="text" id="Images" size="40" maxlength="200"></td>
</tr>
<tr>
  <td class="b1_1"><iframe src="upload.asp?action=simg" width="400" height="25" frameborder="0" scrolling="no"></iframe></td>
</tr>
<tr>
  <td class="b1_1">文章摘要<br><span class="note">不填写则自动截取正文开始部分字符</span></td>
  <td class="b1_1"><textarea name="ArtDescription" id="ArtDescription" cols="60" rows="6"></textarea></td>
</tr>
<tr>
  <td valign="top" class="b1_1"><p>内容</p>
    <p>发布时间<br>
      <input name="DateAndTime" type="text" id="DateAndTime" value="<%=NOW()%>">
    </p>
    <p>
      <input name="sSaveFileSelect" type="checkbox" class="noborder" id="sSaveFileSelect" value="True">
    保存内容中的图片到本地</p></td>
  <td class="b1_1"><textarea name="Content" cols="80" rows="10" id="Content" style="display:none"></textarea><IFRAME ID="eWebEditor" SRC="../Editor/ewebeditor.htm?id=Content&style=laoy" FRAMEBORDER="0" SCROLLING="no" WIDTH="600" HEIGHT="350"></IFRAME></td>
</tr>
<tr>
  <td class="b1_1">附加选项</td>
  <td class="b1_1">固顶
    <input name="IsTop" type="checkbox" class="noborder" id="IsTop" value="1">
    推荐
    <input name="IsHot" type="checkbox" class="noborder" id="IsHot" value="1">
    幻灯
    <input name="IsFlash" type="checkbox" class="noborder" id="IsFlash" value="1">
    <INPUT type=button class="bnt" onClick="eWebEditor.insertHTML('[yao_page]')" value="插入分页符"></td>
</tr>
<tr>
  <td class="b1_1">自动分页<strong>字数</strong></td>
  <td class="b1_1"><input name="PageNum" type="text" id="PageNum" value="0" size="6" maxlength="4">
    <span class="note">　注:如果在内容中加入了手动分页符,请填写0</span></td>
</tr><%If Mydb("Select Count([ID]) From ["&tbname&"_Vote]",1)(0)>0 then%>
<tr>
  <td class="b1_1">本文显示投票</td>
  <td class="b1_1"><select name="Vote" size=4 multiple id="Vote">
    <%=ShowVoteList(0)%>
  </select><span class="note">　可按住Ctrl多选</span></td>
</tr><%End if%>
<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")),"'","")
	Hits			=trim(request.form("Hits"))
	ClassID			=trim(request.form("ClassID"))
	Content			=request.form("Content")
	Author			=trim(request.form("Author"))
	CopyFrom		=trim(request.form("CopyFrom"))
	KeyWord			=trim(request.form("KeyWord"))
	IsTop			=request.form("IsTop")
	IsHot			=request.form("IsHot")
	IsFlash			=request.form("IsFlash")
	ArtDescription	=request.form("ArtDescription")
	TitleFontColor	=request.form("TitleFontColor")
	Images			=trim(request.form("Images"))
	PageNum			=trim(request.form("PageNum"))
	LinkUrl			=trim(request.form("LinkUrl"))
	UseLinkUrl		=request.form("UseLinkUrl")
	DateAndTime		=trim(request.form("DateAndTime"))
	sSaveFileSelect =request.Form("sSaveFileSelect")
	Vote			=request.form("Vote")
	Vote		 	=replace(Vote," ","")
	
	if Title="" or ClassID="" then
		Call Alert ("请填写完整再提交",-1)
	end if
	If ClassID="-1" then
		Call Alert ("请选择正确的分类！",-1)
	End if		
	If LinkUrl="" and Content="" then
		Call Alert ("你没有填写内容",-1)
	End if

	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_Article where Title='"&Title&"'"
	rs.open sql,conn,1,3
	if rs.eof and rs.bof then
		rs.AddNew 
		rs("Title")				=Title
		rs("Hits")				=Hits
		rs("ClassID")			=ClassID
		rs("LinkUrl")			=LinkUrl
		rs("Author")			=Author
		rs("CopyFrom")			=CopyFrom
		rs("KeyWord")			=KeyWord
		If IsTop=1 then
			rs("IsTop")				=1
		else
			rs("IsTop")				=0
		end if
		If IsHot=1 then
			rs("IsHot")				=1
		else
			rs("IsHot")				=0
		end if
		If IsFlash=1 then
			rs("IsFlash")			=1
		else
			rs("IsFlash")			=0
		end if
		If ArtDescription<>"" then
			rs("ArtDescription")		=ArtDescription
		Else
			rs("ArtDescription")		=Left(LoseHtml(Content),250)
		End if
		rs("TitleFontColor")	=TitleFontColor
		rs("Images")			=Images
		rs("yn")				=0
		rs("PageNum")			=PageNum
		rs("DateAndTime")		=DateAndTime
		rs("Vote")				=Vote
		rs("UserName")			=Session("YaoAdmin")
		If sSaveFileSelect="True" Then
      		Rs("Content")=ReplaceRemoteUrl(Content,SitePath&SiteUp,sFileExt)
     	Else
      		Rs("Content")=Content
		End If

		rs.update
		session("YaoClassID")=ClassID
		Call Alert ("添加成功！","Admin_Article.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&"_Article 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">
		<input name="TitleFontColor" type="hidden" id="TitleFontColor" value="<%=rs("TitleFontColor")%>" onClick="Getcolor(ColorBG,'TitleFontColor');" Readonly>
	  <img border=0 src="../images/Rect.gif" style="cursor:pointer;background:<%=rs("TitleFontColor")%>" onClick="Getcolor(this,'TitleFontColor');" title="选取标题颜色" align="absmiddle" ID="ColorBG">&nbsp;<span class="note">注：最多50个字符</span></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">关键字【<a href="#" id="KeyLinkByTitle" style="color:green">根据标题自动获取</a>】</td>
  <td colspan=4 class=b1_1><input name="KeyWord" type="text" id="KeyWord" value="<%=rs("KeyWord")%>" size="40">&nbsp;<span class="note">多个关键字用|隔开</span></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">作者</td>
  <td colspan=4 class=b1_1><input name="Author" type="text" id="Author" value="<%=rs("Author")%>" size="40"></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">录入员</td>
  <td colspan=4 class=b1_1><input name="UserName" type="text" id="UserName" value="<%=rs("UserName")%>" size="40"></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">来源</td>
  <td colspan=4 class=b1_1><input name="CopyFrom" type="text" id="CopyFrom" value="<%=rs("CopyFrom")%>" size="40"></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">分类</td>
  <td colspan=4 class=b1_1><select ID="ClassID" name="ClassID">
   <%
   Set Rsp=server.CreateObject("adodb.recordset") 
   Sqlp ="select * from "&tbname&"_Class Where TopID = 0 and link=0 order by num"   
   rsp.open sqlp,conn,1,1 
   Response.Write("<option value="""">请选择分类</option>") 
   If Rsp.Eof and Rsp.Bof Then
      Response.Write("<option value="""">请先添加分类</option>")
   Else
      Do while not Rsp.Eof   
         Response.Write("<option")
         If rs("ClassID")=Rsp("ID") Then
            Response.Write(" selected")
         End If
		 If Yao_MyID(rsp("ID"))<>"0" then
		 		Response.Write(" value=""-1"" style='background:#f7f7f7;color:#ccc;'")
		 Else
				Response.Write(" value="& Rsp("ID") & " style='color:#0000ff;'")
		 End if
         Response.Write(">|-" & Rsp("ClassName") & "</option>")  & VbCrLf
		 
		 Sqlpp ="select * from "&tbname&"_Class Where TopID="&Rsp("ID")&" and link=0 order by num"   
   			Set Rspp=server.CreateObject("adodb.recordset")   
   			rspp.open sqlpp,conn,1,1
			Do while not Rspp.Eof 
				Response.Write("<option value=" &Rspp("ID")& "")
				If rs("ClassID")=Rspp("ID") Then
            	Response.Write(" selected")
         		End If
         		Response.Write(" value="&Rspp("ID")&" style='color:#0000ff;'>　|-" & Rspp("ClassName") & "")
				Response.Write("</option>" )  & VbCrLf
			Rspp.Movenext   
      		Loop
			rspp.close
			set rspp=nothing
      Rsp.Movenext   
      Loop   
   End if
   rsp.close
   set rsp=nothing
   %>
  </select>  </td></tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">转向链接</td>
  <td colspan=4 class=b1_1><input name="LinkUrl" type="text" size="50" value="<%=rs("Linkurl")%>" disabled>
		  <INPUT name="UseLinkUrl" type="checkbox" class="noborder" id="UseLinkUrl" onClick="if(this.checked){
			  LinkUrl.disabled = false;
		  }else{
			  LinkUrl.disabled = true;
		  }" value="Yes"<%if rs("LinkUrl")<>"" then Response.Write(" checked") end if%>>
      使用转向链接		</td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">浏览次数</td>
  <td colspan=4 class=b1_1><input name="Hits" type="text" id="Hits" value="<%=rs("Hits")%>" size="6" maxlength="5"></td>
</tr>
<tr>
  <td rowspan="2" bgcolor="#FFFFFF" class="b1_1">图片上传</td>
  <td colspan=4 class=b1_1><input name="Images" type="text" id="Images" value="<%=rs("Images")%>" size="40" maxlength="200"></td></tr>
<tr>
  <td colspan=4 class=b1_1><iframe src="upload.asp?action=simg" width="400" height="25" frameborder="0" scrolling="no"></iframe></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">文章摘要</td>
  <td colspan=4 class=b1_1><textarea name="ArtDescription" id="ArtDescription" cols="60" rows="6"><%=rs("ArtDescription")%></textarea></td></tr>
<tr>
  <td valign="top" bgcolor="#FFFFFF" class="b1_1"><p>内容</p>
    <p>发布时间<br>
      <input name="DateAndTime" type="text" id="DateAndTime" value="<%=rs("DateAndTime")%>">
</p>
    <p>
      <input name="sSaveFileSelect" type="checkbox" class="noborder" id="sSaveFileSelect" value="True">
保存内容中的图片到本地</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><IFRAME ID="eWebEditor" SRC="../Editor/ewebeditor.htm?id=Content&style=laoy" FRAMEBORDER="0" SCROLLING="no" WIDTH="600" HEIGHT="350"></IFRAME></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">附加选项</td>
  <td colspan=4 class=b1_1>固顶
    <input name="IsTop" type="checkbox" class="noborder" id="IsTop" value="1"<%if rs("IsTop")=1 then Response.Write("checked") end if%>>
推荐
<input name="IsHot" type="checkbox" class="noborder" id="IsHot" value="1"<%if rs("IsHot")=1 then Response.Write("checked") end if%>>
幻灯
<input name="IsFlash" type="checkbox" class="noborder" id="IsFlash" value="1"<%if rs("IsFlash")=1 then Response.Write("checked") end if%>>
<INPUT type=button class="bnt" onClick="eWebEditor.insertHTML('[yao_page]')" value="插入分页符"></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">自动分页<strong>字数</strong></td>
  <td colspan=4 class=b1_1><input name="PageNum" type="text" id="PageNum" value="<%=rs("PageNum")%>" size="6" maxlength="4"><span class="note">　注:如果在内容中加入了手动分页符,请填写0</span></td>
</tr><%If Mydb("Select Count([ID]) From ["&tbname&"_Vote]",1)(0)>0 then%>
<tr>
  <td bgcolor="#FFFFFF" class="b1_1">本文显示投票</td>
  <td colspan=4 class=b1_1><select name="Vote" size=4 multiple id="Vote">
    <%=ShowVoteList(rs("Vote"))%>
  </select>
    <span class="note">　可按住Ctrl多选</span></td>
</tr><%End if%>
<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")
	page=request.form("page")
	Title			=trim(request.form("Title"))
	Hits			=trim(request.form("Hits"))
	ClassID			=trim(request.form("ClassID"))
	Content			=request.form("Content")
	Author			=trim(request.form("Author"))
	UserName		=trim(request.form("UserName"))
	CopyFrom		=trim(request.form("CopyFrom"))
	KeyWord			=trim(request.form("KeyWord"))
	IsTop			=request.form("IsTop")
	IsHot			=request.form("IsHot")
	IsFlash			=request.form("IsFlash")
	ArtDescription	=request.form("ArtDescription")
	TitleFontColor	=request.form("TitleFontColor")
	Images			=trim(request.form("Images"))
	PageNum			=trim(request.form("PageNum"))
	LinkUrl			=trim(request.form("LinkUrl"))
	UseLinkUrl		=request.form("UseLinkUrl")
	DateAndTime		=trim(request.form("DateAndTime"))
	sSaveFileSelect =request.Form("sSaveFileSelect")
	Vote			=request.form("Vote")
	Vote		 	=replace(Vote," ","")
	
	if Title="" or ClassID="" then
		Call Alert ("请填写完整再提交","-1")
	end if
	If ClassID="-1" then
		Call Alert ("请选择正确的分类！",-1)
	End if		
	If LinkUrl="" and Content="" then
		Call Alert ("你没有填写内容","-1")
	End if
	set rs = server.CreateObject ("adodb.recordset")
	sql="select * from "&tbname&"_Article 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("Hits")				=Hits
		rs("ClassID")			=ClassID
		rs("LinkUrl")			=LinkUrl
		rs("Author")			=Author
		rs("UserName")			=UserName
		rs("CopyFrom")			=CopyFrom
		rs("KeyWord")			=KeyWord
		If IsTop=1 then
			rs("IsTop")				=1
		else
			rs("IsTop")				=0
		end if
		If IsHot=1 then
			rs("IsHot")				=1
		else
			rs("IsHot")				=0
		end if
		If IsFlash=1 then
			rs("IsFlash")			=1
		else
			rs("IsFlash")			=0
		end if
		If ArtDescription<>"" then
			rs("ArtDescription")		=ArtDescription
		Else
			rs("ArtDescription")		=Left(LoseHtml(Content),250)
		End if
		rs("TitleFontColor")	=TitleFontColor
		rs("Images")			=Images
		rs("yn")				=0
		rs("PageNum")			=PageNum
		rs("DateAndTime")		=DateAndTime
		rs("Vote")				=Vote
		If sSaveFileSelect="True" Then
      		Rs("Content")=ReplaceRemoteUrl(Content,SitePath&SiteUp,sFileExt)
     	Else
      		Rs("Content")=Content
		End If
		
		rs.update
		Call Alert("修改成功！",-2)
	else
		Call Alert("修改错误！",-2)
	end if
	rs.close
	set rs=nothing
end sub

sub Admin_ShowClass_Option()
   Dim Sqlp,Rsp,TempStr
   Sqlp ="select * from "&tbname&"_Class Where TopID = 0 and link=0 order by num"   
   Set Rsp=server.CreateObject("adodb.recordset")   
   rsp.open sqlp,conn,1,1 
   Response.Write("<option value="""">请选择分类</option>") 
   If Rsp.Eof and Rsp.Bof Then
      Response.Write("<option value="""">请先添加分类</option>")
   Else
      Do while not Rsp.Eof   
         Response.Write("<option")
		 If int(session("YaoClassID"))=Rsp("ID") then
				Response.Write(" selected" ) 
		 End if
		 If Yao_MyID(rsp("ID"))<>"0" then
		 		Response.Write(" value=""-1"" style='background:#f7f7f7;color:#ccc;'")
		 Else
				Response.Write(" value=" &Rsp("ID")& " style='color:#0000ff;'")
		 End if
         Response.Write(">|-" & Rsp("ClassName") & "</option>") & VbCrLf
		 
		    Sqlpp ="select * from "&tbname&"_Class Where TopID="&Rsp("ID")&" and link=0 order by num"   
   			Set Rspp=server.CreateObject("adodb.recordset")   
   			rspp.open sqlpp,conn,1,1
			Do while not Rspp.Eof 
				Response.Write("<option")
				If int(session("YaoClassID"))=Rspp("ID") then
				Response.Write(" selected" ) 
				End if
         		Response.Write(" value="""&Rspp("ID")&""" style='color:#0000ff;'>　|-" & Rspp("ClassName") & "")
				Response.Write("</option>" )  & VbCrLf
			Rspp.Movenext   
      		Loop
			rspp.close
			set rspp=nothing
      Rsp.Movenext   
      Loop   
   End if
   rsp.close
   set rsp=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("Update "&tbname&"_Article set yn = 1 where ID In(" & ID & ")")
ElseIf Request("Del")="更新时间" Then
   set rs=conn.execute("Update "&tbname&"_Article set DateAndTime = Now() where ID In(" & ID & ")")
ElseIf Request("Del")="批量审核" Then
   set rs=conn.execute("Update "&tbname&"_Article set yn = 0 where ID In(" & ID & ")")
ElseIf Request("Del")="推荐" Then
   set rs=conn.execute("Update "&tbname&"_Article set IsHot = 1 where ID In(" & ID & ")")
ElseIf Request("Del")="解除推荐" Then
   set rs=conn.execute("Update "&tbname&"_Article set IsHot = 0 where ID In(" & ID & ")")
ElseIf Request("Del")="固顶" Then
   set rs=conn.execute("Update "&tbname&"_Article set IsTop = 1 where ID In(" & ID & ")")
ElseIf Request("Del")="解除固顶" Then
   set rs=conn.execute("Update "&tbname&"_Article set IsTop = 0 where ID In(" & ID & ")")
ElseIf Request("Del")="移动" Then
		If ytype="" or ytype="-1" then
			Call Alert("请选择正确的类别",-1)
		End if
   set rs=conn.execute("Update "&tbname&"_Article set ClassID = "&ytype&" where ID In(" & ID & ")")
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&"_Article] where ID = "&ArticleID&"")
				'删除文章相关评论
				Conn.Execute("Delete From ["&tbname&"_Pl] where ArticleID = "&ArticleID&"")
			next
End If
Dim LaoyOK
LaoyOK=request.servervariables("http_referer")
If LaoyOK="" then LaoyOK=-1
Call Alert("操作成功",LaoyOK)
End Sub
%>
<!--#include file="Admin_copy.asp"-->
</body>
</html>