<!-- #include file="include/admin_onlogin.asp" -->
<%
dim ndim,nnum,ntit1,ntit2
index_url="err"
call admin_master(0,0)
call admin_header(0,0)
nsort=""
ntit=tit
call joekoe_chk_dim()
ntit2=tit_fir&"查看"
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'><%response.write tit_fir%>列表</a></td>
  <td width=10></td>
  <td><a href='?nsort=<%response.write nsort%>'><%response.write ntit1&tit%></a></td>
  <td width=10></td>
  <td><a href='?nsort=<%response.write nsort%>&action=clear' onclick="return click_return('清空<%response.write ntit1&tit_fir%>',0);">清空<%response.write ntit1&tit_fir%></a></td>
  </tr>
  </table>
</td></tr>
</table>
<%
call admin_table(1)

if int(nnum)<0 then
  response.write vbcrlf&"<tr><td align=center height=100 colspan=2><font class=red>暂时没有栏目"&tit_fir&"可管理！</font><br><br>请先在 <a href='admins_menu.asp'>管理菜单</a> 里设置正确。</td></tr>"
else
  response.write vbcrlf&"<tr align=center valign=top><td>" & _
		 vbcrlf&"<table class=table2>" & _
		 vbcrlf&"<tr><td width=15></td><td></td></tr>"
  for i=0 to nnum+1
    if nsort=ndim(0,i) then
      response.write vbcrlf&"<tr><td align=center>"&img_admin("s_left_sort","")&"</td><td><a href='?nsort="&ndim(0,i)&"' class=red2>"&ndim(1,i)&tit_fir&"</a></td></tr>"
    else
      response.write vbcrlf&"<tr><td align=center>"&img_admin("s_nsort","")&"</td><td><a href='?nsort="&ndim(0,i)&"'>"&ndim(1,i)&tit_fir&"</a></td></tr>"
    end if
  next
  response.write vbcrlf&"</table>" & _
		 vbcrlf&"</td><td>"
  select case action
  case "delete"
    call joekoe_chk_delete()
  case "reply"
    call joekoe_chk_reply()
  case "clear"
    call joekoe_chk_clear()  
  case else
    call joekoe_chk_main()
  end select
  response.write vbcrlf&"</td></tr>"
end if

call joekoe_chk_erase()
call admin_ender(1)

sub joekoe_chk_delete()
  dim sel_type,seltype,sel_id,hdim,hnum,hid,hi,htype
  htype=1
  sel_type="删除"
  seltype="delete"
  if joekoe_cms.post_chk()=false or seltype="" then
    call admin_event("外部提交！！！",0,0)
    call joekoe_chk_main()
    exit sub
  end if
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
  for hi=0 to hnum
    hid=hdim(hi)
    if isnumeric(hid) then
      call joekoe_cms.exec("delete from "&data_name&" where rid="&hid,0)
    end if
  next
  erase hdim
  action=""
  call admin_event(sel_type&" "&(hnum+1)&"条（"&tit_fir&"）记录",0,0)
  call admin_msg("已成功（"&sel_type&"）操作了"&(hnum+1)&"条记录！","?nsort="&nsort,1)
end sub

sub joekoe_chk_clear()
  dim nnsort:nnsort=trim(request.querystring("nsort"))
  sql_add=" where esort='"&nnsort&"'"
  if nnsort="_all" then sql_add=" "
  sql="delete from err"&sql_add
  response.write ntit1
  call joekoe_cms.exec(sql,0)
  call admin_event("删除 "&ntit1&" 报错的记录",0,0) 
  call admin_msg("已成功删除了"&ntit1&"报错的记录！","?",1)
end sub

sub joekoe_chk_reply()
  dim reword,types,isread,eid,url,ebody,topic
  sql="select top 1 * from "&data_name&" where rid="&id
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?nsort="&nsort,1)
    exit sub
  end if
  reword=trim(Request.Form("reword"))
  if rs("esort")="flash" or rs("esort")="gall" or rs("esort")="film" or rs("esort")="web" then
  url="gallery_view.asp?types="&rs("esort")&"&id="&rs("eid")
  else
  url=rs("esort")&"_view.asp?action=view&id="&rs("eid")
  end if
  ebody=">感谢你对本站的支持：" & _
		vbcrlf&">你所报告的错误标题是："& rs("topic")& _
		vbcrlf
  if request.form("ischeck")="true" then
	ebody=ebody&vbcrlf&">本站已经修复所存在的错误，请再次访问！" & _
		vbcrlf& _
		vbcrlf&">修复后的地址为：" & _
		vbcrlf& joekoe_cms.web_urls&url & _
		vbcrlf
  end if
  ebody=ebody&vbcrlf&"以下是本站给您的附言：" & _
		vbcrlf&"--------------------------------------------------------" & _
		vbcrlf&reword
  types=1
  isread=0
  if chk() then 
     sql="insert into user_mail(send_u,accept_u,topic,word,tim,types,isread) " & _
	"values ('"&login_username&"','"&rs("eusername")&"','站内资源报错回复!','"&ebody&"','"&joekoe_cms.now_time&"',"&types&","&isread&")"
    call joekoe_cms.exec(sql,0)	 
       sql="select id from user_data where username='"&rs("eusername")&"'"
       set rs=joekoe_cms.exec(sql,1)
       application(joekoe_cms.web_cookies&"_"&rs(0))=rs(0)
       rs.close
    call admin_msg("成功回复了"&tit_fir&"（ID："&id&"）","?nsort="&nsort,1)
    exit sub
  end if
  call form_first()
%>
<table cellspacing=1 cellpadding=3 class=table0>
<form action='?nsort=<%response.write nsort%>&action=reply&id=<%response.write id%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td width='20%' class=td></td>
<td width='80%' class=td><%response.write tit_fir%>详细信息</td>
</tr>
<tr>
<td><%response.write tit_fir%>用户：</td>
<td><%response.write format_user_view(rs("eusername"),1,0)%></td>
</tr>
<tr>
<td>用户邮件：</td>
<td><a href='javascript:;' onclick=open_win('joekoe_mail.asp?user=<%response.write rs("email")%>','','510','335','no')><%response.write rs("email")%></a></td>
</tr>
<tr>
<td><%response.write tit_fir%>时间：</td>
<td><%response.write rs("etim")%></td>
</tr>
<tr>
<td>简短留言：</td>
<td><%response.write joekoe_cms.code_html(rs("eword"),1,0)%></td>
</tr>
<tr>
<td><%response.write tit_fir%>回复：<br><br>250字以内<br><br>(发到用户短信中)</td>
<td><textarea name=reword cols=50 rows=6>感谢你对本站的支持！你所报告的有关:已经修复，请访问！</textarea></td>
</tr>
<td>是否修正：</td>
<td><input name=ischeck type=checkbox  value=true checked><font class=gray>&nbsp;&nbsp;如错误已修正，请保持选择状态发消息，否则取消后发消息！</font></td>
</tr>
<%call submit_add()%>
</table>
<%
  rs.close
end sub

sub joekoe_chk_main()
  dim rid,eusername,eword,email,rtype,etim,eid,sqle,action
%>
<form name=sel_form action='?nsort=<%response.write nsort%>&action=delete' method=post>
<table cellspacing=1 cellpadding=3 class=table0>
<tr align=center>
<td class=td width='7%'>序号</td>
<td class=td width='55%'><%response.write tit_fir%>简短留言</td>
<td class=td width='13%'><%response.write tit_fir%>时间</td>
<td class=td width='20%'>操作</td>
<td class=td width='5%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
</tr>
<%
action=trim(request.QueryString("action"))
eid=trim(request.QueryString("id"))
  if nsort<>ndim(0,0) then
    sql_add=" where esort='"&nsort&"'"
    pageurl=pageurl&"nsort="&nsort&"&"
  end if
  
  if nsort<>ndim(0,0) and action="list" then
  sql_add=sql_add&" and eid="&eid
  end if
  	
  sql="select count(rid) from "&data_name&sql_add

  set rs=joekoe_cms.exec(sql,1)

  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from "&data_name&sql_add&" order by rid desc"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
    rid=rs("rid")
    eword=rs("eword")
    etim=rs("etim")
	eid=rs("eid")
%>
<tr align=center>
<td>
<%  
    if rs("esort")="scast" then
%>
<a href='<%response.write rs("esort")%>.asp?action=view&id=<%response.write eid%>' target=_blank><%response.write (viewpage-1)*nummer+i%></a></td>
<%  
    else
