Author: bpapez
Date: Fri Jun 15 14:33:51 2007
New Revision: 711

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D711&repname=
=3Dcorporate_portal_templates_v2
Log:
issue TEMPLATES-212: 4.2 (certainly 5.x): adding a new blog could not be di=
rectly done by the users =

(url: http://www.jahia.net/jira/browse/TEMPLATES-212)

* add validation to blog container (title and date must be mandatory)
* set proper ACLs on adding blog pages for users
* make containerlist action menu available only to admins
* TEMPLATES-213, TEMPLATES-218: Make trackbacks work

Added:
    trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/BlogValidationBean.java
Modified:
    trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/BoxValidationBean.java
    trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/navigationValidationBean.java
    trunk/src/jsp/blogs/blog.jsp
    trunk/src/jsp/blogs/definitions.inc
    trunk/src/jsp/blogs/entries.inc
    trunk/src/jsp/blogs/eventlistener.inc
    trunk/src/jsp/blogs/list.inc

Added: trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation=
/beans/BlogValidationBean.java
URL: https://svndev.jahia.net/websvn/filedetails.php?path=3D/trunk/src/java=
/jahiatemplates/org/jahia/corporateportalv2/validation/beans/BlogValidation=
Bean.java&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/BlogValidationBean.java (added)
+++ trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/BlogValidationBean.java Fri Jun 15 14:33:51 2007
@@ -0,0 +1,6 @@
+package jahiatemplates.org.jahia.corporateportalv2.validation.beans;
+
+public interface BlogValidationBean {
+    public String getBlogTitle();
+    public String getBlogDate();
+}
\ No newline at end of file

Modified: trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validat=
ion/beans/BoxValidationBean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/java/jahiat=
emplates/org/jahia/corporateportalv2/validation/beans/BoxValidationBean.jav=
a&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/BoxValidationBean.java (original)
+++ trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/BoxValidationBean.java Fri Jun 15 14:33:51 2007
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and =

  * limitations under the License.
  */
-package org.jahia.cg71_templates.validation.beans;
+package jahiatemplates.org.jahia.corporateportalv2.validation.beans;
 =

 import org.jahia.data.containers.ContainerFacadeInterface;
 import org.jahia.data.containers.ContainerValidatorBase;

Modified: trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validat=
ion/beans/navigationValidationBean.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/java/jahiat=
emplates/org/jahia/corporateportalv2/validation/beans/navigationValidationB=
ean.java&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/navigationValidationBean.java (original)
+++ trunk/src/java/jahiatemplates/org/jahia/corporateportalv2/validation/be=
ans/navigationValidationBean.java Fri Jun 15 14:33:51 2007
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and =

  * limitations under the License.
  */
-package org.jahia.cg71_templates.validation.beans;
+package jahiatemplates.org.jahia.corporateportalv2.validation.beans;
 =

 import org.jahia.data.containers.ContainerFacadeInterface;
 import org.jahia.data.containers.ContainerValidatorBase;

Modified: trunk/src/jsp/blogs/blog.jsp
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/jsp/blogs/b=
log.jsp&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/jsp/blogs/blog.jsp (original)
+++ trunk/src/jsp/blogs/blog.jsp Fri Jun 15 14:33:51 2007
@@ -1,18 +1,18 @@
 <%--
 Copyright 2002-2006 Jahia Ltd
 =

-Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDD=
L), =

-Version 1.0 (the "License"), or (at your option) any later version; you ma=
y =

-not use this file except in compliance with the License. You should have =

-received a copy of the License along with this program; if not, you may ob=
tain =

-a copy of the License at =

+Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDD=
L),
+Version 1.0 (the "License"), or (at your option) any later version; you may
+not use this file except in compliance with the License. You should have
+received a copy of the License along with this program; if not, you may ob=
tain
+a copy of the License at
 =

  http://www.jahia.org/license/
 =

-Unless required by applicable law or agreed to in writing, software =

