<!-- #Include File="Include/AMH_Onlogin.asp" -->
<!-- #Include File="../Include/Inc_UpRemote.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

del_user_true=true
del_upload_true=true
Index_Url="Article"
PageUrl = PageUrl&"ChannelIDs="&iChannelIDs&"&"
Call AMH_Master(1,2)
Call AMH_Header(1)
Select Case AsaiMHMod
Case "isgood"
	ntit="推荐"&tit_fir
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=1 and isgood=1"
Case "sh"
	ntit="待审核"&tit_fir
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=0"
Case Else
	AsaiMHMod=""
	ntit=tit_fir&"列表"
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=1"
End Select
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?ChannelIDs=<%=iChannelIDs%>'><%Response.Write tit_fir%>列表</a></td>
  <td width=10></td>
  <td><a href='?AsaiMHMod=isgood&ChannelIDs=<%=iChannelIDs%>'<%if AsaiMHMod="isgood" then Response.Write " class=red"%>>推荐<%Response.Write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?AsaiMHMod=sh&ChannelIDs=<%=iChannelIDs%>'<%if AsaiMHMod="sh" then Response.Write " class=red"%>>待审核<%Response.Write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?Action=Add&ChannelIDs=<%=iChannelIDs%>&ClassID=<%Response.Write ClassID%>'<%if action="add" then Response.Write " class=red"%>>添加<%Response.Write tit_fir%></a></td>
<%call AsaiMHIs_Nsort_Review()%>
  </tr>
  </table>
</td></tr>
<tr><td colspan=2 align=center>
  <table border=0 cellspacing=0 cellpadding=2>
  <form action='?' method=get>
  <input type=hidden name=ChannelIDs value='<%Response.Write iChannelIDs%>'>
  <input type=hidden name=AsaiMHMod value='<%Response.Write AsaiMHMod%>'>
  <input type=hidden name=ClassID value='<%Response.Write ClassID%>'>
  <tr>
  <td>搜索（<%Response.Write ntit%>） 关键字：</td>
  <td><input type=text name=keyword value='<%Response.Write Cls.Code_Query("keyword")%>' size=15 maxlength=20></td>
  <td><select name=sea_type size=1><option value='topic'>按标题</option><option value='username'>按发布人</option></select></td>
  <td><select name=sea_term size=1><option value='all'>满足所有条件</option><option value='only'>满足一个条件</option></seelct></td>
  <td><input type=submit value='搜索' class=btn></td>
  </tr>
  </form>
  </table>
</td></tr>
</table>
<%
Call AMH_Table(1)
If Action="handle" Then call AsaiMHGo_Handle()

Select Case LCase(Action)
Case "clear"
	AsaiMHGo_Clear()
Case "add"
	AsaiMHArticle_Add()
Case "edit"
	AsaiMHArticle_Edit()
Case Else
	AsaiMHArticle_Main()
End Select

Call AMH_Ender(tit)

Sub AsaiMHArticle_Edit()
  dim topic,Subtitle,keyes,comto,author,power,emoney,username,tim,counter,isgood,hidden,pic,ispic,Isfocus,istop,word,tcolor,oSpecialID,oIncludeInfo,UpdateClasses,preset
  call AMH_td("编辑"&tit_fir)
  sql="select top 1 * from "&Data_Name&" where id="&id
  Call Cls.Exe_Conn(Rs,SQL,3)
  if rs.eof then
    rs.close
    call AMH_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  End If
  if chk() then
    tcolor=Cls.Code_Form("tcolor")
    topic=Cls.Code_Admin("topic",1,40)
	Subtitle=Cls.Code_Admin("Subtitle",1,100)
    word=Cls.Code_Remark("word")
  if Cls.Code_Remark("remote")="yes" then word=DoRemoteUpload(word,Cls.ChannelUpMax,Cls.ChannelUpFileType(4),Cls.ChannelUploadDir,Cls.Get_ChannelSetup(Cls.ChannelSetup,15))
    csid=Cls.Code_Form("ClassID")
    if len(tcolor)<>6 then tcolor=""
    if cs_nd(csid)=false then
      rs.close
      call AMH_error("请选择 "&tit_fir&"分类！<br />如有下级分类，请如实选择所属下级分类")
      exit sub
    End If
    if topic="" or word="" then
      rs.close
      call AMH_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    End If
    keyes=Cls.Code_Admin("keyes",1,20)
    comto=Cls.Code_Admin("comto",1,10)
	  author=Cls.Code_Admin("author",1,20)
    power=Cls.Code_Admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=Cls.Code_Int("emoney",1)
    if not isnumeric(emoney) then emoney=0
    username=Cls.Code_Admin("username",1,20)
    if ChkName(username)=false then username=login_username
    tim=Cls.Code_Admin("tim",1,20)
    tim=Cls.time_type(tim,1)
    if tim="" then tim=Cls.now_time
    pic=Cls.Code_Admin("pic",1,100)
	ispic=true
    if pic="" then ispic=false
    counter=Cls.Code_Int("counter",1)
    isgood=false
    if Cls.Code_Form("isgood")="yes" then isgood=true
	istop=0
    if Cls.Code_Form("istop")="yes" then istop=1
	Isfocus=false
    if Cls.Code_Form("Isfocus")="yes" then Isfocus=true
    hidden=true
    if Cls.Code_Form("hidden")="yes" then hidden=false
    oSpecialID=Cls.Code_Int("SpecialID",0)
	  oIncludeInfo=Cls.Code_Form("IncludeInfo")
    Call Chk_Cid()
    rs("ChannelIDs")=iChannelIDs
    rs("SpecialID")=oSpecialID
    rs("ClassID")=cid
    rs("cod")=1
    rs("IncludeInfo")=oIncludeInfo
    rs("topic")=topic
    rs("Subtitle")=Subtitle
    rs("comto")=comto
    rs("author")=author
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("tim")=tim
    rs("counter")=counter
    rs("isgood")=isgood
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    rs("ispic")=ispic
    rs("istop")=istop
	rs("Isfocus")=Isfocus
    rs("word")=word
    rs("tcolor")=tcolor
    rs("isUpdate")=True
    rs.update
    rs.close
          UpdateClasses = Cls.Exec("SELECT ClassParentStr FROM [AsaiMHClass] WHERE ChannelIDs=" & iChannelIDs & " And C_ID=" & Cid,1)(0)
	Call Cls.Exec ("UPDATE AsaiMHClass SET isUpdate=1 WHERE ChannelIDs=" & iChannelIDs & " And  C_ID in (" & UpdateClasses & ")",0)
    call AMH_msg("已成功编辑了一篇"&tit_fir&"！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&ChannelIDs="&iChannelIDs,0)
    exit sub
  End If
  call form_first()
  iChannelIDs=rs("ChannelIDs")
  oSpecialID=rs("SpecialID")
  cid=rs("ClassID")
  pic=rs("pic")
  if ispic="" then ispic=Cls.Rand_File(Index_Url)
%>
<form name=add_frm action="?AsaiMHMod=<%Response.Write AsaiMHMod%>&ChannelIDs=<%=iChannelIDs%>&ClassID=<%Response.Write ClassID%>&action=edit&id=<%Response.Write id%>" method=post  onsubmit="return checkPost(1)">
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<%preset=split(Cls.ChannelPreset,"|||")
  Response.Write ShowTopic(rs("IncludeInfo"),"Topic",rs("topic"),"Tcolor",rs("tcolor"),"Subtitle",rs("Subtitle"))
  Response.Write ShowClassSel(iChannelIDs,rs("ClassID"),Cls.ClassDepth)
  Response.Write ShowSpecialSel(iChannelIDs,rs("SpecialID"))
  Response.Write ShowKeyWord(rs("keyes"),preset(0))
  Response.Write ShowComeFrom(rs("comto"),preset(1),rs("author"),preset(2))
  Response.Write ShowEditor(iChannelIDs,1,"add_frm","word","内容","TempUploadFiles",Cls.code_word(rs("word")))
  Response.Write ShowPicUpload(iChannelIDs,pic,"pic")
  Response.Write ShowPutInfo(rs("username"),rs("tim"))
  Response.Write ShowRelateInfo(rs("isgood"),rs("istop"),rs("Isfocus"),rs("hidden"),rs("counter"))
  Response.Write ShowLimit(rs("power"),0,rs("emoney"))
  Response.Write ShowUploadList()
  Response.Write ShowMoreItem(0,0)
    Call Submit_Edit()
    rs.close
End Sub

