svn commit: r544732 - in /ofbiz/trunk/applications/content: data/ script/org/ofbiz/content/content/ script/org/ofbiz/content/data/ script/org/ofbiz/content/permission/ servicedef/ src/org/ofbiz/content/cms/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r544732 - in /ofbiz/trunk/applications/content: data/ script/org/ofbiz/content/content/ script/org/ofbiz/content/data/ script/org/ofbiz/content/permission/ servicedef/ src/org/ofbiz/content/cms/

byersa-3
Author: byersa
Date: Tue Jun  5 22:30:17 2007
New Revision: 544732

URL: http://svn.apache.org/viewvc?view=rev&rev=544732
Log:
Some content mods done in the course of trying to get forums to work in ecommerce.
Added two services.

createArticleContent is meant to be a more general version of postBlogEntry.

getSubContentWithPermCheck adds a content permission check inside the loop - returning only records
  that have the right permission.

Modified CmsEvents.cms to return "success" instead of null.

Modified:
    ofbiz/trunk/applications/content/data/ForumDemoData.xml
    ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
    ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml
    ofbiz/trunk/applications/content/script/org/ofbiz/content/permission/ContentPermissionServices.xml
    ofbiz/trunk/applications/content/servicedef/services.xml
    ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java

Modified: ofbiz/trunk/applications/content/data/ForumDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/ForumDemoData.xml?view=diff&rev=544732&r1=544731&r2=544732
==============================================================================
--- ofbiz/trunk/applications/content/data/ForumDemoData.xml (original)
+++ ofbiz/trunk/applications/content/data/ForumDemoData.xml Tue Jun  5 22:30:17 2007
@@ -30,26 +30,26 @@
 
     <!-- forums -->
     <Content contentId="ASK" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreFORUM" contentName="Ask the Experts" description="Ask the Experts" childBranchCount="0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-02 20:06:50.782" lastUpdatedTxStamp="2006-05-02 20:06:50.646" createdStamp="2006-05-01 13:07:23.198" createdTxStamp="2006-05-01 13:07:22.778"/>
-    <ContentAssoc contentId="ASK" contentIdTo="WebStoreFORUM" contentAssocTypeId="SUBSITE" fromDate="2004-03-01 12:00:00.0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-01 13:07:23.201" lastUpdatedTxStamp="2006-05-01 13:07:22.778" createdStamp="2006-05-01 13:07:23.201" createdTxStamp="2006-05-01 13:07:22.778"/>
+    <ContentAssoc contentIdTo="ASK" contentId="WebStoreFORUM" contentAssocTypeId="SUBSITE" fromDate="2004-03-01 12:00:00.0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-01 13:07:23.201" lastUpdatedTxStamp="2006-05-01 13:07:22.778" createdStamp="2006-05-01 13:07:23.201" createdTxStamp="2006-05-01 13:07:22.778"/>
     <ContentAttribute contentId="ASK" attrName="publishOperation" attrValue="HAS_USER_ROLE"/><!-- do we need this? -->
     
     <Content contentId="GIZMOS" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreFORUM" statusId="CTNT_PUBLISHED" contentName="Gizmos" description="Gizmos" childBranchCount="3" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-03 08:49:38.728" lastUpdatedTxStamp="2006-05-03 08:49:38.534" createdStamp="2006-05-01 13:07:23.161" createdTxStamp="2006-05-01 13:07:22.778"/>
-    <ContentAssoc contentId="GIZMOS" contentIdTo="WebStoreFORUM" contentAssocTypeId="SUBSITE" fromDate="2004-03-01 12:00:00.0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-01 13:07:23.166" lastUpdatedTxStamp="2006-05-01 13:07:22.778" createdStamp="2006-05-01 13:07:23.166" createdTxStamp="2006-05-01 13:07:22.778"/>
+    <ContentAssoc contentIdTo="GIZMOS" contentId="WebStoreFORUM" contentAssocTypeId="SUBSITE" fromDate="2004-03-01 12:00:00.0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-01 13:07:23.166" lastUpdatedTxStamp="2006-05-01 13:07:22.778" createdStamp="2006-05-01 13:07:23.166" createdTxStamp="2006-05-01 13:07:22.778"/>
     <ContentAttribute contentId="GIZMOS" attrName="publishOperation" attrValue="HAS_USER_ROLE"/>
     
     <Content contentId="WIDGETS" contentTypeId="WEB_SITE_PUB_PT" ownerContentId="WebStoreFORUM" statusId="CTNT_IN_PROGRESS" contentName="Widgets" description="Widgets" childBranchCount="0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-02 20:06:46.214" lastUpdatedTxStamp="2006-05-02 20:06:45.781" createdStamp="2006-05-01 13:07:23.039" createdTxStamp="2006-05-01 13:07:22.778"/>
-    <ContentAssoc contentId="WIDGETS" contentIdTo="WebStoreFORUM" contentAssocTypeId="SUBSITE" fromDate="2004-03-01 12:00:00.0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-01 13:07:23.126" lastUpdatedTxStamp="2006-05-01 13:07:22.778" createdStamp="2006-05-01 13:07:23.126" createdTxStamp="2006-05-01 13:07:22.778"/>
+    <ContentAssoc contentIdTo="WIDGETS" contentId="WebStoreFORUM" contentAssocTypeId="SUBSITE" fromDate="2004-03-01 12:00:00.0" createdDate="2004-03-01 12:00:00.0" createdByUserLogin="admin" lastUpdatedStamp="2006-05-01 13:07:23.126" lastUpdatedTxStamp="2006-05-01 13:07:22.778" createdStamp="2006-05-01 13:07:23.126" createdTxStamp="2006-05-01 13:07:22.778"/>
     <ContentAttribute contentId="WIDGETS" attrName="publishOperation" attrValue="HAS_USER_ROLE"/>
     
     <!-- Threads -->
     <Content contentId="thread10021" contentTypeId="DOCUMENT" ownerContentId="GIZMOS" dataResourceId="TEMPLATE_TEXT_ONLY" statusId="CTNT_PUBLISHED" contentName="This is a Thread" description="Gizmo useless?" childBranchCount="1" createdDate="2006-05-02 13:36:31.937" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:31.937" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-01 08:49:38.78" lastUpdatedTxStamp="2006-05-01 08:49:38.534" createdStamp="2006-05-01 13:36:31.987" createdTxStamp="2006-05-01 13:36:31.904"/>
-    <ContentAssoc contentId="thread10021" contentIdTo="GIZMOS" contentAssocTypeId="PUBLISH_LINK" fromDate="2006-05-02 13:36:32.036" createdDate="2006-05-02 13:36:32.055" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.055" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.154" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.154" createdTxStamp="2006-05-02 13:36:31.904"/>
+    <ContentAssoc contentIdTo="thread10021" contentId="GIZMOS" contentAssocTypeId="PUBLISH_LINK" fromDate="2006-05-02 13:36:32.036" createdDate="2006-05-02 13:36:32.055" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.055" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.154" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.154" createdTxStamp="2006-05-02 13:36:31.904"/>
     <ContentPurpose contentId="thread10021" contentPurposeTypeId="ARTICLE" lastUpdatedStamp="2006-05-03 11:08:10.788" lastUpdatedTxStamp="2006-05-03 11:08:10.751" createdStamp="2006-05-03 11:08:10.788" createdTxStamp="2006-05-03 11:08:10.751"/>
     <!-- Messages -->    
     <DataResource dataResourceId="msg10002" dataResourceTypeId="ELECTRONIC_TEXT" ownerContentId="GIZMOS" dataTemplateTypeId="NONE" statusId="CTNT_PUBLISHED" createdDate="2006-05-02 13:36:32.264" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.264" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.266" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.266" createdTxStamp="2006-05-02 13:36:31.904"/>
     <Content contentId="msg10002" contentTypeId="DOCUMENT" ownerContentId="GIZMOS" dataResourceId="msg10002" statusId="CTNT_PUBLISHED" contentName="This is a message" description="Gizmo useless?" childBranchCount="0" createdDate="2006-05-02 13:36:32.417" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.417" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-01 08:05:42.715" lastUpdatedTxStamp="2006-05-01 08:05:42.438" createdStamp="2006-05-01 13:36:32.429" createdTxStamp="2006-05-01 13:36:31.904"/>
     <ContentPurpose contentId="msg10002" contentPurposeTypeId="MAIN_ARTICLE" lastUpdatedStamp="2006-05-03 11:08:11.0" lastUpdatedTxStamp="2006-05-03 11:08:10.914" createdStamp="2006-05-03 11:08:11.0" createdTxStamp="2006-05-03 11:08:10.914"/>