-distributed under the License is distributed on an "AS IS" BASIS, =

-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. =

-See the License for the specific language governing permissions and =

+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
 limitations under the License.
 --%><%@ include file=3D"../common/declarations.inc"%>
 <%@ include file=3D"../common/common_vars.inc"%>
@@ -63,7 +63,63 @@
             }
             %>
             </dl>
-            <div class=3D"xmlWrap"><div class=3D"xmlButton"><a class=3D"xm=
lButton" title=3D"<content:resourceBundle resourceBundle=3D'jahiatemplates.=
Corporate_portal_templates_v2' resourceName=3D'rss.title'/>" href=3D"<%=3Db=
ypassUrl%>/template/blog_rss_2_0.rss">RSS</a></div><div class=3D"spacer">&n=
bsp;</div></div>
+            <div class=3D"xmlWrap" style=3D"border:1px solid red;"><div cl=
ass=3D"xmlButton"><a class=3D"xmlButton" title=3D"<content:resourceBundle r=
esourceBundle=3D'jahiatemplates.Corporate_portal_templates_v2' resourceName=
=3D'rss.title'/>" href=3D"<%=3DbypassUrl%>/template/blog_rss_2_0.rss">RSS</=
a></div><div class=3D"spacer">&nbsp;</div></div>
+        </div>
+        <div style=3D"padding:15px 0 0 0;">
+        <%
+        JahiaContainerList subs =3D jData.containers().getContainerList( "=
subscriber_list" );
+        if(subs !=3D null){
+        //check if already registered
+        boolean isregistered=3Dfalse;
+        Enumeration enumsub=3Dsubs.getContainers();
+        while (enumsub.hasMoreElements()) {
+
+           JahiaContainer register =3D (JahiaContainer) enumsub.nextElemen=
t();
+           String uname =3D register.getFieldValue( "subscriber_username",=
 "" );
+           logger.info(uname);
+           if(uname.equals(jParams.getUser().getUsername ())){
+               isregistered=3Dtrue;
+               break;
+           }
+           }
+        if(request.getParameter("subscribe")!=3Dnull && request.getParamet=
er("subscribe").equals("true") && !isregistered){
+
+        JahiaContainer sub =3D new JahiaContainer(0,jData.getProcessingCon=
text().getJahiaID(),jData.getProcessingContext().getPageID(),subs.getID(),0=
, /* rank */subs.getAclID(),subs.getctndefid(),0, 2);
+            ServicesRegistry.getInstance().getJahiaContainersService().sav=
eContainer(sub, subs.getID(), jData.getProcessingContext());
+        sub.setLanguageCode(jData.getProcessingContext().getLocale().toStr=
ing());
+        sub.fieldsStructureCheck(jData.getProcessingContext());
+        JahiaField curField =3D sub.getField("subscriber_username");
+        String curFieldValue =3D jParams.getUser().getUsername ();
+        curField.setValue(curFieldValue);
+        curField.setObject(curFieldValue);
+        curField.save(jData.getProcessingContext());
+
+        curField =3D sub.getField("subscriber_mail");
+        curFieldValue =3D jParams.getUser().getUserProperty("email").getVa=
lue();
+        curField.setValue(curFieldValue);
+        curField.setObject(curFieldValue);
+        curField.save(jData.getProcessingContext());
+        // immediate validation
+        if (ServicesRegistry.getInstance().getWorkflowService().getWorkflo=
wMode(subs.getContentContainerList()) !=3D WorkflowService.INACTIVE) {
+                ServicesRegistry.getInstance().getWorkflowService().setWor=
kflowMode(subs.getContentContainerList(), WorkflowService.INACTIVE,null, nu=
ll,jData.getProcessingContext());
+                        }
+                        }
+                        if(!isregistered){
+                        String watch =3D "<img src=3D\"" + contextURL + "/=
img/push.gif\" width=3D\"32\" height=3D\"18\" border=3D\"0\" align=3D\"midd=
le\" />";
+ if (isLogged && !jParams.getUser().getUserProperty("email").getValue().eq=
uals("")){
+
+%>
+<%=3Dwatch%> <a href=3D"<%=3DbypassUrl%>?subscribe=3Dtrue" title=3D"email =
address:<%=3DjParams.getUser().getUserProperty("email").getValue()%>">watch=
 this blog, <%=3DjParams.getUser().getUsername ()%></a><br>
+<%
+} else if (isLogged) {
+%>
+<%=3Dwatch%><a href=3D"?subscribe=3Dfalse"> please fill you email adress i=
n user settings</a><br>
+<%
+}
+}
+
+}
+        %>
         </div>
     </td>
     <td><img src=3D"<content:contextURL/>/img/pix.gif" width=3D"25" height=
=3D"12" alt=3D""/></td>

Modified: trunk/src/jsp/blogs/definitions.inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/jsp/blogs/d=
efinitions.inc&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/jsp/blogs/definitions.inc (original)
+++ trunk/src/jsp/blogs/definitions.inc Fri Jun 15 14:33:51 2007
@@ -14,7 +14,10 @@
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
---%><content:declareContainerList name=3D"blogEntries" title=3D"List of en=
tries">
+--%>
+<content:declareContainerList name=3D"blogEntries" title=3D"List of entrie=
s"
+    containerBeanName=3D"jahiatemplates.org.jahia.corporateportalv2.valida=
tion.beans.BlogValidationBean"
+    validatorKey=3D"blogValidationBean">
 <content:declareContainer>
     <content:declareField name=3D"blogTitle" title=3D"Title" type=3D"Small=
Text"
         titleKey=3D"blog.title" bundleKey=3D"<%=3DresBundleID%>"/>
@@ -78,4 +81,11 @@
     </content:declareContainerList>
 =

 </content:declareContainer>
-</content:declareContainerList>
\ No newline at end of file
+</content:declareContainerList>
+
+<content:declareContainerList name=3D"subscriber_list" title=3D"subscriber=
 list">
+    <content:declareContainer>
+        <content:declareField name=3D"subscriber_username" title=3D"subscr=
iber_username" type=3D"SharedSmallText" titleKey=3D"blog.subscriber_usernam=
e" bundleKey=3D"<%=3DresBundleID%>"/>
+        <content:declareField name=3D"subscriber_mail" title=3D"subscriber=
_mail" type=3D"SharedSmallText" titleKey=3D"blog.subscriber_mail" bundleKey=
=3D"<%=3DresBundleID%>"/>
+    </content:declareContainer>
+    </content:declareContainerList>
\ No newline at end of file

Modified: trunk/src/jsp/blogs/entries.inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/jsp/blogs/e=
ntries.inc&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/jsp/blogs/entries.inc (original)
+++ trunk/src/jsp/blogs/entries.inc Fri Jun 15 14:33:51 2007
@@ -1,21 +1,20 @@
 <%--
 Copyright 2002-2006 Jahia Ltd
 =

-Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDD=
L), =

