<!--#include file="../ACT.Function.asp"-->
<!--#include file="../../ACT_inc/cls_pageview.asp"-->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文章管理 By ActCMS</title>
<link href="../Images/css1/css.css" rel="stylesheet" type="text/css"></head>
<body>
<% 
	With Response
	Dim ShowErr,ModeID,ModeName,Item
	 ModeID = ACTCMS.ChkNumeric(Request("ModeID"))
	 if ModeID=0 or ModeID="" Then ModeID=1
	 ModeName= ACTCMS.ACT_C(ModeID,1) 
	 IF  ACTCMS.ACT_C(ModeID,7) = 0 Then Item="本操作将选中的文章移到回收站当中.必要时您可以从回收站恢复!"  Else item="本操作将选中的文章彻底删除.该操作不可恢复!"
	 IF ACTCMS.G("Action") = "del" Then'删除
		Dim ID,Rsd,Rsp:ID =Request("ID")
		IF ID = "" Then
			Call Actcms.ActErr("请先选定文章！","1")
			.End
		End IF		
		IF  ACTCMS.ACT_C(ModeID,7) = 0 Then '是否物理删除
			ID = Split(ID,",")
			 For I = LBound(ID) To UBound(ID)
				If  ACTCMS.ACTCMS_QXYZ(ModeID,"4",ACT_CL(ID(i))) Then 
					Conn.execute("Update "&ACTCMS.ACT_C(ModeID,2)&" set delif=1 where ID = "&ID(I)&"")
				End If 	
			Next 
			set conn=Nothing
			Call Actcms.ActErr("文章已经移动到回收站,必要时您可以从回收站中恢复","")
		Else
			ID = Split(ID,",")
			 For I = LBound(ID) To UBound(ID)
				set Rsd=ACTCMS.ActExe("Select * from "&ACTCMS.ACT_C(ModeID,2)&"  Where ID=" & ID(I) & "")
				If rsd.eof And rsd.bof Then
					Call Actcms.ActErr("参数错误","1")
				Else
					If  ACTCMS.ACTCMS_QXYZ(ModeID,"4",Rsd("classid")) Then  
						Set Rsp = server.CreateObject("adodb.recordset")'删除图片
						Rsp.open "Select * from Upload_Act Where ArtileID=" & ID(I) & " and modeid="&ModeID&"", conn, 1, 3
						If Not  rsp.eof  Then
							Call ACTCMS.DeleteFile(Rsp("UpfileDir"))
						End If 
						Dim Tmps,TmpUs 
						If Right(ACTCMS.ACT_C(ModeID,10),1)<>"/" Then 
								Call ACTCMS.DeleteFile(ACTCMS.ActSys&ACTCMS.ACT_C(ModeID,6)&Rsd("FileName")&ACTCMS.ACT_C(ModeID,11))
						Else
								Call ACTCMS.DeleteFile(ACTCMS.ActSys&ACTCMS.ACT_C(ModeID,6)&Rsd("FileName")&"/Index"&ACTCMS.ACT_C(ModeID,11))
						End If 
						Conn.execute("Delete from Upload_Act  Where ArtileID=" & ID(I) & " and ModeID="&ModeID&"")
						Conn.execute("Delete from "&ACTCMS.ACT_C(ModeID,2)&"  Where ID=" & ID(I) & "")
						Conn.execute("Delete from Comment_Act  Where ID=" & ID(I) & " and ModeID="&ModeID&"")
						Conn.execute("Delete from Digg_ACT  Where NewsID=" & ID(I) & " and ModeID="&ModeID&"")
					End If 
				End If 
		 	 Next
				Set  conn=nothing	
		End If
			Call Actcms.ActErr("文章已经彻底删除！&nbsp;&nbsp;<a href=Article/ACT.Manage.asp?action=ListisAccept&ModeID="&ModeID&">点击这里返回管理首页</a>","")
	End IF
	
	IF Request.QueryString("Action") = "isAccept" Then'审核通过
		Dim AcceptID,Rss:AcceptID =Request.Form("ID")
		IF AcceptID = "" Then
			Call Actcms.ActErr("请先选定文章！","1")
			.End
		End IF		
			 AcceptID = Split(AcceptID,",")
			 For I = LBound(AcceptID) To UBound(AcceptID)
				 If  ACTCMS.ACTCMS_QXYZ(ModeID,"3",ACT_CL(AcceptID(i))) Then '只通过该栏目下的文章.无权限的将忽略
					 Set Rss= ACTCMS.ACTEXE("Select ArticleInput,Title,userid From "&ACTCMS.ACT_C(ModeID,2)&" Where  ID=" & CLng(AcceptID(i)))
					 Call ACTCMS.isAcceptOK(ModeID,Rss(2),Rss(0),Rss(1))
				 	 Conn.execute("Update "&ACTCMS.ACT_C(ModeID,2)&" set isAccept=0 where ID = "&CLng(AcceptID(i))&"")
				 End If 
			 Next
		set conn=nothing
		.Redirect("?ModeID="&ModeID&"")
	End IF

	IF Request.QueryString("Action") = "NoAccept" Then
		Dim NoAcceptID:NoAcceptID =Request.Form("ID")
		IF NoAcceptID = "" Then
			Call Actcms.ActErr("请先选定文章！","1")
			.End
		End IF		
		 NoAcceptID = Split(NoAcceptID,",")
		 For I = LBound(NoAcceptID) To UBound(NoAcceptID)
			If  ACTCMS.ACTCMS_QXYZ(ModeID,"3",ACT_CL(NoAcceptID(i))) Then '只通过该栏目下的文章.无权限的将忽略
				Conn.execute("Update "&ACTCMS.ACT_C(ModeID,2)&" set isAccept=2 where ID = "&NoAcceptID(i)&"")
			End If 
		 Next

		set conn=nothing
		.Redirect("?ModeID="&ModeID&"")
	End IF

	IF Request.QueryString("Action") = "tg" Then'退稿
		Dim TG_ID:TG_ID =Request.Form("ID")
		IF TG_ID = "" Then
			Call Actcms.ActErr("请先选定文章！","1")
			.End
		End IF		
		 TG_ID = Split(TG_ID,",")
		 For I = LBound(TG_ID) To UBound(TG_ID)
			If  ACTCMS.ACTCMS_QXYZ(ModeID,"3",ACT_CL(TG_ID(i))) Then '只通过该栏目下的文章.无权限的将忽略
				Conn.execute("Update "&ACTCMS.ACT_C(ModeID,2)&" set isAccept=3 where ID = "&TG_ID(i)&"")
			End If 
		 Next
		set conn=nothing
		.Redirect("?ModeID="&ModeID&"")
	End IF
	
		IF Request.QueryString("Action") = "Istop" Then'固顶
			ID=ACTCMS.ChkNumeric(Request.QueryString("ID"))
			If Not ACTCMS.ACTCMS_QXYZ(ModeID,"3",ACT_CL(ID)) Then   Call Actcms.Alert("对不起，你没有该栏目下的相应操作权限","")
			Conn.execute("Update "&ACTCMS.ACT_C(ModeID,2)&" set Istop=1 where ID ="&ID&"")
			set conn=nothing
			.Redirect("?ModeID="&ModeID&"")
		End IF
		IF Request.QueryString("Action") = "Notop" Then'解除固顶
			ID=ACTCMS.ChkNumeric(Request.QueryString("ID"))
			If Not ACTCMS.ACTCMS_QXYZ(ModeID,"3",ACT_CL(ID)) Then   Call Actcms.Alert("对不起，你没有该栏目下的相应操作权限","")
				Conn.execute("Update "&ACTCMS.ACT_C(ModeID,2)&" set Istop=0 where ID ="&ID&"")
				set conn=nothing
				.Redirect("?ModeID="&ModeID&"")
		End IF

	Dim strLocalUrl
	strLocalUrl = request.ServerVariables("SCRIPT_NAME")
	
	Dim intPageNow
	intPageNow = request("page")
	
	Dim intPageSize, strPageInfo
	intPageSize = 20
	
	Dim arrRecordInfo, i
	Dim sql, sqlCount,Sqls,pages
	pages = "action="&Request("action")&"&title="& request("title")&"&ModeID="&ModeID&"&page"
	Select Case Request.QueryString("Action")
		Case "ListID"
			Sqls = " where classid='"&Request.QueryString("ClassID")&"' and delif=0  "
			pages = "Action=ListID&ClassID="&Request("ClassID")&"&ModeID="&ModeID&"&page"
		Case "ListisAccept"
			Sqls = "  where isAccept=0 and delif=0 "
		Case "ListNoAccept"
			Sqls = "  where isAccept=2 and delif=0 "
		Case "Listcg"
			Sqls = "  where isAccept=1 and delif=0 "
		Case "Listtg"
			Sqls = "  where isAccept=3 and delif=0 "
		Case "Lististop"
			Sqls = "  where istop=1 and delif=0 "
		Case "Listpic"
			Sqls = "  where ArticlePic=1 and delif=0 "
		Case "Slide"
			Sqls = "  where Slide=1 and delif=0 "
		Case "sh"
			Sqls = "  where isAccept>0 and delif=0 "
		Case "MyArticle"
			Sqls="  where ArticleInput='"&ACTCMS.RSQL(Request.Cookies(AcTCMSN)("AdminName"))&"' and delif=0 "
		Case "t"
			If Request("ClassID")="" Then 
				Sqls = " where title Like '%" & ACTCMS.RSQL(request("title")) & "%' "
			Else 
				Sqls = " where ClassID='"&Request.QueryString("ClassID")&"' and title Like '%" & request("title") & "%' "
			End If 
		Case Else
			Sqls = " where delif=0 and  isAccept=0 "
			pages = "ModeID="&ModeID&"&page"
	End Select
	
	sql = "SELECT [ID], [Title], [ArticleInput], [Hits], [isAccept], [IStop],  [ClassID], [FileName],[ChangesLink],[Ismake],[GroupID_ACT],[Score_ACT],[ArticlePic],[Slide]" & _
		" FROM ["&ACTCMS.ACT_C(ModeID,2)&"]" &Sqls& _
		"ORDER BY [ID] DESC"
	sqlCount = "SELECT Count([ID])" & _
			" FROM ["&ACTCMS.ACT_C(ModeID,2)&"]"&Sqls
		Dim clsRecordInfo
		Set clsRecordInfo = New Cls_PageView
			clsRecordInfo.intRecordCount = 2816
			clsRecordInfo.strSqlCount = sqlCount
			clsRecordInfo.strSql = sql
			clsRecordInfo.intPageSize = intPageSize
			clsRecordInfo.intPageNow = intPageNow
			clsRecordInfo.strPageUrl = strLocalUrl
			clsRecordInfo.strPageVar = pages
		clsRecordInfo.objConn = Conn		
		arrRecordInfo = clsRecordInfo.arrRecordInfo
		strPageInfo = clsRecordInfo.strPageInfo
		Set clsRecordInfo = nothing

	 %>
<table width="99%" border="0" align="center"  class="table">
  <tr>
    <td  class="bg_tr"><strong>您现在的位置：<%= ModeName %>系统管理 &gt;&gt; <%= ModeName %>管理</strong></td>
  </tr>

  <tr>
    <td ><%= ModeName %>选项：<a href="?ModeID=<%=ModeID%>">所有文章</a> ┆ <a href="?ModeID=<%=ModeID%>&action=ListisAccept">已审核</a>┆ <a href="?ModeID=<%=ModeID%>&action=ListNoAccept">未审核</a>┆ <a href="?ModeID=<%=ModeID%>&action=Listcg">草稿</a>   ┆ <a href="?ModeID=<%=ModeID%>&action=Listtg">退稿</a>┆<a href="?ModeID=<%=ModeID%>&action=Lististop">固顶<%= ModeName %></a> ┆<a href="?ModeID=<%=ModeID%>&action=Listpic">图片<%= ModeName %></a>┆<a href="?ModeID=<%=ModeID%>&action=Slide">幻灯片</a></td>
  </tr>
</table>

<table width='99%'  border='0' align="center" cellpadding='0' cellspacing='1' class="table">
   <tr> 
          <form name='form3' action='?Action=t&ClassID=<%=Request.QueryString("ClassID")%>' method='post'>
          <td>
          	<table width='720' border='0' cellpadding='0' cellspacing='0'>
          	<tr>
          	<td width='90' align='center'>请选择栏目：</td>
          	<td width='160'>
<select name="ClassID" size="1" onchange="javascript:window.location=this.options[this.selectedIndex].value;">
<option value='?ModeID=<%=ModeID%>' >全部</option>
      <% 	 Response.Write Classmake(ModeID)
		%>
    </select>        </td>
        <td width='70'>
          关键字：        </td>
          <td width='160'>
          	<input type='text' name='title' value='' style='width:150'>  </td>
          <td>
            <input  name="Submit"  type="submit" class="ACT_btn" value="  搜索  "> </td>
          </tr>
        </table>
          </td>
        </form>
  </tr>
</table>

  <table width="99%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
<form name="Article" method="post" action="?Action=">
    <tr>
      <td width="28" align="center" class="bg_tr">选中 </td>
      <td width="24" align="center" class="bg_tr">ID</td>
      <td width="150" align="center" class="bg_tr">文章标题</td>
	   <% 
	    .Write " <td width=""100"" align=""center"" class=""bg_tr"">栏目</td>" 
	    .Write " <td width=""60"" align=""center"" class=""bg_tr"">录入者</td>" 
	    .Write " <td width=""50"" align=""center"" class=""bg_tr"">点击数</td>" 
	    .Write " <td width=""60"" align=""center"" class=""bg_tr"">审核状态</td>" 
	    .Write " <td width=""50"" align=""center"" class=""bg_tr"">已生成</td>" 
	    %>
      <td width="20%" colspan="2" align="center" class="bg_tr">常规管理操作</td>
    </tr>
	 <%
		Dim bgColor
		If IsArray(arrRecordInfo) Then
			For i = 0 to UBound(arrRecordInfo, 2)
			bgColor="#FFFFFF"
			if i mod 2=0 then bgColor="#DFEFFF"
			Dim Rs ,ClassName,ClasseName
			  Set Rs = server.CreateObject("adodb.recordset")
					Rs.Open "select ClassName,ClasseName from Class_Act where ClassID='"& arrRecordInfo(6,i) &"'",Conn,1,1
					if  Not Rs.bof then
							ClassName =Rs("ClassName")
							ClasseName =Rs("ClasseName")
					Else
							ClassName ="<font color=red>程序出现错误</font>"
							ClasseName ="<font color=red>意外错误</font>"
					End if 
	%>
    <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
      <td align="center"  >
	  <input type="checkbox" name="ID" value="<%= arrRecordInfo(0,i) %>">	  </td>
      <td align="center"  ><%= arrRecordInfo(0,i) %></td>
      <td  ><a target="_blank" href="<%
	  If arrRecordInfo(8,i) = 1 Then
		.write arrRecordInfo(7,i)
		Else
	 .write  ACTCMS.ActCMSDM&"Article/TypeArticle.asp?ID="&arrRecordInfo(0,i)&"&ModeID="&ModeID
	  End if%>"><%= arrRecordInfo(1,i) %></a>&nbsp;<%
	  If arrRecordInfo(12,i)=1 Then 
			response.write "<font color=red title=""图片文章""  style=""cursor:default"">图</font>"
	  End If 
	  If arrRecordInfo(13,i)=1 Then 
			response.write "&nbsp;<font color=green title=""幻灯片文章""  style=""cursor:default"">幻</font>"
	  End If 

	  If arrRecordInfo(8,i)=1 Then 
			response.write "&nbsp;<font color=green title=""转向链接""  style=""cursor:default"">转</font>"
	  End If 

	  %></td>
      
	  <td align="center"  >
	 <a href="?Action=ListID&ModeID=<%=ModeID%>&ClassID=<%= arrRecordInfo(6,i) %>"><%= classname %></a>	  </td>
    
	  <td align="center"  ><%= arrRecordInfo(2,i) %></td>
  
      <td align="center" ><%= arrRecordInfo(3,i) %></td>
	 
  
	 
      <td align="center" ><% '0审核通过  1草稿  2待审核 3退稿
	  
	   Select Case(arrRecordInfo(4,i))
	  			Case 0
					.Write "审核通过"	
				Case 1
					.Write "<font color=red>草稿</font>"
				Case 2
					.Write "<font color=red>待审核</font>"	
				Case 3
					.Write "<font color=red>退稿</font>"
		 End Select	
	   %></td>
	   
      <td align="center" >
	<%IF arrRecordInfo(9,i) = 1 Then 
	  .Write "<font color=red><b>√</b></font>"
	  ElseIf arrRecordInfo(10,i) <> "" Or arrRecordInfo(11,i) > "0" Then 
	  .Write "<font color=#008000 title='因为设置了阅读权限,所以不用生成HTML'><b>¤</b></font>"
	  Else
	  .Write "<font color=red><b>×</b></font>"
	  End If %>
	  </td>
      <td  colspan="2" align="center" >
	   <%if request.QueryString("action") ="sh" then %>
		  <a href="ACT.Add.asp?Action=edit&actcms=sh&ID=<%= arrRecordInfo(0,i) %>&ModeID=<%=ModeID%>">审核</a>
		  <a href="ACT.Manage.asp?Action=del&ID=<%= arrRecordInfo(0,i) %>&ModeID=<%=ModeID%>" onClick="return confirm('确认删除此文章吗?删除后您可以从回收站还原!')">删除</a>
		  <a href="ACT.Manage.asp?Action=tg&ID=<%= arrRecordInfo(0,i) %>&ModeID=<%=ModeID%>">退稿</a> 
	    <%Else  %>
	  <a href="ACT.Add.asp?Action=edit&ID=<%= arrRecordInfo(0,i) %>&ModeID=<%=ModeID%>">修改</a>
	  <a href="ACT.Manage.asp?Action=del&ID=<%= arrRecordInfo(0,i) %>&ModeID=<%=ModeID%>" onClick="return confirm('确认删除此文章吗?删除后您可以从回收站还原!')">删除</a>
	<% if arrRecordInfo(5,i) = 1 Then %>
	  <a title="解除固顶" href="ACT.Manage.asp?Action=Notop&ID=<%= arrRecordInfo(0,i) %>&ModeID=<%=ModeID%>">解固</a>
   <% ELse
   	%><a href="ACT.Manage.asp?Action=Istop&ID=<%= arrRecordInfo(0,i) %>&ModeID=<%=ModeID%>">固顶</a> 
	<%
	 end if%> 
		 <%End If  %>
 	  </td>
    </tr>
	<% 
	Next
	End If
	%>
    <tr >
      <td height="30" colspan="11" >
<input name="ChkAll" type="checkbox" id="ChkAll" onClick="CheckAll(this.form)" value="checkbox">
		<label for="chkAll">&nbsp;选中本页显示的所有文章</label>
	  <input type="button" class="act_btn" name="Submit" value="批量删除"  onClick="delpost()"> 
	  <input type="button" class="act_btn" name="isAccept" value="审核通过" onClick="isAcceptpost()">
	  <input type="button" class="act_btn" name="NoAccept" value="取消审核" onClick="NoAcceptpost()">
	  <%if request.QueryString("action") ="sh" then %>
	  <input type="button" class="act_btn" name="tg" value=" 退稿 " onClick="tgpost()">
	  <%end if %>
	  <input type="button" class="act_btn" name="setarticle" value="批量设置" onClick="setarticlepost()">	  </td>
    </tr>
    <tr >
      <td height="25" colspan="11" align="center" ><%= strPageInfo%></td>
    </tr></form>

  </table>

<script language="javascript">
function SelectIterm(form,sign){
	for (var i=0; i<form.elements.length;i++ ){
		if (form.elements[i].type == "checkbox"){
				var e=form.elements[i];
					if (sign==0) e.checked= true;
					if (sign==1) e.checked= !e.checked;
					if (sign==2) e.checked= false;
		}
	} 
}
//CSS背景控制
function overColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg1"
		Obj.bgColor="";
	}
	
}

function CheckAll(form)
		  {  
		 for (var i=0;i<form.elements.length;i++)  
			{  
			   var e = Article.elements[i];  
			   if (e.name != 'ChkAll'&&e.type=="checkbox")  
			   e.checked = Article.ChkAll.checked;  
		   }  
	  }

function outColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg";
		Obj.bgColor="";
	}
}
 
 function setarticlepost(){
    document.Article.method="post";
    document.Article.action="ACT.SetArticle.asp?ModeID=<%=ModeID%>&Action=SetArticle";
    document.Article.submit();
    return true;
	}

function isAcceptpost(){
    document.Article.method="post";
    document.Article.action="ACT.Manage.asp?ModeID=<%=ModeID%>&Action=isAccept";
    document.Article.submit();
    return true;
	}


function NoAcceptpost(){
    document.Article.method="post";
    document.Article.action="ACT.Manage.asp?ModeID=<%=ModeID%>&Action=NoAccept";
    document.Article.submit();
    return true;
	}

function tgpost(){
    document.Article.method="post";
    document.Article.action="ACT.Manage.asp?ModeID=<%=ModeID%>&Action=tg";
    document.Article.submit();
    return true;
	}

	
function delpost(){
    document.Article.method="post";
    document.Article.action="ACT.Manage.asp?ModeID=<%=ModeID%>&Action=del";
{
	if(confirm('确认要删除选中的文章吗?<%=item%>')){
	this.document.Article.submit();
	return true;}return false;
}
	}
</script>


<% End With
	Function  ACT_CL(ID)
		ACT_CL=ACTCMS.ACTEXE("Select ClassID From "&ACTCMS.ACT_C(ModeID,2)&" Where ID=" & ID)(0)
	End Function  
	Function  Classmake(ModeID)
		 Dim FolderRS,selected
		 Set FolderRS = actcms.actexe("Select * from Class_act where ParentID='0' And ModeID="&ModeID&"  and ChangesLinkUrl='' Order by Orderid desc,ID desc")
		 IF FolderRS.Eof Then
		 Classmake=("<option value='?ModeID="&ModeID&"'>还没有添加任何栏目</option>")
		 Else 
		 do while Not FolderRS.Eof
			If Request("ClassID")=FolderRS("ClassID") Then selected=" selected=""selected""" Else selected=""
			 Classmake=Classmake&"<option value='?Action=ListID&ModeID="&ModeID&"&ClassID="&FolderRS("ClassID")&"' "&selected&">"& FolderRS("ClassName") & "</option>"& vbCrLf
			 Classmake=Classmake&(GetChildClassList(FolderRS("ClassID"),""))
			 FolderRS.MoveNext
		 Loop
		 End IF

	 End  Function 
	 Function GetChildClassList(ClassID,Str)
	       Dim Sql,RsTempObj,TempImageStr,ImageStr,CheckStr,selected
	        TempImageStr = "&nbsp;└"
	        Sql = "Select * from Class_act where ParentID='" & ClassID & "'  and ChangesLinkUrl=''"
	        ImageStr = Str & "&nbsp;└"
	        Set RsTempObj = Conn.Execute(Sql)
	            do while Not RsTempObj.Eof
					If Request("ClassID")=RsTempObj("ClassID") Then selected=" selected=""selected""" Else selected=""
					   GetChildClassList = GetChildClassList  & "<option value='?Action=ListID&ModeID="&ModeID&"&ClassID="&RsTempObj("ClassID")&"' "&selected&">"& ImageStr & TempImageStr &" "& RsTempObj("ClassName")& "</option>"& vbCrLf
					   GetChildClassList = GetChildClassList & GetChildClassList(RsTempObj("ClassID"),ImageStr)
					   RsTempObj.MoveNext
	           loop
	       Set RsTempObj = Nothing
	 End Function 

CloseConn 
%>
</body>
</html>
