<!-- #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="YP"
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='Company'>按标题</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"
	AsaiMHFlea_Add()
Case "edit"
	AsaiMHFlea_Edit()
Case Else
	AsaiMHFlea_Main()
End Select
Call AMH_Ender(tit)
Sub AsaiMHFlea_Edit()
  dim topic,keyes,power,emoney,username,tim,counter,isgood,hidden,pic,ispic,istop,Isfocus,word,tcolor,oSpecialID,UpdateClasses
  Dim types,trade,faren,contact,ysheng,yshi,phone,email,url,address
  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
    topic=Cls.Code_Admin("Company",1,40)
    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")
    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)
    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)
    if topic="" or word="" then
      call AMH_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    End If
	trade=Cls.Code_Int("trade",0)
	types=Cls.Code_Admin("types",1,50)
	faren=Cls.Code_Admin("faren",1,20)
	contact=Cls.Code_Admin("contact",1,20)
	ysheng=Cls.Code_Admin("province",1,10)
	yshi=Cls.Code_Admin("city",1,10)
	phone=Cls.Code_Admin("phone",1,20)
	email=Cls.Code_Admin("email",1,30)
	url=Cls.Code_Admin("url",1,50)
	address=Cls.Code_Admin("address",1,60)
	types=replace(types," ","")
  If types=""  Then
    call AMH_error(tit_fir&"的 <font class=red>经营类型</font> 必须选择！<br />")
	exit sub
  End If
  If trade=0  Then
    call AMH_error(tit_fir&"的 <font class=red>所属行业</font> 必须选择！<br />")
	exit sub
  End If
  If ysheng = "" or yshi = "" Then
    call AMH_error(tit_fir&"的 <font class=red>所在地区</font> 必须选择！<br />")
	exit sub
  End If  
  If contact=""  or email ="" Then
      call AMH_error(tit_fir&"的 <font class=red>联系人名称和邮件</font> 不能为空！<br />")
      exit sub
  End If
    Call Chk_Cid()
    rs("SpecialID")=oSpecialID
    rs("ClassID")=cid
    rs("cod")=0
    rs("Company")=topic
    rs("power")=""
    rs("emoney")=0
    rs("username")=username
    rs("tim")=tim
    rs("types")=types
    rs("trade")=trade
    rs("faren")=faren
    rs("contact")=contact
    rs("sheng")=ysheng
    rs("shi")=yshi
    rs("phone")=phone
    rs("email")=email
    rs("url")=url
    rs("address")=address
    rs("counter")=counter
    rs("isgood")=isgood
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    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 AMH_msg("已成功编辑了一篇"&tit_fir&"！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&ChannelIDs="&iChannelIDs,0)
    exit sub
  End If
  call form_first()
%>
<form name=add_frm action='?AsaiMHMod=<%Response.Write AsaiMHMod%>&ChannelIDs=<%=iChannelIDs%>&ClassID=<%Response.Write ClassID%>&action=edit&id=<%Response.Write id%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<%dim preset:preset=split(Cls.ChannelPreset,"|||")
  Response.Write "<tr><td width=70>企业名称：</td><td width='*'><input type=text name=Company size=50 maxlength=40 value='"&rs("Company")&"'>"&redx&"</td></tr>"  
  Response.Write ShowClassSel(iChannelIDs,rs("ClassID"),Cls.ClassDepth)

  'Response.Write ShowSpecialSel(iChannelIDs,0)
  'Response.Write ShowKeyWord("",preset(0))
  'Response.Write ShowComeFrom(Cls.Web_Name,"佚名")
  'Response.Write ShowLimit("",1,0)
  Response.Write "<tr><td>企业法人：</td><td><input type=text name=faren size=30 maxlength=20 value='"&rs("faren")&"'></td></tr>" 
  Response.Write ShowYpType(rs("types"))
  Response.Write ShowYpTrade(rs("trade"))
  Response.Write  "<tr><td>联系人：</td><td><input type=text name=contact size=20 maxlength=20 value='"&rs("contact")&"'> "&redx&"&nbsp;&nbsp;电话：<input type=text name=phone size=20 maxlength=20 value='"&rs("phone")&"'> </td></tr>"  
  Response.Write  "<tr><td>电子邮件：</td><td><input type=text name=email size=20 maxlength=50 value='"&rs("email")&"'> "&redx&"&nbsp;&nbsp;网址：<input type=text name=url size=30 maxlength=30 value='"&rs("url")&"'> </td></tr>"  
  Response.Write  "<tr><td>所在地区：</td><td>"&ShowCity(rs("sheng"),rs("shi"))&" "&redx&"</td></tr>" 

  Response.Write   "<tr><td>联系住址：</td><td><input type=text name=address size=40 maxlength=60 value='"&rs("address")&"'> <font class=red>最好加上邮编，以方便联系</font></td></tr>"  
  Response.Write  ShowUBBEditor("12","add_frm","word","说明",Cls.code_word(rs("word")),"Simple",480,150)  
  Response.Write   "<tr height=30 class=tr><td>"&Cls.ChannelTit&"图片：</td><td><input type=text name=pic value='"&rs("pic")&"' size=60></td></tr>"
  Response.Write  "<tr height=30 class=tr><td>上传图片： </td><td><iframe id=UploadFiles1 width='98%' height=30 frameborder=0 scrolling=no src='"&Cls.Web_Dir&"Include/Upload.asp?ID="&iChannelIDs&"&Type=0&Obj=pic'></iframe></td></tr>"
  Response.Write ShowPutInfo(rs("username"),rs("tim"))
  Response.Write ShowRelateInfo(rs("isgood"),rs("istop"),rs("Isfocus"),rs("hidden"),rs("counter")) 
  Response.Write ShowMoreItem("s",0)
    Call Submit_Edit()
    rs.close
