xlawrence    2005/12/28 16:59:52 CET

  Modified files:
    core/src/java/org/jahia/engines/pages 
                                          PageProperties_Engine.java 
  Log:
  don't forget to save the engineMessages so they can be displayed in the JSP
  
  Revision  Changes    Path
  1.38      +53 -47    
jahia/core/src/java/org/jahia/engines/pages/PageProperties_Engine.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/engines/pages/PageProperties_Engine.java.diff?r1=1.37&r2=1.38&f=h
  
  
  
  Index: PageProperties_Engine.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/engines/pages/PageProperties_Engine.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- PageProperties_Engine.java        28 Dec 2005 15:58:38 -0000      1.37
  +++ PageProperties_Engine.java        28 Dec 2005 15:59:52 -0000      1.38
  @@ -1,4 +1,4 @@
  -// $Id: PageProperties_Engine.java,v 1.37 2005/12/28 15:58:38 xlawrence Exp $
  +// $Id: PageProperties_Engine.java,v 1.38 2005/12/28 15:59:52 xlawrence Exp $
   //
   //
   //                                   ____.
  @@ -131,7 +131,8 @@
        * @param jData   a JahiaData object (not mandatory)
        */
       public EngineValidationHelper handleActions(final ProcessingContext 
jParams, final JahiaData jData)
  -            throws JahiaException, JahiaUpdateLockException, 
JahiaForbiddenAccessException {
  +            throws JahiaException, JahiaUpdateLockException,
  +            JahiaForbiddenAccessException {
           final JahiaUser user = jParams.getUser();
           EngineValidationHelper evh = null;
   
  @@ -150,7 +151,6 @@
               engineMap.put("enableRightView", Boolean.TRUE);
               engineMap.put("enableTimeBasedPublishing", Boolean.TRUE);
               engineMap.put("writeAccess", Boolean.TRUE);
  -            engineMap.put("enableVersioning", Boolean.TRUE);
   
           } else if (thePage.checkWriteAccess(user)) {
               engineMap.put("enableAuthoring", Boolean.TRUE);
  @@ -251,39 +251,45 @@
                   }
               }
           } else if (lastScreen.equals("versioning")) {
  -            engineMap.put(RENDER_TYPE_PARAM,
  -                    new Integer(JahiaEngine.RENDERTYPE_FORWARD));
  -            // reset engine map to default value
  -            engineMap.remove(ENGINE_OUTPUT_FILE_PARAM);
  +            if (engineMap.get("writeAccess") != null
  +                    || engineMap.get("adminAccess") != null) {
  +                engineMap.put(RENDER_TYPE_PARAM,
  +                        new Integer(JahiaEngine.RENDERTYPE_FORWARD));
  +                // reset engine map to default value
  +                engineMap.remove(ENGINE_OUTPUT_FILE_PARAM);
   
  -            releaseTreeVersioningLocks(jParams);
  +                releaseTreeVersioningLocks(jParams);
   
  -            // now let's reacquire the page lock for this page, as we
  -            // have cleared it as part of the page subtree.
  -            if (jParams.settings().areLocksActivated()) {
  -                final LockKey lockKey = LockKey.composeLockKey(LockKey.
  -                        UPDATE_PAGE_TYPE,
  -                        thePage.getID(), thePage.getID());
  -                final JahiaUser user = jParams.getUser();
  -                if (lockService.acquire(lockKey, user,
  -                        user.getUserKey(),
  -                        jParams.getSessionState().
  -                                getMaxInactiveInterval())) {
  +                // now let's reacquire the page lock for this page, as we
  +                // have cleared it as part of the page subtree.
  +                if (jParams.settings().areLocksActivated()) {
  +                    final LockKey lockKey = LockKey.composeLockKey(LockKey.
  +                            UPDATE_PAGE_TYPE,
  +                            thePage.getID(), thePage.getID());
  +                    final JahiaUser user = jParams.getUser();
  +                    if (lockService.acquire(lockKey, user,
  +                            user.getUserKey(),
  +                            jParams.getSessionState().
  +                                    getMaxInactiveInterval())) {
   
  -                    // since we cannot efficiently determine all the 
references
  -                    // to this page we do an entire cache flush.
  -                    /** todo is there a better way to do this ? */
  -                    cacheService.getHtmlCacheInstance().flush();
  -                    // #endif
  -                    // #ifdef LOCK
  -                } else {
  -                    // Prerequisites are NOT completed ! Damned ! Redirect 
the JSP
  -                    // output to lock informations.
  -                    LockEngine.getInstance().redirect(jParams, engineMap,
  -                            lockKey);
  +                        // since we cannot efficiently determine all the 
references
  +                        // to this page we do an entire cache flush.
  +                        /** todo is there a better way to do this ? */
  +                        cacheService.getHtmlCacheInstance().flush();
  +                        // #endif
  +                        // #ifdef LOCK
  +                    } else {
  +                        // Prerequisites are NOT completed ! Damned ! 
Redirect the JSP
  +                        // output to lock informations.
  +                        LockEngine.getInstance().redirect(jParams, engineMap,
  +                                lockKey);
  +                    }
                   }
  +                // #endif
  +
  +            } else {
  +                throw new JahiaForbiddenAccessException();
               }
  -            // #endif
           } else if (lastScreen.equals("rightsMgmt")) {
               if (engineMap.get("adminAccess") != null) {
                   final EngineValidationHelper evh = 
ManageRights.getInstance().
  @@ -382,24 +388,24 @@
                   throw new JahiaForbiddenAccessException();
               }
           } else if (theScreen.equals("versioning")) {
  -            // we don't need to free the lock when going to the versioning
  -            // engine because we can re-acquire a lock we already have.
  +            if (engineMap.get("writeAccess") != null
  +                    || engineMap.get("adminAccess") != null) {
  +
  +                // we don't need to free the lock when going to the 
versioning
  +                // engine because we can re-acquire a lock we already have.
   
  -            String goTo = jParams.getParameter("method");
  -            if (goTo == null || goTo.length() == 0) {
  -                goTo = "showOperationChoices";
  -            }
  -            logger.debug("Going to: " + goTo);
  -
  -            final Properties params = new Properties();
  -            params.put("method", goTo);
  -            params.put("pageid", String.valueOf(thePage.getID()));
  -            final String versioningURL = jParams.composeStrutsUrl(
  -                    "PagesVersioning", params, null);
  -
  -            engineMap.put(RENDER_TYPE_PARAM,
  -                    new Integer(JahiaEngine.RENDERTYPE_REDIRECT));
  -            engineMap.put(ENGINE_OUTPUT_FILE_PARAM, versioningURL);
  +                final Properties params = new Properties();
  +                params.put("method", "showOperationChoices");
  +                params.put("pageid", String.valueOf(thePage.getID()));
  +                final String versioningURL = jParams.composeStrutsUrl(
  +                        "PagesVersioning", params, null);
  +
  +                engineMap.put(RENDER_TYPE_PARAM,
  +                        new Integer(JahiaEngine.RENDERTYPE_REDIRECT));
  +                engineMap.put(ENGINE_OUTPUT_FILE_PARAM, versioningURL);
  +            } else {
  +                throw new JahiaForbiddenAccessException();
  +            }
           } else if (theScreen.equals("categories")) {
               ManageCategories.getInstance().handleActions(jParams, mode[0],
                       engineMap, new ContentPageKey(thePage.getID()),
  

Reply via email to