📄 config_index.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.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 = "0590";
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 colspan=\"2\"><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 colspan=\"4\"><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 width=\"10\">·</td><td width=\"70%\" height=\"20\" id=\""+pc.getName()+"\" align=\"left\"><a href=\"");
sPromotionList.append(request.getContextPath()+pc.getName());
sPromotionList.append("\">");
sPromotionList.append(pc.getDesc()+"</span></a></td><td>");
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><td width=\"30%\"> <a href=\"javascript:ren_type('"+pc.getName()+"')\">修改</a> <span><a href=\"javascript:deltreepage('"+code+"','"+pc.getName()+"')\">删除</span></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">
<script language="javascript">
function toPage() {
try{
var src = window.event.srcElement;
if ( typeof(src) == "object" && src.tagName == "A" ) {
document.faqForm.to_page.value = src.innerText;
document.faqForm.city.value = src.city;
document.faqForm.submit();
}
}
catch(ex){}
}
</script>
<script>
function aa(){
var start = document.upload.FILE1.value;
var end = start.substring(start.lastIndexOf("\\")+1,start.length);
var end2 = start.substring(start.lastIndexOf(".")+1,start.length);
if(start != ""){
if(end2 != 'html' && end2 != 'htm' && end2 != 'HTML' && end2 != 'HTM'){
alert("在主文件里请上传网页文件(格式为html,htm,HTML,HTM)!!!");
return;
}
}
checkChar(end);
document.upload.name.value = end;
document.upload.type.value = end2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -