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

Index_Url="gbook"
call AMH_master(0,0)
Call AMH_Header(1)
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'><%Response.Write tit%></a></td>
  <td width=10></td>
  <td><a href='?action=clear'<%if action="clear" then Response.Write " class=red"%>>清理<%Response.Write tit_fir%>数据</a></td>
<%call AsaiMHIs_Nsort_Review()%>
  </tr>
  </table>
</td></tr>
</table>
<%
call AMH_table(1)
if action="handle" then call AsaiMHGo_Handle()
select case action
case "clear"
  call AsaiMHGo_Clear()
case "reply"
  call AsaiMHChk_Reply()
case else
  call AsaiMHChk_Main()
end select
Call AMH_Ender(tit)

sub AsaiMHGo_Clear()
  dim data_type,data_reply,clear_msg
  call AMH_td("清理留言数据")
  if Cls.chk() then
    data_type=trim(request.form("data_type"))
    data_reply=trim(request.form("data_reply"))
    select case data_type
    case "all"
	  if data_reply="yes" then
        sql="delete from "&Data_Name&" where isreply=0"
        clear_msg="所有未回复的"
      else
        sql="delete from "&Data_Name
        clear_msg="所有"
      end if
    case "week"
	  if data_reply="yes" then
        sql="delete from "&Data_Name&" where DateDiff("&s_d&",tim,"&s_tim&")>7 and isreply=0"
        clear_msg="一周前未回复的"
      else
        sql="delete from "&Data_Name&" where DateDiff("&s_d&",tim,"&s_tim&")>7"
        clear_msg="一周前"
      end if
    case else
	  if data_reply="yes" then
        sql="delete from "&Data_Name&" where DateDiff("&s_d&",tim,"&s_tim&")>30 and isreply=0"
        clear_msg="一个月前未回复的"
      else
        sql="delete from "&Data_Name&" where DateDiff("&s_d&",tim,"&s_tim&")>30"
        clear_msg="一个月前"
      end if
    end select
    call Cls.exec(sql,0)
    call AMH_msg("已成功清理了"&clear_msg&"留言数据！",pageurl&"action="&action,1)
    exit sub
  end if
  call form_first()
%>
<form name=event_frm action='<%response.write pageurl%>action=<%response.write action%>' method=post>
<input type=hidden name=chk value='yes'>
<td width='20%' class=htd>注意：<br />清除后将不能再恢复</td>
<td width='80%'>
  <table border=0>
   <tr>
   <td width=180>
     <table border=0>
     <tr><td><input type=radio name=data_type value='month' checked>&nbsp;清除一个月前的留言数据</td></tr>
     <tr><td><input type=radio name=data_type value='week'>&nbsp;清除一周前的留言数据</td></tr>
     <tr><td><input type=radio name=data_type value='all'>&nbsp;清除所有的留言数据</td></tr>
     </table>
   </td>
   <td width=*>
     <table border=0>
     <tr><td><input type=radio name=data_reply value='yes' checked>&nbsp;<font class=blue>未回复的</font></td></tr>
    <tr><td><input type=radio name=data_reply value='all'>&nbsp;<font class=red>所有留言</font></td></tr>
    </table>
   </td>
  </tr>
 </table>
</td>
</tr>
<tr>
<td></td>
<td><input type=submit value='执行清除操作' onclick="javascript:return click_return('执行清除操作',0);"></td>
</form>
<%
end sub

sub AsaiMHChk_Reply()
  call AMH_td(tit_fir&"回复")
  dim reword,reicon,issecret,ishidden
  sql="select top 1 * from "&Data_Name&" where 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&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    reword=Cls.Code_Admin("reword",1,250)
	reicon=Cls.Code_Form("icon")
    if reword="" then
      call AMH_error("回复内容 不能为空！")
      exit sub
    end if
    rs("re_word")=reword
    rs("re_tim")=Cls.now_time
    rs("re_icon")=reicon
  	rs("isreply")=1
    If 	Cls.Code_Form("issecret")="yes" then rs("issecret")= false
    If 	Cls.Code_Form("issecret")="no" then rs("issecret")= true
    If 	Cls.Code_Form("ishidden")="yes" then rs("hidden")= true
    If 	Cls.Code_Form("ishidden")="no" then rs("hidden")= false
    rs.update
    rs.close
    call AMH_msg("成功回复了"&tit_fir&"（ID："&id&"）","?",1)
    exit sub
  end if
  call form_first()