%>
<a href='<%response.write rs("esort")%>_view.asp?id=<%response.write eid%>' target=_blank><%response.write (viewpage-1)*nummer+i%></a></td>
<%
    end if
%>
<td align=left><%response.write joekoe_cms.code_html(eword,1,0)%></td>
<td><%response.write "<font class=tims alt='"&joekoe_cms.time_type(etim,2)&"'>"&joekoe_cms.time_type(etim,3)&"</font>"%></td>
<%if rs("esort")="flash" or rs("esort")="gall" or rs("esort")="film" or rs("esort")="web" then%>
<td><a href=admin_vouch_gallery.asp?jk_mod=&types=<%response.write rs("esort")%>&action=edit&id=<%response.write eid%>><%response.write img_admin("reply","处理此条"&tit_fir)%></a>
<%else%>
<td><a href=admin_<%response.write joekoe_is_nsort_index(rs("esort"))%>.asp?jk_mod=&action=edit&id=<%response.write eid%>><%response.write img_admin("reply","处理此条"&tit_fir)%></a>
<%end if%>
<%if rs("esort")="flash" or rs("esort")="gall" or rs("esort")="film" or rs("esort")="web"  then%>
&nbsp;<a href=gallery_view.asp?&types=<%response.write rs("esort")%>&id=<%response.write eid%> target=_blank><%response.write img_admin("edit","查看此条"&tit_fir&"的前台信息")%></a>
<%else%>
&nbsp;<a href='<%response.write joekoe_is_nsort_index(rs("esort"))%>_view.asp?id=<%response.write eid%>' target=_blank><%response.write img_admin("edit","查看此条"&tit_fir&"的前台信息")%></a>
<%end if%>
&nbsp;<a href='?nsort=<%response.write rs("esort")%>&action=list&id=<%response.write eid%>'><%response.write img_admin("istop","归类此条"&tit_fir)%></a>
&nbsp;<a href='?nsort=<%response.write nsort%>&action=reply&id=<%response.write rid%>'><%response.write img_admin("sys","查看用户信息"&tit_fir)%></a>
</td>
<td><input type=checkbox name=sel_id value='<%response.write rid%>'></td>
</tr>
<%
  rs.movenext
  next
  rs.close
%>
<tr class=tr1>
<td colspan=2>
现有<font class=red><%response.write rssum%></font>篇<%response.write tit_fir%>，
页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>
分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
</td>
<td colspan=3 align=center>
执行
<select name=sel_type size=1>
<option value='删除'>删除</option>
</select>
<input type=submit value='操作' onclick="return sel_click(this.form);">
</td>
</tr>
</table>
</form>
<%
end sub

function joekoe_is_nsort_index(nsort)
  dim ti
  select case nsort
  case "mdisk"
    joekoe_is_nsort_index="music_disk"
    exit function
  case "msing"
    joekoe_is_nsort_index="music_singer"
    exit function
  case "video"
    joekoe_is_nsort_index="video"
    exit function
  case "down"
    joekoe_is_nsort_index="down"
    exit function
  case "art"
    joekoe_is_nsort_index="article"
    exit function
  case "shop"
    joekoe_is_nsort_index="shop_product"
    exit function			
  case "flash","film"
    joekoe_is_nsort_index="gallery"
    exit function
  case "scast"
    joekoe_is_nsort_index="shop_product"
    exit function  
  end select

end function

sub joekoe_chk_dim()
  dim tmpsort
  tmpsort=trim(request.querystring("nsort"))
  nnum=-1
  sql="select m_nsort,m_tit_fir,m_index_url from admin_menu where m_is_master=1 and m_is_err=1 order by m_id"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if not rs.eof then
    nnum=rs.recordcount-1
    redim ndim(2,nnum+1)
    ndim(0,0)="_all"
    ndim(1,0)="所有"
    for i=1 to nnum+1
      ndim(0,i)=rs(0)
      ndim(1,i)=rs(1)
      ndim(2,i)=rs(2)
      if tmpsort=ndim(0,i) then
        nsort=tmpsort
        ntit=ndim(1,i)
      end if
      rs.movenext
    next
    if nsort="" then
      nsort=ndim(0,0)
      ntit=ndim(1,0)
    end if
    ntit1=ntit
    ntit=ntit&tit_fir
  end if
  rs.close
end sub

sub joekoe_chk_erase()
  if isarray(ndim) then erase ndim
end sub
%>



