<%@ page contentType="text/html; charset=GBK"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="gbase.init.*,gbase.db.*,java.sql.*,gbase.util.*"%>
<%
//CMS站点的发布上下文(虚拟目录）
WebConfig theWebConfig1=new WebConfig();
String cms_url=theWebConfig1.getCms_url(); //已包括“/”
String old_cms_url="";
if(cms_url.lastIndexOf("/")>0)
old_cms_url=cms_url.substring(0,cms_url.lastIndexOf("/"));

//参数:网站账号web_account
String web_account=request.getParameter("web_account")==null?"":request.getParameter("web_account");

//参数:要显示栏目的ID
String bar_id=request.getParameter("bar_id")==null?"":request.getParameter("bar_id");

//参数:行数
String str_page_size=request.getParameter("page_size")==null?"5":request.getParameter("page_size");
int page_size=Integer.parseInt(str_page_size);

//每行的图片数
String str_row_size=request.getParameter("row_size")==null?"3":request.getParameter("row_size");
int row_size=Integer.parseInt(str_row_size);

//参数:需要生成的当前页数need_page
String str_need_page=request.getParameter("need_page")==null?"1":request.getParameter("need_page");
int need_page=Integer.parseInt(str_need_page);

//参数:总页数sum_page
String str_sum_page=request.getParameter("sum_page")==null?"1":request.getParameter("sum_page");
int sum_page=Integer.parseInt(str_sum_page);

//参数:每个图片的宽度
String img_width=request.getParameter("img_width")==null?"0":request.getParameter("img_width");

//参数:每个图片的高度
String img_height=request.getParameter("img_height")==null?"0":request.getParameter("img_height");

//参数:是否显示图片标题
String is_show_title=request.getParameter("is_show_title")==null?"15":request.getParameter("is_show_title");

//参数:标题字符数(汉字数)
String str_title_length=request.getParameter("title_length")==null?"0":request.getParameter("title_length");
int title_length=Integer.parseInt(str_title_length);

//参数:打开方式　与html中<a>的target属性相同
String target=request.getParameter("target")==null?"_blank":request.getParameter("target");

int row_height=22;
%>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<%
String id="";
String image_url="";
String image_url_link="";
String title="";
String sql1="";
if(bar_id.equals("all"))
sql1="select id,image_url,title,bar_id from web_imageinfo where web_account='"+web_account+"' order by id desc";
else
sql1="select id,image_url,title,bar_id from web_imageinfo where bar_id="+bar_id+" and web_account='"+web_account+"' order by id desc";
PageManager thePageManager1 = new PageManager();
thePageManager1.setPageSize(page_size*row_size);
ResultSet rs1 = thePageManager1.gePageData(request, sql1);
int img_i=0;
while(rs1.next())
{
id=rs1.getString("id");
title=StringUtils.getStringLength(rs1.getString("title"),title_length);
bar_id=rs1.getString("bar_id");
image_url=rs1.getString("image_url");
image_url_link="/"+bar_id+"/content"+rs1.getString("id")+".html";
img_i++;
%>

<%if(img_i%row_size==1){%><tr><%}%>
<td>
  <table width="96%"  border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
       <!--显示文章图片-->
	 <td height="1" align="center">
	   <a href="<%=image_url_link%>" target="<%=target%>"><img src="<%=image_url%>" <%if(!img_width.equals("0")){%>width="<%=img_width%>"<%}%> <%if(!img_height.equals("0")){%>height="<%=img_height%>"<%}%> border="0" alt="<%=title%>"></a>
	 </td>
    </tr>
    <tr>
	<td height="5"><img border="0" src="/cmsweb/images/spacer.gif" width="1" height="5"></td>
    </tr>
  </table>
  <%if(is_show_title.equals("true")){%>
  <table width="96%" height="20"  border="0" cellpadding="0" cellspacing="0">
    <tr>
      <!--显示文章标题-->
      <td align="center" valign="middle" height="<%=row_height%>">
	<a href="<%=image_url_link%>" target="<%=target%>"><%=title%></a>
      </td>
    </tr>
  </table>
  <%}%>
</td>
<%if(img_i%row_size==0){%></tr><%}%>
<%}%>
<%if(img_i%row_size!=0){%></tr><%}%>

<tr>
<td>
<%for(int kk=1;kk<=sum_page;kk++){
if(kk==need_page){
%>
<font color=red>[<%=kk%>]</font> 
<%} else {%> 
<a href="/bar<%=bar_id%>_<%=kk%>/">[<%=kk%>]</a> 
<%}}%>
</td>
</tr>
</table>

