<!-- #include file="config.asp" -->
<!-- #include file="skin.asp" -->
<%
dim forum_mode,ptnums,etim
dim classid,classname,forumf,forumn,forumw,forumid,viewid,forumname,forumpower,forumtype,forumtopicnum,forumdatanum
forumid=trim(request.querystring("forum_id"))
viewid=trim(request.querystring("view_id"))

sk_jt="fk4"
index_url="forum"
tit_fir=objv7.format_menu(web_menu,index_url)
ptnums=objv7.web_var_num(web_setup,6,1)
etim=int(objv7.web_var(web_num,13))

'-------------------------------------初始化 1--------------------------------------
sub forum_first()
  sql="select bbs_class.class_name,bbs_forum.class_id,bbs_forum.forum_f,bbs_forum.forum_n,bbs_forum.forum_w,bbs_forum.forum_name,bbs_forum.forum_power,bbs_forum.forum_topic_num,bbs_forum.forum_data_num,bbs_forum.forum_type " & _
      "from bbs_class inner join bbs_forum on bbs_forum.class_id=bbs_class.class_id where bbs_forum.forum_id="&forumid&" and bbs_forum.forum_hidden=0"
  set rs=conn.execute(sql)
  if rs.eof and rs.bof then
    rs.close:set rs=nothing
    call close_conn()
    call cookies_type("forum_id")
  end if
  classid=rs("class_id"):classname=rs("class_name")
  forumf=int(rs("forum_f")):forumn=int(rs("forum_n")):forumw=rs("forum_w")
  forumname=rs("forum_name"):forumpower=rs("forum_power")
  forumtopicnum=rs("forum_topic_num"):forumdatanum=rs("forum_data_num"):forumtype=rs("forum_type")
  rs.close
  page_power=format_forum_type(forumtype,0)
end sub

'-------------------------------------论坛标头--------------------------------------
function forum_top(ft)
  forum_top=vbcrlf & "<table border=0 width='100%' class=tdbg-dark>" & _
	    vbcrlf & "<tr>" & _
	    vbcrlf & "<td><a href='forum_write.asp?forum_id="&forumid&"'><img src='images/"&objv7.web_var(web_config,5)&"/new_topic.gif' align=absMiddle border=0 title='在 "&forumname&" 里发表我的新贴'></a>&nbsp;&nbsp;" & _
	    vbcrlf & ft&"</td>" & _
	    vbcrlf & "<td align=right>"&forum_power(forumpower,ptnums)&"&nbsp;" & _
	    vbcrlf & "<font class=gray>[ <a href='forum_list.asp?forum_id="&forumid&"&action=isgood'>本版精华</a> ]&nbsp;" & _
	    vbcrlf & "[ <a href='forum_list.asp?forum_id="&forumid&"&action=manage'>版面管理</a> ]</font></td>" & _
	    vbcrlf & "</tr></table>" & _
	    web_right()&web_left(2)&kong	'分屏
end function

'-------------------------------------论坛分级--------------------------------------
sub forum_grade()
  dim sql,rs,fo
  call forum_grade_board(forumf,fo)
  response.write kong&"<table width='100%' border=0 cellpadding=0 cellspacing=0 class=tdbg-dark>" & _
		 vbcrlf&"<tr><td height=25><table border=0 width='99%' align=center cellpadding=1 cellspacing=2><tr align=left><td width='100%'>"&img_skins()&"<a href='forum.asp'>"&tit_fir&"</a>&nbsp;→&nbsp;<font class=hit>"&objv7.code_html(classname,1,0)&"</font>"&fo&"&nbsp;→&nbsp;<a href='forum_list.asp?forum_id="&forumid&"'>"&objv7.code_html(forumname,1,0)&"</a></td></tr></table></td></tr>" & _
		 vbcrlf&"</table>"
end sub

sub forum_grade_board(fid,fo)
  if int(fid)<1 then exit sub
  dim sql,rs,f_f,fname:f_f=0
  sql="select forum_f,forum_name from bbs_forum where forum_id="&fid
  set rs=conn.execute(sql)
  if not(rs.eof and rs.bof) then f_f=int(rs(0)):fname=rs(1)
  rs.close:set rs=nothing
  fo="&nbsp;→&nbsp;<a href='forum_list.asp?forum_id="&fid&"'>"&objv7.code_html(fname,1,0)&"</a>"&fo
  if int(f_f)>0 then call forum_grade_board(f_f,fo)
end sub

'-------------------------------------论坛版主--------------------------------------
function forum_power(forum_admin,ft)
  dim forumadmin,k
  forum_power="<img src='images/small/forum_power.gif' title='论坛版主' align=absmiddle border=0>&nbsp;"
  if ft=0 then forum_power=forum_power&"<select onchange=""if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}""><option>本版版主</option><option>--------</option>"
  if forum_admin<>"" and not isnull(forum_admin) then
    forumadmin=split(forum_admin, "|")
    for k=0 to ubound(forumadmin)
      if ft=0 then
        forum_power=forum_power&"<option value='user_view.asp?username=" & server.urlencode(forumadmin(k)) & "'>"&forumadmin(k)&"</option>"
      else
        forum_power=forum_power & "<a href='user_view.asp?username=" & server.urlencode(forumadmin(k)) & "' title='查看（版主）" & forumadmin(k) & " 的详细资料' target=_blank>" & forumadmin(k) & "</a>&nbsp;"
      end if
    next
    erase forumadmin
  else
    if ft=0 then
      forum_power=forum_power&"<option>还没呢</option>"
    else
      forum_power=forum_power & "<font class=gray>还没呢&nbsp;</font>"
    end if
  end if
  if ft=0 then forum_power=forum_power&"</select>"
end function

'-------------------------------------论坛等级--------------------------------------
function format_forum_type(fvars,ft)
  dim fdim,fvar:fvar=fvars-1:format_forum_type=""
  fdim=split(forum_type,"|")
  for i=0 to ubound(fdim)
    if ft=0 then
      if fvar=i then format_forum_type=left(fdim(i),instr(fdim(i),":")-1):exit for
    else
      if fvar=i then format_forum_type=right(fdim(i),len(fdim(i))-instr(fdim(i),":")):exit for
    end if
  next
  erase fdim
end function

'-------------------------------------数据生成--------------------------------------
dim word_size,word_remark
sub forum_word()
  word_size=objv7.web_var(web_num,6)
  word_remark=objv7.web_var(web_error,3)&"<br>长度<="&word_size&"KB"
end sub

function user_view_sex(us,utim)
  dim a,b,t:a="0":b="离线了"
  t=DateDiff("n",utim,now)
  if int(t)<=int(etim) then a="":b="在线哦！有人找吗？"
  if us=false then
    user_view_sex="<img src='images/small/forum_girl"&a&".gif' align=absmiddle title='青春女孩，"&b&"' border=0>":exit function
  else
    user_view_sex="<img src='images/small/forum_boy"&a&".gif' align=absmiddle title='阳光男孩，"&b&"' border=0>":exit function
  end if
end function
%>