<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/cms4j" prefix="cms4j" %>

<%@ page import = "cn.com.dekn.cms.util.*,cn.com.dekn.common.util.*" %>

<%
/************************************************
* 元件　更新历史		www.cms4j.com
* 1.0		
* 1.1	2006-10-17	dekn	支持列数、滚动参数
*************************************************/
%>

<%
//网站群节点ID
String NODE_ID = ParamUtil.getStrParam(request,"NODE_ID","root"); 

//网站群节点参数
String CLUSTER_URL_PARAM = "";
if(null != request.getParameter("cluster_node_id")){
	CLUSTER_URL_PARAM = "cluster_node_id=" + StrUtil.encodeHTML(request.getParameter("cluster_node_id").toString());
}


//默认的文章显示页,下面会从配置信息中取
String DEF_ARTICLE_SHOW_PATH = "";
%>

<cms4j:site_config node_id="<%=NODE_ID%>">
<% DEF_ARTICLE_SHOW_PATH = siteconfig_info.getARTICLE_VIEW_TEMPLET_PATH(); %>
</cms4j:site_config>



<%
/***********************************
* TAG参数初始化
***********************************/
//要显示栏目的ID
String CLASS_ID = ParamUtil.getStrParam(request,"CLASS_ID","");

//过滤属性
String FILTER = ParamUtil.getStrParam(request,"FILTER","summary_image");

//过滤属性2
String FILTER2 = ParamUtil.getStrParam(request,"FILTER2","");

//排序属性
String ORDER = ParamUtil.getStrParam(request,"ORDER","");

//指定显示哪一篇文章
String ARTICLE_ID = ParamUtil.getStrParam(request,"ARTICLE_ID","");

//显示哪一个专题
String SPECIAL_ID = ParamUtil.getStrParam(request,"SPECIAL_ID",""); 

//搜索关键字
String KEY = ParamUtil.getStrParam(request,"KEY","");
KEY = Convert.convertEncode(KEY);

//显示文章的默认页面
String SHOW_ARTICLE_PAGE = ParamUtil.getStrParam(request,"SHOW_ARTICLE_PAGE",DEF_ARTICLE_SHOW_PATH); 

//搜索关键字
String SEARCH = ParamUtil.getStrParam(request,"SEARCH","");

//搜索关键字
String SEARCH_TYPE = ParamUtil.getStrParam(request,"SEARCH_TYPE",""); 

//栏目的状态(默认显示状态为USE的)
String CLASS_STATE = 	ParamUtil.getStrParam(request,"CLASS_STATE","use");

//栏目的显示方式（all 为显示所有； show 为显示“在导航中显示的” hidden为显示“在导航中不显示的”
String CLASS_SHOW = 	ParamUtil.getStrParam(request,"CLASS_SHOW","all");

//文章日期范围（all 显示所有；now 显示文章所设置的日期范围内； expire 显示过期的；notbegin 显示未开始的
String DATE = 	ParamUtil.getStrParam(request,"DATE","now");

//排除
String EXCLUDE = 		ParamUtil.getStrParam(request,"EXCLUDE","");

//排除2
String EXCLUDE2 = 		ParamUtil.getStrParam(request,"EXCLUDE2","");

//指定显示第几页的数据
int PN = ParamUtil.getIntParam(request,"PN",0);

//行数
String PAGE_SIZE = ParamUtil.getStrParam(request,"PAGE_SIZE","4");

/***********************************
* 显示特性参数初始化
***********************************/
//新闻标题长度
int TITLE_LENGTH = ParamUtil.getIntParam(request,"TITLE_LENGTH",10);

//标题长度超出时显示的字符
String TITLE_OUT_STR = ParamUtil.getStrParam(request,"TITLE_OUT_STR","..");

//每行的高度
String ROW_HEIGHT = ParamUtil.getStrParam(request,"ROW_HEIGHT","22");

//显示添加日期的格式
String ADD_DATE_FORMAT = ParamUtil.getStrParam(request,"ADD_DATE_FORMAT","MM-dd"); 

//图像宽度
int IMG_WIDTH = ParamUtil.getIntParam(request,"IMG_WIDTH",130);

//图像高度
int IMG_HEIGHT = ParamUtil.getIntParam(request,"IMG_HEIGHT",100);

//每行显示几列
int ROW_COLUMN = ParamUtil.getIntParam(request,"ROW_COLUMN",4);

//是否显示图片标题
boolean IS_SHOW_TITLE = ParamUtil.getBooleanParam(request,"IS_SHOW_TITLE","true"); 

//图片对齐方式
String PIC_ALIGN = ParamUtil.getStrParam(request,"PIC_ALIGN","Center"); 

//文字对齐方式
String TEXT_ALIGN = ParamUtil.getStrParam(request,"TEXT_ALIGN","Center"); 

//每行之间的高度
String ROW_SPACE_HEIGHT = ParamUtil.getStrParam(request,"ROW_SPACE_HEIGHT","2"); 

//打开方式　与html中<a>的target属性相同
String TARGET = ParamUtil.getStrParam(request,"TARGET",""); 

/***********************************
* 滚动
***********************************/
//是否滚动显示
boolean IS_SCROLL = ParamUtil.getBooleanParam(request,"IS_SCROLL","false"); 

//滚动方向
String SCROLL_DIRECTION = ParamUtil.getStrParam(request,"SCROLL_DIRECTION","left"); 

//滚动速度
String SCROLL_AMOUNT = ParamUtil.getStrParam(request,"SCROLL_AMOUNT","");

//滚动高度
String SCROLL_HEIGHT = ParamUtil.getStrParam(request,"SCROLL_HEIGHT","100%"); 

//滚动宽度
String SCROLL_WIDTH = ParamUtil.getStrParam(request,"SCROLL_WIDTH","100%"); 




/***********************************
* CSS样式 参数初始化
***********************************/
//CSS样式
String CSS = ParamUtil.getStrParam(request,"CSS",""); 

//图片样式
String CSS_PIC = ParamUtil.getStrParam(request,"CSS_PIC","");

//标题CSS样式
String CSS_TITLE = ParamUtil.getStrParam(request,"CSS_TITLE","");

/***********************************
* 其它处理
***********************************/
//最终显示图片的URL
String imgURL = "";
%>


<% int rowPicCount = ROW_COLUMN,i = 0,j=0; %>


<!--BEGIN:设置文章显示条件-->
<cms4j:article page_size="<%=PAGE_SIZE%>" class_id="<%=CLASS_ID%>" filter="<%=FILTER%>" filter2="<%=FILTER2%>" order="<%=ORDER%>" article_id="<%=ARTICLE_ID%>" special_id="<%=SPECIAL_ID%>" key="<%=KEY%>"  node_id="<%=NODE_ID%>" search="<%=SEARCH%>" search_type="<%=SEARCH_TYPE%>"  exclude="<%=EXCLUDE%>" exclude2="<%=EXCLUDE2%>" class_state="<%=CLASS_STATE%>" class_show="<%=CLASS_SHOW%>" date="<%=DATE%>" pn="<%=PN%>">

<% if(IS_SCROLL){ %>
	<!--BEGIN: 图片是否滚动显示-->
	<marquee onMouseOver="this.stop();" onMouseOut="this.start()" direction="<%=SCROLL_DIRECTION%>" scrollamount="<%=SCROLL_AMOUNT%>" height="<%=SCROLL_HEIGHT%>" width="<%=SCROLL_WIDTH%>">
<% } %>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="<%=CSS%>">

		<!--BEGIN: 显示文章-->
  		<cms4j:article_list>
		<%
			//首页摘要图片,summary_image
			//文章摘要图片,article_image
			//栏目摘要图片1,class_image_1
			//栏目摘要图片2,class_image_2
			//栏目摘要图片3,class_image_3
			if(FILTER.equalsIgnoreCase("summary_image")){
				imgURL = article_info.getHOMEPAGE_IMAGE();
			}else if(FILTER.equalsIgnoreCase("article_image")){
				imgURL = article_info.getARTICLE_IMAGE();
			}else if(FILTER.equalsIgnoreCase("class_image_1")){
				imgURL = article_info.getCLASS_IMAGE_1();
			}else if(FILTER.equalsIgnoreCase("class_image_2")){
				imgURL = article_info.getCLASS_IMAGE_2();
			}else if(FILTER.equalsIgnoreCase("class_image_3")){
				imgURL = article_info.getCLASS_IMAGE_3();
			}else{
				imgURL = article_info.getHOMEPAGE_IMAGE();
			}
		%>

  		<% if (i%rowPicCount == 0){ %>
		  <% j=i; %>
		  <tr>
		<% } %> 
		
		
    
		  <td align="center">
		  
				<table  border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
					  <!--显示文章图片-->
					  <td  align="<%=PIC_ALIGN%>">
						<a href="<%=article_info.getURL(SHOW_ARTICLE_PAGE,CLUSTER_URL_PARAM)%>" target="<%=TARGET%>"><img src="<%=imgURL%>" width="<%=IMG_WIDTH%>" height="<%=IMG_HEIGHT%>" border="0" alt="<%=article_info.getTITLE()%>" class="<%=CSS_PIC%>"></a>
						</td>
					</tr>
			</table>
				
				<% if(IS_SHOW_TITLE){ %>
				<table width="96%" height="20"  border="0" cellpadding="0" cellspacing="0">
					<tr>
						<!--显示文章标题-->
						<td valign="middle" height="<%=ROW_HEIGHT%>" align="<%=TEXT_ALIGN%>">
						<a href="<%=article_info.getURL(SHOW_ARTICLE_PAGE,CLUSTER_URL_PARAM)%>" target="<%=TARGET%>"><span class="<%=CSS_TITLE%>"><%=article_info.getTITLE(TITLE_LENGTH,TITLE_OUT_STR,"","","")%></span></a>
						</td>
					</tr>
				</table>
				<% } %>
		  </td>
    
	
	
  		<% if (i==j+rowPicCount){ %>
		  </tr><tr><td colspan="<%=ROW_COLUMN%>" height="<%=ROW_SPACE_HEIGHT%>"></td></tr>
		<% 
		   } 
		   i++; 
		%>
		
		</cms4j:article_list>
		<!--END: 显示文章-->
</table>

<% if(IS_SCROLL){ %>
	</marquee>
	<!--END: 图片是否滚动显示-->
<% } %>
</cms4j:article>
<!--END: 设置文章显示条件-->
