<!-- whilvydy news release system -->

<%@ page contentType="text/html; charset=GB2312" language="java" import="java.sql.*" %>
<%@ page import="java.io.*" %> 
<%@ page import="java.util.*" %>
<%@ include file = "function/parameter.jsp" %>

<jsp:useBean id="index_man" scope="page" class="net.jspcn.db.DbConnect" />
<jsp:useBean id='StrTool' scope='page' class='net.jspcn.tool.StringProcess' />
<jsp:useBean id="counter" class="net.jspcn.util.counter" scope="request" />

<%
///////////////////////// the varity init */
int intDisplay,newslength;
int giveType_id = 2;
intDisplay = param[0];
newslength = param[1];
String htmltitle;
htmltitle = msg[0];

index_man.openConnection();
String sql,sql1,userWealth;
userWealth="";
ResultSet rs,rs1;


//String cont=counter.ReadFile(msg[1]+"count.txt");
//counter.WriteFile(msg[1]+"count.txt",cont);

///////////////////* 得到横目录
String[] vtitle = new String[10];
String[] vlink = new String[10];
int vtitle_count = 0;
sql = "select * from "+type_table+" where type_audit=1 and type_id<>1";
rs = index_man.executeQuery(sql);

while(rs.next()) {
	vtitle[vtitle_count] = rs.getString("type_name");
	vlink[vtitle_count] = rs.getString("type_id");
	vtitle_count++;
}

///////////////////变量定义
String type_name,board_name;
int type_id,board_id;


/////////////////////初始化页面参数值
if(request.getParameter("type_id")==null)	
	type_id =giveType_id;
else
	type_id = Integer.parseInt(request.getParameter("type_id"));
%>

<%@ include file = "function/header1.jsp" %>
中文网
<%@ include file = "function/header2.jsp" %>


<!-- this table is used to display the content -->
<table width="760" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
	<tr> 
      		<td width="13%" height="207" valign="top"> 

	
	
<!----- 中左board级目录 和 搜索 --- -->
		<table width="98%" border="0" bordercolor="#FFFFFF" background="images/bg.gif" bgcolor="#FFFFFF">
          		<tr bgcolor="#D8FEE4"> 
            			<td colspan="2" class="typename"> <div align="left"> 
                		<%
				out.println("主要栏目");
				sql1 = "select * from "+board_table+" where board_audit=1 and type_id='"+type_id+"'";
				rs1 = index_man.executeQuery(sql1);
				%>
              			</div>
              			</td>
          		</tr>
          			<%
					while(rs1.next()) {
					board_name = rs1.getString("board_name");
					board_id = rs1.getInt("board_id");
				%>


          		<tr> 
            			<td align="center"> <a href="more_news.jsp?type_id=<%=type_id%>&board_id=<%=board_id%>&board_name=<%=board_name%>" target=_blank><%=board_name%></a></td>
            			<td>&nbsp;</td>
          		</tr>
          			<%
					}
					%>
					
			<tr bgcolor="#D8FEE4">
            			<td colspan="2" class="typename"> <div align="left">
            			新闻搜索
            			</div>
            			</td>
            		</tr>
       			<tr>
			<td align="center">
				<form name="form1" method="post" action="search.jsp">
                		<input name="strSearchWord" type="text" size="10" class=input value=""><br>
                		按 关 键字<input type="radio" name="strSearchType" value="keywordSearch"><br>
                		按文章标题<input type="radio" name="strSearchType" value="titleSearch"><br>
                		按文章内容<input type="radio" name="strSearchType" value="contentSearch">
                		<br><input type="submit" name="Submit" class=button value="确   定"> 
              			</form>
			</td>
			</tr>
        	</table>
        	</td>
      		<td width="73%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" valign="top"> 

<!-- --------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------- -->


<!-- 中 中 新闻标题显示 -->  
      
      			<!-- ------------------------------------all title page content ---------------------------------- -->
      			<table width="100%" border="0" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
          			<tr> 
            				<td width="50%" style="border-right: 1 solid #66cc00"> 
              				<%
	  				sql = "select * from "+news_table+" where news_audit=1 and type_id=1 and board_id=1 order by news_id desc limit 10";
					rs = index_man.executeQuery(sql);	   
	  				%>
	  
	<!-- -技术新闻显示区- -->
              				<table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF">
			       			<tr>                  	
                  					<td width="68%" class="typename"  bgcolor="#e5fee5"> 技术新闻 </td>		  			
                  					<td width="32%" bgcolor="#e5fee5"> <div align="center"><a href="more_news.jsp?type_id=1&board_id=1&board_name=技术新闻" target=_blank>更多...</a>	
                    					</div>
                    					</td>
                				</tr>
                				<%
						int iii;
			 	   		for (iii=0;iii<intDisplay;iii++)  {
				   		if(rs.next()) {
				 		%>
                				<tr> 
                  					<td width="68%">
                  					<IMG height=12 src="images/square.gif" width=12 border=0 valign="middle">&nbsp;
                  					<a href="newsdetail.jsp?news_id=<%=rs.getString("news_id")%>" target=_blank><%=StrTool.getTitle(rs.getString("news_title"),newslength)%></a>
                  					</td>
		  					<td width="32%"><span class="copyright">
		  					[<%=rs.getString("news_time").substring(0,10)%>]</span>
		  					</td>
                				</tr>
                				<%
							}
							else {
						%>
							<tr>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
							</tr>
						<%
							}
							}
						%>
              				</table>
        <!-- 技术新闻 end ------- -->
              				
            				</td>
            			
            			
            				<td width="50%">              
						<%
	  					sql = "select * from "+news_table+" where news_audit=1 order by news_hits desc limit "+intDisplay;
						rs = index_man.executeQuery(sql);	   
	  					%>
             
             
       <!-- -热点新闻显示区- -->  
              				<table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF">
			      			<tr>
                  				<td width="68%" class="typename"  bgcolor="#e5fee5"> 热点文章</td>
                  				<td width="32%" bgcolor="#e5fee5">&nbsp; </td>
                				</tr>
                				<%
			 	   		while (rs.next()){
			 			%>
                			<tr> 
                  			<td width="68%">
                  				<IMG height=12 src="images/square.gif" width=12 border=0 valign="middle">&nbsp;
                  				<a href="newsdetail.jsp?news_id=<%=rs.getString("news_id")%>" target=_blank><%=StrTool.getTitle(rs.getString("news_title"),newslength)%></a>
                  			</td>
                  			<td width="32%"><span class="copyright">
		  				[<%=rs.getString("news_time").substring(0,10)%>]</span>
                  			</td>
                			</tr>
                			<%
						}
					%>
              				</table>
	<!-- 热点新闻显示结束 -->    
           
                     
            				</td>
          			</tr>
          			


	<!-- 各版面新闻显示区 -->

	<%
	///////////////////////////////////////////////////////////////////////////////////////////////////
	//////////////////////////////          this is the begin of all news in every board //////////////
	

			sql = "select * from "+board_table+" where board_audit=1 and type_id="+type_id;
			rs = index_man.executeQuery(sql);
			
			boolean columFirst;
			for(columFirst = true;rs.next();columFirst=!columFirst) {
			
			if(columFirst==true) {
	%>
          <tr> 
          <td style="border-right: 1 solid #66cc00">
          <%
          }
          else {	
          %>
            <td>
           <% } %> 
            
            
            <!-- ------------------------------ this is the news table ------------------------------- -->
               <table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#FFFFFF">
		<tr>	
                  <td width="68%" class="typename" bgcolor="#e5fee5"><%=rs.getString("board_name")%></td>
                  <td width="32%"  bgcolor="#e5fee5" align="center"><a href="more_news.jsp?type_id=<%=type_id%>&board_id=<%=rs.getString("board_id")%>&board_name=<%=rs.getString("board_name")%>" target=_blank>更多...</a></td>
                </tr>
                <%
                sql1 = "select * from "+news_table+" where type_id = " + type_id +" and board_id = " + rs.getString("board_id") + " and news_audit = 1 order by news_id desc";
                rs1 = index_man.executeQuery(sql1);
		for(iii=0;iii<intDisplay;iii++) {
			if(rs1.next()) {
		%>
                <tr> 
                  <td width="68%">
                  	<IMG height=12 src="images/square.gif" width=12 border=0 valign="middle">&nbsp;
                  	<a href="newsdetail.jsp?news_id=<%=rs1.getString("news_id")%>" target=_blank><%=StrTool.getTitle(rs1.getString("news_title"),newslength)%></a>
                  </td>
                  <td width="32%"><span class="copyright">
		  [<%=rs1.getString("news_time").substring(0,10)%>]</span>
                  </td>
                </tr>
                <%
                }
                else
                {
                %>
                <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                </tr>
                <%
			}
			}
			
		%>
              </table>
          <!-- ------------------------- this is the end of the news table ---------------------------------- -->
           
            
            
            </td>
        
          <%
          if (columFirst==false) {
          %>
          </tr>
          <%
          }
          }
          %>

	
          		</table>
          		
       <!-- -各版面新闻显示结束- -->


<!-- 右 中显示区 -->
</td>
      <td width="14%" bgcolor="#FFFFFF" align="right" valign="top">
      <table width="100%" height="207" border="0" cellpadding="2" cellspacing="1" bordercolor="#FFFFFF">
         <tr bgcolor="#D8FEE4"> 
            <td align="left" class=typename >
            论坛登陆：
            </td>
          </tr>
          <tr>
            <td align="center">
	<!-- bbs 登陆 -->     
	<form action="forum/login.jsp" method="post">       
         <table width=100%  bgcolor="#FFFFFF"  cellpadding="1" cellspacing="0"  bordercolor="#FFFFFF"  background="images/bg.gif">
          <tr>
            <td valign=right width="25%">用户名</td>
            <td valign=left><INPUT name=userName type=text size="6" class=input></td>
          </tr>
          <tr>
            <td valign=right width="25%">密  码</td>
            <td valign=left><INPUT name=userPassword type=password size="6" class=input>
            </td>
          </tr>
          <tr>
            <td valign=right>
            Cookie
            </td>
            <td valign=left>
              <select name="cookieDate" size="1" class=input>
    		<option value="0">不保存</option>
    		<option value="1">一天</option>
    		<option value="2">一月</option>
    		<option value="3">一年</option>
  	      </select>
            </td>
          </tr>
          <tr>
            <td  valign=middle align=center colspan=2>
            <input type=hidden name=comeURL value="index.jsp">	
              <input type=submit name="submit" value="登录" class=button>
              <input type=submit name="reset" value="重置" class=button>
            </td>
          </tr>
        </table>
        </form>
	<!-- bbs 登陆结束 -->
            
            
        <!-- 滚动屏显示区 -->
            </td>
          </tr>
	  <tr> 
            <td bgcolor="#e5fee5"> 
              <MARQUEE onmouseover=this.stop() onmouseout=this.start() scrollAmount=1 scrollDelay=70 direction=up height=100>
              
              		<%
	       		sql = "select a.news_title title,b.newsdetail_content content from "+news_table+" a,"+newsdetail_table+" b where a.news_id = b.news_id and a.news_id = 1";
	       		rs = index_man.executeQuery(sql);
	       		while(rs.next()) {
	       		out.println("<span class=typename align=center>"+rs.getString("title")+"</span><br><a href=\"newsdetail.jsp?news_id=1\">"+rs.getString("content")+"</a>");
	       		}
	       		%>
              

              </MARQUEE>
			
	    </td>
          </tr>
 <!-- here is send mail area -->
          <tr>
            <td height="200">
            	<form action="sendmail.jsp" method="post"> 
	       	 <table width=100%  bgcolor="#FFFFFF"  cellpadding="1" cellspacing="0"  bordercolor="#FFFFFF"  background="images/bg.gif">
	       	  <tr>
	       	    <td align=left class=typename  bgcolor="#D8FEE4">给站长写信</td>
	       	  </tr>
	       	  <tr>
	       	    <!--<td align=right width="30%">主 题</td>-->
	       	    <td align=left><INPUT name=subject type=text size="18" class=input value="主题："></td>
	       	  </tr>
	       	  <tr>
	       	    <!--<td align=right width="30%">发件人</td>-->
	       	    <td align=left><INPUT name=from type=text size="18" class=input value="发件人："></td>
	       	  </tr>
	       	  <tr>
	       	    <td  align=middle align=center>
			<TEXTAREA name="content" rows=12 cols=13 class="textare"></TEXTAREA>
	       	    </td>
	       	  </tr>
         	<tr>
            		<td  valign=middle align=center>	
            	  	<input type=submit name="submit" value="发送" class=button>
              		<input type=submit name="reset" value="重置" class=button>
            		</td>
          	</tr>
	       	</table>

            </td>
          </tr>
 <!-- here is the end of send mail area -->
        </table>
        
      </td>
    </tr>
  </table>
<!-- display table over -->
  

<%
index_man.close();
%>
<%@ include file = "function/feeder.jsp" %>
