⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page_field.jsp

📁 java 写的一个新闻发布系统
💻 JSP
字号:
<%@ page language="java" %><%@ page import="org.jahia.params.*" %><%@ page import="org.jahia.data.*" %><%@ page import="org.jahia.data.fields.*" %><%@ page import="org.jahia.services.pages.*" %><%@ page import="org.jahia.engines.shared.*" %><%@ page import="org.jahia.services.usermanager.*" %><%@ page import="org.jahia.services.acl.*" %><%@ page import="org.jahia.services.sites.*" %><%@ page import="org.jahia.exceptions.*" %><%@ page import="java.util.*" %><%!    private String renderTemplateList( ParamBean jParams, JahiaSite site, Enumeration templateList, int templateID )    throws JahiaException    {		JahiaUser theUser = jParams.getUser();				int selTemplate = templateID;		if ( templateID<0 ){			selTemplate = site.getDefaultTemplateID();		}        String html = "";        while (templateList.hasMoreElements()) {            JahiaPageDefinition theTemplate = (JahiaPageDefinition) templateList.nextElement();            if ( ACLResource.checkReadAccess(theTemplate,theUser,jParams.getSiteID()) ){	            html += "<option value=\"" + theTemplate.getID() + "\"";	            if (theTemplate.getID() == selTemplate) {	                 html += " selected";	            } 	            html += "> " + theTemplate.getName() + "</option>\n";	        }        }        return html;    }%><%    // get session attributes    HashMap  subEngineMap  =  (HashMap) session.getAttribute( ("org.jahia.engines.CopyTree_Engine.engineMap") );    String   operation     =  null;    if (subEngineMap != null) {        operation          =  (String) subEngineMap.get( "operation" );    }        // get request attributes    String  message      = (String) request.getAttribute("message");    if(message == null) {        message = "";    }    int columns = 30;    String userAgent = request.getHeader( "user-agent" );    if (userAgent != null) {        if (userAgent.indexOf( "MSIE" ) != -1) {            columns = 40;        }    }            // get engine context and all data we need from it...    HashMap engineMap  = (HashMap) request.getAttribute( "org.jahia.engines.EngineHashMap" );    JahiaField  theField         = (JahiaField) engineMap.get( "theField" );    String pageTitle             = (String) engineMap.get( "pageTitle" + theField.getDefinition().getName());    if(pageTitle == null) {        pageTitle = "";    }        JahiaPageEngineTempBean thePage = (JahiaPageEngineTempBean)     									request.getAttribute( "PageBean" + theField.getDefinition().getName());    if (thePage == null) {        System.out.println( "the page is null !!" );    }    int  pageType    =  thePage.getPageType();    int  pageLinkID  =  thePage.getPageLinkID();        String fieldName = theField.getDefinition().getName();    Enumeration templateList     = (Enumeration) engineMap.get( "templateList" );    String      remoteUrl        = thePage.getRemoteURL();    String      manageTreeURL    = (String) engineMap.get( "manageTreeURL" );    String      linkSelectorURL  = manageTreeURL + "&operation=link&fname="+fieldName;    String      copyTreeURL      = manageTreeURL + "&operation=copy&fname="+fieldName;    manageTreeURL                = manageTreeURL + "&operation=move&fname="+fieldName;    if (remoteUrl == null) {        remoteUrl = "http://www";    }    Integer     intTemplateID    = (Integer) engineMap.get( "templateID" );    int         templateID       = (intTemplateID != null) ? intTemplateID.intValue() : -1;    Integer     intPageID        = (Integer) engineMap.get( "pageID" );    int         pageID           = (intPageID != null) ? intPageID.intValue() : 0;    Integer     intChoiceID      = (Integer) engineMap.get( "choiceID" +theField.getDefinition().getName());    int         choiceID         = (intChoiceID != null) ? intChoiceID.intValue() : 0;    int         treeChoiceID     = 1;    if ((choiceID == 3) || (choiceID == 5)) {        treeChoiceID = choiceID;    }    Boolean     boolIsDirectLink = (Boolean) engineMap.get( "isDirectLink" );    boolean     isDirectLink     = (boolIsDirectLink != null) ? boolIsDirectLink.booleanValue() : true ;    Boolean     boolIsNewPage    = (Boolean) engineMap.get( "isNewPage" );    boolean     isNewPage        = (boolIsNewPage != null) ? boolIsNewPage.booleanValue() : true ;       ParamBean   jParams          = (ParamBean) engineMap.get( "jParams" );    JahiaSite	site	       	 = jParams.getSite();	Boolean		isSelectedField			= (Boolean) engineMap.get( "isSelectedField" );%><script language="javascript"><!--function OpenTreeSelector( url ){<% if (isNewPage && theField.getValue().toUpperCase().indexOf("JAHIA_LINKONLY") == -1 ) {%>document.mainForm.choice[0].checked=true;<% } else { %>document.mainForm.choice[1].checked=true;<%} %>    var params = "width=550,height=550,status=0,menubar=0,resizable=1,scrollbars=1";    var name="copytree";    var theMatrix = Math.round(Math.random() * 10000);	var newURL = url + "&matrix=" + theMatrix;        var myWin = window.open( newURL, name, params );}//--></script><table border="0" width="100%"><tr>    <td width="10%"></td>    <td width="90%"><%=message%></td></tr><tr>    <td colspan="2" class="text">        Title :<br>        <input class="input" type="text" size="<%=columns%>" name="page_title" value="<%=pageTitle%>" maxlength="250">    </td></tr><tr>    <td colspan="2"> <br> </td></tr><%    if(!isDirectLink)    {%><% if (isNewPage && theField.getValue().toUpperCase().indexOf("JAHIA_LINKONLY") == -1) {%><tr>    <td colspan="2" class="text">        New Jahia Page Using Template :    </td></tr><tr>    <td valign="top">        <input class="input" type="radio" name="choice" value="0" <%if((pageType == 0) &&                                                                        (choiceID !=3) &&                                                                        (choiceID !=1)){%>checked<%}%>>    </td>    <td valign="top">        <span class="input"><select class="input" name="template_id" onChange="choice[0].checked = true">        <%=renderTemplateList( jParams, site, templateList, templateID)%>        </select></span>    </td></tr><tr>    <td colspan="2"><br></td></tr><tr>    <td colspan="2" class="text">        Existing Jahia Page (move) :    </td></tr><tr>    <td valign="top" class="text">        <input class="input" type="radio" name="choice" value="<%=treeChoiceID%>" onClick="javascript:OpenTreeSelector('<%=manageTreeURL%>')"            <% if (choiceID == 3) { %> checked <% } %>>    </td>    <td valign="top" class="text">        <a href="javascript:OpenTreeSelector('<%=manageTreeURL%>')" ><b>Select page to move</b></a>    </td></tr><!--<tr>    <td colspan="2"><br></td></tr><tr>    <td colspan="2" class="text">        Existing Jahia Page (copy) :    </td></tr><tr>    <td valign="top" class="text">        <input class="input" type="radio" name="choice" value="<%=treeChoiceID%>" onClick="javascript:OpenTreeSelector('<%=manageTreeURL%>')"            <% if (choiceID == 5) { %> checked <% } %>>    </td>    <td valign="top" class="text">        <a href="javascript:OpenTreeSelector('<%=copyTreeURL%>')" ><b>Select page to copy</b></a>    </td></tr>--><tr>    <td colspan="2"><br></td></tr><% } else { %><input type="hidden" name="template_id" value="0"><% } %><tr>    <td colspan="2" class="text">        Existing Jahia Page (link) :    </td></tr><tr>    <td valign="top" class="text">        <input class="input" type="radio" name="choice" value="<%=treeChoiceID%>" onClick="javascript:OpenTreeSelector('<%=linkSelectorURL%>')"            <% if ((choiceID == 1) || (pageType == 1)) { %> checked <% } %>>            <% if (pageType == 1) { %>                <input type="hidden" name="pagelinkid" value="<%=pageLinkID%>">            <% }%>    </td>    <td valign="top" class="text">        <a href="javascript:OpenTreeSelector('<%=linkSelectorURL%>')" ><b>Select page to link</b></a>    </td></tr><tr>    <td colspan="2"> <br> </td></tr><tr>    <td colspan="2" class="text">        Remote URL :    </td></tr><tr>    <td valign="top">        <input class="input" type="radio" name="choice" value="2"            <% if ( (pageType == 2 && choiceID!=1) || (theField.getValue().toUpperCase().indexOf("JAHIA_LINKONLY") != -1 && choiceID!=1)  ) { %> checked <% } %>>    </td>    <% int choiceNum = 3;    if (theField.getValue().toUpperCase().indexOf("JAHIA_LINKONLY") != -1 || !isNewPage) {        choiceNum = 1;    }    %>    <td valign="top">        <input class="input" type="text" name="remote_url" value="<%=remoteUrl%>" maxlength="250" onFocus="choice[<%=choiceNum%>].checked = true">    </td></tr><% if (!isNewPage) { %><tr>    <td colspan="2"> <br> </td></tr><tr>    <td colspan="2" class="text">        Remove link :    </td></tr><tr>    <td valign="top">        <input class="input" type="radio" name="choice" value="9"            <% if ( choiceID == 9 ) { %> checked <% } %>>    </td>    <td valign="top" class="text">        No link :    </td></tr><% } %>    <%    } else {%><tr>    <td colspan="2" class="text">        Template :<br>        <span class="input"><select class="input" name="template_id">        <%=renderTemplateList( jParams, site, templateList, templateID)%>        </select></span>	    <input type="hidden" name="choice" value="0">    </td></tr><% } %></table><input type="hidden" name="page_field_submitted" value="ok"><br><%	if ( isSelectedField.booleanValue() ) { %><script type="text/javascript" language="javascript"><!--function setfocus() {    document.mainForm.elements["page_title"].focus();}//--></script><% } %><SCRIPT type="text/javascript"><!--function check() {          return true; }// --></SCRIPT>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -