Author: shuber
Date: Fri Jun  1 14:18:54 2007
New Revision: 17438

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17438&repname=
=3Djahia
Log:
New performance improvements :
- HTML cache now has a new mode "expiration only" that de-activates JahiaLi=
nk usage, and uses time-based expiration for LIVE mode. EDIT mode cache is =
de-activated and never used. This should also help JAHIA-289 : "Minimize us=
e of ObjectLinks to track HTML cache dependencies" but doesn't solve it. Se=
e the new "outputCacheExpirationOnly" and "outputCacheDefaultExpirationDela=
y" properties in jahia.properties
- Configuration parameters have been added in jahia.properties file to de-a=
ctivate all pre-loading of ACLs and Workflow levels, so that Jahia may star=
tup faster. These new parameters are called : org.jahia.acl.preload_active =
and org.jahia.workflow.preload_active
- Added new permission called "Permission to enter EDIT mode", that allows =
to control on a site-wide basis access to the EDIT mode. This is recommende=
d to avoid the content permission checks on the whole page when we know tha=
t the user will not be allowed to enter edit mode. The Jahia fine-tuning ti=
ps will document the usage of this new permission.
- Added new system to extend the duration of a session when a user enters e=
dit mode. This is by default configured at the same session length as the d=
efault one, but this can be used for example to say that all content editor=
s may have 2 hour session timeout, while only browsing users could have a 1=
0 minute session length. This both saves memory and makes for a better expe=
rience for the content editors.
- Minor corrections (logging) =


Modified:
    branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces.properties
    branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces_en.properties
    branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces_fr.properties
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/core/Core_=
Engine.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/logout/Log=
out_Engine.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/operations/valves/=
CacheWriteValve.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/params/ParamBean.j=
ava
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/acl/Jahia=
ACLManagerService.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/applicati=
ons/ServletIncludeRequestWrapper.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/workflow/=
WorkflowService.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/settings/SettingsB=
ean.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/config/jahia.s=
keleton
    branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/spring/applica=
tioncontext-services.xml
    branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/administration/s=
tatus.jsp
    branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/operation=
buttons.inc

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrati=
onResources.properties
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/conf/java/JahiaAdministrationResources.properties&rev=3D17=
438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces.properties (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces.properties Fri Jun  1 14:18:54 2007
@@ -498,6 +498,7 @@
 org.jahia.admin.sitepermissions.permission.engines.actions.copy.label=3DCo=
py content
 org.jahia.admin.sitepermissions.permission.engines.actions.add.label=3DAdd=
 content
 org.jahia.admin.sitepermissions.permission.engines.actions.paste.label=3DP=
aste content
+org.jahia.admin.sitepermissions.permission.engines.actions.editMode.label=
=3DAccess to edit mode
 org.jahia.admin.sitepermissions.permission.engines.languages.en.label=3DEd=
it content in English
 org.jahia.admin.sitepermissions.permission.engines.languages.fr.label=3DEd=
it content in French
 org.jahia.admin.sitepermissions.permission.engines.languages.de.label=3DEd=
it content in German

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrati=
onResources_en.properties
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/conf/java/JahiaAdministrationResources_en.properties&rev=
=3D17438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces_en.properties (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces_en.properties Fri Jun  1 14:18:54 2007
@@ -498,6 +498,7 @@
 org.jahia.admin.sitepermissions.permission.engines.actions.copy.label=3DCo=
py content
 org.jahia.admin.sitepermissions.permission.engines.actions.add.label=3DAdd=
 content
 org.jahia.admin.sitepermissions.permission.engines.actions.paste.label=3DP=
aste content
+org.jahia.admin.sitepermissions.permission.engines.actions.editMode.label=
=3DAccess to edit mode
 org.jahia.admin.sitepermissions.permission.engines.languages.en.label=3DEd=
it content in English
 org.jahia.admin.sitepermissions.permission.engines.languages.fr.label=3DEd=
it content in French
 org.jahia.admin.sitepermissions.permission.engines.languages.de.label=3DEd=
it content in German

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrati=
onResources_fr.properties
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/conf/java/JahiaAdministrationResources_fr.properties&rev=
=3D17438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces_fr.properties (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/conf/java/JahiaAdministrationReso=
urces_fr.properties Fri Jun  1 14:18:54 2007
@@ -655,6 +655,7 @@
 org.jahia.admin.sitepermissions.permission.engines.actions.delete.label=3D=
Supprimer contenu
 org.jahia.admin.sitepermissions.permission.engines.actions.paste.label=3DC=
oller contenu
 org.jahia.admin.sitepermissions.permission.engines.actions.update.label=3D=
Mettre =C3=A0 jour contenu
+org.jahia.admin.sitepermissions.permission.engines.actions.editMode.label=
=3DAcc=C3=A8s au mode d'=C3=A9dition
 org.jahia.admin.sitepermissions.permission.engines.audit.ManageLogs_Engine=
.label=3DJournaux
 org.jahia.admin.sitepermissions.permission.engines.containerlistproperties=
.FieldRightsEngine.label=3DDroits sur les champs (pop-up)
 org.jahia.admin.sitepermissions.permission.engines.content.Edit.label=3D=
=C3=89dition de contenu

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/core=
/Core_Engine.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/engines/core/Core_Engine.java&rev=3D17438&r=
epname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/core/Core_=
Engine.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/core/Core_=
Engine.java Fri Jun  1 14:18:54 2007
@@ -248,8 +248,10 @@
      */
     private void postProcessCore (JahiaData jData)
             throws JahiaException {
-        if(!jData.getProcessingContext().settings().isEsiCacheActivated())
+        if(!jData.getProcessingContext().settings().isEsiCacheActivated() =
&&
+           !jData.getProcessingContext().settings().isOutputCacheExpiratio=
nOnly()) {
             handleAbsoluteReferencesChanges (jData);
+        }
     }
 =

     /**

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/logo=
ut/Logout_Engine.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/engines/logout/Logout_Engine.java&rev=3D174=
38&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/logout/Log=
out_Engine.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/engines/logout/Log=
out_Engine.java Fri Jun  1 14:18:54 2007
@@ -29,6 +29,7 @@
 import org.jahia.exceptions.JahiaException;
 import org.jahia.params.ParamBean;
 import org.jahia.params.ProcessingContext;
+import org.jahia.params.SessionState;
 import org.jahia.registries.EnginesRegistry;
 import org.jahia.registries.ServicesRegistry;
 import org.jahia.services.applications.ServletDispatchingProvider;
@@ -293,6 +294,15 @@
             jParams.changePage(contentPage);
 =

         }
+
+        // we now restore the session timeout to it's initial value.
+        SessionState sessionState =3D jParams.getSessionState();
+        if (sessionState.getAttribute("previousInactiveInterval") !=3D nul=
l) {
+            int previousInactiveInterval =3D ((Integer) sessionState.getAt=
tribute("previousInactiveInterval")).intValue();
+            sessionState.setMaxInactiveInterval(previousInactiveInterval);
+            sessionState.removeAttribute("previousInactiveInterval");
+        }
+
         if (logoutPage.hasActiveEntries()
                 && logoutPage.checkGuestAccess(jParams.getSiteID())) {
             if (jParams instanceof ParamBean) {

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/operations/v=
alves/CacheWriteValve.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/operations/valves/CacheWriteValve.java&rev=
=3D17438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/operations/valves/=
CacheWriteValve.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/operations/valves/=
CacheWriteValve.java Fri Jun  1 14:18:54 2007
@@ -111,7 +111,13 @@
         if (logger.isDebugEnabled()) logger.debug("Storing generated conte=
nt into the HTML Cache...");
 =

         final Map notCacheablePage =3D generatorQueue.getNotCacheablePage(=
);
+        boolean doWeCache =3D true;
+        if (ProcessingContext.EDIT.equals(jParams.getOperationMode()) &&
+            jParams.settings().isOutputCacheExpirationOnly()) {
+            doWeCache =3D false;
+        }
         if ( ("core".equals(jParams.getEngine())) &&
+                doWeCache &&
              ( (ProcessingContext.CACHE_ON.equals(jParams.getOriginalCache=
Status())) ||
                (ProcessingContext.CACHE_ONLYUPDATE.equals(jParams.getOrigi=
nalCacheStatus())) ||
                (ProcessingContext.CACHE_OFFONCE.equals(jParams.getOriginal=
CacheStatus()))

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/params/Param=
Bean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/params/ParamBean.java&rev=3D17438&repname=
=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/params/ParamBean.j=
ava (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/params/ParamBean.j=
ava Fri Jun  1 14:18:54 2007
@@ -127,6 +127,7 @@
 import org.jahia.services.usermanager.JahiaUserManagerService;
 import org.jahia.services.version.EntryLoadRequest;
 import org.jahia.services.version.StateModificationContext;
+import org.jahia.services.acl.JahiaBaseACL;
 import org.jahia.settings.SettingsBean;
 import org.jahia.taglibs.esi.JesiConst;
 import org.jahia.tools.files.FileUpload;
@@ -3222,45 +3223,92 @@
 =

             if (COMPARE.equals(getParameter(OPERATION_MODE_PARAMETER))) {
                 this.opMode =3D COMPARE;
-                // User has write rights to edit?
-                if (! (contentPage.checkWriteAccess(theUser,true)
-                       || contentPage.checkAdminAccess(theUser,true)))
-                // No -> Normal mode !
-                {
+
+                if (REGISTRY.getJahiaACLManagerService().getSiteActionPerm=
ission("engines.actions.editMode", getUser(), JahiaBaseACL.READ_RIGHTS, get=
SiteID()) <=3D 0) {
                     this.opMode =3D NORMAL;
+                } else {
+                    // User has write rights to edit?
+                    if (! (contentPage.checkWriteAccess(theUser,true)
+                           || contentPage.checkAdminAccess(theUser,true)))
+                    // No -> Normal mode !
+                    {
+                        this.opMode =3D NORMAL;
+                    } else {
+                        // we are in an "editing" mode, we expand the sess=
ion's expiration time
+                        // we first save the previous inactive interval, t=
hat we will restore on logout
+                        if (session.getAttribute("previousInactiveInterval=
") =3D=3D null) {
+                            int previousInactiveInterval =3D session.getMa=
xInactiveInterval();
+                            session.setAttribute("previousInactiveInterval=
", new Integer(previousInactiveInterval));
+                            session.setMaxInactiveInterval(settings().getE=
ditModeSessionTimeout());
+                        }
+                    }
                 }
             }
 =

             if (EDIT.equals(getParameter(OPERATION_MODE_PARAMETER))) {
                 this.opMode =3D EDIT;
-                // NK : EDIT_MODE_PAGE_ACCESS_ISSUE
-                // Edit Mode allowed even the user has no write access on =
page
 =

-                // User has write rights to edit?
-                if (! (contentPage.checkWriteAccess(theUser,true)
-                       || contentPage.checkAdminAccess(theUser,true)))
-                // No -> Normal mode !
-                {
+                if (REGISTRY.getJahiaACLManagerService().getSiteActionPerm=
ission("engines.actions.editMode", getUser(), JahiaBaseACL.READ_RIGHTS, get=
SiteID()) <=3D 0) {
                     this.opMode =3D NORMAL;
+                } else {
+                    // NK : EDIT_MODE_PAGE_ACCESS_ISSUE
+                    // Edit Mode allowed even the user has no write access=
 on page
+
+                    // User has write rights to edit?
+                    if (! (contentPage.checkWriteAccess(theUser,true)
+                           || contentPage.checkAdminAccess(theUser,true)))
+                    // No -> Normal mode !
+                    {
+                        this.opMode =3D NORMAL;
+                    } else {
+                        // we are in an "editing" mode, we expand the sess=
ion's expiration time
+                        // we first save the previous inactive interval, t=
hat we will restore on logout
+                        if (session.getAttribute("previousInactiveInterval=
") =3D=3D null) {
+                            int previousInactiveInterval =3D session.getMa=
xInactiveInterval();
+                            session.setAttribute("previousInactiveInterval=
", new Integer(previousInactiveInterval));
+                            session.setMaxInactiveInterval(settings().getE=
ditModeSessionTimeout());
+                        }
+                    }
                 }
             }
 =

             if (PREVIEW.equals(getParameter(OPERATION_MODE_PARAMETER))) {
                 this.opMode =3D PREVIEW;
-                // NK : EDIT_MODE_PAGE_ACCESS_ISSUE
-                // User has write rights to edit?
 =

-                if (! (contentPage.checkWriteAccess(theUser,true)
-                       || contentPage.checkAdminAccess(theUser,true)))
-                // No -> Normal mode !
-                {
+                if (REGISTRY.getJahiaACLManagerService().getSiteActionPerm=
ission("engines.actions.editMode", getUser(), JahiaBaseACL.READ_RIGHTS, get=
SiteID()) <=3D 0) {
                     this.opMode =3D NORMAL;
+                } else {
+
+                    // NK : EDIT_MODE_PAGE_ACCESS_ISSUE
+                    // User has write rights to edit?
+
+                    if (! (contentPage.checkWriteAccess(theUser,true)
+                           || contentPage.checkAdminAccess(theUser,true)))
+                    // No -> Normal mode !
+                    {
+                        this.opMode =3D NORMAL;
+                    } else {
+                        // we are in an "editing" mode, we expand the sess=
ion's expiration time
+                        // we first save the previous inactive interval, t=
hat we will restore on logout
+                        if (session.getAttribute("previousInactiveInterval=
") =3D=3D null) {
+                            int previousInactiveInterval =3D session.getMa=
xInactiveInterval();
+                            session.setAttribute("previousInactiveInterval=
", new Integer(previousInactiveInterval));
+                            session.setMaxInactiveInterval(settings().getE=
ditModeSessionTimeout());
+                        }
+                    }
                 }
             }
 =

             if (DEBUG.equals(getParameter(OPERATION_MODE_PARAMETER))) {
                 if (contentPage.checkAdminAccess(theUser)) {
                     this.opMode =3D DEBUG;
+                    // we are in an "editing" mode, we expand the session'=
s expiration time
+                    // we first save the previous inactive interval, that =
we will restore on logout
+                    if (session.getAttribute("previousInactiveInterval") =
=3D=3D null) {
+                        int previousInactiveInterval =3D session.getMaxIna=
ctiveInterval();
+                        session.setAttribute("previousInactiveInterval", n=
ew Integer(previousInactiveInterval));
+                        session.setMaxInactiveInterval(settings().getEditM=
odeSessionTimeout());
+                    }
                 } else {
                     this.opMode =3D NORMAL;
                 }

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/acl=
/JahiaACLManagerService.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java&re=
v=3D17438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/acl/Jahia=
ACLManagerService.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/acl/Jahia=
ACLManagerService.java Fri Jun  1 14:18:54 2007
@@ -121,11 +121,12 @@
         }
         mACLCache =3D cacheService.createCacheInstance(ACL_TREE_CACHE);
 =

-        int preloadCount =3D this.settingsBean.getAclPreloadCount();
-
-        logger.debug("Preloading " + preloadCount + " ACLs from the databa=
se");
-        manager.preloadACLs(mACLCache);
+        if (settingsBean.isAclPreloadActive()) {
+            int preloadCount =3D this.settingsBean.getAclPreloadCount();
 =

+            logger.info("Preloading " + preloadCount + " ACLs from the dat=
abase...");
+            manager.preloadACLs(mACLCache);
+        }
     }
 =

     // Javadoc inherited from parent

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/app=
lications/ServletIncludeRequestWrapper.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/applications/ServletIncludeRequest=
Wrapper.java&rev=3D17438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/applicati=
ons/ServletIncludeRequestWrapper.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/applicati=
ons/ServletIncludeRequestWrapper.java Fri Jun  1 14:18:54 2007
@@ -1151,7 +1151,10 @@
                 logger.debug ("Exception : " + sw.toString ());
             }
         }
+
+       if (logger.isDebugEnabled()) {
        logger.debug ("setAttribute("+name+", " + o + ")");
+       }
 =

         if (emulatedURL !=3D null) {
             // Note : we used to have here some code to deactivate setting

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/wor=
kflow/WorkflowService.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/workflow/WorkflowService.java&rev=
=3D17438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/workflow/=
WorkflowService.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/workflow/=
WorkflowService.java Fri Jun  1 14:18:54 2007
@@ -131,21 +131,23 @@
         modeCache =3D cacheService.createCacheInstance(WORKFLOWMODE_CACHEN=
AME);
         linkedObjectsCache =3D cacheService.createCacheInstance(WORKFLOWLI=
NKEDOBJECT_CACHENAME);
 =

-        try {
-            Enumeration e =3D ServicesRegistry.getInstance().getJahiaSites=
Service().getSites();
-            while (e.hasMoreElements()) {
-                JahiaSite jahiaSite =3D (JahiaSite) e.nextElement();
-                if (jahiaSite !=3D null) {
-                    ContentPage homeContentPage =3D jahiaSite.getHomeConte=
ntPage();
-                    if (homeContentPage !=3D null) {
-                        ContentObjectKey k =3D (ContentObjectKey) homeCont=
entPage.getObjectKey();
-
-                        preload(k, Jahia.getSettings().getWorkflowLevelsPr=
eloadCount());
+        if (Jahia.getSettings().isWorkflowLevelsPreloadActive()) {
+            try {
+                Enumeration e =3D ServicesRegistry.getInstance().getJahiaS=
itesService().getSites();
+                while (e.hasMoreElements()) {
+                    JahiaSite jahiaSite =3D (JahiaSite) e.nextElement();
+                    if (jahiaSite !=3D null) {
+                        ContentPage homeContentPage =3D jahiaSite.getHomeC=
ontentPage();
+                        if (homeContentPage !=3D null) {
+                            ContentObjectKey k =3D (ContentObjectKey) home=
ContentPage.getObjectKey();
+                            logger.info("Preloading " + Jahia.getSettings(=
).getWorkflowLevelsPreloadCount() + " levels of workflow states for site "+=
jahiaSite.getSiteKey()+"...");
+                            preload(k, Jahia.getSettings().getWorkflowLeve=
lsPreloadCount());
+                        }
                     }
                 }
+            } catch (Exception ex) {
+                logger.error("Error during preloading of workflow levels",=
 ex);
             }
-        } catch (Exception e1) {
-            e1.printStackTrace();  //To change body of catch statement use=
 File | Settings | File Templates.
         }
     }
 =


Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/settings/Set=
tingsBean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/settings/SettingsBean.java&rev=3D17438&repn=
ame=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/settings/SettingsB=
ean.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/settings/SettingsB=
ean.java Fri Jun  1 14:18:54 2007
@@ -89,11 +89,13 @@
     private String jahiaNewTemplatesDiskPath;
     private String jahiaNewWebAppsDiskPath;
     private String jahiaSharedTemplatesDiskPath;
+
     private String jspContext;
     private String templatesContext;
     private String htmlEditorsContext;
     private String enginesContext;
     private String javascriptContext;
+
     private String jahiaJavaScriptHttpPath;
     private String classDiskPath;
     private String componentsDiskPath;
@@ -205,6 +207,7 @@
 =

     // Output cache expiration delay in milliseconds
     private long outputCacheDefaultExpirationDelay;
+    private boolean outputCacheExpirationOnly =3D false;
 =

     // Activation / deactivation of site ID in URLs
     private boolean siteIDInURL;
@@ -222,11 +225,13 @@
     // Default site
     private String defaultSite;
 =

+    private boolean aclPreloadActive =3D true;
     // this value is used to preload ACLs upon Jahia startup in order to a=
void
     // the real time cost of loading them upon first access. This value *m=
ust*
     // be smaller than the maximum size of the cache.
     private int aclPreloadCount =3D 0;
 =

+    private boolean workflowLevelsPreloadActive =3D true;
     private int workflowLevelsPreloadCount =3D 3;
 =

     // should the webdav filenames be converted into full-ascii
@@ -280,26 +285,33 @@
     private String defaultURIEncoding;
     private int preloadCountForPageProperties;
     private boolean jmxActivated;
+
     private int cookieAuthIDLength;
     private String cookieAuthUserPropertyName;
     private String cookieAuthCookieName;
     private int cookieAuthMaxAgeInSeconds;
     private boolean cookieAuthRenewalActivated;
+    private boolean cookieAuthActivated;
+
     private String authPipelineFileName;
     private String authPipelineClassName;
+
     private String processPipelineClassName;
     private String processPipelineFileName;
-    private boolean cookieAuthActivated;
+
     private String slideContentDiskPath;
     private String tmpContentDiskPath;
     private long templatesObserverInterval;
     private long webAppsObserverInterval;
     private String schedulerConfigFile;
     private String ramSchedulerConfigFile;
+
     private boolean isProcessingServer;
+
     private String siteServerNameTestURLExpr;
     private int siteServerNameTestConnectTimeout;
     private int siteURLPortOverride =3D -1;
+
     private boolean isSiteErrorEnabled;
 =

     private String jetspeedDeploymentDirectory;
@@ -349,6 +361,8 @@
     private int pageGenerationMaxRetryCount =3D 10000;
     private int pageGenerationLoopWaitTime =3D 1000; // in milliseconds
 =

+    private int editModeSessionTimeout =3D 2*60*60; // 2 hours
+
     /**
      * Default constructor.
      *
@@ -510,6 +524,8 @@
             // output cache default expiration delay
             outputCacheDefaultExpirationDelay =3D getLong ("outputCacheDef=
aultExpirationDelay", -1);
 =

+            outputCacheExpirationOnly =3D getBoolean("outputCacheExpiratio=
nOnly", false);
+
             // ESI cache activation / deactivation
             esiCacheActivated =3DgetBoolean ("esiCacheActivated", false);
             if (!LicenseActionChecker.isAuthorizedByLicense("org.jahia.ser=
vices.esi.EsiService", 0)) {
@@ -601,9 +617,10 @@
             // multi language default language code property.
             defaultLanguageCode =3D getString ("org.jahia.multilang.defaul=
t_language_code", "en");
 =

-            // multi language default language code property.
+            aclPreloadActive =3D getBoolean("org.jahia.acl.preload_active"=
, true);
             aclPreloadCount =3D getInt("org.jahia.acl.preload_count", 0 /*=
 preload count is deactivated by default */);
 =

+            workflowLevelsPreloadActive =3D getBoolean("org.jahia.workflow=
.preload_active", true);
             workflowLevelsPreloadCount =3D getInt("org.jahia.workflow.prel=
oad_count", 1 /* preload count is deactivated by default */);
 =

             preloadCountForPageProperties =3D getInt("org.jahia.pages.prop=
erties.preload_count", 2000);
@@ -752,6 +769,8 @@
             pageGenerationMaxRetryCount =3D getInt("pageGenerationMaxRetry=
Count", 10000);
             pageGenerationLoopWaitTime =3D getInt("pageGenerationLoopWaitT=
ime", 1000);
 =

+            editModeSessionTimeout =3D getInt("editModeSessionTimeout", 2*=
60*60);
+
         } catch (NullPointerException npe) {
             logger.debug ("Properties file is not valid...!", npe);
         } catch (NumberFormatException nfe) {
@@ -1093,6 +1112,15 @@
         return aclPreloadCount;
     }
 =

+
+    public boolean isAclPreloadActive() {
+        return aclPreloadActive;
+    }
+
+    public void setAclPreloadActive(boolean aclPreloadActive) {
+        this.aclPreloadActive =3D aclPreloadActive;
+    }
+
     public int getWorkflowLevelsPreloadCount() {
         return workflowLevelsPreloadCount;
     }
@@ -2014,7 +2042,6 @@
         this.pageGenerationLoopWaitTime =3D pageGenerationLoopWaitTime;
     }
 =

-
     public int getCacheMaxGroups() {
         return cacheMaxGroups;
     }
@@ -2022,4 +2049,28 @@
     public void setCacheMaxGroups(int cacheMaxGroups) {
         this.cacheMaxGroups =3D cacheMaxGroups;
     }
+
+    public boolean isOutputCacheExpirationOnly() {
+        return outputCacheExpirationOnly;
+    }
+
+    public void setOutputCacheExpirationOnly(boolean outputCacheExpiration=
Only) {
+        this.outputCacheExpirationOnly =3D outputCacheExpirationOnly;
+    }
+
+    public boolean isWorkflowLevelsPreloadActive() {
+        return workflowLevelsPreloadActive;
+    }
+
+    public void setWorkflowLevelsPreloadActive(boolean workflowLevelsPrelo=
adActive) {
+        this.workflowLevelsPreloadActive =3D workflowLevelsPreloadActive;
+    }
+
+    public int getEditModeSessionTimeout() {
+        return editModeSessionTimeout;
+    }
+
+    public void setEditModeSessionTimeout(int editModeSessionTimeout) {
+        this.editModeSessionTimeout =3D editModeSessionTimeout;
+    }
 }

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/config/j=
ahia.skeleton
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/webapp/WEB-INF/etc/config/jahia.skeleton&rev=3D17438&repna=
me=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/config/jahia.s=
keleton (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/config/jahia.s=
keleton Fri Jun  1 14:18:54 2007
@@ -157,7 +157,10 @@
 ######################################################################
 ### Cache settings ###################################################
 ######################################################################
-
+# These settings controls all the caches that are integrated in Jahia,
+# except for the Hibernate ones that are controlled from the
+# WEB-INF/etc/spring/applicationcontext-hibernate.xml configuration
+# file.
 #
 # By default cache have no limits. If you want to set a size
 # limit for a cache, use the following syntax :
@@ -225,6 +228,18 @@
 outputCacheActivated                                   =3D   true
 # the following value is in milliseconds, set to -1 for no time expiration
 outputCacheDefaultExpirationDelay                      =3D   -1
+# The following setting is designed to be used for large sites (10'000
+# pages and more), and will switch the output cache to a expiration-only
+# mode. This means that all pages in live mode will not be invalidated
+# immediately when content is published, but only after the expiration
+# of the cache entry. This also deactivates the output cache in EDIT
+# mode, which might have a performance impact. Also, this deactivates
+# the generation of the JahiaLink HTML references building, which is
+# a performance problem when sites reach large sizes. So if your
+# site is getting large, it is recommended that you switch this
+# variable to true and that you set a reasonable value for the
+# outputCacheDefaultExpirationDelay.
+outputCacheExpirationOnly                              =3D   false
 =

 ######################################################################
 ### ESI fragment-based Output cache  #################################
@@ -424,15 +439,23 @@
 ######################################################################
 ### ACLs   ###########################################################
 ######################################################################
-# Specifies the number of ACLs to preload at Jahia startup.
+# Specifies whether we should preload ACLs from database on startup.
+org.jahia.acl.preload_active                           =3D   true
+# Specifies the number of ACLs to preload at Jahia startup. This
+# variable will do nothing if the preloading is not activated
+# in the above variable.
 org.jahia.acl.preload_count                            =3D   10000
 =

 ######################################################################
 ### Workflows states   ###############################################
 ######################################################################
+# Specifies whether the workflow levels should be precalculated upon
+# Jahia startup.
+org.jahia.workflow.preload_active                      =3D   true
 # This settings specifies the amount of level of page tree hierarchy
 # to preload upon Jahia startup. The preload will calculate the
-# workflow status per language at startup.
+# workflow status per language at startup. This variable will do
+# nothing if the above preload_active variable is set to false
 org.jahia.workflow.preload_count                       =3D   3
 =

 ######################################################################
@@ -844,7 +867,7 @@
 #site.error.enabled                                                            
                =3D true
 =

 ######################################################################
-### Connection Timeout For Prodcution Job ############################
+### Connection Timeout For Production Job ############################
 ######################################################################
 # This setting allows you to specify the timeout for connecting this
 # jahia instance to a distant jahia when using production job
@@ -884,4 +907,19 @@
 # is a lot (>10'000) pages, the flat view should be disabled for
 # performance reasons. Use the AJAXed tree view instead.
 #
-enableSelectPageFlatView                                =3D true
\ No newline at end of file
+enableSelectPageFlatView                                =3D true
+
+######################################################################
+### Session settings #################################################
+######################################################################
+# The editModeSessionTimeout variable controls the session timeout
+# (in seconds, not milliseconds !) for a user that has entered
+# edit mode, compare mode or preview mode. Jahia administrators are
+# encouraged to augment this value so that content editors may spend
+# more time editing a site without suffering from session timeouts.
+# At the same time, the default timeout for "regular" users could be
+# reduced to a lower value (by default 30 minutes on Tomcat) so that
+# less memory is used by session data. In Tomcat, the default session
+# setting is located in the tomcat/conf/web.xml file, under the tag
+# <session-timeout>.
+editModeSessionTimeout                                  =3D 30*60
\ No newline at end of file

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/spring/a=
pplicationcontext-services.xml
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/webapp/WEB-INF/etc/spring/applicationcontext-services.xml&=
rev=3D17438&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/spring/applica=
tioncontext-services.xml (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/etc/spring/applica=
tioncontext-services.xml Fri Jun  1 14:18:54 2007
@@ -490,6 +490,7 @@
                                 <value>org.jahia.actions.sites.*.engines.a=
ctions.delete</value>
                                 <value>org.jahia.actions.sites.*.engines.a=
ctions.copy</value>
                                 <value>org.jahia.actions.sites.*.engines.a=
ctions.paste</value>
+                                <value>org.jahia.actions.sites.*.engines.a=
ctions.editMode</value>
                             </list>
                         </entry>
                         <entry>

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/administra=
tion/status.jsp
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/webapp/jsp/jahia/administration/status.jsp&rev=3D17438&rep=
name=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/administration/s=
tatus.jsp (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/administration/s=
tatus.jsp Fri Jun  1 14:18:54 2007
@@ -198,20 +198,15 @@
             <td width=3D"100%">
                 <%=3DcurCache.getName()%> : <strong><jahia:adminResourceBu=
ndle resourceName=3D"<%=3DresourceKey%>"/></strong>
                 <br>
-                <%=3DcurCache.size()%>
+                <%=3DcurCache.size()%>&nbsp;
                 <% if(curCache.size() > 1){
                 %><jahia:adminResourceBundle resourceName=3D"org.jahia.adm=
in.entries.label"/><%
             } else {
             %><jahia:adminResourceBundle resourceName=3D"org.jahia.admin.e=
ntrie.label"/><%
-                } %>&nbsp;/&nbsp;
-                <% if(cacheLimit =3D=3D -1) {
-                %><jahia:adminResourceBundle resourceName=3D"org.jahia.adm=
in.status.ManageStatus.unlimited.label"/><%
-            } else {
-            %><%=3DLong.toString(cacheLimit)+"MB"%>&nbsp;<jahia:adminResou=
rceBundle resourceName=3D"org.jahia.admin.status.ManageStatus.max.label"/><%
                 } %>
                 <br>
                 <jahia:adminResourceBundle resourceName=3D"org.jahia.admin=
.status.ManageStatus.successfulHits.label"/> :
-                <%=3DcurCache.getSuccessHits()%> / <%=3DcurCache.getTotalH=
its()%>
+                <%=3DcurCache.getSuccessHits()%> / <%=3DcurCache.getTotalH=
its()%>&nbsp;
                 <jahia:adminResourceBundle resourceName=3D"org.jahia.admin=
.status.ManageStatus.totalHits.label"/>,
                 <jahia:adminResourceBundle resourceName=3D"org.jahia.admin=
.status.ManageStatus.efficiency.label"/> :
                 <%=3DefficiencyStr%> %

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/ope=
rationbuttons.inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/webapp/jsp/jahia/topbar/operationbuttons.inc&rev=3D17438&r=
epname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/operation=
buttons.inc (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/jsp/jahia/topbar/operation=
buttons.inc Fri Jun  1 14:18:54 2007
@@ -15,26 +15,32 @@
 See the License for the specific language governing permissions and =

 limitations under the License.
 --%><%
-    boolean writeAccess =3D jData.page().checkWriteAccess(user, true);
-    if (writeAccess || jData.page().checkAdminAccess(user, true)) {
 =

-        // reduce the scope of this local var to avoid conflicts with corp=
orate2: please check against both corporate sets before commit
-        ContentPage thecontentPage =3D jData.getProcessingContext().getCon=
tentPage();
-        String thelocale =3D jParams.getLocale().toString();
-        boolean hasActiveEntries =3D thecontentPage.hasEntries(ContentPage=
.ACTIVE_PAGE_INFOS, thelocale);
-        String pageTitle =3D thecontentPage.getTitle(jData.getProcessingCo=
ntext());
-
-        boolean isAvailable =3D true;
-        //check the isAvailable only if tbp display activated
-        /*if(tbp_visu.equalsIgnoreCase("true"))*/
-        isAvailable =3D thecontentPage.isAvailable();
+    boolean writeAccess =3D false;    =

+    boolean editModePermission =3D ServicesRegistry.getInstance().getJahia=
ACLManagerService().getSiteActionPermission("engines.actions.editMode", jPa=
rams.getUser(), JahiaBaseACL.READ_RIGHTS, jParams.getSiteID()) > 0;
+    if (editModePermission) {
+        // we have a permission to use edit mode, now let's check if we ha=
ve write access
+        // on the content.
+        writeAccess =3D jData.page().checkWriteAccess(user, true);
+        if (writeAccess || jData.page().checkAdminAccess(user, true)) {
+
+            // reduce the scope of this local var to avoid conflicts with =
corporate2: please check against both corporate sets before commit
+            ContentPage thecontentPage =3D jData.getProcessingContext().ge=
tContentPage();
+            String thelocale =3D jParams.getLocale().toString();
+            boolean hasActiveEntries =3D thecontentPage.hasEntries(Content=
Page.ACTIVE_PAGE_INFOS, thelocale);
+            String pageTitle =3D thecontentPage.getTitle(jData.getProcessi=
ngContext());
+
+            boolean isAvailable =3D true;
+            //check the isAvailable only if tbp display activated
+            /*if(tbp_visu.equalsIgnoreCase("true"))*/
+            isAvailable =3D thecontentPage.isAvailable();
 %>
 <div class=3D"tab">
     <ul>
         <%
-            // Display Live button
-            if (hasActiveEntries && isAvailable) {
-                //String liveUrl =3D jData.gui().drawNormalModeLink();
+                // Display Live button
+                if (hasActiveEntries && isAvailable) {
+                    //String liveUrl =3D jData.gui().drawNormalModeLink();
         %>
         <li <%=3D jData.gui().isNormalMode() ? "class=3D'selected'" : ""%>>
             <a href=3D"<%=3DjData.gui().drawNormalModeLink()%>">
@@ -44,38 +50,38 @@
             </a>
         </li>
         <%
-            }
+                }
 =

-//            boolean writeAccess =3D thecontentPage.checkWriteAccess(user=
);
-            Integer languageState =3D (Integer) languagesStates.get(theloc=
ale);
-            if ( !jData.gui().isNormalMode() ){
-            // Display Preview & compare buttons
-            boolean displayPreview =3D false;
-            boolean isSharedInStaging_1 =3D false;
-            Integer sharedState_1 =3D (Integer) languagesStates.get("share=
d");
-            boolean isMarkedForDelete =3D thecontentPage.isStagedEntryMark=
edForDeletion(thelocale);
-            if (sharedState_1 !=3D null) {
-                if (sharedState_1.intValue() > EntryLoadRequest.ACTIVE_WOR=
KFLOW_STATE) {
-                    isSharedInStaging_1 =3D true;
-                    displayPreview =3D true;
-                }
-            }
-            if (!displayPreview && languageState !=3D null) {
-                if (languageState.intValue() > EntryLoadRequest.ACTIVE_WOR=
KFLOW_STATE) {
-                    displayPreview =3D true;
-                }
-            }
-            if (isMarkedForDelete)
-            {
-                displayPreview =3D false;
-                isSharedInStaging_1 =3D false;
-            }
-
-            displayPreview =3D (displayPreview && isAvailable && (pageTitl=
e !=3D null) );
-
-            if ((displayPreview || isSharedInStaging_1 || jData.gui().isCo=
mpareMode()) && writeAccess) {
-                if (displayPreview) {
-                    //String previewUrl =3D jData.gui().drawPreviewModeLin=
k();
+    //            boolean writeAccess =3D thecontentPage.checkWriteAccess(=
user);
+                Integer languageState =3D (Integer) languagesStates.get(th=
elocale);
+                if ( !jData.gui().isNormalMode() ){
+                // Display Preview & compare buttons
+                boolean displayPreview =3D false;
+                boolean isSharedInStaging_1 =3D false;
+                Integer sharedState_1 =3D (Integer) languagesStates.get("s=
hared");
+                boolean isMarkedForDelete =3D thecontentPage.isStagedEntry=
MarkedForDeletion(thelocale);
+                if (sharedState_1 !=3D null) {
+                    if (sharedState_1.intValue() > EntryLoadRequest.ACTIVE=
_WORKFLOW_STATE) {
+                        isSharedInStaging_1 =3D true;
+                        displayPreview =3D true;
+                    }
+                }
+                if (!displayPreview && languageState !=3D null) {
+                    if (languageState.intValue() > EntryLoadRequest.ACTIVE=
_WORKFLOW_STATE) {
+                        displayPreview =3D true;
+                    }
+                }
+                if (isMarkedForDelete)
+                {
+                    displayPreview =3D false;
+                    isSharedInStaging_1 =3D false;
+                }
+
+                displayPreview =3D (displayPreview && isAvailable && (page=
Title !=3D null) );
+
+                if ((displayPreview || isSharedInStaging_1 || jData.gui().=
isCompareMode()) && writeAccess) {
+                    if (displayPreview) {
+                        //String previewUrl =3D jData.gui().drawPreviewMod=
eLink();
         %>
         <li <%=3D jData.gui().isPreviewMode() ? "class=3D'selected'" : ""%=
>>
             <a href=3D"<%=3DjData.gui().drawPreviewModeLink()%>">
@@ -85,9 +91,9 @@
             </a>
         </li>
         <%
-            }
-            if (hasActiveEntries) {
-                //String compareUrl =3D jData.gui().drawRevDifferenceModeL=
ink(1, jData.params().getOperationMode());
+                }
+                if (hasActiveEntries) {
+                    //String compareUrl =3D jData.gui().drawRevDifferenceM=
odeLink(1, jData.params().getOperationMode());
         %>
         <li <%=3D jData.gui().isCompareMode() ? "class=3D'selected'" : ""%=
>>
             <a href=3D"<%=3DjData.gui().drawRevDifferenceModeLink(1, jData=
.params().getOperationMode())%>">
@@ -97,12 +103,12 @@
             </a>
         </li>
         <%
+                    }
                 }
-            }
-            }
-            // Display Edit button
-            if (writeAccess) {
-                //String editUrl =3D jData.gui().drawEditModeLink();
+                }
+                // Display Edit button
+                if (writeAccess) {
+                    //String editUrl =3D jData.gui().drawEditModeLink();
         %>
         <li <%=3D jData.gui().isEditMode() ? "class=3D'selected'" : ""%>>
             <a href=3D"<%=3DjData.gui().drawEditModeLink()%>">
@@ -112,10 +118,11 @@
             </a>
         </li>
         <%
-            }
+                }
         %>
     </ul>
 </div>
 <%
+        }
     }
 %>

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to