<!--#include file="../act_inc/ACT.User.asp"-->
<!--#include file="../ACT_inc/ACT.M.ASP"-->
<!--#include file="../ACT_inc/md5.ASP"-->
<!--#include file="../ACT_INC/cls_pageview.asp"-->
<script language="JavaScript" type="text/javascript" src="../editor/fckeditor/fckeditor.js"></script>
<script type='text/javascript' src='../ACT_INC/WebTime/WdatePicker.js'></script>

<%

Dim  UserHS,ModeID,ModeName,U_Simple,ACT_DIY,ActCMS_DIY
	ModeID=ACTCMS.ChkNumeric(request("ModeID"))
	If ModeID=0 Or ModeID="" Then ModeID=1
	ModeName= ACTCMS.ACT_C(ModeID,1) 
		Set UserHS = New ACT_User
		IF Cbool(UserHS.UserLoginChecked)=false then
		  Response.Write "<script>top.location.href ='login.asp' ;</script>"
		  Response.end
		End If
	If UserHS.G_Simple="" Then 
		U_Simple="Simple"
	Else
		U_Simple=UserHS.G_Simple
	End If 
	Set ACT_DIY = ActCMS.actexe("Select ACT_DiY from Mode_Act where ModeID="& ModeID)
    ActCMS_DIY=Split(ACT_DIY("ACT_DiY"),"§") 
	function Classmake(ModeID)
		 Dim FolderRS
		 Set FolderRS = Conn.Execute("Select ClassID,Classname,TGGroupID from Class_act where ParentID='0' And ModeID="&ModeID&" And tg=1 Order by Orderid desc,ID desc")
		 IF FolderRS.Bof And FolderRS.Eof Then
		 Response.Write("<br><li>还没有添加任何栏目!")
		 End IF
			 do while Not FolderRS.Eof
		 IF InStr(FolderRS("TGGroupID"),UserHS.GroupID)=0 Then
		 else
				Classmake=Classmake&"<option value="&FolderRS("ClassID")&" {ClassID="&FolderRS("ClassID")&"}>"& FolderRS("ClassName") & "</option>"
				 Classmake=Classmake&(GetChildClassList(FolderRS("ClassID"),""))
			 
		 End If
		  FolderRS.MoveNext
			  loop
	 end function
	 Function GetChildClassList(ClassID,Str)
	       Dim Sql,RsTempObj,TempImageStr,ImageStr,CheckStr
	        TempImageStr = "&nbsp;└"
	        Sql = "Select ClassID,Classname,TGGroupID from Class_act where ParentID='" & ClassID & "' and tg=1 And ModeID="&ModeID&"  "
	        ImageStr = Str & "&nbsp;└"
	        Set RsTempObj = Conn.Execute(Sql)
	            do while Not RsTempObj.Eof
		 IF InStr(RsTempObj("TGGroupID"),UserHS.GroupID)=0 Then
		 else
					   GetChildClassList = GetChildClassList  & "<option value="&RsTempObj("ClassID")&" {ClassID="&RsTempObj("ClassID")&"}>"& ImageStr & TempImageStr &" "& RsTempObj("ClassName")& "</option>"
					  GetChildClassList = GetChildClassList & GetChildClassList(RsTempObj("ClassID"),ImageStr)
		        
		end if
		 RsTempObj.MoveNext
	           loop
	       Set RsTempObj = Nothing
	 End Function 
 %>
 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="Images/css/css.css" rel="stylesheet" type="text/css">
<title>添加内容_By actcms.com</title>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <tr>
    <td colspan="2" class="bg_tr">当前操作：网站首页 &gt;&gt; 会员中心 &gt;&gt; 添加/修改</td>
  </tr>
  <tr>
    <td > 我发布的<%=ModeName%></td>
    <td align="right" >·<a href="?action=add&ModeID=<%=request("ModeID")%>"><font color="red">发表<%=ModeName%></font></a>  ·<a href="User_Article.asp?Status=Listcg">草 稿[
	<%=conn.execute("select count(id) from "&ACTCMS.ACT_C(ModeID,2)&" where isAccept=1 and articleinput='"& UserHS.UserName &"'")(0)%></a>]  &nbsp;·<a href="User_Article.asp?Status=ListNoAccept">待审核[<%=conn.execute("select count(id) from "&ACTCMS.ACT_C(ModeID,2)&" where isAccept=2 and articleinput='"& UserHS.UserName &"'")(0)%>]</a>&nbsp;&nbsp;·<a href="User_Article.asp?Status=ListisAccept">&nbsp;已审核[<%=conn.execute("select count(id) from "&ACTCMS.ACT_C(ModeID,2)&" where isAccept=0 and articleinput='"& UserHS.UserName &"'")(0)%>]</a>&nbsp;&nbsp;·<a href="User_Article.asp?Status=Listtg">被退稿[<%=conn.execute("select count(id) from "&ACTCMS.ACT_C(ModeID,2)&" where isAccept=3 and articleinput='"& UserHS.UserName &"'")(0)%></a></td>
  </tr>
</table><% 
	dim frmAction,ClassID,rs,ClassName,Title,Keywords,author,CopyFrom,Content,id,PicUrl,isAccept,action
	 action=request("action")
	 select case action
	 	case "add"
			call add()
		case "adds","edit"
			call adds()
		case "Saveadd"
			call Saveadd()
		case "Saveedit"
			call Saveedit()
		case "del"
			call del()
		case else
			call main()
	end select
	
	
  Sub del()
	Dim ID:ID=ACTCMS.S("ID")
	If ID="" Then Call ACTCMS.Alert("你没有选中要删除的"&ModeNam&"!",""):Response.End
	Conn.Execute("Delete From "&ACTCMS.ACT_C(ModeID,2)&" Where isAccept<>0 and articleinput='"& UserHS.UserName &"' and ID In(" & ID & ")")
	Response.Redirect "user_article.asp"
  End Sub

	sub Saveedit()
	dim Save_SQL,IF_NULL,i
		 Title=Trim(ACTCMS.S("Title"))
		 Keywords=Trim(ACTCMS.S("Keywords"))
		 CopyFrom=Trim(ACTCMS.S("CopyFrom"))
		 Content=server.htmlencode(ACTCMS.S("Content"))
		 PicUrl=ACTCMS.S("PicUrl")
		 isAccept=ACTCMS.S("isAccept")
		 author=ACTCMS.S("author")
		 IF_NULL=ACTCMS.Act_MX_Arr(ModeID)
		 If IsArray(IF_NULL) Then
			For I=0 To Ubound(IF_NULL,2)
			 If IF_NULL(2,I)=0 And Trim(ACTCMS.S(IF_NULL(0,I)))="" Then  Call  ACTCMS.ALERT(IF_NULL(1,I)&"不能为空","")
			Next
		 End If
				 If UserHS.G_A_SH="0" And isAccept=0 Then 
				 	isAccept=0 
				 elseIf isAccept=1 Then 
					isAccept=1
				else
					isAccept=2
				end if
			If UserHS.G_A_SH="1" Then isAccept=2:Else:isAccept=0 
				
				  If Title="" Then
					Call ACTCMS.alert("请输入简短标题","")
				    Exit Sub
				  End IF
				  If Content="" Then
					Call ACTCMS.alert("请输入"&ModeNam&"内容","")
				    Exit Sub
				  End IF
		Set Save_SQL=Server.CreateObject("Adodb.Recordset")		  
		Save_SQL.Open "Select * From "&ACTCMS.ACT_C(ModeID,2)&"  Where userid<>1 and articleinput='"& UserHS.UserName &"' and ID=" & ACTCMS.ChkNumeric(ACTCMS.S("ID")),Conn,1,3
		Save_SQL("Title") = Title'简短标题
		Save_SQL("isAccept") = isAccept
		Save_SQL("Content") = Content'内容
		Save_SQL("CopyFrom") = CopyFrom'来源
		Save_SQL("Keywords") = Keywords'关键字
		Save_SQL("UpdateTime")=now
		Save_SQL("ArticleInput") = UserHS.UserName
		Save_SQL("author") = author'作者
		If isAccept=0 Then  Conn.Execute("Update "&UserHS.TableName(UserHS.UModeID)&" Set ArticleNum=ArticleNum+1 Where UserName='" & Rss(0) & "'")'暂放

		If IsArray(IF_NULL) Then
			For I=0 To Ubound(IF_NULL,2)
				If IF_NULL(3,I)="NumberType" Then 
				   Save_SQL("" & IF_NULL(0,I) & "" )= ACTCMS.ChkNumeric(ACTCMS.S(IF_NULL(0,I)))
				ElseIf IF_NULL(3,I)="DateType" Then 
					If IsDate(ACTCMS.S(IF_NULL(0,I)))=False Then 
						Save_SQL("" & IF_NULL(0,I) & "")= Now()
					Else 
						Save_SQL("" & IF_NULL(0,I) & "")=server.htmlencode(ACTCMS.S(IF_NULL(0,I)))
					End If 
				Else 
					Save_SQL("" & IF_NULL(0,I) & "")=server.htmlencode(ACTCMS.S(IF_NULL(0,I)))
				End If 
			Next
		End If
	  Save_SQL("PicUrl")=PicUrl
	  if PicUrl<>"" Then 
	   Save_SQL("ArticlePic")=1
	  Else
	   Save_SQL("ArticlePic")=0
	  End if
		Save_SQL.update
	    Save_SQL.Close:Set Save_SQL=Nothing
		call ACTCMS.alert(""&ModeName&"修改成功!","User_Article.asp?ModeID="&ModeID&"")
				
	end sub
	sub Saveadd()
	dim TGGroupID,NewsID,Save_SQL
		 ClassID=ACTCMS.S("ClassID")
		 Title=Trim(ACTCMS.S("Title"))
		 Keywords=Trim(ACTCMS.S("Keywords"))
		 CopyFrom=Trim(ACTCMS.S("CopyFrom"))
		 Content=server.htmlencode(ACTCMS.S("Content"))
		 PicUrl=ACTCMS.S("PicUrl")
		 isAccept=ACTCMS.S("isAccept")
		 author=ACTCMS.S("author")
		 TGGroupID=Conn.Execute("Select TGGroupID From Class_Act Where ClassID='" & ClassID &"'")(0)
		IF InStr(TGGroupID,UserHS.GroupID)=0 Then		
			call ACTCMS.alert("该栏目禁止投稿或您没有这个权限,请不要从外部提交数据!","")
			Exit Sub
		End IF	

				If isAccept="1" Then 
					isAccept=1
				elseif UserHS.G_A_SH="0" And isAccept=0 Then 
				 	isAccept=0 
					Call ACTCMS.isAcceptOK(ModeID,UserHs.GroupID,UserHS.UserName,Title)
				else
					isAccept=2
				end If
				  if ClassID="" Then ClassID=0
				  If ClassID=0 Then
					Call ACTCMS.alert("请选择"&ModeName&"栏目","")
				    Exit Sub
				  End IF
				  If Title="" Then
					Call ACTCMS.alert("请输入简短标题","")
				    Exit Sub
				  End IF
				  If Content="" Then
					Call ACTCMS.alert("请输入"&ModeName&"内容","")
				    Exit Sub
				  End IF
		Dim ChkFileName,strFileName,IF_NULL,i

		IF_NULL=ACTCMS.Act_MX_Arr(ModeID)
		If IsArray(IF_NULL) Then
			For I=0 To Ubound(IF_NULL,2)
			 If IF_NULL(2,I)=0 And Trim(ACTCMS.S(IF_NULL(0,I)))="" Then  Call  ACTCMS.ALERT(IF_NULL(1,I)&"不能为空","")
			Next
		End If

		strFileName=ACTCMS.ACT_C(ModeID,10)
		If Instr(strFileName,"{y}") > 0 Then strFileName = Replace(strFileName,"{y}",Right("0" & Year(Now), 2))
		If Instr(strFileName,"{m}") > 0 Then strFileName = Replace(strFileName,"{m}",Right("0" & Month(Now), 2))
		If Instr(strFileName,"{d}") > 0 Then strFileName = Replace(strFileName,"{d}",Right("0" & Day(Now), 2))
		If Instr(strFileName,"{date}") > 0 Then strFileName = Replace(strFileName,"{date}",Year(Now) & "-" & Month(Now) & "-" & Day(Now))
		If Instr(strFileName,"{classid}") > 0 Then strFileName = Replace(strFileName,"{classid}",Actcms.ACT_L(classid,3))
		If Instr(strFileName,"{enname}") > 0 Then strFileName = Replace(strFileName,"{enname}",Actcms.ACT_L(classid,1))
		If Instr(strFileName,"{md5}") > 0 Then strFileName = Replace(strFileName,"{md5}",MD5(Now))
		If Instr(strFileName,"{rnd}") > 0 Then strFileName = Replace(strFileName,"{rnd}",ACTCMS.GetRandomize(10))
		If Instr(strFileName,"{pinyin}") > 0 Then strFileName = Replace(strFileName,"{pinyin}",ACTCMS.GetEn(ACTCMS.PinYin(ACTCMS.CloseHtml(Title))))

		If Instr(strFileName,".")>0 Then '截取扩展名
			Dim Tmps,TmpUs : Tmps = Split(strFileName,".") : TmpUs = Tmps(Ubound(Tmps)-1)
			strFileName=TmpUs
		End If 
		If Right(strFileName,1)="/" Then 
			strFileName=Left(strFileName, Len(strFileName) - 1)
		End If 


		set ChkFileName = actcms.actexe("select ID From "&ACTCMS.ACT_C(ModeID,2)&" where ClassID ='"& ClassID &"' and FileName='"& strFileName &"' order by ID desc")
		if Not ChkFileName.eof then
			Call ACTCMS.alert("文件名重复","")
			Response.end
		End If
		Set Save_SQL = server.CreateObject("adodb.recordset")
		Save_SQL.Open "Select * from "&ACTCMS.ACT_C(ModeID,2)&" where 1=0",Conn,1,3
		
		Save_SQL.AddNew
		Save_SQL("ClassID") = ClassID
		Save_SQL("Title") = Title'简短标题
		Save_SQL("isAccept") = isAccept
		Save_SQL("TemplateUrl") = ACTCMS.ACT_L(ClassID,5)
		Save_SQL("Content") = Content'内容
		Save_SQL("CopyFrom") = CopyFrom'
		Save_SQL("Keywords") = Keywords'关键字
		Save_SQL("UpdateTime")=now
		Save_SQL("ArticleInput") = UserHS.UserName
		Save_SQL("author") = author'作者
		Save_SQL("userid") = UserHS.GroupID'作者

		If IsArray(IF_NULL) Then
			For I=0 To Ubound(IF_NULL,2)
				If IF_NULL(3,I)="NumberType" Then 
				   Save_SQL("" & IF_NULL(0,I) & "" )= ACTCMS.ChkNumeric(ACTCMS.S(IF_NULL(0,I)))
				ElseIf IF_NULL(3,I)="DateType" Then 
					If IsDate(ACTCMS.S(IF_NULL(0,I)))=False Then 
						Save_SQL("" & IF_NULL(0,I) & "")= Now()
					Else 
						Save_SQL("" & IF_NULL(0,I) & "")=server.htmlencode(ACTCMS.S(IF_NULL(0,I)))
					End If 
				Else 
					Save_SQL("" & IF_NULL(0,I) & "")=server.htmlencode(ACTCMS.S(IF_NULL(0,I)))
				End If 
			Next
		End If


	  If Instr(strFileName,"{id}") > 0 Then strFileName = Replace(strFileName,"{id}",Save_SQL("id"))
	  Save_SQL("FileName") = strFileName'文件名
	  Save_SQL("PicUrl")=PicUrl
	  if PicUrl<>"" Then 
	   Save_SQL("ArticlePic")=1
	  Else
	   Save_SQL("ArticlePic")=0
	  End if
		Save_SQL.update
	    Save_SQL.Close:Set Save_SQL=Nothing
	    Response.Write "<script>if (confirm('"&ModeName&"添加成功，继续添加吗?')){location.href='User_Article.asp?action=add&ModeID="&ModeID&"&ClassID=" & ClassID &"';}else{location.href='User_Article.asp?ModeID="&ModeID&"';}</script>"
		
	end sub
	sub adds()
	Dim KeywordArr,I
	Set Rs=server.CreateObject("adodb.recordset") 
	KeywordArr=Split(ActCMS_DIY(4), "-")

	IF Action = "edit" Then
	id=Actcms.ChkNumeric(Actcms.S("ID"))
	Rs.Open "Select * From "&ACTCMS.ACT_C(ModeID,2)&"  Where articleinput='"& UserHS.UserName &"' and ID=" & id,Conn,1,3
		IF Rs.eof Then 
			call Actcms.alert("非法提交数据,试图更改其他用户"&ModeName&"!","User_Article.asp?ModeID="&ModeID&"")
			Response.End
		Else
			Title=RS("Title")
			ClassID=RS("ClassID")
			If RS("Content") <> "" Then Content=Server.HTMLEncode(RS("Content"))
			Keywords=RS("Keywords")
			author=RS("author")
			CopyFrom=RS("CopyFrom")
			isAccept=RS("isAccept")
			PicUrl=RS("PicUrl")
			Rs.close
			frmAction="edit"
	End IF
	else
		frmAction="add"
		ClassID=request("ClassID")
		author=UserHS.UserName
		CopyFrom=ActCMS_DIY(8)
	   If UBound(KeywordArr)=>0 Then Keywords=KeywordArr(0)
	end if
		Rs.OPen "Select * from class_Act  where ClassID = '"& ClassID &"'",Conn,1,1
		IF Not Rs.eof Then
			ClassID = Rs("ClassID"):ClassName = Rs("ClassName")
		End IF
	%>	
  
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <form  action="?ModeID=<%=ModeID%>" method="post" name="tcjdxr" id="tcjdxr"> <tr>
    <td width="17%" align="center" class="bg_tr">发布<%=ModeName%></td>
    <td width="83%" align="center" class="bg_tr">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" >所属分类：</td>
    <td ><%= ClassName %></td>
  </tr>
  <tr>
    <td align="right" >简短标题：</td>
    <td ><input name="Title" type="text" id="Title" value="<%= Title %>" size="50" /></td>
  </tr>


	<%  
	If ActCMS_DIY(5)="0" Then
%>
	<tr>
    <td height="23" align="right">关键字：</td>
    <td height="23" colspan="2" align="left">
	<input name="Keywords" type="text"  size="50" maxlength="255" id="Keywords" value="<%= Keywords %>">
	<input id=Tags type="checkbox" name="Tags" value="1"><label for=Tags>写入Tags</label>
	<%
		  For I = 0 To UBound(KeywordArr)
			response.Write  "<a href=""javascript:SetValue('add','Keywords','"&","&KeywordArr(I) &"')"">【<font color=""blue"">" & KeywordArr(I) & "</font>】</a>"
		  Next
	%>
	</td>
  </tr>
  <%Else
		response.write "<input type=""hidden"" id=""Keywords"" name=""Keywords"" value="""&Keywords&""">"
	End If 


	If ActCMS_DIY(7)="0" Then  %>
  <tr>
    <td align="right" ><%=ModeName%>作者：</td>
    <td ><input name="author" type="text" id="author" value="<%= author %>"  size="50" /></td>
  </tr>
  <%
  
  Else
		response.write "<input type=""hidden"" id=""author"" name=""author"" value="""&author&""">"
	End If 

	If ActCMS_DIY(9)="0" Then 
  %>
  <tr>
    <td align="right" ><%=ModeName%>来源：</td>
    <td ><input name="CopyFrom" type="text" id="CopyFrom" value="<%= CopyFrom %>"  size="50" /></td>
  </tr>
   <%
   Else
		response.write "<input type=""hidden"" id=""CopyFrom"" name=""CopyFrom"" value="""&CopyFrom&""">"
	End If    
   If Action="edit" Then Call M.ACT_MXEdit(ModeID,ID) Else Call M.ACT_MXList(ModeID) %>
  <tr>
    <td align="right" ><%=ModeName%>状态：</td>
    <td >
	<input <% IF isAccept = 0 Then Response.Write "Checked" %> name="isAccept" id="IsAcceptTF1" type="radio" value="0" checked><label for="IsAcceptTF1">投搞</label>
      <input <% IF isAccept = 1 Then Response.Write "Checked" %> type="radio" name="isAccept" id="IsAcceptTF2" value="1"><label for="IsAcceptTF2">草稿</label>
     &nbsp;&nbsp; <% If UserHS.G_A_SH="1" Then Response.Write "当前系统状态：<font color=red>发布"&ModeName&"需要管理员审核才能显示</font>" else Response.Write "当前系统状态：<font color=green>发布"&ModeName&"不需要管理员审核</font>" %></td>
  </tr>
  <tr>
    <td colspan="2" ><%=ModeName%>内容??<font color="#ff0000">如果<%=ModeName%>较长可以使用分页标签：</font>
  <input name="button"  type="button"  class="ACT_btn" style="cursor:hand;" onClick="insertHTMLToEditor('[NextPage]');" value="[NextPage]">
点击插入，注意大小写</td></tr>
<!--   <tr>
    <td colspan="2" ></td>
    </tr>
  <tr> -->
    <td align="right" ><%=ModeName%>内容</td>
    <td ><div><input type="hidden" id="content" name="content" value="<%=Content%>" style="display:none" />
	  <input name="hidden" type="hidden" id="cont___Config" style="display:none" value="" />
	  <iframe id="cont___Frame" src="../editor/fckeditor/editor/fckeditor.html?InstanceName=content&amp;Toolbar=<%=U_Simple%>" width="690" height="480" frameborder="0" scrolling="no"> </iframe>
      </div></td>
  </tr><%
   If UserHS.G_UserUpFilesTF="1" Then

 %>
  <tr>
    <td align="center" >图片地址：</td>
    <td ><input name="PicUrl" type="text" id="PicUrl" value="<%= PicUrl %>" size="60"></td>
  </tr>
  <tr>
    <td align="center" >上传图片：</td>
    <td align="center" >
	<iframe name="image" frameborder="0" width='100%' height="25" scrolling="no" src="Upload_user.asp?ModeID=1&instr=1&instrname=PicUrl&YNContent=1&instrct=content"></iframe></td>
  </tr><% End if %>
  <tr>
    <td colspan="2" align="center" >
	  	  <input name="ID" type="hidden" value="<%=ID%>">
		  <input name="ClassID" type="hidden" value="<%=ClassID%>">
	  <input name="Action" type="hidden" id="Action" value="Save<%=frmAction %>">
	 <input type=button onclick=CheckForm() class="ACT_btn"  name=Submit1 value="  保存  " />
      &nbsp;&nbsp; <input type="reset" class="ACT_btn" name="Submit2" value="  取消  " onClick="javascript:history.back()"></td>
  </tr></form>
</table>
<script language="JavaScript" type="text/javascript">

function OpenWindowAndSetValue(Url,Width,Height,WindowObj,SetObj)
{
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:yes;help:no;scroll:yes;');
	if (ReturnStr!='') SetObj.value=ReturnStr;
	return ReturnStr;
}	
function insertHTMLToEditor(codeStr){
  var oEditor = FCKeditorAPI.GetInstance("content");
  if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG){
    oEditor.InsertHtml(codeStr);
  }else{
    return false;
  }
}	
function SetValue(type,objname,strvalue)
{ 
	var obj=document.getElementById(objname)
	if (type=="add"){
		obj.value=',,,'+obj.value
		obj.value=obj.value.replace(strvalue,'');
		obj.value=obj.value+strvalue;
		obj.value=obj.value.replace(',,,','');
		obj.value=obj.value.replace(',,','');
		}
	else if (type=="+"){obj.value=parseInt(obj.value)+parseInt(strvalue);}
	else{obj.value=strvalue;}
	obj.focus(); 
 return; 
}	
function CheckForm()
{ var form=document.tcjdxr;
  
	 if (form.Title.value=='')
    { alert("请填写标题!");   
	  form.Title.focus();    
	   return false;
    }

	    form.Submit1.value="正在提交数据,请稍等...";
		form.Submit1.disabled=true;	
		form.Submit2.disabled=true;	
	    form.submit();
        return true;
	}
</script>  
<%end sub
sub add() %>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
  <form  action="User_Article.asp?action=adds&ModeID=<%=ModeID%>" method="post" name="tcjdxr" id="tcjdxr"> <tr>
    <td align="center" class="bg_tr">第一步：选 择 投 稿 栏 目</td>
  </tr>
  <tr>
    <td align="center" >
	温馨提示：您所在的会员组是<font color="red">
	<%= UserHS.G_Name%></font> 开放的投稿栏目如下：</td>
  </tr>
  <tr>
    <td align="center" >选择栏目：
      <select class="textbox" size='1' name='ClassID' style="width:250">
        <option value="0">-请选择允许投稿的栏目-</option>
        <%=Classmake(ModeID)%>
      </select></td>
  </tr>
  <tr>
    <td align="center" >
	 <input type=button onclick=CheckForm() class="ACT_btn"  name=Submit1 value="  下一步  " />
      &nbsp;&nbsp; <input type="reset" class="ACT_btn" name="Submit2" value="  取消  " onClick="javascript:history.back()"></td>
  </tr></form>
</table>
<script language="JavaScript" type="text/javascript">
function CheckForm()
{ var form=document.tcjdxr;
  
	 if (form.ClassID.value=='0')
    { alert("请选择投稿栏目!");   
	  form.ClassID.focus();    
	   return false;
    }

	    form.Submit1.value="正在提交数据,请稍等...";
		form.Submit1.disabled=true;	
		form.Submit2.disabled=true;	
	    form.submit();
        return true;
	}
</script>
<%  end sub


sub main()

	Dim strLocalUrl
	strLocalUrl = request.ServerVariables("SCRIPT_NAME")
	
	Dim intPageNow
	intPageNow = request.QueryString("page")
	
	Dim intPageSize, strPageInfo
	intPageSize = 20
	
	Dim arrRecordInfo, i
	Dim sql, sqlCount,Sqls,pages
	pages = "action="&Request("action")&"&page"
	Select Case Request.QueryString("Status")
		Case "ListisAccept"
			Sqls = "  where isAccept=0 and delif=0 and  userid<>0  and ArticleInput='"& UserHS.UserName &"'"
		Case "ListNoAccept"
			Sqls = "  where isAccept=2 and delif=0 and  userid<>0  and ArticleInput='"& UserHS.UserName &"'"
		Case "Listcg"
			Sqls = "  where isAccept=1 and delif=0 and  userid<>0  and ArticleInput='"& UserHS.UserName &"'"
		Case "Listtg"
			Sqls = "  where isAccept=3 and delif=0 and  userid<>0  and ArticleInput='"& UserHS.UserName &"'"
		Case Else
			Sqls = " where delif=0 and  userid<>0  and ArticleInput='"& UserHS.UserName &"'"
			pages = "page"
	End Select
	sql = "SELECT [ID], [Title], [ArticleInput], [Hits], [isAccept], [IsTop],  [ClassID], [FileName],[ChangesLink],[Ismake],[GroupID_ACT],[Score_ACT]" & _
		" 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="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <form name="Article" method="post" action="?Action=">
    <tr>
      <td width="30" align="center" class="bg_tr">选中 </td>
      <td width="300" align="center" class="bg_tr">简短标题</td>
	   <td width="100" align="center" class="bg_tr">栏目</td>
	   <td width="60" align="center" class="bg_tr">录入者</td> 
	 <td width="60" align="center" class="bg_tr">审核状态</td>
	    <td width="50" align="center" class="bg_tr">已生成</td>
	  
      <td width="120" 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  ><a target="_blank" href="<%
	  If arrRecordInfo(8,i) = 1 Then
		response.write arrRecordInfo(7,i)
		Else
	 response.write  ACTCMS.ActCMSDM&"Article/TypeArticle.asp?ID="&arrRecordInfo(0,i)&"&ModeID="&ModeID
	  End if%>"><%= arrRecordInfo(1,i) %></a></td>
	  <td align="center"  ><%= classname %></td>
	  <td align="center"  ><%= arrRecordInfo(2,i) %></td>
      <td align="center" ><% '0审核通过  1草稿  2待审核 3退稿
	  
	   Select Case(arrRecordInfo(4,i))
	  			Case 0
					Response.Write "审核通过"	
				Case 1
					Response.Write "<font color=red>草稿</font>"
				Case 2
					Response.Write "<font color=red>待审核</font>"	
				Case 3
					Response.Write "<font color=red>退稿</font>"
		 End Select	
	   %></td>
      <td align="center" >
	<%IF arrRecordInfo(9,i) = 1 Then 
	  Response.Write "<font color=red><b>√</b></font>"
	  ElseIf arrRecordInfo(10,i) <> "" Or arrRecordInfo(11,i) > "0" Then 
	  Response.Write "<font color=#008000 title='因为设置了阅读权限,所以不用生成HTML'><b>¤</b></font>"
	  Else
	  Response.Write "<font color=red><b>×</b></font>"
	  End If %>
	  </td>
      <td colspan="2" align="center" >
	  <a href="?Action=edit&ModeID=<%=ModeID%>&ID=<%= arrRecordInfo(0,i) %>">修改</a>
	  <a href="?Action=del&ModeID=<%=ModeID%>&ID=<%= arrRecordInfo(0,i) %>" onClick="return confirm('确认删除此<%=ModeName%>吗?删除后您可以从回收站还原!')">删除</a>	  </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;选中本页显示的所有<%=ModeName%></label>
	  <input type="button" class="act_btn" name="Submit" value="批量删除"  onClick="delpost()"></td>
    </tr>
    <tr >
      <td height="25" colspan="11" align="center" ><%= strPageInfo%></td>
    </tr>
</form>  </table>

<script language="JavaScript" type="text/javascript">
function overColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg1"
		Obj.bgColor="";
	}
	
}
function outColor(Obj)
{
	var elements=Obj.childNodes;
	for(var i=0;i<elements.length;i++)
	{
		elements[i].className="tdbg";
		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 delpost(){
    document.Article.method="post";
    document.Article.action="?Action=del";
{
	if(confirm('确认要删除选中的<%=ModeName%>吗?')){
	this.document.Article.submit();
	return true;}return false;
}
	}
</script>

<% end sub %>
