<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0
%>
<!-- #include file="./dsnroot.asp" -->
<!-- #include file="./links.asp" -->
<%
set cn=Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset")
set rs1=Server.CreateObject("ADODB.Recordset")
cn.Open mycnstr
xx=1
menu="0000100"
classid=Request.QueryString ("classid")
pageno=Request.QueryString ("pageno")
mode=Request.QueryString ("mode")
work=Request.QueryString ("work")
if classid="" then
		classid=0
	else
		classid=cint(classid)
end if		
if work="" then
		work=0
	else
		work=cint(work)
end if		
if classid=0 then
	sqltext="select id from bbs_class where enable=1 order by pl"
	rs.Open sqltext,cn,1,1
	if not rs.EOF then
		classid=rs("id")
	end if
	rs.Close 
end if
if classid<>0 then
	sqltext="select id,flag from bbs_class where enable=1 and id="&classid
	rs.Open sqltext,cn,1,1
	if not rs.EOF then
		flag=rs("flag")
	end if
	rs.Close 
end if
if flag=1 then
	if session("userflag")<>1 then
		err=1
	end if
end if
if session("userflag")=1 and session("username")<>"" then
	sqltext="select flag from userls where enable=1 and username='"+session("username")+"' and flag=1"
	rs.Open sqltext,cn,1,1
	if not rs.EOF then
		adminqx=1
	else
		adminqx=0	
	end if
	rs.Close 
elseif session("adminusername")<>"" then
	adminqx=1
else	
	adminqx=0
end if
if Request.ServerVariables("REQUEST_METHOD")="POST" and mode="999"and adminqx=1 then
		if not isempty(request("sel")) then
     		idlist=request("sel")
     		if instr(idlist,",")>0 then
				dim idarr
				idArr=split(idlist)
				for i = 0 to ubound(idarr)
	       			delid=clng(idarr(i))
	       			call setupdate(delid,mode)
				next
			else
				delid=clng(idlist)
				call setupdate(delid,mode)
			end if	
		end if
		delid=0
		Response.Redirect "forum.asp?classid="&classid&"&work=1"
end if
  sub setupdate(id,mm)
    if mm="999" then
		sqltext3="delete from bbs where id="&id&" or pid="&id
		cn.Execute sqltext3	
	end if	
  end sub  