-Version 1.0 (the "License"), or (at your option) any later version; you ma=
y =

-not use this file except in compliance with the License. You should have =

-received a copy of the License along with this program; if not, you may ob=
tain =

-a copy of the License at =

+Licensed under the JAHIA COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (JCDD=
L),
+Version 1.0 (the "License"), or (at your option) any later version; you may
+not use this file except in compliance with the License. You should have
+received a copy of the License along with this program; if not, you may ob=
tain
+a copy of the License at
 =

  http://www.jahia.org/license/
 =

-Unless required by applicable law or agreed to in writing, software =

-distributed under the License is distributed on an "AS IS" BASIS, =

-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. =

-See the License for the specific language governing permissions and =

+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
 limitations under the License.
 --%>
-
 <content:jahiaPageForm name=3D"jahiapageform">
 <%
 if (requestedCategory !=3D null) {
@@ -26,7 +25,7 @@
 }
 if ( t !=3D -1 ){
     %><input type=3D"hidden" name=3D"t" value=3D"<%=3DString.valueOf(t)%>"=
/><%
-} =

+}
 %>
 <input type=3D"hidden" name=3D"range" value=3D"<%=3Drange%>"/>
 <content:containerList name=3D"blogEntries" windowSize=3D"25">
@@ -45,7 +44,8 @@
 <%
 JahiaContainerList entries =3D jData.containers().getContainerList( "blogE=
ntries" );
 if (entries !=3D null) {
-    entries.setIsContainersLoaded(false);
+    // Any reason here to force reloading the container list ?
+    //entries.setIsContainersLoaded(false);
     ContainerListBean entriesBean =3D new ContainerListBean(entries,jParam=
s);
     jData.gui().html().drawBeginActionMenu(entriesBean ,
         null, null, true, "", "jahiatemplates.Corporate_portal_templates_v=
2", null, out);
@@ -142,9 +142,11 @@
         <dt><a href=3D"<%=3DbypassUrl%>?entryId=3D<%=3Dentry.getID()%>"><%=
=3Dtitle%></a></dt>
         <dd class=3D"summary">
             <%=3DtoEmotion(excerpt,contextUrl + "/img/emotions/")%>
+        <div style=3D"text-align:right;margin:10px;"><br/>
             <a href=3D"<%=3DbypassUrl%>?entryId=3D<%=3Dentry.getID()%>" cl=
ass=3D"continued"><content:resourceBundle
                             resourceBundle=3D"jahiatemplates.Corporate_por=
tal_templates_v2"
                             resourceName=3D"blog.continued"/></a>
+        </div>
         </dd>
         <dd class=3D"posted">
             <a href=3D"<%=3DbypassUrl%>?entryId=3D<%=3Dentry.getID()%>"
@@ -260,12 +262,16 @@
                         resourceName=3D"blog.the"/> <%=3Dsdf.format( (new =
Date(lowerVal.getTime())) )%>
                     <%
                 } else {
+                String doc=3DjData.page().getDoc();
+                    long tdoc=3DLong.parseLong(doc);
+
                     %>
+
                     <content:resourceBundle resourceBundle=3D"jahiatemplat=
es.Corporate_portal_templates_v2"
-                        resourceName=3D"blog.from"/> <%=3Dsdf.format( (new=
 Date(lowerVal.getTime())) )%>
+                        resourceName=3D"blog.to"/> <%=3Dsdf.format( (new D=
ate(tdoc)) )%><!--<%=3Dsdf.format( (new Date(lowerVal.getTime())) )%>
                     <content:resourceBundle resourceBundle=3D"jahiatemplat=
es.Corporate_portal_templates_v2"
                         resourceName=3D"blog.to"/>
-                    <%=3Dsdf.format( (new Date(upperVal.getTime())) ) %>
+                    <%=3Dsdf.format( (new Date(upperVal.getTime())) ) %>-->
                     <%
                 }
             }

Modified: trunk/src/jsp/blogs/eventlistener.inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/jsp/blogs/e=
ventlistener.inc&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/jsp/blogs/eventlistener.inc (original)
+++ trunk/src/jsp/blogs/eventlistener.inc Fri Jun 15 14:33:51 2007
@@ -14,7 +14,12 @@
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. =

 See the License for the specific language governing permissions and =

 limitations under the License.
---%><%
+--%>
+<[EMAIL PROTECTED] import=3D"org.jahia.services.acl.JahiaBaseACL"%>
+<[EMAIL PROTECTED] import=3D"org.jahia.services.acl.ACLInfo"%>
+<[EMAIL PROTECTED] import=3D"org.jahia.hibernate.model.JahiaAclEntry"%>
+<[EMAIL PROTECTED] 
import=3D"org.jahia.services.usermanager.JahiaGroupManagerService"=
%>
+<%
 if ( "blogs".equals(theContainer.getDefinition().getName()) ){
     if ( "addContainerEngineAfterInit".equals(eventName) ) {
         logger.debug("Start eventlistner for event addContainerEngineAfter=
Init for blogs");
@@ -69,6 +74,23 @@
             }
         }
     } else if ( "containerAdded".equals(eventName) ) {
+        JahiaBaseACL theACL =3D new JahiaBaseACL(theContainer.getAclID());
+                =

+        theACL.setInheritance(ACLInfo.NO_INHERITANCE);
+            =

+        JahiaAclEntry readPermission =3D new JahiaAclEntry();
+        readPermission.setPermission(JahiaBaseACL.READ_RIGHTS, JahiaAclEnt=
ry.ACL_YES);
+        theACL.setGroupEntry(ServicesRegistry.getInstance().getJahiaGroupM=
anagerService().lookupGroup(
+                JahiaGroupManagerService.GUEST_GROUPNAME + ":" + jParams.g=
etSiteID()), readPermission);
+
+        JahiaAclEntry adminPermission =3D new JahiaAclEntry();
+        adminPermission.setPermission(JahiaBaseACL.READ_RIGHTS, JahiaAclEn=
try.ACL_YES);
+        adminPermission.setPermission(JahiaBaseACL.WRITE_RIGHTS, JahiaAclE=
ntry.ACL_YES);
+        adminPermission.setPermission(JahiaBaseACL.ADMIN_RIGHTS, JahiaAclE=
ntry.ACL_YES);
+        theACL.setUserEntry(jParams.getUser(), adminPermission);
+               =

+    =

+    =

         JahiaPage blogPage =3D (JahiaPage) theContainer.getFieldObject("bl=
ogPage");
         if (blogPage !=3D null) {
             logger.debug("Activate blogPage ["+blogPage.getID()+"]");
@@ -110,6 +132,7 @@
             updatedFields.add(new Integer(theField.getID()));
             logger.debug("Set value for field [blogDate] to : [" + theFiel=
d.getObject() +"]");
         }
+
         theField =3D theContainer.getField("blogAuthor");
         if (theField.getValue() =3D=3D null || "".equals(theField.getValue=
())) {
             String author =3D jParams.getUser().getUsername();
@@ -121,33 +144,47 @@
     } else if ( "containerAdded".equals(eventName) ) {
         logger.debug("Activate container ["+theContainer.getID()+"]");
         // container validation
-        Set languageCodes =3D new HashSet();
-        languageCodes.add(ContentObject.SHARED_LANGUAGE);
-        languageCodes.add(jParams.getLocale().toString());
-
-        JahiaSaveVersion saveVersion =3D
-            ServicesRegistry.getInstance().getJahiaVersionService().
-                getSiteSaveVersion(jParams.getSiteID());
-
-        StateModificationContext smc =3D new StateModificationContext(
-            new ContentContainerKey(theContainer.getID()), languageCodes);
-        smc.setDescendingInSubPages(false);
-
-        Enumeration childs =3D theContainer.getFields();
-        while (childs.hasMoreElements()) {
-            JahiaField child =3D (JahiaField)childs.nextElement();
-            ContentField field =3D child.getContentField();
-            if (field !=3D null) {
-                field.activate(languageCodes, saveVersion.getVersionID(),j=
Params, smc);
+        boolean substitutedElr =3D false;
+        try {
+            if (jParams.getEntryLoadRequest().isCurrent()) {
+                substitutedElr =3D true;
+                EntryLoadRequest elr =3D new EntryLoadRequest(EntryLoadReq=
uest.STAGING_WORKFLOW_STATE, 0,
+                        jParams.getEntryLoadRequest().getLocales());
+                jParams.setSubstituteEntryLoadRequest(elr);
+            }            =

+        // container validation
+            Set languageCodes =3D new HashSet();
+            languageCodes.add(ContentObject.SHARED_LANGUAGE);
+            languageCodes.add(jParams.getLocale().toString());
+
+            JahiaSaveVersion saveVersion =3D
+                ServicesRegistry.getInstance().getJahiaVersionService().
+                    getSiteSaveVersion(jParams.getSiteID());
+
+            StateModificationContext smc =3D new StateModificationContext(
+                   new ContentContainerKey(theContainer.getID()), languageCo=
des);
+            smc.setDescendingInSubPages(false);
+
+            Enumeration childs =3D theContainer.getFields();
+            while (childs.hasMoreElements()) {
+                JahiaField child =3D (JahiaField)childs.nextElement();
+                ContentField field =3D child.getContentField();
+                if (field !=3D null) {
+                    field.activate(languageCodes, saveVersion.getVersionID=
(),jParams, smc);
+                }
             }
-        }
-        JahiaContainersService jahiaContainersService =3D
-            ServicesRegistry.getInstance().getJahiaContainersService();
-        if (jahiaContainersService !=3D null) {
-            ActivationTestResults atr =3D jahiaContainersService.activateS=
tagedContainer(languageCodes,theContainer.getID(),
-                jParams.getUser(), saveVersion, jParams, smc);
-            logger.debug("ActivationTestResults is " + atr.toString());
-        }
+            JahiaContainersService jahiaContainersService =3D
+                ServicesRegistry.getInstance().getJahiaContainersService();
+            if (jahiaContainersService !=3D null) {
+                ActivationTestResults atr =3D jahiaContainersService.activ=
ateStagedContainer(languageCodes,theContainer.getID(),
+                           jParams.getUser(), saveVersion, jParams, smc);
+                logger.debug("ActivationTestResults is " + atr.toString());
+            }
+        } finally {
+              if (substitutedElr)
+                  jParams.resetSubstituteEntryLoadRequest();
+        }                =

+
     }
 }
 %>
\ No newline at end of file

Modified: trunk/src/jsp/blogs/list.inc
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/jsp/blogs/l=
ist.inc&rev=3D711&repname=3Dcorporate_portal_templates_v2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/jsp/blogs/list.inc (original)
+++ trunk/src/jsp/blogs/list.inc Fri Jun 15 14:33:51 2007
@@ -39,9 +39,15 @@
     <td class=3D"boxcontentborder1">
 =

         <content:containerList name=3D'blogs' id=3D"blogs">
-            <jahiaHtml:actionMenu name=3D"blogs" namePostFix=3D""
-                resourceBundle=3D"jahiatemplates.Corporate_portal_template=
s_v2">
-            <%
+            <% =

+            // if user is admin -> can access list action menu            =

+            ContainerListBean blogsBean =3D (ContainerListBean) pageContex=
t.findAttribute("blogs");
+            =

+            if (jParams.getUser().isAdminMember( jParams.getSiteID() )) { =

+                jData.gui().html().drawBeginActionMenu(blogsBean ,
+                        null, null, true, "", "jahiatemplates.Corporate_po=
rtal_templates", null, out);            =

+            }
+
             // get all pages with template definition name "Blog"
             JahiaPageDefinition pageDef =3D
                 ServicesRegistry.getInstance().getJahiaPageTemplateService=
()
@@ -75,8 +81,6 @@
                 }
             }
 =

-            ContainerListBean blogsBean =3D (ContainerListBean) pageContex=
t.findAttribute("blogs");
-
             boolean hasWriteAccessOnContainerList =3D blogsBean.getJahiaCo=
ntainerList().getID() =3D=3D 0 ?
                 jData.page().checkWriteAccess(jParams.getUser()) :
                 blogsBean.getJahiaContainerList().checkWriteAccess(jParams=
.getUser());
@@ -145,7 +149,12 @@
             %>
             </li>
             </ul>
-            </jahiaHtml:actionMenu>
+            <%
+            if (jParams.getUser().isAdminMember( jParams.getSiteID() )) { =

+                jData.gui().html().drawEndActionMenu(blogsBean ,
+                        null, null, true, "", "jahiatemplates.Corporate_po=
rtal_templates", null, out);            =

+            }
+            %>
         </content:containerList>
         </td>
 </tr>

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

Reply via email to