<%@page import="com.hanweb.jcms.constant.Tables"%> <%@page import="com.hanweb.common.util.DateUtil"%> <%@page import="com.hanweb.common.util.NumberUtil"%> <%@page import="com.hanweb.common.util.StringUtil"%> <%@page import="com.hanweb.common.util.mvc.Script"%> <%@page import="com.hanweb.jcms.build.service.makeunit.Info"%> <%@page import="com.hanweb.jcms.entity.Jcms_CataloginfoEntity"%> <%@page import="com.hanweb.jcms.entity.Jcms_InforefEntity"%> <%@page import="com.hanweb.jcms.plugins.permission.service.PermissionBLF"%> <%@page import="com.hanweb.jcms.service.column.Jcms_CataloginfoBLF"%> <%@page import="com.hanweb.jcms.service.info.Jcms_InforefBLF"%> <%@page import="com.hanweb.jcms.service.website.Jcms_WebinfomationBLF"%> <%@page import="com.hanweb.jcms.sys.service.SysInfo"%> <%@page import="com.hanweb.jcms.util.SafeUtil"%> <%@page import="com.hanweb.jcms.util.xml.XMLFile"%> <%@page import="org.apache.commons.logging.Log"%> <%@page import="org.apache.commons.logging.LogFactory"%> <%@page import="java.io.File"%> <%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ include file="./config.jsp" %> <% SysInfo sys = new SysInfo(); sys.initSysPara(request); String strAppId = "1"; int iWebId = NumberUtil.getInt(request.getParameter("webid")); int iCataId = NumberUtil.getInt(request.getParameter("cataid")); int iCataType = NumberUtil.getInt(request.getParameter("catatype")); int iOrderId = NumberUtil.getInt(request.getParameter("orderid")); int infoId = NumberUtil.getInt(request.getParameter("infoid")); String strPosition = SafeUtil.getSafeString(request.getParameter("position")); Log logger = LogFactory.getLog(getClass()); if (strAppId.equals("") || iWebId == 0 || iCataId == 0 || iCataType == 0 || strPosition.equals("")){ logger.error("网站id和栏目id和栏目类型中存在为0的情况或者位置和应用为空"); return; } Jcms_CataloginfoBLF cataBlf = Jcms_CataloginfoBLF.getInstance().init(strAppId,iWebId); Jcms_CataloginfoEntity cataEn = cataBlf.getEntity( iCataId ); if( cataEn == null ){ logger.error("参数栏目id"+iCataId+"在jcms_cataloginfo找不到信息"); return; } String strTableName = StringUtil.getStringTrim( cataEn.getVc_tablename() ); String strCurrentDate = DateUtil.getCurrDateTime(); String strSql = ""; String[][] strData = null; Script script = Script.getInstanceOnly(); if( iCataType == 6 ){ /*指定表*/ out.println(script.addAlert("指定表栏目不支持文章上下篇功能!").getScript()); return; } PermissionBLF permissionBLF = PermissionBLF.getInstance().init(strAppId,iWebId); if(strTableName==null || strTableName.length() ==0){ strTableName = Tables.INFO+"_"+iWebId; } strData = permissionBLF.findRedirect(NumberUtil.getInt(strWebID),iCataType,infoId,iCataId,iOrderId,strPosition,cataEn,strTableName); String strPath = application.getRealPath("") + "/jcms_files/jcms" + strAppId + "/web" + iWebId + "/site/module/changepage/" ; String strConfigPath = strPath + "config" + File.separator + "config.xml"; XMLFile xmlFile = new XMLFile(); String strwebtype = xmlFile.getContent("webtype", strConfigPath); // 1 制作端; 2 web服务器端 String strWebServerName = xmlFile.getContent("web_in_servername", strConfigPath); //系统路径 String strSysPath = "/"; if (strwebtype.equals("1")) { strSysPath = "/" + strWebServerName + "/jcms_files/jcms" + strAppId + "/web" + iWebId + "/site/view/"; } if (strwebtype.equals("2")) { strSysPath = "/"; } if (strData == null || strData.length == 0) { if (strPosition.equals("next")) out.println(script.addAlert("已经到达最后一篇文章!").getScript()); else out.println(script.addAlert("已经到达第一篇文章!").getScript()); out.println(""); return; } int b_ref = NumberUtil.getInt( strData[0][2] ); String strInfoHref = StringUtil.getStringTrim( strData[0][3] ); String strUrl = Info.getInfoUrl(strSysPath, iCataId, NumberUtil.getInt(strData[0][0]), StringUtil.getStringTrim(strData[0][1])); String strDomain = ""; Jcms_InforefEntity refEn = null; if( b_ref == 2 ){ Jcms_InforefBLF refblf = Jcms_InforefBLF.getInstance().init(strAppId); /*找当前信息的原信息的网站域名*/ refEn = refblf.getSEntity( NumberUtil.getInt(strData[0][0]),iCataId ); if( refEn != null ){ strDomain = Jcms_WebinfomationBLF.modifyAndGetWebDomain( strAppId, refEn.getI_swebid() ); if( strDomain.trim().length() >0 ) strPath = "http://" + strDomain +"/"+ strInfoHref; } }else{ strUrl = Info.getInfoUrl( strUrl, strInfoHref ); } if(strwebtype.equals("2")) { strUrl = strUrl.replaceAll(strSysPath ,"/"); } //所有的"http://" + strDomain +"/"改为相对路径输出! strUrl = strUrl.replaceAll("http://" + strDomain +"/", "../../"); out.println(script.addScript("location.href='" + strUrl+ "';").getScript()); %>