Sub AsaiMHArticle_Add()
  dim topic,Subtitle,keyes,comto,author,power,emoney,username,tim,counter,isgood,hidden,pic,ispic,istop,Isfocus,word,tcolor,oSpecialID,oIncludeInfo,UpdateClasses,preset
  call AMH_td("添加"&tit_fir)
  if chk() then
    topic=Cls.Code_Admin("topic",1,40)
	Subtitle=Cls.Code_Admin("Subtitle",1,100)
    word=Cls.Code_Remark("word")
  if Cls.Code_Remark("remote")="yes" then word=DoRemoteUpload(word,Cls.ChannelUpMax,Cls.ChannelUpFileType(4),Cls.ChannelUploadDir,Cls.Get_ChannelSetup(Cls.ChannelSetup,15))
    csid=Cls.Code_Form("ClassID")
	  oIncludeInfo=Cls.Code_Form("IncludeInfo")
    tcolor=Cls.Code_Form("tcolor")
    if len(tcolor)<>6 then tcolor=""
    if cs_nd(csid)=false then
      call AMH_error("请选择 "&tit_fir&"分类！<br />如有下级分类，请如实选择所属下级分类")
      exit sub
    End If
    if topic="" or word="" then
      call AMH_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    End If
    keyes=Cls.Code_Admin("keyes",1,20)
    comto=Cls.Code_Admin("comto",1,10)
    author=Cls.Code_Admin("author",1,20)
    power=Cls.Code_Admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=Cls.Code_Int("emoney",0)
    if not isnumeric(emoney) then emoney=0
    username=Cls.Code_Admin("username",1,20)
    if ChkName(username)=false then username=login_username
    tim=Cls.Code_Admin("tim",1,20)
    tim=Cls.time_type(tim,1)
    if tim="" then tim=Cls.now_time
    pic=Cls.Code_Admin("pic",1,100)
    ispic=true
    if pic="" then ispic=false
    counter=Cls.Code_Int("counter",0)
    isgood=false
    if Cls.Code_Form("isgood")="yes" then isgood=true
	 istop=0
    if Cls.Code_Form("istop")="yes" then istop=1
	Isfocus=false
    if Cls.Code_Form("Isfocus")="yes" then Isfocus=true
    hidden=true
    if Cls.Code_Form("hidden")="yes" then hidden=false
    oSpecialID=Cls.Code_Int("SpecialID",0)
    Call Chk_Cid()
    sql="select * from "&Data_Name
    call Cls.exec(sql,-1)
    rs.open sql,conn,1,3
    rs.addnew
    rs("ChannelIDs")=iChannelIDs
    rs("SpecialID")=oSpecialID
    rs("ClassID")=cid
    rs("cod")=1
    rs("IncludeInfo")=oIncludeInfo
    rs("topic")=topic
    rs("Subtitle")=Subtitle
    rs("comto")=comto
    rs("author")=author
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("tim")=tim
    rs("counter")=counter
    rs("isgood")=isgood
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    rs("ispic")=ispic
    rs("istop")=istop
    rs("Isfocus")=Isfocus
    rs("word")=word
    rs("tcolor")=tcolor
    rs("HtmlFileDate")=Cls.HtmlRndFileName()
    rs("isUpdate")=True
    rs.update
    rs.close
          UpdateClasses = Cls.Exec("SELECT ClassParentStr FROM [AsaiMHClass] WHERE ChannelIDs=" & iChannelIDs & " And C_ID=" & Cid,1)(0)
	Call Cls.Exec ("UPDATE AsaiMHClass SET isUpdate=1 WHERE ChannelIDs=" & iChannelIDs & " And  C_ID in (" & UpdateClasses & ")",0)
    Call Cls.Channel_Count(iChannelIDs)
    call AMH_msg("已成功添加了一篇"&tit_fir&"！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&ChannelIDs="&iChannelIDs,0)
    exit sub
  End If
  call form_first()
  ispic=Cls.rand_file(Index_Url)
%>
<form name=add_frm action='<%Response.Write PageUrl%>Action=add' method=post onsubmit="return checkPost(1)">
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<input type=hidden name=uppic value='' onchange="doChange(this,picsel);">
<%preset=split(Cls.ChannelPreset,"|||")
  Response.Write ShowTopic(0,"Topic","","Tcolor","","Subtitle","")
  Response.Write ShowClassSel(iChannelIDs,ClassID,Cls.ClassDepth)
  Response.Write ShowSpecialSel(iChannelIDs,0)
  Response.Write ShowKeyWord("",preset(0))
  Response.Write ShowComeFrom("本站整理",preset(1),"佚名",preset(2))
  Response.Write ShowEditor(iChannelIDs,1,"add_frm","word","内容","TempUploadFiles","")
  Response.Write ShowPicUpload(iChannelIDs,"","pic")
  Response.Write ShowUploadList()
  Response.Write ShowPutInfo(Login_username,Cls.Now_time)
  Response.Write ShowRelateInfo("",Istop,"",1,0)
  Response.Write ShowLimit("",1,0)
  Response.Write ShowMoreItem(0,0)
	Call Submit_Add()
End Sub

Sub AsaiMHArticle_Main()
Dim IncludeInfo,IsReview,topic,pageurl2,tcolor,obj_page
	pageurl2=pageurl
	Call SQL_ClassID(sql_add)
	Call format_search("topic","topic,username",2,1)
  Call AMH_Td(tit_fir&"列表")
%>
<tr valign=top align=center>
<td width='20%'>
  <table border=0 width='100%'>
  <tr><td height=5></td></tr>
  <tr><td class=htd><%Call Left_Channel_Class(pageurl2,iChannelIDs)%></td></tr>
  </table>
</td>
<td width='80%'>
  <table cellspacing=1 cellpadding=3 class=table0>
<form name=sel_form action='<%Response.Write PageUrl%>ClassID=<%Response.Write cid%>&Action=handle' method=post>
<tr align=center>
<td class=td width='7%'>序号</td>
<td class=td width='65%'><%Response.Write tit_fir%>标题及整理时间<%if keyword<>"" then Response.Write "（搜索结果："&keyword&"）"%></td>
<td class=td width='28%'>相关属性</td>
<td class=td width='5%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
</tr>
<%
  set obj_page=New Cls_pageCute
  obj_page.nummer=nummer
  obj_page.pageurl=pageurl
  obj_page.page_tit=tit_fir
  obj_page.page_unit="条"
  obj_page.v_id="id"
  call obj_page.p_init("id,IncludeInfo,istop,Isfocus,topic,ispic,tim,isgood,hidden,cod,tcolor",Data_Name,sql_add,"id desc")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
  call obj_page.p_main("id,IncludeInfo,istop,Isfocus,topic,ispic,tim,isgood,hidden,cod,tcolor",Data_Name,sql_add,"id desc")
  for i=1 to obj_page.page_num
    id=rs("id")
    IncludeInfo=rs("IncludeInfo")
    topic=rs("topic")
    tcolor=rs("tcolor")
    topic=Cls.code_html(topic,1,40)
    if Cls.Is_Null(tcolor)<>"" then
      topic="<font color=#"&tcolor&">"&topic&"</font>"
    End If
%>
<tr align=center>
<td class=tims><a href='<%Response.Write Cls.Web_Dir%><%Response.Write Index_Url%>/View.asp?id=<%Response.Write id%>' target=_blank><%Response.Write obj_page.page_now+i%></a></td>
<td>
  <table border=0 cellspacing=0 cellpadding=0 width='100%'>
  <tr>
  <td>
  <%
 if int(IncludeInfo)=0 then
    response.write " "
	elseif int(IncludeInfo)=1 then
      response.write "<font class=yellow>[话题]</font>"
    elseif int(IncludeInfo)=2 then
      response.write "<font class=blue>[图文]</font> "
    elseif int(IncludeInfo)=3 then
      response.write "<font class=read>[组图]</font> "
    elseif int(IncludeInfo)=4 then
      response.write "<font class=red2>[推荐]</font> "
    elseif int(IncludeInfo)=5 then
      response.write "<font class=red>[观点]</font> "
    end if
  %>
  <a href='<%Response.Write PageUrl%>Action=edit&id=<%Response.Write id%>'><%Response.Write topic%></a>
  </td>
  <td align=right><font class=tims><%Response.Write Cls.time_type(rs("tim"),4)%></font></td>
  </tr>
  </table>
</td>
<td align=left><%Response.Write pro_edit(PageUrl&"Action=edit&id="&id,"编辑该"&tit_fir) &"&nbsp;"& pro_hidden(rs("hidden"),1) &"&nbsp;"& pro_cod(rs("cod")) &"&nbsp;"& pro_isgood(rs("isgood")) &"&nbsp;"& pro_Isfocus(rs("Isfocus")) &"&nbsp;"& pro_istop(rs("istop")) &"&nbsp;"& pro_ispic(rs("ispic")) &"&nbsp;"& pro_IncludeInfo(rs("IncludeInfo"))%></td>
<td><input type=checkbox name=sel_id value='<%Response.Write id%>'></td>
</tr>
<%
    rs.movenext
  next
  rs.close
%>
<tr class=tr1>
<td colspan=2>
  <table border=0 cellspacing=0 cellpadding=2>
  <tr class=tr1>
  <td><%Response.Write obj_page.page_var%></td>
  <td width=3></td>
  <td>分页：</td>
  <td><%Response.Write obj_page.page_cute%></td>
  </tr>
  </table>
</td>
<td colspan=2 align=center>
执行
<select name=sel_type size=1>
<option value='推荐'>推荐</option>
<option value='取消推荐'>取消推荐</option>
<option value='焦点'>焦点</option>
<option value='取消焦点'>取消焦点</option>
<option value='固顶'>固顶</option>
<option value='取消固顶'>取消固顶</option>
<option value='审核'>审核</option>
<option value='待审核'>待审核</option>
<option value='删除'>删除</option>
</select>
<input type=submit value='操作' onclick="return sel_click(this.form);" class=btn>
</td>
</tr>
</form>
  </table>
</td>
</tr>
<%
  set obj_page=nothing
End Sub
%>