%>
<!-- #include file="./func.inc" -->
<!-- #include file="./begin.asp" -->
      <table width="778" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="170" bgcolor="#079C07" valign="top" align="center"> 
			<!-- #include file="./bbs_left.asp" -->
          </td>
          <td bgcolor="#FFFFEC" valign="top" align="center" height="400"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="right" height="70">&nbsp;</td>
              </tr>
            </table>
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="20" height="24">&nbsp;</td>
                <%sqltext="select id,title from bbs_class where enable=1 order by pl"
                  rs.Open sqltext,cn,1,1
                  do while not rs.EOF 
                %>
                <td width="89"> 
                  <table width="88" border="0" cellspacing="0" cellpadding="0" height="24">
                    <tr>
                      <%if classid=rs("id") then%>
							<td background="images/forum/bt_over_forum.gif" align="center"><a href="forum.asp?classid=<%=rs("id")%>" class="a01"><%=trim(rs("title"))%></a></td>
						<%else%>
							<td background="images/forum/bt_out_forum.gif" align="center"><a href="forum.asp?classid=<%=rs("id")%>" class="a02"><%=trim(rs("title"))%></a></td>	
					  <%end if%>		
                    </tr>
                  </table>
                </td>
                <%rs.MoveNext 
                  loop
                  rs.Close 
                %>
                <%if err<>1 then%>
						<td align="right"><a href="forum_write.asp?classid=<%=classid%>" class="a12">[发表话题]</a></td>
					<%else%>	
						<td align="right">&nbsp;</td>
				<%end if%>		
              </tr>
            </table>
          
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
             <form action="#" method=post name="listform">
              <tr>
                <td height="22" bgcolor="#B78900" align="center"><font color="#FFFFFF"><b>主题</b></font></td>
                <td width="1"></td>
                <td width="150" bgcolor="#B78900" align="center"><font color="#FFFFFF"><b>发表者</b></font></td>
                <td width="1"></td>
                <td width="50" bgcolor="#B78900" align="center"><font color="#FFFFFF"><b>阅读</b></font></td>
                <td width="1"></td>
                <td width="50" bgcolor="#B78900" align="center"><font color="#FFFFFF"><b>回复</b></font></td>
              </tr>
            </table>
           <%if err<>1 then%>
           <%if work<>1 then%>  
           <%sqltext="select * from bbs where classid="&classid&" and enable=1 and pid=0"+qtxt+" order by upupdate desc,creatdate desc"
            'Response.Write sqltext
              rs.Open sqltext,cn,1,1
              listcs=15
			  rs.PageSize=listcs
			  if pageno="" then 
					pageno=1
				else
					pageno=cint(pageno)	
			  end if	
			  m=0
			  if rs.PageCount>0 then rs.AbsolutePage=pageno
              do while not rs.EOF and m<listcs
					if rs("userflag")=0 then
							tabname="userbase"
						else	
							tabname="userls"
					end if		
            %>
             <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr> 
                <%if adminqx=1 then%>
             	<td width="15" align="center">
				  <input type="checkbox" name="sel" value="<%=rs("id")%>">
				</td>
				<%end if%>
                <td class="font2" height="22" valign="bottom">&nbsp;<font color="#996600">☆</font><a href="forum_details.asp?id=<%=rs("id")%>" class="a02"><%=server.HTMLEncode(trim(rs("title")))%></a>
                </td>
                <td class="font2" width="150" align="center" valign="bottom"><a href="Javascript:userinfo('<%=trim(rs("username"))%>','<%=rs("userflag")%>')" class="a02"><%=server.HTMLEncode(trim(rs("username")))%>
                <%if rs("userflag")=1 then Response.Write "&nbsp;(皖宝员工)"%>
                </a></td>
                <td width="50" class="font2" align="center" valign="bottom"><%=rs("count")%></td>
                <td width="50" class="font2" align="center" valign="bottom"><%=rs("relcount")%></td>
              </tr>
            </table>
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td background="images/company/point_line.gif" height="1"></td>
              </tr>
            </table>
           <%rs.MoveNext 
             m=m+1
             i=i+1
             loop
           %>
            </form>
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="22">&nbsp;</td>
              </tr>
              <%if adminqx=1 then%>
				<td align="right"><a href="javascript:delrows()" class="anews2"><font color="#000000">删除选中记录</font></a>&nbsp;&nbsp;</td>
			  <%end if%>	
            </table>
           <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#CC9933">
              <tr>
                <td height="22">&nbsp;<font color="#FFFFFF">[第<b><%=pageno%></b>页, 共<b><%=rs.PageCount%></b>页<b><%=rs.RecordCount%></b>条记录]</td>
                <td align="right" class="font1">
                 <%if pageno>1 then%>
						<a href="forum.asp?pageno=<%=pageno-1%>&classid=<%=classid%>" class="anews2"><font color="#555555"><< 上一页</font></a>&nbsp;&nbsp;
				 <%end if%>
				 <%if pageno<rs.PageCount then%>
						<a href="<%=linkforum%>?pageno=<%=pageno+1%>&classid=<%=classid%>" class="anews2"><font color="#555555">下一页 >></font></a>
				 <%end if%>
				 <%rs.Close %>
                </td>
              </tr>
              </form>
            </table>  
          <%else%>  
          	<table width="95%" border="0" cellspacing="0" cellpadding="0">
          	  <tr><td height=20 height="50"><br>
				   <font face=webdings color=fe8c14>4</font>&nbsp;操作成功     <a href="forum.asp?classid=<%=classid%>" class=anews2 target=_top><font color="#ff6600">返回论坛</font>
			  </td></tr>
			</table>  
		  <%end if%>	
           <%else%>
           <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align=center><br><font color=red>本版面为内部员工交流区，您无权限进入！</font></td>
              </tr>
            </table>
          <%end if%>  
            <table width="95%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
<!-- #include file="./end.asp" -->
	<script language="Javascript">
    function delrows()
    {
        if (confirm('您确认要删除你所选中的项目吗？')==true)
        {        
        document.listform.action="forum.asp?mode=999&classid=<%=classid%>";
        document.listform.submit();
        }
    }
   </script> 