<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%
ColumnName="":Tablename="HX_MailChit":action=request("action")
if action<>"" then
  MAID=request("MAID") 
  if MAID="" or isnull(MAID) then HX_GoBack "非法操作",""  
end if
page=request("page")
select case action
  case "del" 
   for i=0 to ubound(split(MAID,","))
     Orderby= " where WS_MAID="&cint(split(MAID,",")(i))
     set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
	 if rs.recordcount>0 then
	   if rs("WS_MailToDel")=1 then  conn.execute("update "&Tablename&" set WS_MailToDel=-1 where WS_MAID="&split(MAID,",")(i))
	   if rs("WS_MailSendDel")=1 then conn.execute("update "&Tablename&" set WS_MailSendDel=-1 where WS_MAID="&split(MAID,",")(i))
       if rs("WS_MailToDel")=-1 and rs("WS_MailSendDel")=-1 then   conn.execute("delete from "&Tablename&" where WS_MAID="&rs("WS_MAID"))
     end if
	 response.Write rs.recordcount&"*******"&Orderby&"<br>"
   next
   call WS_S.HX_RSClose(rs)
   WS_S.HX_Redirect "MyDelMessage.asp?page="&page
  case "redo"  
   for i=0 to ubound(split(MAID,","))
     Orderby= " where WS_MAID="&split(MAID,",")(ii)
     set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
	 if rs.recordcount>0 then
	   if rs("WS_MailToUid")=cint(loginuid) then  conn.execute("update "&Tablename&" set WS_MailToDel=0 where WS_MAID="&split(MAID,",")(i))
	   if rs("WS_MailSendUid")=cint(loginuid) then conn.execute("update "&Tablename&" set WS_MailSendDel=0 where WS_MAID="&split(MAID,",")(i))
     end if
   next
   call WS_S.HX_RSClose(rs)
   WS_S.HX_Redirect "MyDelMessage.asp?page="&page
end select
Orderby=" where (WS_MailToUid="&loginuid&" and WS_MailToDel=1) or (WS_MailSendUid="&loginuid&" and WS_MailSendDel=1) order by WS_MailSendDate desc"
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
response.write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>垃圾箱</title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'><script src='../HXinclude/HX_Function.js'></script></head><body topmargin='10' leftmargin='0' bottommargin='10'><table width='595'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8 background='../hximages/titlelinebg.gif'><table width='580'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>垃圾箱</font></td></tr></table><table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor=FFFBE8><form method='post' action='MyDelMessage.asp?page="&page&"' name='form1'><tr bgcolor='#BF9B73' class='td4'><td width='38' align=center><input type='checkbox' name='checkall' value='checkbox' onClick='chkall(this)' class='radio' style='background-color:BF9B73;'></td><td width='40'>&nbsp;</td><td width='241'><div align='center'><font color='#FFFBE8'>标题</font></div></td><td width='63'><div align='center'><font color='#FFFBE8'>发件人</font></div></td><td width='50'><div align='center'><font color='#FFFBE8'>收件人</font></div></td><td width='118'><div align='center'><font color='#FFFBE8'>日期</font></div></td></tr>"
if rs.recordcount<=0 then
response.Write "<tr><td colspan=6 bgcolor=FFFBE8 height=25 align=center>垃圾箱中暂时没有邮件！</td></tr>"
else
 rs.PageSize =14 '每页记录条数
	iCount=rs.RecordCount '记录总数
	iPageSize=rs.PageSize
    maxpage=rs.PageCount 
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if    
    rs.AbsolutePage=Page
	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	ii=0
do while not rs.EOF	   
response.write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td width='38' align=center><input type='checkbox' name='MAID' value='"&rs("WS_MAID")&"' class='radio' style='background-color:FFFBE8;'></td><td width='40' align='left'>"
if rs("WS_MailIsRead")=0 then response.Write "<img src='../HXIMAGES/Message/newmail.GIF' title='新邮件'>" else response.Write "<img src='../HXIMAGES/Message/oldmail.GIF' title='已读邮件'>"
if rs("WS_MailAnnex")<>"" then response.Write "<img src='../HXIMAGES/Message/sign.GIF' title='有附件'>"
response.write "</td><td width='241'><a href='javascript:'  title='"&rs("WS_MailObject")&"' onClick=""openwin(630,490,'Readmessage.asp?MAID="&rs("WS_MAID")&"')"">"&left(rs("WS_MailObject"),20)&"</a></td><td width='63' align=center>"
Call WS_S.HX_OutUserInfo(rs("WS_MailSendUid")):response.write OutName&"</td><td width='50' align=center>"
Call WS_S.HX_OutUserInfo(rs("WS_MailToUid")):response.write OutName&"</td><td width='118'>"&rs("WS_MailSendDate")&"</td></tr>"
ii=ii+1
if ii>=rs.PageSize then Exit Do
rs.movenext
loop
response.write "<tr bgcolor='#BF9B73' class='td4'><input type='hidden' name='action' value=''><td colspan='6' height='30'>&nbsp;<input type='checkbox' name='checkall' value='checkbox' onClick='chkall(this)' id='checkall' class='radio' style='background-color:BF9B73;'><label for='checkall'>全选</label>&nbsp;将选中全部&nbsp;<input name='del' type='button' value='删除' onClick=""javascript:document.form1.action.value='del';document.form1.submit();""> <input type='button' name='redod' value='还原' onClick=""javascript:document.form1.action.value='redo';document.form1.submit();"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;说明:<img src='../HXIMAGES/Message/newmail.GIF' title='新邮件' align='absmiddle'>新邮件	   <img src='../HXIMAGES/Message/oldmail.GIF' title='已读邮件' align='absmiddle'>已读邮件	   <img src='../HXIMAGES/Message/sign.GIF' title='有附件' align='absmiddle'>有附件</td></tr>"
call WS_S.PageControl(iCount,maxpage,page,"border=0 align=right","<p align=right>",6)
end if
WS_S.HX_RSClose rs 
response.write "</form></table></td></tr></table>"%>