End Sub
Sub AsaiMHFlea_Add()
  dim topic,keyes,power,emoney,username,tim,counter,isgood,hidden,pic,ispic,istop,Isfocus,word,tcolor,oSpecialID,UpdateClasses
  Dim types,trade,faren,contact,ysheng,yshi,phone,email,url,address
  call AMH_td("添加"&tit_fir)
  if chk() then
    topic=Cls.Code_Admin("Company",1,40)
    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")
    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)
    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)
    if topic="" or word="" then
      call AMH_error(tit_fir&"标题 和 "&tit_fir&"内容 不能为空！")
      exit sub
    End If
	trade=Cls.Code_Int("trade",0)
	types=Cls.Code_Admin("types",1,50)
	faren=Cls.Code_Admin("faren",1,20)
	contact=Cls.Code_Admin("contact",1,20)
	ysheng=Cls.Code_Admin("province",1,10)
	yshi=Cls.Code_Admin("city",1,10)
	phone=Cls.Code_Admin("phone",1,20)
	email=Cls.Code_Admin("email",1,30)
	url=Cls.Code_Admin("url",1,50)
	address=Cls.Code_Admin("address",1,60)
	types=replace(types," ","")
  If types=""  Then
    call AMH_error(tit_fir&"的 <font class=red>经营类型</font> 必须选择！<br />")
	exit sub
  End If
  If trade=0  Then
    call AMH_error(tit_fir&"的 <font class=red>所属行业</font> 必须选择！<br />")
	exit sub
  End If
  If ysheng = "" or yshi = "" Then
    call AMH_error(tit_fir&"的 <font class=red>所在地区</font> 必须选择！<br />")
	exit sub
  End If  
  If contact="" or email ="" Then
      call AMH_error(tit_fir&"的 <font class=red>联系人名称和邮件</font> 不能为空！<br />")
      exit sub
  End If
    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")=0
    rs("Company")=topic
    rs("power")=""
    rs("emoney")=0
    rs("username")=username
    rs("tim")=tim
    rs("types")=types
    rs("trade")=trade
    rs("faren")=faren
    rs("contact")=contact
    rs("sheng")=ysheng
    rs("shi")=yshi
    rs("phone")=phone
    rs("email")=email
    rs("url")=url
    rs("address")=address
	rs("skin")=1
    rs("counter")=counter
    rs("isgood")=isgood
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    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()
%>
<form name=add_frm action='<%Response.Write PageUrl%>Action=add' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<input type=hidden name=uppic value='' onchange="doChange(this,picsel);">
<%dim preset:preset=split(Cls.ChannelPreset,"|||")
  Response.Write "<tr><td width=70>企业名称：</td><td width='*'><input type=text name=Company size=50 maxlength=40>"&redx&"</td></tr>"  
  Response.Write ShowClassSel(iChannelIDs,ClassID,Cls.ClassDepth)
  'Response.Write ShowSpecialSel(iChannelIDs,0)
  'Response.Write ShowKeyWord("",preset(0))
  'Response.Write ShowComeFrom(Cls.Web_Name,"佚名")
  'Response.Write ShowLimit("",1,0)
  Response.Write "<tr><td>企业法人：</td><td><input type=text name=faren size=30 maxlength=20> </td></tr>" 
  Response.Write ShowYpType("0")
  Response.Write ShowYpTrade(0)
  Response.Write "<tr><td>联系人：</td><td><input type=text name=contact size=20 maxlength=20> "&redx&"&nbsp;&nbsp;电话：<input type=text name=phone size=20 maxlength=20> </td></tr>"  
  Response.Write "<tr><td>电子邮件：</td><td><input type=text name=email size=20 maxlength=50> "&redx&"&nbsp;&nbsp;网址：<input type=text name=url size=30 maxlength=30> </td></tr>"
  Response.Write "<tr><td>所在地区：</td><td>"&ShowCity("","")&" "&redx&"</td></tr>" 
  Response.Write   "<tr><td>联系住址：</td><td><input type=text name=address size=40 maxlength=60> <font class=red>最好加上邮编，以方便联系</font></td></tr>"  
  Response.Write  ShowUBBEditor("12","add_frm","word","说明","","Simple",480,150)  
  Response.Write   "<tr height=30 class=tr><td>"&Cls.ChannelTit&"图片：</td><td><input type=text name=pic value='' size=60></td></tr>"
  Response.Write  "<tr height=30 class=tr><td>上传图片： </td><td><iframe id=UploadFiles1 width='98%' height=30 frameborder=0 scrolling=no src='"&Cls.Web_Dir&"Include/Upload.asp?ID="&iChannelIDs&"&Type=0&Obj=pic'></iframe></td></tr>"
  Response.Write ShowPutInfo(Login_username,Cls.Now_time)
  Response.Write ShowRelateInfo("","","",1,0)
  Response.Write ShowMoreItem("s",0)

	Call Submit_Add()
End Sub

Sub AsaiMHFlea_Main()
Dim Types,IsReview,topic,pageurl2,tcolor,obj_page
	pageurl2=pageurl
	Call SQL_ClassID(sql_add)
	Call format_search("Company","Company,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,Types,istop,Isfocus,Company,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,Types,istop,Isfocus,Company,tim,isgood,hidden,cod,tcolor",Data_Name,sql_add,"id desc")
  for i=1 to obj_page.page_num
    id=rs("id")
    Types=rs("Types")
    topic=rs("Company")
    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>
  <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")) %></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
%>