-    <ContentAssoc contentId="msg10002" contentIdTo="thread10021" contentAssocTypeId="RESPONSE" fromDate="2006-05-02 13:36:32.495" mapKey="ARTICLE" createdDate="2006-05-02 13:36:32.495" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.495" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.537" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.537" createdTxStamp="2006-05-02 13:36:31.904"/>
+    <ContentAssoc contentIdTo="msg10002" contentId="thread10021" contentAssocTypeId="RESPONSE" fromDate="2006-05-02 13:36:32.495" mapKey="ARTICLE" createdDate="2006-05-02 13:36:32.495" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.495" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.537" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.537" createdTxStamp="2006-05-02 13:36:31.904"/>
     <ElectronicText dataResourceId="msg10002" lastUpdatedStamp="2006-05-02 13:36:32.351" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.351" createdTxStamp="2006-05-02 13:36:31.904">
         <textData><![CDATA[
         It is well known that a Gizmo is no use to everybody. However everybody wants it, why is that?
@@ -59,7 +59,7 @@
     <!-- Responses -->    
     <DataResource dataResourceId="msg10002a" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="NONE" statusId="CTNT_PUBLISHED" createdDate="2006-05-02 13:36:32.264" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.264" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.266" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.266" createdTxStamp="2006-05-02 13:36:31.904"/>
     <Content contentId="msg10002a" contentTypeId="DOCUMENT" ownerContentId="GIZMOS" dataResourceId="msg10002a" statusId="CTNT_PUBLISHED" contentName="This is a reponse" description="re1:Gizmo useless?" childBranchCount="0" createdDate="2006-05-02 13:36:32.417" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.417" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-03 08:05:42.715" lastUpdatedTxStamp="2006-05-03 08:05:42.438" createdStamp="2006-05-02 13:36:32.429" createdTxStamp="2006-05-02 13:36:31.904"/>
-    <ContentAssoc contentId="msg10002a" contentIdTo="thread10021" contentAssocTypeId="RESPONSE" fromDate="2006-05-02 13:36:32.495" mapKey="ARTICLE" createdDate="2006-05-02 13:36:32.495" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.495" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.537" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.537" createdTxStamp="2006-05-02 13:36:31.904"/>
+    <ContentAssoc contentIdTo="msg10002a" contentId="thread10021" contentAssocTypeId="RESPONSE" fromDate="2006-05-02 13:36:32.495" mapKey="ARTICLE" createdDate="2006-05-02 13:36:32.495" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.495" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.537" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.537" createdTxStamp="2006-05-02 13:36:31.904"/>
     <ContentPurpose contentId="msg10002a" contentPurposeTypeId="RESPONSE" lastUpdatedStamp="2006-05-03 11:08:11.0" lastUpdatedTxStamp="2006-05-03 11:08:10.914" createdStamp="2006-05-03 11:08:11.0" createdTxStamp="2006-05-03 11:08:10.914"/>
     <ElectronicText dataResourceId="msg10002a" lastUpdatedStamp="2006-05-02 13:36:32.351" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.351" createdTxStamp="2006-05-02 13:36:31.904">
         <textData><![CDATA[
@@ -71,7 +71,7 @@
 
     <DataResource dataResourceId="msg10002b" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="NONE" statusId="CTNT_PUBLISHED" createdDate="2006-05-02 13:36:32.264" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.264" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.266" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.266" createdTxStamp="2006-05-02 13:36:31.904"/>
     <Content contentId="msg10002b" contentTypeId="DOCUMENT" ownerContentId="GIZMOS" dataResourceId="msg10002b" statusId="CTNT_PUBLISHED" contentName="This is a reponse" description="re2:Gizmo useless?" childBranchCount="0" createdDate="2006-05-02 13:36:32.417" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.417" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-03 08:05:42.715" lastUpdatedTxStamp="2006-05-03 08:05:42.438" createdStamp="2006-05-02 13:36:32.429" createdTxStamp="2006-05-02 13:36:31.904"/>
-    <ContentAssoc contentId="msg10002b" contentIdTo="thread10021" contentAssocTypeId="RESPONSE" fromDate="2006-05-02 13:36:32.495" mapKey="ARTICLE" createdDate="2006-05-02 13:36:32.495" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.495" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.537" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.537" createdTxStamp="2006-05-02 13:36:31.904"/>
+    <ContentAssoc contentIdTo="msg10002b" contentId="thread10021" contentAssocTypeId="RESPONSE" fromDate="2006-05-02 13:36:32.495" mapKey="ARTICLE" createdDate="2006-05-02 13:36:32.495" createdByUserLogin="admin" lastModifiedDate="2006-05-02 13:36:32.495" lastModifiedByUserLogin="admin" lastUpdatedStamp="2006-05-02 13:36:32.537" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.537" createdTxStamp="2006-05-02 13:36:31.904"/>
     <ContentPurpose contentId="msg10002b" contentPurposeTypeId="RESPONSE" lastUpdatedStamp="2006-05-03 11:08:11.0" lastUpdatedTxStamp="2006-05-03 11:08:10.914" createdStamp="2006-05-03 11:08:11.0" createdTxStamp="2006-05-03 11:08:10.914"/>
     <ElectronicText dataResourceId="msg10002b" lastUpdatedStamp="2006-05-02 13:36:32.351" lastUpdatedTxStamp="2006-05-02 13:36:31.904" createdStamp="2006-05-02 13:36:32.351" createdTxStamp="2006-05-02 13:36:31.904">
         <textData><![CDATA[

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml?view=diff&rev=544732&r1=544731&r2=544732
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml Tue Jun  5 22:30:17 2007
@@ -942,4 +942,227 @@
             </else>
         </if>
     </simple-method>
+    
+    <simple-method method-name="createArticleContent" short-description="Post a new Content article Entry">
+        <set field="contentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
+        <set field="origContentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
+        <set field="ownerContentId" from-field="parameters.threadContentId"/>
+        <if-compare operator="equals" field-name="origContentAssocTypeId" value="PUBLISH_LINK">
+            <set field="ownerContentId" from-field="parameters.pubPtContentId"/>
+        </if-compare>
+        <set field="contentIdFrom" from-field="parameters.contentIdFrom"/>        
+        <set field="pubPtContentId" from-field="parameters.pubPtContentId"/>  
+        <call-object-method method-name="length" obj-field-name="parameters.textData" ret-field-name="textDataLen"/>
+        <log level="info" message="textDataLen:${textDataLen}"/>
+        <property-to-field resource="forum" property="descriptLen" field-name="descriptLen" />
+        <log level="info" message="descriptLen:${descriptLen}"/>
+        <set field="dblTextDataLen" from-field="textDataLen" type="Double"/>
+        <set field="dblDescriptLen" from-field="descriptLen" type="Double"/>
+        <call-class-method method-name="min" class-name="java.lang.Math" ret-field-name="subStringLen">
+            <field field-name="dblTextDataLen" type="double"/>
+            <field field-name="dblDescriptLen" type="double"/>
+        </call-class-method>
+        <set field="intSubStringLen" from-field="subStringLen" type="Integer"/>
+        <log level="info" message="subStringLen:${subStringLen}"/>
+        <set field="zeroValue" value="0" type="Integer"/>
+        <call-object-method method-name="substring" obj-field-name="parameters.textData" ret-field-name="subDescript">
+            <field field-name="zeroValue" type="int"/>
+            <field field-name="intSubStringLen" type="int"/>
+        </call-object-method>
+        <log level="info" message="subDescript:${subDescript}"/>
+        <if-compare operator="equals" field-name="contentAssocTypeId" value="PUBLISH_LINK">
+            <set field="ownerContentId" from-field="pubPtContentId"/>
+        </if-compare>  
+
+        <!-- determine of we need to create complex template structure or simple content structure -->
+        <if>
+            <condition>
+                <and>
+                    <not>
+                        <if-empty field-name="parameters.uploadedFile"/>
+                    </not>
+                    <not>
+                        <if-empty field-name="parameters.textData"/>
+                    </not>
+                </and>
+            </condition>
+            <then>
+                <!-- complex template structure (image & text) -->
+                <set field="createMain.dataResourceId" from-field="parameters.dataResourceId"/>
+                <set field="createMain.contentAssocTypeId"  from-field="contentAssocTypeId"/>
+                <set field="createMain.contentName" from-field="parameters.contentName"/>
+                <set field="createMain.description" from-field="subDescript"/>
+                <set field="createMain.statusId" from-field="parameters.statusId"/>
+                <set field="createMain.contentIdFrom" from-field="contentIdFrom"/>                
+                <set field="createMain.partyId" from-field="userLogin.partyId"/>
+                <set field="createMain.ownerContentId" from-field="ownerContentId"/>
+
+                <set field="createMain.dataTemplateTypeId" value="SCREEN_COMBINED"/>
+                <set field="createMain.mapKey" value="MAIN"/>
+
+                <call-service service-name="createContent" in-map-name="createMain">
+                    <result-to-field result-name="contentId" field-name="contentId"/>
+                </call-service>
+                
+                <!-- reset contentIdFrom to new contentId -->
+                <set field="contentAssocTypeId" value="SUB_CONTENT"/>
+                <set field="contentIdFrom" from-field="contentId"/>                                
+            </then>
+        </if>
+
+        <if>
+            <condition>
+                <not>
+                    <if-empty field-name="parameters.uploadedFile"/>
+                </not>
+            </condition>
+            <then>
+                <!-- create image data -->
+                <set field="createImage.dataResourceTypeId" value="LOCAL_FILE"/>
+                <set field="createImage.dataTemplateTypeId" value="NONE"/>
+                <set field="createImage.mapKey" value="IMAGE"/>
+
+                <set field="createMain.ownerContentId" from-field="ownerContentId"/>
+                <set field="createImage.contentName" from-field="parameters.contentName"/>
+                <set field="createImage.description" from-field="subDescript"/>
+                <set field="createImage.statusId" from-field="parameters.statusId"/>
+                <set field="createImage.contentAssocTypeId"  from-field="contentAssocTypeId"/>
+                <set field="createImage.contentIdFrom" from-field="contentIdFrom"/>
+                <set field="createImage.partyId" from-field="userLogin.partyId"/>
+                <set field="createImage.uploadedFile" from-field="parameters.uploadedFile"/>
+                <set field="createImage._uploadedFile_fileName" from-field="parameters._uploadedFile_fileName"/>
+                <set field="createImage._uploadedFile_contentType" from-field="parameters._uploadedFile_contentType"/>
+
+                <call-service service-name="createContentFromUploadedFile" in-map-name="createImage">
+                    <result-to-field result-name="contentId" field-name="imageContentId"/>
+                </call-service>
+
+                <if-empty field-name="contentId">
+                    <set field="contentIdFrom" from-field="imageContentId"/>
+                    <set field="contentId" from-field="imageContentId"/>
+                    <set field="contentAssocTypeId" value="SUB_CONTENT"/>
+                </if-empty>
+            </then>
+        </if>
+
+        <if>
+            <condition>
+                <not>
+                    <if-empty field-name="parameters.textData"/>
+                </not>
+            </condition>
+            <then>
+                <!-- create text data -->
+                <set field="createText.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
+                <set field="createText.dataTemplateTypeId" value="NONE"/>
+                <set field="createText.mapKey" value="MAIN"/>
+
+                <set field="createText.ownerContentId" from-field="ownerContentId"/>
+                <set field="createText.contentName" from-field="parameters.contentName"/>
+                <set field="createText.description" from-field="subDescript"/>
+                <set field="createText.statusId" from-field="parameters.statusId"/>
+                <set field="createText.contentAssocTypeId"  from-field="contentAssocTypeId"/>
+                <set field="createText.textData" from-field="parameters.textData"/>
+                <set field="createText.contentIdFrom" from-field="contentIdFrom"/>
+                <set field="createText.partyId" from-field="userLogin.partyId"/>
+
+                <log level="always" message="calling createTextContent with map: ${createText}"/>
+                <call-service service-name="createTextContent" in-map-name="createText">
+                    <result-to-field result-name="contentId" field-name="textContentId"/>
+                </call-service>
+
+                <if-empty field-name="contentId">
+                    <set field="contentIdFrom" from-field="textContentId"/>
+                    <set field="contentId" from-field="textContentId"/>
+                    <set field="contentAssocTypeId" value="SUB_CONTENT"/>
+                </if-empty>
+            </then>
+        </if>
+                
+        <!-- we should have a primary (at least) contentId -->
+        <if>
+            <condition>
+                <and>
+                    <not>
+                        <if-empty field-name="contentId"/>
+                    </not>
+                    <not>
+                        <if-empty field-name="parameters.summaryData"/>
+                    </not>
+                </and>
+            </condition>
+            <then>
+                <!-- create the summary data -->
+                <set field="createSummary.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
+                <set field="createSummary.dataTemplateTypeId" value="NONE"/>
+                <set field="createSummary.mapKey" value="SUMMARY"/>
+
+                <set field="createSummary.ownerContentId" from-field="ownerContentId"/>
+                <set field="createSummary.contentName" from-field="parameters.contentName"/>
+                <set field="createSummary.description" from-field="parameters.description"/>
+                <set field="createSummary.statusId" from-field="parameters.statusId"/>
+                <set field="createSummary.contentAssocTypeId"  from-field="contentAssocTypeId"/>
+                <set field="createSummary.textData" from-field="parameters.summaryData"/>
+                <set field="createSummary.contentIdFrom" from-field="contentIdFrom"/>
+                <set field="createSummary.partyId" from-field="userLogin.partyId"/>
+
+                <call-service service-name="createTextContent" in-map-name="createSummary"/>
+            </then>
+        </if>
+        
+        <!-- If a response, still link it to the publish point -->
+        <if-compare operator="equals" field-name="origContentAssocTypeId" value="RESPONSE">
+            <set field="contentAssocMap.contentId" from-field="pubPtContentId"/>
+            <set field="contentAssocMap.contentIdTo" from-field="contentId"/>
+            <set field="contentAssocMap.contentAssocTypeId" value="RESPONSE"/>
+        <log level="info" message="contentAssocMap:${contentAssocMap.contentId}"/>
+             <call-service service-name="createContentAssoc" in-map-name="contentAssocMap"/>
+        </if-compare>  
+
+
+        <field-to-result field-name="contentId"/>
+    </simple-method>
+    
+    <simple-method method-name="getSubContentWithPermCheck" short-description="Get sub content and perform permission check on each record">
+    
+     <set field="filterByDate" from-field="parameters.filterByDate" default-value="true" type="Boolean" />
+     <set field="useCache" from-field="parameters.useCache" default-value="true" type="Boolean" />
+        <entity-condition list-name="viewList" entity-name="ContentAssocViewTo" filter-by-date="${filterByDate}" use-cache="${useCache}">
+          <condition-list combine="and">
+              <condition-expr field-name="contentIdStart" env-name="parameters.contentId"/>
+              <condition-expr field-name="caContentAssocTypeId" env-name="parameters.contentAssocTypeId" ignore-if-empty="true"/>
+              <condition-expr field-name="caMapKey" env-name="parameters.mapKey" ignore-if-empty="true"/>
+          </condition-list>
+        </entity-condition>
+        
+        <iterate entry-name="view" list-name="viewList">
+            <set field="hasPermission" value="true" type="Boolean"/>
+            <if>
+                <condition>
+                    <and>
+                    <not>
+                        <if-empty field-name="parameters.mainAction"/>
+                    </not>
+                    <not>
+                        <if-empty field-name="parameters.userLogin"/>
+                    </not>
+                    </and>
+                </condition>
+                <then>
+                    <set field="inMap.contentId" from-field="parameters.contentId"/>
+                    <set field="inMap.mainAction" from-field="parameters.mainAction"/>
+                    <set field="inMap.userLogin" from-field="parameters.userLogin"/>
+                    <set field="inMap.contentOperationId" from-field="parameters.contentOperationId" default-value="CONTENT_CREATE"/>
+                    <call-service service-name="genericContentPermission" in-map-name="inMap" include-user-login="true">
+                        <result-to-field result-name="hasPermission"/>
+                    </call-service>
+                </then>
+            </if>
+            <if-compare operator="equals" field-name="hasPermission" value="true" type="Boolean">
+                <set field="contentViewList[]" from-field="view"/>
+            </if-compare>
+        </iterate>
+        
+        
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml?view=diff&rev=544732&r1=544731&r2=544732
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml Tue Jun  5 22:30:17 2007
@@ -388,7 +388,7 @@
 
     <simple-method method-name="updateElectronicText" short-description="Update Electronic Text">
         <make-value entity-name="ElectronicText" value-name="lookupKeyValue"/>
-
+<log level="always" message="updateElectronicText, lookupKeyValue: ${lookupKeyValue}"/>
         <set-pk-fields map-name="parameters" value-name="lookupKeyValue"/>
         <find-by-primary-key entity-name="ElectronicText" map-name="lookupKeyValue" value-name="lookedUpValue"/>
 

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/permission/ContentPermissionServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/permission/ContentPermissionServices.xml?view=diff&rev=544732&r1=544731&r2=544732
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/permission/ContentPermissionServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/permission/ContentPermissionServices.xml Tue Jun  5 22:30:17 2007
@@ -37,7 +37,6 @@
         <!-- setting the roleEntity or this service -->
         <set field="roleEntityField" value="contentId"/>
         <set field="roleEntity" value="ContentRole"/>
-        
         <!-- here we can use contentIdTo to check parent(s) ownership -->
         <if>
             <condition>
@@ -132,14 +131,24 @@
                     <set field="parameters.contentOperationId" value="CONTENT_VIEW"/>
                 </if-empty>
 
+        <!-- contentId is required for update checking -->
+        <if-empty field-name="contentId">
+            <set field="contentId" from-field="parameters.contentId"/>
+        </if-empty>
+        <if-empty field-name="contentId">
+            <add-error><fail-message message="Content Permission Service VIEW requires a contentId!"/></add-error>
+        </if-empty>
+        <check-errors/>
+        
                 <!-- grab the current requested content record -->
                 <entity-one entity-name="Content" value-name="content">
-                    <field-map field-name="contentId" env-name="parameters.contentId"/>
+                    <field-map field-name="contentId" env-name="contentId"/>
                 </entity-one>
 
                 <!-- check the operation security -->
                 <set field="contentOperationId" from-field="parameters.contentOperationId"/>
                 <set field="content" from-field="content"/>
+                <set field="checkId" from-field="contentId"/>
                 <call-simple-method method-name="checkContentOperationSecurity"/>
             </then>
         </if>

Modified: ofbiz/trunk/applications/content/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services.xml?view=diff&rev=544732&r1=544731&r2=544732
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services.xml Tue Jun  5 22:30:17 2007
@@ -27,12 +27,12 @@
     <service name="uploadFileInterface" engine="interface">
         <description>Contains necessary paramters for all file upload requests via service event handler</description>
         <attribute name="uploadedFile" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="true"/>
-        <attribute name="_uploadedFile_fileName" type="String" mode="IN" optional="true"/>
+        <attribute name="_uploadedFile_fileName" type="String" mode="IN" optional="true" />
         <attribute name="_uploadedFile_contentType" type="String" mode="IN" optional="false"/>
     </service>
 
     <!-- Content services? -->
-    <service name="getPublicForumMessage" engine="simple" default-entity-name="Content" auth="false"
+    <service name="getPublicForumMessage" engine="simple" default-entity-name="Content" auth="true"
             location="org/ofbiz/content/content/ContentServices.xml" invoke="getPublicForumMessage">
         <description>Get Content and resource information</description>
         <permission-service service-name="genericContentPermission" main-action="VIEW"/>
@@ -40,6 +40,20 @@
         <attribute mode="OUT" name="resultData" optional="true" type="java.util.Map"/>
     </service>
 
+    <service name="getSubContentWithPermCheck" engine="simple"  auth="true"
+            location="org/ofbiz/content/content/ContentServices.xml" invoke="getSubContentWithPermCheck">
+        <description>Get Content and resource information</description>
+        <permission-service service-name="genericContentPermission" main-action="VIEW"/>
+        <attribute mode="IN" name="content" optional="false" type="String"/>
+        <attribute mode="IN" name="contentAssocTypeId" optional="true" type="String"/>
+        <attribute mode="IN" name="mapKey" optional="true" type="String"/>
+        <attribute mode="IN" name="mainAction" optional="true" type="String"/>
+        <attribute mode="IN" name="contentOperationId" optional="true" type="String"/>
+        <attribute mode="IN" name="useCache" optional="true" type="Boolean"/>
+        <attribute mode="IN" name="filterByDate" optional="true" type="Boolean"/>
+        <attribute mode="OUT" name="resultData" optional="true" type="java.util.Map"/>
+    </service>
+
     <service name="getContentAndDataResource" engine="simple" default-entity-name="Content" auth="true"
             location="org/ofbiz/content/content/ContentServices.xml" invoke="getContentAndDataResource">
         <description>Get Content and resource information</description>
@@ -525,6 +539,16 @@
         <attribute mode="IN" name="fromDate" optional="true" type="Timestamp"/>
     </service>
 
+    <service name="createArticleContent" engine="simple" transaction-timeout="300" auth="true"
+            location="org/ofbiz/content/content/ContentServices.xml" invoke="createArticleContent">
+        <description>Creates content records for a blog entry</description>
+        <implements service="createContentFromUploadedFile" optional="true"/>
+        <implements service="createTextContent" optional="true"/>
+        <attribute name="contentIdFrom" type="String" mode="IN" optional="false"/>
+        <attribute name="pubPtContentId" type="String" mode="IN" optional="false"/>
+        <attribute name="threadContentId" type="String" mode="IN" optional="true"/>
+        <attribute name="summaryData" type="String" mode="IN" optional="true"/>
+    </service>
     <!-- SubContent Render Services -->
     <service name="renderSubContentAsText" engine="java"
             location="org.ofbiz.content.content.ContentServices" invoke="renderSubContentAsText" auth="false">

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java?view=diff&rev=544732&r1=544731&r2=544732
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java Tue Jun  5 22:30:17 2007
@@ -59,7 +59,7 @@
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         ServletContext servletContext = request.getSession().getServletContext();
         HttpSession session = request.getSession();
-
+        
         String webSiteId = (String) session.getAttribute("webSiteId");
         if (webSiteId == null) {
             request.setAttribute("_ERROR_MESSAGE_", "Not able to run CMS application; no webSiteId defined for WebApp!");
@@ -222,14 +222,15 @@
                     throw new GeneralRuntimeException("Error rendering content: " + e.toString(), e);
                 }
 
-                return null;
+                return "success";
             } else {
                 Debug.log("No website [" + webSiteId + "] publish point found for contentId: " + contentId, module);
             }
         }
 
+        return "success";
         // throw an unknown request error
-        throw new GeneralRuntimeException("Unknown request; this request does not exist or cannot be called directly.");
+        //throw new GeneralRuntimeException("Unknown request; this request does not exist or cannot be called directly.");
     }
 
     protected static boolean verifyContentToWebSite(GenericDelegator delegator, String webSiteId, String contentId) throws GeneralException {