Author: bpapez
Date: Wed Sep 26 12:00:07 2007
New Revision: 18663

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18663&repname=
=3Djahia
Log:
http://www.jahia.net/jira/browse/JAHIA-2367: SP3: Double login required on =
first connection after reboot when accessing directly to a 403 page
- rollback the removing of the title =3D=3D null check
- now I have extended the check in the JahiaPage constructor to not only ch=
eck whether the current page has active entries, but also if it has active =
entries in the requested locale, otherwise switch to staging

Modified:
    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/params/ProcessingC=
ontext.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/pages/Con=
tentPage.java
    branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/pages/Jah=
iaPage.java

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=3D18663&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 Wed Sep 26 12:00:07 2007
@@ -726,92 +726,8 @@
     public ArrayList getLocales(final boolean allowMixLanguages)
             throws JahiaException {
 =

-        // first we test if we have already this list once, as this method
-        // is going to be called a lot.
-        if (getLocaleList() !=3D null) {
-            return getLocaleList();
-        }
-
-        List newLocaleList =3D new ArrayList();
-
-        List siteLanguages;
-        try {
-            siteLanguages =3D this.getSite().getLanguageSettingsAsLocales(=
true);
-        } catch (Throwable t) {
-            logger.warn("Exception while getting language settings as loca=
les",
-                    t);
-            siteLanguages =3D new ArrayList();
-        }
-
-        if (getRequest() !=3D null) {
-            // STEP 1 : let's retrieve the current session locale
-            try {
-                setCurrentLocale((Locale) this.getSession().getAttribute(
-                        SESSION_LOCALE));
-                if (getCurrentLocale() !=3D null
-                        && siteLanguages.contains(getCurrentLocale())) {
-                    newLocaleList.add(getCurrentLocale());
-                }
-            } catch (JahiaSessionExpirationException jsee) {
-                logger
-                        .debug(
-                                "Session expiration, cannot add language s=
etting from session",
-                                jsee);
-            }
-
-            // STEP 3 : retrieve the browser locales
-            final Enumeration browserLocales =3D getRequest().getLocales();
-            while (browserLocales.hasMoreElements()) {
-                final Locale curLocale =3D (Locale) browserLocales.nextEle=
ment();
-                if (siteLanguages.contains(curLocale)) {
-                    if (!newLocaleList.contains(curLocale)) {
-                        newLocaleList.add(curLocale);
-                    }
-                } else if (curLocale.getCountry().length() !=3D 0) {
-                    final Locale langOnlyLocale =3D new Locale(curLocale
-                            .getLanguage());
-                    if (siteLanguages.contains(langOnlyLocale)) {
-                        if (!newLocaleList.contains(langOnlyLocale)) {
-                            newLocaleList.add(langOnlyLocale);
-                        }
-                    }
-                }
-            }
-        }
-        // STEP 4 : retrieve the site settings locales
-        try {
-            final Vector siteLanguageSettings =3D this.getSite()
-                    .getLanguageSettings();
-            if (siteLanguageSettings !=3D null) {
-                boolean firstSiteActiveLanguage =3D true;
-                for (int i =3D 0; i < siteLanguageSettings.size(); i++) {
-                    final SiteLanguageSettings curSetting =3D (SiteLanguag=
eSettings) siteLanguageSettings
-                            .elementAt(i);
-                    if (curSetting.isActivated()) {
-                        final Locale tempLocale =3D LanguageCodeConverters
-                                .languageCodeToLocale(curSetting.getCode()=
);
-                        if (!newLocaleList.contains(tempLocale)) {
-                            newLocaleList.add(tempLocale);
-                        }
-                        if (firstSiteActiveLanguage) {
-                            ParamBean.defaultParameterValues.setProperty(
-                                    ParamBean.LANGUAGE_CODE, curSetting
-                                            .getCode());
-                            firstSiteActiveLanguage =3D false;
-                        }
-                    } else {
-                        logger.debug("Not adding language "
-                                + curSetting.getCode()
-                                + " because it is currently deactivated.");
-                    }
-                }
-            }
-        } catch (JahiaException je) {
-            logger.debug("Cannot retrieve site language settings", je);
-        }
-
-        testLocaleList(newLocaleList, allowMixLanguages);
-        return getLocaleList();
+        return getLocales(allowMixLanguages,
+                getRequest() !=3D null ? getRequest().getLocales() : null);
     }
 =

     // -------------------------------------------------------------------=
------

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/params/Proce=
ssingContext.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/params/ProcessingContext.java&rev=3D18663&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/params/ProcessingC=
ontext.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/params/ProcessingC=
ontext.java Wed Sep 26 12:00:07 2007
@@ -1129,9 +1129,15 @@
      * =

      * @return an ArrayList of Locale objects that contain the list of loc=
ale that are active for the current session, user and site.
      */
-    public ArrayList getLocales(final boolean allowMixLanguages)
+     public ArrayList getLocales(final boolean allowMixLanguages)
             throws JahiaException {
 =

+        return getLocales(allowMixLanguages, null);
+    }
+
+    protected ArrayList getLocales(final boolean allowMixLanguages,
+            Enumeration browserLocales) throws JahiaException {
+
         // first we test if we have already this list once, as this method
         // is going to be called a lot.
         if (getLocaleList() !=3D null) {
@@ -1144,7 +1150,8 @@
         try {
             siteLanguages =3D this.getSite().getLanguageSettingsAsLocales(=
true);
         } catch (Throwable t) {
-            t.printStackTrace();
+            logger.warn("Exception while getting language settings as loca=
les",
+                    t);
             siteLanguages =3D new ArrayList();
         }
 =

@@ -1156,13 +1163,25 @@
             newLocaleList.add(getCurrentLocale());
         }
 =

-        /*
-         * // todo : Implement user language preferences before activate t=
hese check if (!getUser().isMixLanguagesActive()) {
-         * testLocaleList(localeList); return localeList; } // STEP 2 : le=
t's retrieve the user settings locales Vector userLanguageCodes =3D
-         * this.getUser().getLanguageCodes(); if (userLanguageCodes !=3D n=
ull) { for (int i =3D 0; i < userLanguageCodes.size(); i++) { Locale
-         * tempLocale =3D LanguageCodeConverters.languageCodeToLocale((Str=
ing) userLanguageCodes.elementAt(i)); localeList.add(tempLocale); } }
-         * if (getUser().isUserLanguagesOnlyActive()) { testLocaleList(loc=
aleList); return localeList; }
-         */
+        // STEP 3 : retrieve the browser locales
+        if (browserLocales !=3D null) {
+            while (browserLocales.hasMoreElements()) {
+                final Locale curLocale =3D (Locale) browserLocales.nextEle=
ment();
+                if (siteLanguages.contains(curLocale)) {
+                    if (!newLocaleList.contains(curLocale)) {
+                        newLocaleList.add(curLocale);
+                    }
+                } else if (curLocale.getCountry().length() !=3D 0) {
+                    final Locale langOnlyLocale =3D new Locale(curLocale
+                            .getLanguage());
+                    if (siteLanguages.contains(langOnlyLocale)) {
+                        if (!newLocaleList.contains(langOnlyLocale)) {
+                            newLocaleList.add(langOnlyLocale);
+                        }
+                    }
+                }
+            }
+        }
 =

         // STEP 4 : retrieve the site settings locales
         try {

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/pag=
es/ContentPage.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/pages/ContentPage.java&rev=3D18663=
&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/pages/Con=
tentPage.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/pages/Con=
tentPage.java Wed Sep 26 12:00:07 2007
@@ -248,7 +248,7 @@
         // We need to check if there is still some page infos.
         // it could be empty when called this method after deleting a page
         // that exists only in staging
-        if (mPageInfos.size() > 0) {
+        if (!mPageInfos.isEmpty()) {
             // let's flush the cache of all the pages referencing this one.
             int siteID =3D getJahiaID();
             JahiaSite site =3D ServicesRegistry.getInstance()
@@ -312,7 +312,7 @@
                     WorkflowEvent theEvent =3D new WorkflowEvent(this, thi=
s, user, curInfo.getLanguageCode(), false);
                     ServicesRegistry.getInstance().getJahiaEventService().=
fireObjectChanged(theEvent);
                 } catch (JahiaException e) {
-                    e.printStackTrace();
+                    logger.warn("Exception while firing event", e);
                 }
             }
         }
@@ -634,13 +634,12 @@
             if (!page.checkReadAccess(user)) {
                 return null;
             }
-// Commented due to JAHIA-2367 - uncomment again if there are other side e=
ffects to it
-//            if (!operationMode.equals(ProcessingContext.EDIT) && !operat=
ionMode.equals(ProcessingContext.COMPARE)) {
+            if (!operationMode.equals(ProcessingContext.EDIT) && !operatio=
nMode.equals(ProcessingContext.COMPARE)) {
 //                // only allow null titles if in edit mode
-//                if (page.getTitle() =3D=3D null) {
-//                    return null;
-//                }
-//            }
+                if (page.getTitle() =3D=3D null) {
+                    return null;
+                }
+            }
             if (!operationMode.equals(ProcessingContext.NORMAL)
                     && !operationMode.equals(ProcessingContext.COMPARE)) {
                 // only return page in edit or preview mode if we have wri=
te
@@ -846,7 +845,7 @@
                 locales.remove(lr.getFirstLocale(true));
                 lr.setLocales(locales);
             }
-        } while ("".equals(title) && lr.getFirstLocale(true) !=3D null);
+        } while (title.length() =3D=3D 0 && lr.getFirstLocale(true) !=3D n=
ull);
 =

         if (htmlCompliant) {
             return JahiaTools.text2html(title);
@@ -1393,7 +1392,7 @@
             while (stagingPageInfosIt.hasNext()) {
                 String languageCode =3D (String) stagingPageInfosIt.next();
                 String pageTitle =3D ((JahiaPageInfo) mStagingPageInfos.ge=
t(languageCode)).getTitle();
-                if (pageTitle !=3D null && !pageTitle.equals("")) {
+                if (pageTitle !=3D null && pageTitle.length() > 0) {
                     titles.put(languageCode, pageTitle);
                 }
             }
@@ -2143,7 +2142,7 @@
     protected JahiaPageInfo getPageInfoVersion(EntryLoadRequest loadReques=
t, boolean isWrite,
                                                boolean ignoreLanguage) {
 =

-        if (mPageInfos.size() < 1) {
+        if (mPageInfos.isEmpty()) {
             logger.debug("No page info for page, can't access database dat=
a");
             return null;
         }
@@ -2372,7 +2371,7 @@
                     JahiaPageInfo sourceInfo =3D null;
                     // first we must know if there are staging versions we=
 can
                     // copy the data from :
-                    if (mStagingPageInfos.size() =3D=3D 0) {
+                    if (mStagingPageInfos.isEmpty()) {
                         // no staging page infos yet, we must copy from th=
e active
                         // versions
 =

@@ -2389,7 +2388,7 @@
                         */
 =

                         // NK : We just need to copy an entry no matter wh=
at language it is ?
-                        if (mActivePageInfos.size() > 0) {
+                        if (!mActivePageInfos.isEmpty()) {
                             sourceInfo =3D
                                     (JahiaPageInfo) mActivePageInfos.value=
s().iterator().next();
                         }
@@ -2411,7 +2410,7 @@
                         */
 =

                         // NK : We just need to copy an entry no matter wh=
at language it is ?
-                        if (mStagingPageInfos.size() > 0) {
+                        if (!mStagingPageInfos.isEmpty()) {
                             sourceInfo =3D
                                     (JahiaPageInfo) mStagingPageInfos.valu=
es().iterator().next();
                         }
@@ -2729,7 +2728,7 @@
                         JahiaEvent je =3D new JahiaEvent(this, jParams, cu=
rPageInfo);
                         JahiaEventGeneratorBaseService.getInstance().fireA=
cceptPage(je);
                     } catch (JahiaException e) {
-                        e.printStackTrace();
+                        logger.warn("Exception while firing event", e);
                     }
                     // Nicol=C3=83=C2=A1s Charczewski - Neoris Argentina -=
 added 31/03/2006 - End
 =

@@ -2856,7 +2855,7 @@
                                                         curPageFieldContai=
ner.getID(),
                                                         loadRequest);
 =

-                                        for (int j =3D 0; j < fieldIDs.siz=
e(); j++) {
+                                        for (int j =3D 0, fieldIDSize =3D =
fieldIDs.size(); j < fieldIDSize; j++) {
                                             int fieldID =3D ((Integer) fie=
ldIDs.elementAt(j)).intValue();
                                             if (fieldID !=3D curFieldID) {
                                                 ContentField currentField =
=3D
@@ -3028,7 +3027,6 @@
                         }
                         return activationTestResults;
                     }
-
                 }
             }
         }
@@ -3062,7 +3060,7 @@
                                         "Error while creating activation t=
est node result",
                                         cnfe);
                     }
-                } else if ("".equals(curPageInfo.getTitle().trim())) {
+                } else if (curPageInfo.getTitle().trim().length() =3D=3D 0=
) {
                     // empty title, let's signal it if mixed language mode=
 is not activated
                     if (!theSite.isMixLanguagesActive()) {
                         activationTestResults
@@ -3573,7 +3571,7 @@
     private boolean hasEntry(EntryStateable entryState) {
         Iterator pageInfoIter =3D mPageInfos.iterator();
         if ((entryState.getWorkflowState() < ContentObjectEntryState.WORKF=
LOW_STATE_ACTIVE) &&
-                (mArchivedPageInfos.size() =3D=3D 0)) {
+                mArchivedPageInfos.isEmpty()) {
             ArrayList locales =3D new ArrayList();
             locales.add(
                     LanguageCodeConverters.languageCodeToLocale(entryState=
.getLanguageCode()));
@@ -3694,7 +3692,7 @@
      *         page
      */
     public boolean hasActiveEntries() {
-        return mActivePageInfos.size() > 0;
+        return !mActivePageInfos.isEmpty();
     }
 =

     /**
@@ -3704,7 +3702,7 @@
      *         page
      */
     public boolean hasStagingEntries() {
-        return this.mStagingPageInfos.size() > 0;
+        return !mStagingPageInfos.isEmpty();
     }
 =

     /**
@@ -3727,38 +3725,15 @@
      */
     public boolean hasEntries(int pageInfosFlag, String languageCode) {
         boolean hasEntries =3D false;
-        if ((pageInfosFlag & 0x01) !=3D 0) {
+        if (!hasEntries && (pageInfosFlag & ACTIVE_PAGE_INFOS) !=3D 0 || (=
pageInfosFlag & 0x08) !=3D 0) {
             hasEntries =3D mActivePageInfos.containsKey(languageCode);
         }
-        if ((pageInfosFlag & 0x02) !=3D 0) {
+        if (!hasEntries && (pageInfosFlag & STAGING_PAGE_INFOS) !=3D 0 || =
(pageInfosFlag & 0x08) !=3D 0) {
             hasEntries |=3D mStagingPageInfos.containsKey(languageCode);
         }
-        if ((pageInfosFlag & 0x04) !=3D 0) {
-            // ensure to load versioning entries
-            try {
-                loadVersioningEntryStates();
-            } catch (Throwable t) {
-                logger.debug("Exception ocured loading versining entries",=
 t);
-            }
+        if (!hasEntries && (pageInfosFlag & ARCHIVED_PAGE_INFOS) !=3D 0 ||=
 (pageInfosFlag & 0x08) !=3D 0) {
             hasEntries |=3D hasArchivedPageInfos(languageCode);
         }
-        if ((pageInfosFlag & 0x08) !=3D 0) {
-            hasEntries =3D mActivePageInfos.containsKey(languageCode);
-            if (hasEntries) {
-                return true;
-            }
-            hasEntries =3D mStagingPageInfos.containsKey(languageCode);
-            if (hasEntries) {
-                return true;
-            }
-            // ensure to load versioning entries
-            try {
-                loadVersioningEntryStates();
-            } catch (Throwable t) {
-                logger.debug("Exception ocured loading versining entries",=
 t);
-            }
-            return hasArchivedPageInfos(languageCode);
-        }
         return hasEntries;
     }
 =

@@ -3772,20 +3747,20 @@
      */
     public boolean hasEntries(int pageInfosFlag) {
         boolean hasEntries =3D false;
-        if ((pageInfosFlag & 0x01) !=3D 0) {
-            hasEntries =3D mActivePageInfos.size() > 0;
+        if ((pageInfosFlag & ACTIVE_PAGE_INFOS) !=3D 0) {
+            hasEntries =3D !mActivePageInfos.isEmpty();
         }
-        if ((pageInfosFlag & 0x02) !=3D 0) {
-            hasEntries |=3D mStagingPageInfos.size() > 0;
+        if (!hasEntries && (pageInfosFlag & STAGING_PAGE_INFOS) !=3D 0) {
+            hasEntries |=3D !mStagingPageInfos.isEmpty();
         }
-        if ((pageInfosFlag & 0x04) !=3D 0) {
+        if (!hasEntries && (pageInfosFlag & ARCHIVED_PAGE_INFOS) !=3D 0) {
             // ensure to load versioning entries
             try {
                 loadVersioningEntryStates();
             } catch (Throwable t) {
-                logger.debug("Exception ocured loading versining entries",=
 t);
+                logger.debug("Exception ocured loading versioning entries"=
, t);
             }
-            hasEntries |=3D mArchivedPageInfos.size() > 0;
+            hasEntries |=3D !mArchivedPageInfos.isEmpty();
         }
         return hasEntries;
     }
@@ -3877,7 +3852,7 @@
             try {
                 return ServicesRegistry.getInstance().getWorkflowService()=
.getLanguagesStates(this);
             } catch (JahiaException e) {
-                e.printStackTrace();
+                logger.warn("Exception while retrieving language entry sta=
tes", e);
                 return new HashMap();
             }
         } else {
@@ -4225,7 +4200,7 @@
                         JahiaPageInfo pageInfo =3D (JahiaPageInfo) version=
edPageInfos.get(i);
                         this.mArchivedPageInfos.add(pageInfo);
                     }
-                    if (versionedPageInfos.size() > 0) {
+                    if (!versionedPageInfos.isEmpty()) {
                         mPageInfos.addAll(versionedPageInfos);
                         rebuildStatusMaps();
                     }
@@ -4554,10 +4529,10 @@
         // now let's get any active entry that we currently have for this =
page
         // if there exists at least one.
         JahiaPageInfo anyStagingOrActivePageInfo =3D null;
-        if (mStagingPageInfos.size() > 0) {
+        if (!mStagingPageInfos.isEmpty()) {
             anyStagingOrActivePageInfo =3D
                     (JahiaPageInfo) mStagingPageInfos.values().iterator().=
next();
-        } else if (mActivePageInfos.size() > 0) {
+        } else if (!mActivePageInfos.isEmpty()) {
             anyStagingOrActivePageInfo =3D
                     (JahiaPageInfo) mActivePageInfos.values().iterator().n=
ext();
         }
@@ -4962,7 +4937,7 @@
         ArrayList childs =3D this.getChilds(user, loadRequest);
         ArrayList filteredChilds =3D new ArrayList();
         ContentObject child;
-        for (int i =3D 0; i < childs.size(); i++) {
+        for (int i =3D 0, childSize =3D childs.size(); i < childSize; i++)=
 {
             child =3D (ContentObject) childs.get(i);
             if (child instanceof ContentContainerList) {
                 filteredChilds.addAll(((ContentContainerList) child).getCh=
ildsForTimeBasedPublishing(user, loadRequest, operationMode));

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/pag=
es/JahiaPage.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/services/pages/JahiaPage.java&rev=3D18663&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/services/pages/Jah=
iaPage.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/services/pages/Jah=
iaPage.java Wed Sep 26 12:00:07 2007
@@ -117,14 +117,20 @@
         // ( for some reason, it was not actived ), so change the loadRequ=
est to
         // staging ohterwhise calls to getType(), getJahiaID() will fail !=
!!!
         EntryLoadRequest newLoadRequest =3D loadRequest;
-        if (contentPage !=3D null && !contentPage.hasActiveEntries ()
-            && loadRequest !=3D null && loadRequest.isCurrent ()) {
-            newLoadRequest =3D
-                    new EntryLoadRequest (EntryLoadRequest.STAGING_WORKFLO=
W_STATE,
-                                          0, loadRequest.getLocales ());
-            newLoadRequest.setWithDeleted (loadRequest.isWithDeleted ());
-            newLoadRequest.setWithMarkedForDeletion (loadRequest.isWithMar=
kedForDeletion ());
-            mEntryLoadRequest =3D newLoadRequest;
+        if (loadRequest !=3D null && loadRequest.isCurrent()
+                && contentPage !=3D null) {
+            if (!contentPage.hasActiveEntries()
+                    || (!contentPage.getSite().isMixLanguagesActive() && !=
contentPage
+                            .hasEntries(ContentPage.ACTIVE_PAGE_INFOS,
+                                    loadRequest.getFirstLocale(true).toStr=
ing()))) {
+                newLoadRequest =3D new EntryLoadRequest(
+                        EntryLoadRequest.STAGING_WORKFLOW_STATE, 0, loadRe=
quest
+                                .getLocales());
+                newLoadRequest.setWithDeleted(loadRequest.isWithDeleted());
+                newLoadRequest.setWithMarkedForDeletion(loadRequest
+                        .isWithMarkedForDeletion());
+                mEntryLoadRequest =3D newLoadRequest;
+            }
         }
         if (mPageTemplate =3D=3D null) {
             // retrieve the staging

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

Reply via email to