📄 images_page.jsp
字号:
<%@ page contentType="text/html; charset=GBK" language="java" errorPage=""%>
<%request.setCharacterEncoding("GBK");%>
<%@ page import="java.text.*"%>
<%@ page import="com.doone.webtemplate.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.doone.util.FileLogger"%>
<%@ page import="com.doone.data.*"%>
<%@ page import="com.doone.upload.*"%>
<%@ page import="com.doone.uurm.WebAuth"%>
<%request.setCharacterEncoding("GBK");%>
<%String sPurvICode="NGB007007";%>
<%
WebAuth auth = WebAuth.getInstance(request);
if ( ! auth.IsAuthed() ) {
out.write("<script language=\"javascript\">self.parent.location.replace(\"" + request.getContextPath() + "/view/login/login.jsp" + "\");</script>");
return;
}
else if ( ! auth.CheckPurv(sPurvICode) ) {
out.write("<script language=javascript src=\"../../common/script/RightForbidden.js\"></script>");
return;
}
%>
<%
String spath = application.getRealPath("/upload/templateconfig.xml");
new TemplateFactory(spath);
String citycode;
if(auth.getCityCode()==null || auth.getCityCode().equals(""))
citycode = "0590";
else
citycode = auth.getCityCode();
int listMaxCount =20;
int maxPageCount = 15;
int a_currPage = 0;
int a_recordCount = 0;
int a_pageCount = 0;
int c_currPage = 0;
int c_recordCount = 0;
int c_pageCount = 0;
int startRecord = 0;
int endRecord = listMaxCount;
// 目前只支持固定的最大页数。
String currPage = null;
String city = request.getParameter("city");
String to_page = request.getParameter("to_page");
String code = request.getParameter("code");
FileLogger log = new FileLogger();
// 新闻处理部分
StringBuffer sPromotionList = new StringBuffer();
try {
ModuleConfig mc = TemplateFactory.getModuleConfig(code);
if (mc != null) {
Map map = null;
PageConfig[] areaPages = null;
PageConfig[] pages = null;
// 全省的促销活动。
map = new HashMap();
map.put("citycode","0590");
pages = mc.getValidPages(map);
// 通过文件名建立索引。
HashMap pageMap = new HashMap();
for (int i=0; i<pages.length; i++){
pageMap.put(pages[i].getName(),pages[i]);
}
//if ( _auth.getIsAuthed() ){
// 处理地市的相应信息。
map = new HashMap();
map.put("citycode",citycode);
areaPages = mc.getValidPages(map);
ArrayList areaList = new ArrayList();
for (int i = 0; i < areaPages.length; i++) {
if(!"0590".equals(citycode)){
if ( pageMap.get(areaPages[i].getName()) != null )
continue;
}else{
if ( pageMap.get(areaPages[i].getName()) == null )
continue;
}
areaList.add(areaPages[i]);
}
currPage = request.getParameter("c_currpage");
if ( currPage != null && ! currPage.equals("") ){
c_currPage = Integer.parseInt(currPage);
}
c_recordCount = areaList.size();// 取得促销活动的记录数。
int c_pageSize = c_recordCount / listMaxCount;
// log.debug("c_RecordCount-->" + String.valueOf(c_recordCount));
//log.debug("c_PageSize-->" + String.valueOf( c_pageSize ));
if ( c_recordCount % listMaxCount != 0 ) c_pageSize++;
//log.debug("c_PageSize-->" + String.valueOf( c_pageSize ));
if ( c_pageSize > maxPageCount ) c_pageSize = maxPageCount;
if ( city != null && city.equals("c") ){
if ( to_page == null || to_page.equals("") ){
to_page = "0";
}
int topage = Integer.parseInt(to_page);
if ( topage <= c_pageSize ){
c_currPage = topage;
}
}
if ( c_currPage >= c_pageSize ) c_currPage = c_pageSize - 1;
if ( c_pageSize > 1 ){
// 处理分页显示。
sPromotionList.append("<tr><td ><table width=\"100%\" height=\"26\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../images/t_r_bg03.gif\" ><tr>");
sPromotionList.append("<td width=\"20%\" align=\"left\"><b>"+citycode+mc.getTitle()+"</b></td>");
sPromotionList.append("<td valign=\"middle\" align=\"right\" class=\"color_hui1\">");
for ( int i = 0; i< c_pageSize; i++){
if ( i == c_currPage ) {
sPromotionList.append(" ");
sPromotionList.append(i);
sPromotionList.append(" ");
}
else {
sPromotionList.append(" <a href=\"#\" city=\"c\" onclick=\"toPage(); return false;\">");
sPromotionList.append(i);
sPromotionList.append("</a> ");
}
}
sPromotionList.append("</td></tr></table></td></tr>");
}
else if ( c_recordCount > 0 ){
sPromotionList.append("<tr><td ><table width=\"100%\" height=\"26\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"../../images/t_r_bg03.gif\" ><tr>");
sPromotionList.append("<td width=\"80%\" align=\"left\"><b>"+citycode+mc.getTitle()+"</b></td>");
sPromotionList.append("<td valign=\"middle\" align=\"right\" class=\"color_hui1\">");
sPromotionList.append(" ");
sPromotionList.append("</td></tr></table></td></tr>");
}
startRecord = c_currPage * listMaxCount;
endRecord = startRecord + listMaxCount;
//log.debug("c_StartRecord-->" + String.valueOf(startRecord));
//log.debug("c_EndRecord-->" + String.valueOf(endRecord));
if ( endRecord > c_recordCount ) endRecord = c_recordCount;
int opt = endRecord - startRecord;
if(c_recordCount <= 0)opt=0;
for (int i = 0; i < opt; i++) {
PageConfig pc = (PageConfig)areaList.get(i);
if(pc != null){
sPromotionList.append("<tr>");
sPromotionList.append("<td height=\"20\" id=\""+pc.getName()+"\" align=\"left\">");
//sPromotionList.append(pc.getName());
//sPromotionList.append("\">");
sPromotionList.append(pc.getDesc());
sPromotionList
.append("<span class=\"color_blue2\"> ");
if ( pc.getCreateTime() != null ){
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd");
sPromotionList.append(sdf.format(pc.getCreateTime()));
}
sPromotionList.append("</td></tr>");
//<img src="images/banner_001.jpg" width="930" height="182">
//把图片放在desc里。因为不建议修改name 的值
sPromotionList.append("<tr><td ><input name=\"oldname\" type=\"hidden\" value="+pc.getName()+">");
int location_small=pc.getName().lastIndexOf(".");
String extension_small = null;
if(location_small>0){
int len=pc.getName().length();
//获得文件扩展名
extension_small = pc.getName().substring(len-4,len);
}
if("swf".equalsIgnoreCase(extension_small)){
sPromotionList.append("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" >");
sPromotionList.append("<param name=\"movie\" value=\""+request.getContextPath()+pc.getName()+"\">");
sPromotionList.append("<param name=\"quality\" value=\"high\">");
// out.print("<param name=\"wmode\" value=\"transparent\">");
sPromotionList.append("</object>");
}else{
sPromotionList.append("<img src="+request.getContextPath()+pc.getName()+">");
}
sPromotionList.append("</td></tr>");
}
}
//}//做用户登录认证
}
} catch (Exception ex) {
log.error("获取信息列表时出错:", ex);
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>配置首页</title>
<link href="../../common/main.css" rel="stylesheet" type="text/css">
<style>
.botton {
font-size: 12px;
color: #804000;
BORDER-RIGHT: #666666 1px solid;
BORDER-TOP: #666666 1px solid;
BORDER-LEFT: #666666 1px solid;
BORDER-BOTTOM: #666666 1px solid;
BACKGROUND-COLOR: #ffffff;
}
.add_zl {
font-size: 12px;
line-height: 18px;
color: #333333;
text-decoration: none;
}
body {
margin-top: 0px;
}
.biaoti {
font-size: 12px;
color: #FFFFFF;
text-decoration: none;
}
.style2 {font-weight: bold}
.style3 {font-size: 12px; color: #FFFFFF; text-decoration: none; font-weight: bold; }
</style>
<script>
function aa(){
var start = document.all.FILE1.value;
var end = start.substring(start.lastIndexOf("\\")+1,start.length);
for(i=0;i<end.length;i++){
//转化成ACSII
var charNum=0;
charNum=start.charCodeAt(i)&0xffff;
//如果是255内
if(charNum>0xff){
alert("你上传的文件名有带中文字符,请修改为英文单字节字符!!!");
return;
}
}
var end2 = start.substring(start.lastIndexOf(".")+1,start.length);
document.all.name.value = end;
document.all.type.value = end2;
if(end2 != 'jpg' && end2 != 'JPG' && end2 != 'gif' && end2 != 'GIF' && end2 != 'swf' && end2 != 'SWF'){
alert("上传文件的格式只能是:jpg,gif,swf");
return;
}
}
</script>
<link href="../../common/style/main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE4 {color: #FF0000}
-->
</style>
</head>
<body>
<table id="ibtnPanel" style="font-size: 9pt; border-bottom: #efefef 1px outset" cellspacing="0"
cellpadding="0" width="100%" border="0">
<tr bgcolor="#efefef" height="33">
<td align="left" valign="middle" id="ibtnaddResearch" title="" onClick="return fnToolAddResearch();" DefaultClass="btnDefault" OverClass="btnOver" DownClass="btnDown"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="add_zl">
<tr>
<td height="27" bgcolor="#f5f5f5"> <a href="edit_web_index.jsp">返回修改首页导航</a></td>
</tr>
</table></td>
</tr>
</table>
<FORM NAME="upload" METHOD="POST" ACTION="do_images_upload.jsp" ENCTYPE="multipart/form-data" >
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td align="center" valign="top" background="../../images/t_l_bg.gif" bgcolor="#FFFFFF" class="add_zl">
<table width="100%" class="add_zl">
<%=sPromotionList.toString()%>
</table>
<br> </td>
</tr>
</table>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" class="add_zl">
<tr bgcolor="#FFFFFF">
<td height="30" align="right"> 图片及FLASH等: </td>
<td height="30" align="left">
<input name="FILE1" type="FILE" class="botton" size="30" >
<input name="code" type="hidden" value="<%=code%>">
<input name="name" type="hidden" id="name">
<input name="type" type="hidden" id="type">
<input name="Submit" type="submit" class="botton" value="上传它们!" onMouseDown="aa()">
(文件名请用英文或数字)</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" align="center"><span class="STYLE4">注:为了正常显示,上传文件的格式只能是:jpg,gif,swf。上传的文件名请用英文或数字,不要带中文字符,应用英文的单字节字符!!!</span></td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -