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

📄 containerlistproperties_engine.java

📁 java 写的一个新闻发布系统
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////                 . . . i n   j a h i a   w e   t r u s t . . .//////  PageProperties_Engine//  EV  10.02.20001////  getInstance()//  authoriseRender()//  renderLink()//  needsJahiaData()//  handleActions()//package org.jahia.engines.containerlistproperties;import java.util.*;                                 // HashMapimport javax.servlet.http.*;                        // HttpSessionimport org.apache.regexp.*;                         // Regular Expressionimport org.jahia.content.*;import org.jahia.exceptions.*;                  // JahiaExceptionimport org.jahia.utils.*;                       // JahiaConsoleimport org.jahia.data.*;                        // JahiaDataimport org.jahia.services.pages.JahiaPage;import org.jahia.data.fields.*;                 // JahiaField, FieldTypesimport org.jahia.data.containers.*;             // JahiaContainerimport org.jahia.params.*;                      // ParamBeanimport org.jahia.registries.*;                  // ServicesRegistryimport org.jahia.engines.*;                     // JahiaEngine interfaceimport org.jahia.engines.shared.*;              // SmallText, BigText, etc.import org.jahia.data.events.*;                 // JahiaEventimport org.jahia.engines.rights.*;              // ViewRightsimport org.jahia.services.acl.*;import org.jahia.services.usermanager.*;        // JahiaUserimport org.jahia.services.audit.*;              // LoggingEventListenerimport org.jahia.data.applications.*;           // ApplicationBeanimport org.jahia.data.files.*;                  // JahiaFileFieldimport org.jahia.exceptions.JahiaSessionExpirationException;import org.jahia.exceptions.JahiaForbiddenAccessException;public class ContainerListProperties_Engine implements JahiaEngine {    private static final String CLASS_NAME = ContainerListProperties_Engine.class.getName();    private static  final String TEMPLATE_JSP   = "container_list_properties";    private static          ContainerListProperties_Engine theObject   = null;    private                 String              engineName  = "containerlistproperties";    private                 EngineToolBox       toolBox;    /***        * constructor        *        */    private ContainerListProperties_Engine()    {        // JahiaConsole.println( "Engine",        //                       "***** Starting ContainerListProperties Engine *****" );        toolBox = EngineToolBox.getInstance();    } // end constructor    /***        * returns a single instance of the object        *        */    public static synchronized ContainerListProperties_Engine getInstance()    {        if (theObject == null) {            theObject = new ContainerListProperties_Engine();        }        return theObject;    } // end getInstance    /***        * authoriseRender        *        */    public boolean authoriseRender( ParamBean jParams )    {        return toolBox.authoriseRender( jParams );    } // end authoriseRender    /***        * renderLink        *        */    public String renderLink( ParamBean jParams, Object theObj )    throws JahiaException    {        Properties extraParams = new Properties();        String params = "";        JahiaContainerList theList = (JahiaContainerList) theObj;        String containerListName = theList.getDefinition().getName();        Vector ctnIDs = ServicesRegistry.getInstance().            getJahiaContainersService().getctnidsInList(theList.getID());        String scrollStr = Integer.toString(ctnIDs.size()) + "_0";        if (scrollStr !=null) {            if (scrollStr.length() > 0) {                extraParams.setProperty("ctnscroll_" + containerListName, scrollStr);            }        }//        params += "&mode=display";        params += "?mode=display";        params += "&clid=" + theList.getID();        return jParams.composeEngineUrl( engineName, extraParams, params );    } // end renderLink    /***        * needsJahiaData        *        */    public boolean needsJahiaData( ParamBean jParams )    {        return false;    } // end needsJahiaData    /***        * handles the engine actions        *        * @param        jParams             a ParamBean object        * @param        jData               a JahiaData object (not mandatory)        *        */    public void handleActions( ParamBean jParams, JahiaData jData )        throws  JahiaException,                JahiaSessionExpirationException,                JahiaForbiddenAccessException    {        // initalizes the hashmap        HashMap engineMap = initEngineMap( jParams );        // checks if the user has the right to display the engine        JahiaContainerList  theContainerList = (JahiaContainerList)engineMap.get("theContainerList");        JahiaUser       theUser = jParams.getUser();        if (theContainerList.checkAdminAccess(theUser,jParams.getSiteID())) {            engineMap.put( "adminAccess", Boolean.TRUE );            engineMap.put( "writeAccess", Boolean.TRUE );        } else if (theContainerList.checkWriteAccess(theUser,jParams.getSiteID())) {            engineMap.put( "writeAccess", Boolean.TRUE );        }        if (engineMap.get("writeAccess") != null)        {            processLastScreen( jParams, engineMap );            processCurrentScreen( jParams,engineMap );        } else {            throw new JahiaForbiddenAccessException ();        }        // displays the screen        toolBox.displayScreen( jParams, engineMap );    } // end handleActions    /***        * processes the last screen sent by the user        *        * @param        jParams             a ParamBean object        *        */    public void processLastScreen( ParamBean jParams, HashMap engineMap )        throws  JahiaException,                JahiaForbiddenAccessException    {        JahiaConsole.println(CLASS_NAME+".processLastScreen","started");        // Sets the container list        JahiaContainerList theContainerList = (JahiaContainerList) engineMap.                get( "theContainerList" );        // gets the last screen        // lastscreen   = edit, rights, logs        String lastScreen = jParams.getRequest().getParameter( "lastscreen" );        engineMap.put("lastscreen", lastScreen );        if (lastScreen == null) {            lastScreen = "edit";        }        // indicates to sub engines that we are processing last screen        int mode = JahiaEngine.UPDATE_MODE;        // dispatches to the appropriate sub engine        if (lastScreen.equals( "edit" ))  {            if (!updateContainerListData( jParams, engineMap )) {                // if there was an error, come back to last screen                engineMap.put( "screen", lastScreen );                engineMap.put( "jspSource", TEMPLATE_JSP );            }        } else if (lastScreen.equals("rightsMgmt") ||                   lastScreen.equals("ctneditview_rights") ) {            if (engineMap.get("adminAccess") != null) {                engineMap.put("logObjectType", Integer.toString(LoggingEventListener.CONTAINERLIST_TYPE));                engineMap.put("logObject", theContainerList);                if (lastScreen.equals("rightsMgmt")) {                    ManageRights.getInstance().handleActions( jParams, mode, engineMap,                                                              theContainerList.getAclID());                } else {                    HashMap acls = (HashMap)engineMap.get("fieldAcls");                    if ( acls == null )                        return;                    String val = jParams.getRequest().getParameter("lastaclfield");                    Integer I = null;                    if ( val != null ){                        I = (Integer)acls.get(val);                        if ( I != null ){                            ManageRights.getInstance().handleActions( jParams, mode, engineMap,                            I.intValue() );                        }                    }                }            } else {                throw new JahiaForbiddenAccessException();            }        }    } // end processLastScreen    /***        * prepares the screen requested by the user        *        * @param        jParams             a ParamBean object        *        */    public void processCurrentScreen( ParamBean jParams, HashMap engineMap )        throws  JahiaException,                JahiaForbiddenAccessException    {        JahiaConsole.println(CLASS_NAME+".processCurrentScreen","Started");        // Sets the container list        JahiaContainerList theContainerList = (JahiaContainerList) engineMap.                                        get( "theContainerList" );        // gets the current screen        // screen   = edit, rights, logs        String theScreen    = (String)      engineMap.get( "screen" );        // indicates to sub engines that we are processing last screen        int mode = JahiaEngine.LOAD_MODE;        // dispatches to the appropriate sub engine        if (theScreen.equals( "edit" ))  {            loadContainerListData( jParams, engineMap );        } else if (theScreen.equals("logs")) {            if (engineMap.get("lastscreen") != null && engineMap.get("lastscreen").equals("edit"))            {                // save container's rank                saveContainersRank(jParams, engineMap);            }            toolBox.loadLogData( jParams, LoggingEventListener.CONTAINERLIST_TYPE, engineMap );        } else if (theScreen.equals("rightsMgmt") ||                   theScreen.equals("ctneditview_rights") ) {            if (engineMap.get("lastscreen") != null && engineMap.get("lastscreen").equals("edit"))            {                // save container's rank                saveContainersRank(jParams, engineMap);            }            if (engineMap.get("adminAccess") != null) {                if ( theScreen.equals("rightsMgmt") ){                    ManageRights.getInstance().handleActions( jParams, mode, engineMap,                        theContainerList.getAclID() );                } else {                    JahiaConsole.println(CLASS_NAME+".processCurrentScreen","Step1");                    HashMap acls = (HashMap)engineMap.get("fieldAcls");                    if ( acls == null )                        return;                    String val = jParams.getRequest().getParameter("aclfieldname");                    JahiaConsole.println(CLASS_NAME+".processCurrentScreen","aclfieldname=" + val);                    Integer I = null;                    if ( val == null ){

⌨️ 快捷键说明

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