xlawrence    2005/12/28 16:58:39 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.37      +53 -54    
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.36&r2=1.37&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.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- PageProperties_Engine.java        16 Dec 2005 13:07:26 -0000      1.36
  +++ PageProperties_Engine.java        28 Dec 2005 15:58:38 -0000      1.37
  @@ -1,4 +1,4 @@
  -// $Id: PageProperties_Engine.java,v 1.36 2005/12/16 13:07:26 knguyen Exp $
  +// $Id: PageProperties_Engine.java,v 1.37 2005/12/28 15:58:38 xlawrence Exp $
   //
   //
   //                                   ____.
  @@ -131,8 +131,7 @@
        * @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;
   
  @@ -151,6 +150,7 @@
               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,45 +251,39 @@
                   }
               }
           } else if (lastScreen.equals("versioning")) {
  -            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);
  +            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().
  @@ -388,24 +382,24 @@
                   throw new JahiaForbiddenAccessException();
               }
           } else if (theScreen.equals("versioning")) {
  -            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.
  +            // we don't need to free the lock when going to the versioning
  +            // engine because we can re-acquire a lock we already have.
   
  -                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();
  -            }
  +            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);
           } else if (theScreen.equals("categories")) {
               ManageCategories.getInstance().handleActions(jParams, mode[0],
                       engineMap, new ContentPageKey(thePage.getID()),
  @@ -901,9 +895,11 @@
                       
ProcessingContext.CACHE_MODE_PARAMETER.equals(pageURLKey)) {
   
                   engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyIsReservedWord.label",
 pageURLKey));
  +                engineMessages.saveMessages(((ParamBean) 
jParams).getRequest());
                   return false;
               } else if 
(pageURLKey.startsWith(ProcessingContext.CONTAINER_SCROLL_PREFIX_PARAMETER)) {
                   engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyIsReservedWord.label",
 pageURLKey));
  +                engineMessages.saveMessages(((ParamBean) 
jParams).getRequest());
                   return false;
               }
               // now we must test whether it has been used already or not.
  @@ -916,6 +912,7 @@
                       if 
((curProperty.getName().equals(PageProperty.PAGE_URL_KEY_PROPNAME)) &&
                               (curProperty.getPageID() != 
pageTempBean.getID())) {
                           engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyIsDuplicate.label",
 pageURLKey));
  +                        engineMessages.saveMessages(((ParamBean) 
jParams).getRequest());
                           return false;
                       }
                   }
  @@ -938,6 +935,7 @@
                       (pageURLKey.indexOf('+') != -1) ||
                       (pageURLKey.indexOf('#') != -1)) {
                   engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyHasInvalidChars.label",
 pageURLKey));
  +                engineMessages.saveMessages(((ParamBean) 
jParams).getRequest());
                   return false;
               }
   
  @@ -949,6 +947,7 @@
                       int curChar = (int) pageURLKey.charAt(i);
                       if ((curChar < 32) || (curChar > 127)) {
                           engineMessages.add("pageProperties", new 
EngineMessage("org.jahia.engines.pages.PageProperties_Engine.urlKeyHasInvalidChars.label",
 pageURLKey));
  +                        engineMessages.saveMessages(((ParamBean) 
jParams).getRequest());
                           return false;
                       }
                   }
  

Reply via email to