<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/ex_stock/ex_sm_conn.asp"-->
<!--#include file="inc/ex_stock/ex_sm_const.asp"-->
<%
dim page
dim username,closedatabase
dim currentpage,page_count,totalrec,pcount
select case request("action")
	case "glance"
		call glance()
	case else
		call main()
end select
sub main()
	exsm.title 1,"即时消息"
%>
	<table class="tableborder1" cellspacing="1" cellpadding="3" align="center">
	<tr>
		<th colspan="3" height="25" id="tabletitlelink"><a href="?"><b>浏览新闻</b></a> | <a href="?action=glance"><b>浏览公告</b></a> | <a href="ex_sm_index.asp"><b>返回股市</b></a></th>
	</tr>
	</table>
	<table class="tableborder1" align="center" cellspacing="1" cellpadding="3"><br>
		<tr>
			<th width="35">id</th>
			<th>公告内容</th>
			<th width="160">发布时间</th>
		</tr>
<%
		sql="select id,color,content,addtime from ex_news order by id desc"
		set rs=stock_conn.execute(sql)
		if rs.eof and rs.bof then
			response.write "<tr><td class=""tablebody1"" colspan=""3"">当前没有新闻</td></tr></table>"
		end if
		currentpage=request("page")
		if currentpage="" or not isnumeric(currentpage) then currentpage=1
		set rs= server.createobject("adodb.recordset")
		rs.open sql,stock_conn,1,1
		if rs.eof and rs.bof then
		else
			rs.pagesize=cint(exsm.setting_info(16))
			totalrec=rs.recordcount
			if cdbl(currentpage)>=totalrec\cdbl(rs.pagesize)+1 then
				currentpage=totalrec\cdbl(rs.pagesize)+1
			else
				currentpage=cdbl(currentpage)
			end if
			if clng(currentpage)<1 then currentpage=1
			rs.absolutepage=currentpage
			page_count=0
			do while (not rs.eof) and (not page_count = rs.pagesize)
				response.write "<tr><td class=""tablebody1"" align=""center"">"&rs(0)&"</td><td class=""tablebody1"" align=""left""><font color="""&rs(1)&""">★&nbsp;"&exsm.ubbcode(rs(2))&"</font></td><td class=""tablebody1"" align=""center""><font color=""maroon"">"&rs(3)&"</font></td></tr>"%>
<%			page_count = page_count + 1
			rs.movenext
			loop
			pcount=rs.pagecount
		response.write "</table>"
		call exsm.disppagenum(totalrec,page_count,currentpage,pcount,"?page=","?")
	end if
	rs.close
	set rs=nothing
	exsm.rootshow
end sub
sub glance()
	exsm.title 1,"股市公告"
%>
	<table class="tableborder1" cellspacing="1" cellpadding="3" align="center">
	<tr>
		<th colspan="2" height="25" id="tabletitlelink"><a href="?"><b>浏览新闻</b></a> | <a href="?action=glance"><b>浏览公告</b></a> | <a href="ex_sm_index.asp"><b>返回股市</b></a></th>
	</tr>
	</table>
	<table class="tableborder1" align="center" cellspacing="1" cellpadding="3"><br>
<%
		sql="select title,content,color,addtime,username from ex_announcement order by id desc"
		set rs=stock_conn.execute(sql)
		if rs.eof and rs.bof then
			response.write "<tr><td colspan=""1"" class=""tablebody1"">当前没有公告</td></tr></table>"
		end if
		currentpage=request("page")
		if currentpage="" or not isnumeric(currentpage) then currentpage=1
		set rs= server.createobject("adodb.recordset")
		rs.open sql,stock_conn,1,1
		if rs.eof and rs.bof then
		else
			rs.pagesize=cint(exsm.setting_info(15))
			totalrec=rs.recordcount
			if cdbl(currentpage)>=totalrec\cdbl(rs.pagesize)+1 then
				currentpage=totalrec\cdbl(rs.pagesize)+1
			else
				currentpage=cdbl(currentpage)
			end if
			if clng(currentpage)<1 then currentpage=1
			rs.absolutepage=currentpage
			page_count=0
			do while (not rs.eof) and (not page_count = rs.pagesize)
%>
		<tr>
			<th colspan="2">-=> <%=rs("title")%> <=-</th>
		</tr>
		<tr>
			<td class="tablebody1" colspan="2" valign="top">
			<br><blockquote><p><%=exsm.htmlencode(rs("content"))%></p></blockquote>
			</td>
		</tr>
		<tr>
			<td colspan="1" class="tablebody2">&nbsp;<b>发布人</b>：<%=exsm.ubbcode(rs("username"))%></td>
			<td colspan="1" class="tablebody2" align="right"><b>发布时间</b>： <%=rs("addtime")%>&nbsp;</td>
		</tr>
<%
		page_count = page_count + 1
		rs.movenext
		loop
		pcount=rs.pagecount
		response.write "</table>"
		call exsm.disppagenum(totalrec,page_count,currentpage,pcount,"?action=glance&page=","?action=glance")
	end if
	rs.close
	set rs=nothing
	exsm.rootshow
end sub
%>