%>
<form name=frm_gbook action='?nsort=<%Response.Write nsort%>&action=reply&id=<%Response.Write id%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td width='20%'><%Response.Write tit_fir%>主题：</td>
<td width='80%'><%Response.Write Cls.Code_Html(rs("topic"),1,0)%></td>
</tr>
<tr>
<td><%Response.Write tit_fir%>作者：</td>
<td><%Response.Write Cls.Code_Html(rs("nname"),1,0)%></td>
</tr>
<tr>
<td><%Response.Write tit_fir%>内容：</td>
<td><%Response.Write Ubb.Ubbcode(rs("word"))%></td>
</tr>
<tr>
<td><%Response.Write tit_fir%>时间：</td>
<td><%Response.Write rs("tim")%></td>
</tr>
<tr>
<td>相关属性：</td>
<td>
<%If  rs("hidden")=false then %>
<input name="ishidden" type="checkbox" value="yes"  checked="checked">&nbsp;审核此留言&nbsp;
<%else%>
<input name="ishidden" type="checkbox" value="no"  >&nbsp;设此留言为未审核&nbsp;
<%end if%>
<%If  rs("issecret")=True then %>
<input name="issecret" type="checkbox" value="yes"  >&nbsp;公开此留言&nbsp;
<%else%>
<input name="issecret" type="checkbox" value="no"  >&nbsp;设此留言为悄悄话&nbsp;
<%end if%>
</td>
</tr>
<%Response.Write ShowUBBEditor("","frm_gbook","reword","回复",Cls.Code_Html(rs("re_word"),0,0),"Default",560,200)%>
<%if rs("re_icon")<>"" then%>
<tr>
<td>表情图标： </td>
<td><%Response.Write LoadIcon(rs("re_icon"))%></td>
</tr>
<%else%>
<tr>
<td>表情图标： </td>
<td><%Response.Write LoadIcon(0)%></td>
</tr>
<%end if%>
<%if rs("re_tim")<>"" Then%>
<tr>
<td>回复时间：</td>
<td><%Response.Write rs("re_tim")%></td>
</tr>
<%
end if
  call submit_edit()
  rs.close
end sub

sub AsaiMHChk_Main()
  dim topic,tim
%>
<form name=sel_form action='?AsaiMHMod=<%Response.Write AsaiMHMod%>&action=handle' method=post>
<tr align=center>
<td class=td width='5%'>序号</td>
<td class=td width='35%'><%Response.Write tit_fir%>主题</td>
<td class=td width='15%'><%Response.Write tit_fir%>发布人</td>
<td class=td width='15%'>留言者IP</td>
<td class=td width='15%'>相关信息</td>
<td class=td width='10%'>相关操作</td>
<td class=td width='5%'><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,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("*",Data_Name,sql_add,"id desc")
  for i=1 to obj_page.page_num
    id=rs("id")
    topic=rs("topic")
    tim=rs("tim")
%>
<tr align=center>
<td class=tims><%Response.Write obj_page.page_now+i%></td>
<td align=left><%Response.Write Cls.Code_Html(topic,1,21+tnum)%><%If  rs("hidden")=false then Response.Write "&nbsp;<font class=red>[未审核]</font>"%><%If   rs("issecret")=True then Response.Write "&nbsp;<font class=blue>[悄悄话]</font>"%></td>
<td><%Response.Write rs("nname")%></td>
<td><a href='<%Response.Write Cls.Web_Dir%>Common/Ip_Address.asp?ip=<%Response.Write rs("ip")%>'><%Response.Write rs("ip")%></td>
<td><font class=tims alt='<%Response.Write Cls.time_type(tim,2)%>'><%Response.Write Cls.time_type(tim,4)%></font>&nbsp;&nbsp;<%Response.Write img_admin("sys",view_sys(rs("sys"),0))%></td>
<td><a href='?action=reply&id=<%Response.Write id%>'>
<% 
if rs("re_word")="" or isnull(rs("re_word")) then 
response.write "未回复" 
else 
response.write "<font color=red>已回复</font>" 
end if 
%>
</a>
</td>
<td><input type=checkbox name=sel_id value='<%Response.Write id%>'></td>
</tr>
<%
    rs.movenext
  next
  rs.close
%>
<tr class=tr1>
<td colspan=4>
  <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=4 align=center>
<select name=sel_type size=1>
<option value='审核'>审核</option>
<option value='待审核'>待审核</option>
<option value='删除'>删除</option>
</select>
<input type=submit value='操作' onclick="return sel_click(this.form);" class=btn>
</td>
</tr>
<%
end sub
%>
