<!-- #include file="config.asp" -->
<!-- #include file="config_nsort.asp" -->
<!-- #include file="skin.asp" -->
<%
dim ispic,topic,nid,sqladd,oid
oid=0
index_url="news":n_sort="news"
tit_fir=objv7.format_menu(web_menu,index_url)

sub news_sea()
  dim temp1,nid,nid2,rs,sql,rs2,sql2
  temp1=vbcrlf&"<table border=0 cellspacing=0 cellpadding=0 align=center>" & _
        vbcrlf&"<script language=javascript><!--" & _
        vbcrlf&"function news_sea()" & _
        vbcrlf&"{" & _
        vbcrlf&"  if (news_sea_frm.keyword.value==""请输入关键字"")" & _
        vbcrlf&"  {" & _
        vbcrlf&"    alert(""请在搜索新闻前先输入要查询的 关键字 ！"");" & _
        vbcrlf&"    news_sea_frm.keyword.focus();" & _
        vbcrlf&"    return false;" & _
        vbcrlf&"  }" & _
        vbcrlf&"}" & _
        vbcrlf&"--></script>" & _
        vbcrlf&"<form name=news_sea_frm action='news_list.asp' method=get onsubmit=""return news_sea()"">" & _
        vbcrlf&"<input type=hidden name=action value='more'><tr><td height=3></td></tr>" & _
        vbcrlf&"<tr><td>" & _
        vbcrlf&"  <table border=0><tr>" & _
        vbcrlf&"  <td><select name=sea_type sizs=1><option value='topic'>新闻标题</option><option value='username'>发布人</option></seelct></td>" & _
        vbcrlf&"  <td><input type=text name=keyword value='请输入关键字' onfocus=""if (value =='请输入关键字'){value =''}"" onblur=""if (value ==''){value='请输入关键字'}"" size=12 maxlength=20></td>" & _
        vbcrlf&"  </tr></table>" & _
        vbcrlf&"</td></tr><tr><td>" & _
        vbcrlf&"  <table border=0><tr>" & _
        vbcrlf&"  <td><script language=javascript src='style/select_news.js'></script></td>" & _
        vbcrlf&"  <td><input type=image src='images/small/search_go.gif' border=0></td>" & _
        vbcrlf&"  </tr></table>" & _
        vbcrlf&"</td></tr>" & _
        vbcrlf&"</form><tr><td height=1></td></tr></table>"
  response.write kong&main_bar(0,"新闻搜索",temp1,0,"100%","")
end sub

sub news_new_hot(nt,nsql,n_num,c_num)
  dim htemp,tim,cnum,nhead,n_jt
  n_jt=img_skins()
  htemp=vbcrlf&"<table border=0 width='100%' cellspacing=0 cellpadding=2 class=tf>"
  sql="select top "&n_num&" id,username,topic,tim,counter,ispic from news where hidden=1"
  if nt="top" then sql=sql&" and istop=1"
  sql=sql&nsql&" order by "
  select case nt
  case "hot"
    sql=sql&"counter desc,"
    nhead="热门新闻"
  case "top"
    sql=sql&"istop desc,"
    nhead="推荐新闻"
  case else
    nhead="近期更新"
  end select
  sql=sql&"id desc"
  set rs=conn.execute(sql)
  do while not rs.eof
    cnum=c_num:ispic="":topic=rs("topic"):tim=rs("tim")
    if rs("ispic")=true then cnum=cnum-2:ispic=sk_img
    htemp=htemp&vbcrlf&"<tr><td height="&space_mod&">"&n_jt&"<a href='javascript:;' onclick=""javascript:open_view('news_view.asp?id="&rs("id")&"',1);"" title='新闻标题："&objv7.code_html(topic,1,0)&"<br>发 布 人："&rs("username")&"<br>浏览人次："&rs("counter")&"<br>整理时间："&objv7.time_type(tim,88)&"'>"&objv7.code_html(topic,1,cnum)&"</a>"&ispic
    htemp=htemp&"</td></tr>"
    rs.movenext
  loop
  rs.close
  htemp=htemp&vbcrlf&"</table>"
  response.write kong&main_bar(0,nhead,htemp,0,"100%","")
end sub

sub news_pic(n_num,c_num,pc)
  dim temp1,nid
  sql="select top "&n_num&" id,topic,pic from news where hidden=1 and ispic=1 and id<>"&oid&" order by id desc"
  set rs=conn.execute(sql)
  do while not rs.eof
    topic=rs("topic"):nid=rs("id")
    temp1=temp1&vbcrlf&"<td><table border=0><tr><td align=center><a href='javascript:;' onclick=""javascript:open_view('news_view.asp?id="&nid&"');""><script language=javascript>pic_url('"&rs("pic")&"',1)</script></a></td></tr>" & _
	  vbcrlf&"<tr><td align=center height=25><a href='javascript:;' onclick=""javascript:open_view('news_view.asp?id="&nid&"');"" class=red_3><b>"&objv7.code_html(topic,1,c_num)&"</b></a></td></tr></table></td>"
    rs.movenext
  loop
  temp1="<table border=0 width='100%' cellspacing=2 cellpadding=0><tr><td height=3></td></tr><tr align=center>"&temp1&"</tr></table>"
  response.write kong&main_bar(0,"图片新闻",temp1,0,"100%","")
end sub

sub news_main(n_num,c_num)
  dim ccid,ccname,sqla,crs,csql,nn,temp1,tim,cnum:nn=0
  csql="select c_id,c_name from jk_class where nsort='"&n_sort&"' order by c_order"
  set crs=conn.execute(csql)
  do while not crs.eof
    temp1="<table border=0 width='100%'><tr><td width='92%' height=1></td><td width='8%'></td></tr>"
    ccid=crs("c_id"):ccname=crs("c_name"):sqla=" and c_id="&ccid
    sql="select top "&n_num&" id,topic,tim,username,counter,ispic from news where hidden=1 and c_id="&ccid&" order by id desc"
    set rs=conn.execute(sql)
    do while not rs.eof
      cnum=c_num:ispic="":topic=rs("topic"):tim=rs("tim")
      if rs("ispic")=true then cnum=cnum-2:ispic=sk_img
      temp1=temp1&vbcrlf&"<tr><td height="&space_mod&">"&img_skins()&"<a href='javascript:;' onclick=""javascript:open_view('news_view.asp?id="&rs("id")&"',1);"" title='新闻标题："&objv7.code_html(topic,1,0)&"<br>发 布 人："&rs("username")&"<br>浏览人次："&rs("counter")&"<br>整理时间："&objv7.time_type(tim,88)&"'>"&objv7.code_html(topic,1,cnum)&"</a>"&ispic&"</td><td class=gray align=right>"&objv7.time_type(tim,1)&"</td></tr>"
      rs.movenext
    loop
    rs.close
    temp1=temp1&vbcrlf&"</table>"
    response.write kong&main_bar(1,ccname,temp1,1,"100%","<a href='news_list.asp?c_id="&ccid&"'>"&morepic&"</a>")
    crs.movenext
  loop
  crs.close:set crs=nothing
end sub

sub news_more(c_num)
  dim temp1,tim,cnum,sql2,mhead,cname,sname
  pageurl="?action=more&"
  keyword=objv7.code_form(request.querystring("keyword"))
  sea_type=trim(request.querystring("sea_type"))
  if sea_type<>"username" then sea_type="topic"
  call cid_sid_sql(2,sea_type)
  
  temp1="<table border=0 width='100%'><tr><td height=1 width='5%'></td><td width='77%'></td><td wdith='18%'></td></tr>"
  sql="select id,topic,tim,username,counter,ispic from news where hidden=1"&sqladd
  if cid>0 then
    sql=sql&" and c_id="&cid
    if sid>0 then
      sql=sql&" and s_id="&sid
      sql2="select jk_class.c_name,jk_sort.s_name from jk_sort inner join jk_class on jk_sort.c_id=jk_class.c_id where jk_sort.c_id="&cid&" and jk_sort.s_id="&sid
    else
      sql2="select c_name from jk_class where c_id="&cid
    end if
  end if
  sql=sql&" order by id desc"
  
  cname="搜索结果":sname=""
  if len(sql2)>1 then
    set rs=conn.execute(sql2)
    if rs.eof and rs.bof then
      rs.close
      call news_main(16,20,1,6,33,2,10,1)
      exit sub
    end if
    cname=rs("c_name")
    if sid>0 then sname=rs("s_name")
    rs.close
  end if
  mhead=cname
  if sid>0 and sname<>"" then mhead=mhead&"&nbsp;→&nbsp;"&sname&""
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,1,1
  if rs.eof and rs.bof then
    rssum=0
  else
    rssum=rs.recordcount
  end if
  call format_pagecute()
  if int(viewpage)>1 then
    rs.move (viewpage-1)*nummer
  end if
  for i=1 to nummer
    if rs.eof then exit for
    cnum=c_num:ispic="":topic=rs("topic"):tim=rs("tim")
    if rs("ispic")=true then cnum=cnum-2:ispic=sk_img
    temp1=temp1&vbcrlf&"<tr><td height="&space_mod&">"&i+(viewpage-1)*nummer&".</td><td><a href='javascript:;' onclick=""javascript:open_view('news_view.asp?id="&rs("id")&"',1);"" title='新闻标题："&objv7.code_html(topic,1,0)&"<br>发 布 人："&rs("username")&"<br>浏览人次："&rs("counter")&"<br>整理时间："&objv7.time_type(tim,88)&"'>"&objv7.code_html(topic,1,cnum)&"</a>"&ispic&"</td><td class=gray align=right>"&objv7.time_type(tim,1)&"</td></tr>"
    rs.movenext
  next
  rs.close
  temp1=temp1&vbcrlf&"</table>"
  response.write kong&main_bar(1,mhead,temp1,1,"100%","<a href='news_list.asp?c_id="&cid&"&s_id="&sid&"&action=more'>"&morepic&"</a>")
%>
<table border=0 width='100%' align=center>
<tr><td align=center><table border=0 width='100%'><tr><td height=1 background='images/bg_dian.gif'></td></tr></table></td></tr>
<tr class=tdbg-dark><td>&nbsp;
本栏共有&nbsp;<font class=time><%response.write rssum%></font>&nbsp;条新闻&nbsp;
页次：<font class=time><%response.write viewpage%></font>/<font class=time><%response.write thepages%></font>&nbsp;
分页：<%response.write objv7.jk_pagecute(nummer,thepages,viewpage,pageurl,8,"#ff0000")%>
</td></tr>
</table>
<%
end sub

sub news_list(n_num,c_num)
  dim ssid,ssname,sqla,srs,ssql,nn,temp1,tim,cnum:nn=0
  ssql="select s_id,s_name from jk_sort where c_id="&cid
  if sid<>0 then ssql=ssql&" and s_id="&sid
  ssql=ssql&" order by s_order"
  set srs=conn.execute(ssql)
  do while not srs.eof
    temp1="<table border=0 width='100%'><tr><td height=1></td><td wdith=50></td></tr>"
    ssid=srs("s_id"):ssname=srs("s_name"):sqla=" and c_id="&cid&" and s_id="&ssid
    sql="select top "&n_num&" id,topic,tim,username,counter,ispic from news where hidden=1 and c_id="&cid&" and s_id="&ssid&" order by id desc"
    set rs=conn.execute(sql)
    do while not rs.eof
      cnum=c_num:ispic="":topic=rs("topic"):tim=rs("tim")
      if rs("ispic")=true then cnum=cnum-2:ispic=sk_img
      temp1=temp1&vbcrlf&"<tr><td height="&space_mod&">"&img_skins()&"<a href='news_view.asp?id="&rs("id")&"' title='新闻标题："&objv7.code_html(topic,1,0)&"<br>发 布 人："&rs("username")&"<br>浏览人次："&rs("counter")&"<br>整理时间："&objv7.time_type(tim,88)&"'>"&objv7.code_html(topic,1,cnum)&"</a>"&ispic&"</td><td class=gray align=right>"&objv7.time_type(tim,1)&"</td></tr>"
      rs.movenext
    loop
    rs.close
    temp1=temp1&vbcrlf&"</table>"
    response.write vbcrlf&"<table border=0 width='100%' cellspacing=0 cellpadding=0><tr><td>"
    response.write kong&main_bar(1,ssname,temp1,1,"100%","<a href='news_list.asp?c_id="&cid&"&s_id="&ssid&"&action=more'>"&morepic&"</a>")
    response.write vbcrlf&"</td></tr></table>"
    srs.movenext
  loop
  srs.close:set srs=nothing
end sub
%>