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

Index_Url="Cast"
Call AMH_Master(0,0)
Call AMH_Header(1)
tit=Cls.ChannelName&tit
Tit_Fir=Cls.ChannelTit&Tit_Fir
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><%Response.Write tit%></td>
  <td width=5></td>
  <td><a href='?ChannelIDs=0'<%If iChannelIDs=0 Then Response.Write " class=red"%>>网站<%Response.Write tit_fir%></a></td>
  <td width=5></td>
<%
	Dim iListStr, Lii
	iListStr = Cls.Channel_Menu
	For Lii =0 To Ubound(iListStr,2)
	If Int(iListStr(5,Lii)) <> 2 And Not Cbool(iListStr(7,Lii)) And Cls.Get_ChannelSetup(iListStr(18,Lii),13) = 1 Then
			Response.Write "<td><a href='?ChannelIDs="&Int(iListStr(0,Lii))&"'"
			tit=iListStr(13,Lii)&tit_fir
			If Int(iChannelIDs) = Int(iListStr(0,Lii)) Then
				Response.Write " class=red"
			End If
			Response.Write ">"&tit&"</a></td>"
			Response.Write "<td width=5></td>"
		End If
	Next
	Erase iListStr
%>
</td></tr>
</table>
</td></tr>
<%
Call AMH_Table(1)
Select Case LCase(Action)
Case "edit"
	AsaiMHCast_Edit()
Case "add"
	AsaiMHCast_Add()
Case "delete"
	AsaiMHCast_Delete()
Case Else
	AsaiMHCast_Main()
End Select

Call AMH_Ender(tit)
'//* 删除公告 *//
Sub AsaiMHCast_Delete()
End Sub

'//* 公告编辑 *//
Sub AsaiMHCast_Edit()
  sql="select top 1 * from "&Data_Name&" Where ChannelIDs="&iChannelIDs&" and id="&id
  call Cls.exec("",-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call AMH_msg(tit_fir&"（ID："&id&"）不在存！","?ChannelIDs="&iChannelIDs,1)
    exit sub
  end if
  dim topic,word
  call AMH_td("编辑"&tit_fir)
  if chk() then
    topic=Cls.Code_Admin("topic",1,50)
    word=request.form("word")
    if topic="" or word="" then
      rs.close
      call AMH_error(tit_fir&"标题 和 "&tit_fir&"标题 不能为空！")
      exit sub
    end if
    rs("ChannelIDs")=iChannelIDs
    rs("username")=login_username
    'rs("tim")=Cls.now_time
    rs.update
    rs.close
    call AMH_msg("成功编辑一条"&tit_fir,"?ChannelIDs="&iChannelIDs,1)
    exit sub
  end if
  call form_first()
%>
<form name=add_frm action='?ChannelIDs=<%=iChannelIDs%>&Action=Edit&ID=<%Response.Write ID%>' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr>
<td width='20%'><%Response.Write tit_fir%>标题：</td>
<td width='80%'><input type=text name=topic value='<%Response.Write rs("topic")%>' size=65 maxlength=50></td>
</tr>
<%Response.Write ShowUBBEditor("","add_frm","word","内容",Cls.code_word(rs("word")),"Default",560,200)%>

<tr>
<%
  rs.close
  call submit_edit()
end sub
sub AsaiMHCast_Add()
  dim topic,word
  call AMH_td("添加"&tit_fir)
  if chk() then
    topic=Cls.Code_Admin("topic",1,50)
    word=request.form("word")
    if topic="" or word="" then
      call AMH_error(tit_fir&"标题 和 "&tit_fir&"标题 不能为空！")
      exit sub
    end if
    sql="select * from "&Data_Name&" where ChannelIDs="&iChannelIDs
    call Cls.exec("",-1)
    rs.open sql,conn,1,3
    rs.addnew
    rs("ChannelIDs")=iChannelIDs
    rs("username")=login_username
    rs("topic")=topic
    rs("word")=word
    rs("tim")=Cls.now_time
    rs.update
    rs.close
    call AMH_msg("成功添加一条新的"&tit_fir,"?ChannelIDs="&iChannelIDs,1)
    exit sub
  end if
  call form_first()
%>
<form name=add_frm action='?ChannelIDs=<%=iChannelIDs%>&Action=Add' method=post>
<input type=hidden name=chk value='yes'>
<input type=hidden name=upid value=''>
<tr>
<td width='20%'><%Response.Write tit_fir%>标题：</td>
<td width='80%'><input type=text name=topic size=65 maxlength=50></td>
</tr>
<%Response.Write ShowUBBEditor("","add_frm","word","内容","","Default",560,200)%>

<%
  call submit_add()
end sub
Sub AsaiMHCast_Main()
  dim topic,tim
  call AMH_td(tit_fir&"管理")
%>
<form name=sel_form action='?ChannelIDs=<%=iChannelIDs%>&Action=Delete' method=post>
<tr align=center valign=top>
<td width='20%'>
  <table border=0>
  <tr><td height=30><%Response.Write img_admin("","")%>&nbsp;<a href='?ChannelIDs=<%=iChannelIDs%>&action=add'>添加新<%Response.Write tit_fir%></a></td></tr>
  </table>
</td>
<td width='80%'>
  <table cellspacing=1 cellpadding=3 class=table0>
  <tr align=center>
  <td class=td width='7%'>序号</td>
  <td class=td width='50%'><%Response.Write tit_fir%>标题</td>
  <td class=td width='17%'>发布人</td>
  <td class=td width='20%'>相关操作</td>
  <td class=td width='6%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
  </tr>
<%
  dim obj_page
  set obj_page=new Cls_PageCute
  obj_page.pageurl=pageurl
  obj_page.nummer=nummer
  obj_page.page_t=1
  obj_page.page_p=5
  obj_page.page_unit="条"
  obj_page.page_tit=tit_fir
  obj_page.v_id="id"
  call obj_page.p_init("*",Data_Name,"ChannelIDs="&iChannelIDs,"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("*",Data_Name,"ChannelIDs="&iChannelIDs,"id desc")
  for i=1 to obj_page.page_num
    id=rs("id")
    iChannelIDs = Rs("ChannelIDs")
    topic=rs("topic")
    tim=rs("tim")
%>
  <tr align=center>
  <td class=tims><%Response.Write obj_page.page_now+i%></a></td>
  <td align=left><a href='?action=edit&ChannelIDs=<%=iChannelIDs%>&id=<%Response.Write id%>' alt='<%Response.Write Cls.Code_Html(topic,1,0)%>'><%Response.Write Cls.Code_Html(topic,1,(20+tnum))%></a></td>
  <td><%Response.Write format_user_view(rs("username"),1,0)%></td>
  <td><%Response.Write pro_edit("?action=edit&ChannelIDs="&iChannelIDs&"&id="&id,"编辑该"&tit_fir)%>&nbsp;&nbsp;<font alt='<%Response.Write Cls.time_type(tim,2)%>' class=tims><%Response.Write Cls.time_type(tim,4)%></font></td>
  <td><input type=checkbox name=sel_id value='<%Response.Write id%>'></td>
  </tr>
<%
    rs.movenext
  next
  rs.close
%>
<tr class=tr1>
<td colspan=3>
  <table border=0>
  <tr class=tr1>
  <td></td>
  <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>
  </select>
  <input type=submit value='操作' onclick="return sel_click(this.form);" class=btn>
</td>
</tr>
</form>
</table>
</td>
</tr>
<%
end sub
%>
