some more updates to mainly the blog functions, but also other problems found on the way, still not finish yet altough the blog post function now works correctly including picture, also did some minilanguage syntax changes

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@735383 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2009-01-18 03:34:57 +00:00
parent bc9d99b364
commit e46fbe8080
12 changed files with 178 additions and 223 deletions
@@ -23,13 +23,12 @@
<set field="contentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
<set field="ownerContentId" from-field="parameters.blogContentId"/>
<set field="contentIdFrom" from-field="parameters.blogContentId"/>
<!-- determine of we need to create complex template structure or simple content structure -->
<if>
<condition>
<and>
<not>
<if-empty field="parameters.uploadedFile"/>
<if-empty field="parameters._uploadedFile_fileName"/>
</not>
<not>
<if-empty field="parameters.textData"/>
@@ -46,28 +45,25 @@
<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="contentId"/>
</call-service>
<!-- reset contentIdFrom to new contentId -->
<set field="contentAssocTypeId" value="SUB_CONTENT"/>
<set field="contentIdFrom" from-field="contentId"/>
</then>
</if>
<log level="always" message="=========${parameters.uploadedFile}"></log>
<if>
<condition>
<not>
<if-empty field="parameters.uploadedFile"/>
<if-empty field="parameters._uploadedFile_fileName"/>
</not>
</condition>
<then>
<!-- upload a picture -->
<set field="createImage.dataResourceTypeId" value="LOCAL_FILE"/>
<set field="createImage.dataTemplateTypeId" value="NONE"/>
<set field="createImage.mapKey" value="IMAGE"/>
@@ -78,14 +74,13 @@
<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.isPublic" value="Y"/>
<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="imageContentId"/>
</call-service>
<if-empty field="contentId">
<set field="contentIdFrom" from-field="imageContentId"/>
<set field="contentId" from-field="imageContentId"/>
@@ -93,7 +88,7 @@
</if-empty>
</then>
</if>
<if>
<condition>
<not>
@@ -106,7 +101,6 @@
<set field="createText.contentPurposeTypeId" value="ARTICLE"/>
<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="parameters.description"/>
@@ -115,12 +109,10 @@
<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="textContentId"/>
</call-service>
<if-empty field="contentId">
<set field="contentIdFrom" from-field="textContentId"/>
<set field="contentId" from-field="textContentId"/>
@@ -128,25 +120,25 @@
</if-empty>
</then>
</if>
<!-- we should have a primary (at least) contentId -->
<if>
<condition>
<and>
<and>
<not>
<if-empty field="contentId"/>
</not>
<not>
<if-empty field="parameters.summaryData"/>
</not>
</and> </condition>
</and>
</condition>
<then>
<!-- create the summary data -->
<set field="createSummary.dataResourceTypeId" value="ELECTRONIC_TEXT"/>
<set field="createSummary.contentPurposeTypeId" value="ARTICLE"/>
<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"/>
@@ -155,18 +147,13 @@
<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">
<result-to-field result-name="contentId" field="contentId"/>
</call-service>
<call-service service-name="createTextContent" in-map-name="createSummary"/>
</then>
</if>
<log level="always" message="==========contentId: ${contentId} created"/>
<field-to-result field="contentId"/>
</simple-method>
<simple-method method-name="getOwnedOrPublishedBlogEntries" short-description="Get blog entries that the user owns or are published">
<log level="info" message="parameters: ${parameters}"/>
<entity-condition entity-name="ContentAssocViewTo" use-cache="false" list="unfilteredList">
<condition-list combine="and">
<condition-expr field-name="contentIdStart" operator="equals" from-field="parameters.contentId"/>
@@ -175,28 +162,57 @@
</condition-list>
<order-by field-name="caFromDate DESC"/>
</entity-condition>
<!--log level="info" message="unfilteredList: ${unfilteredList}"/-->
<set field="mapIn.targetOperationList[]" value="CONTENT_VIEW"/>
<set field="mapIn.targetOperationList[]" value="CONTENT_UPDATE"/>
<set field="blogList[]"/>
<iterate entry="view" list="unfilteredList">
<make-value entity-name="Content" value-field="content"/>
<set-nonpk-fields value-field="content" map="view"/>
<set-pk-fields value-field="content" map="view"/>
<set field="mapIn.currentContent" from-field="content"/>
<!--log level="info" message="mapIn: ${mapIn}"/-->
<call-service service-name="checkContentPermission" in-map-name="mapIn">
<result-to-field result-name="permissionStatus" field="permissionStatus"/>
<set-service-fields service-name="genericContentPermission" map="view" to-map="mapIn"/>
<set field="mapIn.mainAction" value="VIEW"/>
<call-service service-name="genericContentPermission" in-map-name="mapIn">
<result-to-field result-name="hasPermission" field="hasPermission"/>
</call-service>
<!--log level="info" message="permissionStatus: ${permissionStatus}"/-->
<if-compare operator="equals" field="permissionStatus" value="granted">
<if-compare operator="equals" field="hasPermission" value="true" type="Boolean">
<set field="blogList[]" from-field="view"/>
<else>
<set field="mapIn.mainAction" value="UPDATE"/>
<call-service service-name="genericContentPermission" in-map-name="mapIn">
<result-to-field result-name="hasPermission" field="hasPermission"/>
</call-service>
<if-compare operator="equals" field="hasPermission" value="true" type="Boolean">
<set field="blogList[]" from-field="view"/>
</if-compare>
</else>
</if-compare>
</iterate>
<!--log level="info" message="blogList: ${blogList}"/-->
<field-to-result field="blogList" result-name="blogList"/>
</simple-method>
<simple-method method-name="getBlogEntry" short-description="Get all the info for a blog article">
<entity-one entity-name="Content" value-field="content"/>
<field-to-result field="content.contentId" result-name="contentId"/>
<field-to-result field="content.contentName" result-name="contentName"/>
<field-to-result field="content.description" result-name="description"/>
<field-to-result field="content.statusId" result-name="statusId"/>
<field-to-result field="content.datResourceId" result-name="templateDataResourceId"/>
<get-related value-field="Content" relation-name="ContentAssoc" list="rawAssocs"/>
<filter-list-by-date list="rawAssocs" to-list="assocs"/>
<iterate entry="assoc" list="assocs">
<if-compare field="assoc.mapKey" value="MAIN" operator="equals">
<get-related-one value-field="assoc" relation-name="Content" to-value-field="content"/>
<get-related-one value-field="content" relation-name="DataResource" to-value-field="dataResource"/>
<get-related-one value-field="dataResource" relation-name="ElectronicText" to-value-field="text"/>
<field-to-result field="text.textData" result-name="article"/>
</if-compare>
<if-compare field="assoc.mapKey" value="SUMMARY" operator="equals">
<get-related-one value-field="assoc" relation-name="Content" to-value-field="content"/>
<get-related-one value-field="content" relation-name="DataResource" to-value-field="dataResource"/>
<get-related-one value-field="dataResource" relation-name="ElectronicText" to-value-field="text"/>
<field-to-result field="text.textData" result-name="summary"/>
</if-compare>
<if-compare field="assoc.mapKey" value="IMAGE" operator="equals">
<get-related-one value-field="assoc" relation-name="Content" to-value-field="content"/>
<get-related-one value-field="content" relation-name="DataResource" to-value-field="dataResource"/>
<field-to-result field="dataResource.dataResourceId" result-name="imageDataResourceId"/>
</if-compare>
</iterate>
</simple-method>
</simple-methods>
@@ -895,9 +895,7 @@
<!-- retrieve Data resource information -->
<simple-method method-name="getDataResource" short-description="get the content and relasted resource information" login-required="false">
<entity-one entity-name="DataResource" value-field="resultData.dataResource">
<field-map field-name="dataResourceId" from-field="parameters.dataResourceId"/>
</entity-one>
<entity-one entity-name="DataResource" value-field="resultData.dataResource"/>
<if-not-empty field="resultData.dataResource">
<if-compare field="resultData.dataResource.dataResourceTypeId" value="ELECTRONIC_TEXT" operator="equals">
<get-related-one value-field="resultData.dataResource" relation-name="ElectronicText"
@@ -41,7 +41,7 @@ under the License.
<set field="newEntity.dataTemplateTypeId" value="NONE"/>
</if-empty>
<if-empty field="content.statusId">
<if-empty field="parameters.statusId">
<!-- get the first status item -->
<entity-and entity-name="StatusItem" list="contentStatus">
<field-map field-name="statusTypeId" value="CONTENT_STATUS"/>
@@ -52,29 +52,22 @@ under the License.
</if-empty>
<create-value value-field="newEntity"/>
<field-to-result field="dataResourceId" map-name="newEntity"/>
<field-to-result field="dataResourceId"/>
</simple-method>
<simple-method method-name="updateDataResource" short-description="Update a Data Resource">
<make-value entity-name="DataResource" value-field="lookupKeyValue"/>
<set-pk-fields map="parameters" value-field="lookupKeyValue"/>
<find-by-primary-key entity-name="DataResource" map="lookupKeyValue" value-field="lookedUpValue"/>
<to-string map-name="parameters" field-name="locale" />
<entity-one entity-name="DataResource" value-field="lookedUpValue"/>
<to-string field="parameters.locale"/>
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
<now-timestamp field="nowTimestamp"/>
<set field="lookedUpValue.lastModifiedByUserLogin" from-field="userLogin.userLoginId"/>
<set field="lookedUpValue.lastModifiedDate" from-field="nowTimestamp"/>
<store-value value-field="lookedUpValue"/>
<field-to-result field="dataResourceId" map-name="lookedUpValue"/>
<field-to-result field="parameters.dataResourceId" result-name="dataResourceId"/>
</simple-method>
<simple-method method-name="deleteDataResource" short-description="Delete a Data Resource">
<make-value entity-name="DataResource" value-field="lookupKeyValue"/>
<set-pk-fields map="parameters" value-field="lookupKeyValue"/>
<find-by-primary-key entity-name="DataResource" map="lookupKeyValue" value-field="lookedUpValue"/>
<entity-one entity-name="DataResource" value-field="lookedUpValue"/>
<remove-value value-field="lookedUpValue"/>
</simple-method>
@@ -83,9 +76,8 @@ under the License.
<make-value entity-name="DataCategory" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="dataCategoryId" map-name="newEntity"/>
<field-to-result field="newEntity.dataCategoryId" result-name="dataCategoryId"/>
</simple-method>
<simple-method method-name="updateDataCategory" short-description="Update a Data Category">
<make-value entity-name="DataCategory" value-field="lookupKeyValue"/>
@@ -194,7 +186,7 @@ under the License.
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="dataCategoryId" map-name="newEntity"/>
<field-to-result result-name="dataCategoryId" field="newEntity.dataCategoryId"/>
</simple-method>
<simple-method method-name="updateDataCategory" short-description="Update Data Category">
<make-value entity-name="DataCategory" value-field="lookupKeyValue"/>
@@ -216,7 +208,7 @@ under the License.
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="dataResourceTypeId" map-name="newEntity"/>
<field-to-result result-name="dataResourceTypeId" field="newEntity.dataResourceTypeId"/>
</simple-method>
<simple-method method-name="updateDataResourceType" short-description="Update Data Resource Type">
<make-value entity-name="DataResourceType" value-field="lookupKeyValue"/>
@@ -280,7 +272,7 @@ under the License.
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="characterSetId" map-name="newEntity"/>
<field-to-result result-name="characterSetId" field="newEntity.characterSetId"/>
</simple-method>
<simple-method method-name="updateCharacterSet" short-description="Update Character Set">
<make-value entity-name="CharacterSet" value-field="lookupKeyValue"/>
@@ -302,7 +294,7 @@ under the License.
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="fileExtensionId" map-name="newEntity"/>
<field-to-result result-name="fileExtensionId" field="newEntity.fileExtensionId"/>
</simple-method>
<simple-method method-name="updateFileExtension" short-description="Update Data Resource Role">
<make-value entity-name="FileExtension" value-field="lookupKeyValue"/>
@@ -324,7 +316,7 @@ under the License.
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="metaDataPredicateId" map-name="newEntity"/>
<field-to-result result-name="metaDataPredicateId" field="newEntity.metaDataPredicateId"/>
</simple-method>
<simple-method method-name="updateMetaDataPredicate" short-description="Update Data Resource Role">
<make-value entity-name="MetaDataPredicate" value-field="lookupKeyValue"/>
@@ -346,7 +338,7 @@ under the License.
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="mimeTypeId" map-name="newEntity"/>
<field-to-result result-name="mimeTypeId" field="newEntity.mimeTypeId"/>
</simple-method>
<simple-method method-name="updateMimeType" short-description="Update MimeType">
<make-value entity-name="MimeType" value-field="lookupKeyValue"/>
@@ -388,9 +380,8 @@ under the License.
<make-value entity-name="ElectronicText" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result field="dataResourceId" map-name="newEntity"/>
<field-to-result result-name="dataResourceId" field="newEntity.dataResourceId"/>
</simple-method>
<simple-method method-name="updateElectronicText" short-description="Update Electronic Text">
@@ -400,7 +391,7 @@ under the License.
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
<store-value value-field="lookedUpValue"/>
<field-to-result field="dataResourceId" map-name="lookedUpValue"/>
<field-to-result result-name="dataResourceId" field="lookedUpValue.dataResourceId"/>
</simple-method>
<simple-method method-name="removeElectronicText" short-description="Remove Electronic Text">
<make-value entity-name="ElectronicText" value-field="lookupKeyValue"/>
@@ -510,9 +501,7 @@ under the License.
<if-empty field="currentContent">
<if-not-empty field="parameters.contentId">
<set field="contextA.contentId" from-field="parameters.contentId" />
<find-by-primary-key value-field="currentContent" entity-name="Content"
map-name="contextA" use-cache="true" />
<entity-one entity-name="Content" value-field="currentContent" use-cache="true"/>
</if-not-empty>
<if-empty field="currentContent">
<add-error>
@@ -527,10 +516,10 @@ under the License.
</add-error>
</if-empty>
<check-errors/>
<field-to-result field="currentContent.dataResourceId" result-name="dataResourceId"/>
<set field="contextB.dataResourceId" from-field="currentContent.dataResourceId" />
<find-by-primary-key value-field="eText" entity-name="ElectronicText"
map-name="contextB" use-cache="true" />
<field-to-result field="currentContent.dataResourceId" result-name="dataResourceId"/>
<entity-one entity-name="ElectronicText" value-field="eText">
<field-map field-name="dataResourceId" from-field="currentContent.dataResourceId"/>
</entity-one>
<if-empty field="eText">
<add-error>
<fail-message message="Electronic Text not found." />
@@ -562,14 +551,14 @@ under the License.
<then>
<if>
<condition>
<if-regexp field-name="parameters._uploadedFile_contentType" expr="image.*"/>
<if-regexp field="parameters._uploadedFile_contentType" expr="image.*"/>
</condition>
<then>
<set field="parameters.dataResourceTypeId" value="IMAGE_OBJECT"/>
</then>
<else-if>
<condition>
<if-regexp field-name="parameters._uploadedFile_contentType" expr="video.*"/>
<if-regexp field="parameters._uploadedFile_contentType" expr="video.*"/>
</condition>
<then>
<set field="parameters.dataResourceTypeId" value="VIDEO_OBJECT"/>
@@ -577,7 +566,7 @@ under the License.
</else-if>
<else-if>
<condition>
<if-regexp field-name="parameters._uploadedFile_contentType" expr="audio.*"/>
<if-regexp field="parameters._uploadedFile_contentType" expr="audio.*"/>
</condition>
<then>
<set field="parameters.dataResourceTypeId" value="AUDIO_OBJECT"/>
@@ -649,9 +638,7 @@ under the License.
<!-- save LOCAL_FILE data -->
<simple-method method-name="saveLocalFileDateResource" short-description="Attach an uploaded file to a data resource as LOCAL_FILE">
<entity-one entity-name="DataResource" value-field="dataResource">
<field-map field-name="dataResourceId" from-field="parameters.dataResourceId"/>
</entity-one>
<entity-one entity-name="DataResource" value-field="dataResource"/>
<if-empty field="dataResource">
<add-error><fail-message message="No data resource found for ID: [$parameters.dataResourceId}]"/></add-error>
</if-empty>
@@ -672,8 +659,8 @@ under the License.
</then>
<else>
<!-- if not upload is found on an update; its okay, don't do anything just return -->
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
<return/>
</else>
</if>
@@ -703,8 +690,8 @@ under the License.
<set from-field="dataResource" field="fileCtx.dataResource"/>
<call-service service-name="createAnonFile" in-map-name="fileCtx" include-user-login="true"/>
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
</simple-method>
<!-- save OTHER_OBJECT data -->
@@ -732,8 +719,8 @@ under the License.
</then>
<else>
<!-- if not upload is found on an update; its okay, don't do anything just return -->
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
<return/>
</else>
</if>
@@ -759,8 +746,8 @@ under the License.
</else>
</if-compare>
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
</simple-method>
<!-- save IMAGE_OBJECT data -->
@@ -788,8 +775,8 @@ under the License.
</then>
<else>
<!-- if not upload is found on an update; its okay, don't do anything just return -->
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
<return/>
</else>
</if>
@@ -815,8 +802,8 @@ under the License.
</else>
</if-compare>
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
</simple-method>
<!-- save VIDEO_OBJECT data -->
@@ -844,8 +831,8 @@ under the License.
</then>
<else>
<!-- if not upload is found on an update; its okay, don't do anything just return -->
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
<return/>
</else>
</if>
@@ -871,8 +858,8 @@ under the License.
</else>
</if-compare>
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
</simple-method>
<!-- save AUDIO_OBJECT data -->
@@ -900,8 +887,8 @@ under the License.
</then>
<else>
<!-- if not upload is found on an update; its okay, don't do anything just return -->
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
<return/>
</else>
</if>
@@ -927,7 +914,7 @@ under the License.
</else>
</if-compare>
<field-to-result field="dataResourceId" map-name="dataResource"/>
<field-to-result field="mimeTypeId" map-name="dataResource"/>
<field-to-result result-name="dataResourceId" field="dataResource.dataResourceId"/>
<field-to-result result-name="mimeTypeId" field="dataResource.mimeTypeId"/>
</simple-method>
</simple-methods>
+13 -1
View File
@@ -1059,13 +1059,25 @@
<!-- blog services -->
<service name="postBlogEntry" engine="simple" transaction-timeout="300" auth="true"
location="org/ofbiz/content/blog/BlogServices.xml" invoke="postBlogEntry">
location="org/ofbiz/content/blog/BlogServices.xml" invoke="postBlogEntry">
<description>Creates content records for a blog entry</description>
<implements service="createContentFromUploadedFile" optional="true"/>
<implements service="createTextContent" optional="true"/>
<attribute name="blogContentId" type="String" mode="IN" optional="false"/>
<attribute name="summaryData" type="String" mode="IN" optional="true"/>
</service>
<service name="getBlogEntry" engine="simple" transaction-timeout="300" auth="true"
location="org/ofbiz/content/blog/BlogServices.xml" invoke="getBlogEntry">
<description>Creates content records for a blog entry</description>
<attribute name="contentId" type="String" mode="INOUT" optional="false"/>
<attribute name="contentName" type="String" mode="OUT" optional="true"/>
<attribute name="statusId" type="String" mode="OUT" optional="true"/>
<attribute name="description" type="String" mode="OUT" optional="true"/>
<attribute name="templateDataResourceId" type="String" mode="OUT" optional="true"/>
<attribute name="summary" type="String" mode="OUT" optional="true"/>
<attribute name="article" type="String" mode="OUT" optional="true"/>
<attribute name="imageDataResourceId" type="String" mode="OUT" optional="true"/>
</service>
<!-- TO BE REMOVED
<service name="updateBlogEntry" engine="simple" transaction-timeout="300" auth="true"
location="org/ofbiz/content/blog/BlogServices.xml" invoke="updateBlogEntry">
@@ -27,7 +27,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="createContent">
<description>Create a Content</description>
<permission-service service-name="genericContentPermission" main-action="CREATE"/>
<implements service="genericContentPermission" optional="true"/>
<auto-attributes entity-name="Content" include="nonpk" mode="IN" optional="true"/>
<!-- TODO: the following fields are deprecated; but will not be removed until all services and callers are updated -->
<attribute mode="IN" name="targetOperationList" optional="true" type="List"/>
@@ -119,7 +118,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="updateContent">
<description>Update a Content</description>
<permission-service service-name="genericContentPermission" main-action="UPDATE"/>
<implements service="genericContentPermission" optional="true"/>
<implements service="updateContentAssoc" optional="true"/>
<auto-attributes entity-name="Content" include="pk" mode="INOUT" optional="false"/>
<auto-attributes entity-name="Content" include="nonpk" mode="IN" optional="true"/>
@@ -241,7 +239,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="createContentAssoc">
<description>Create a ContentAssoc</description>
<permission-service service-name="genericContentPermission" main-action="UPDATE"/>
<implements service="genericContentPermission" optional="true"/>
<auto-attributes include="all" mode="IN" optional="true"/>
<!-- deprecated fields to be removed -->
<attribute mode="IN" name="targetOperationList" optional="true" type="List"/>
@@ -260,7 +257,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="updateContentAssoc">
<description>Update a ContentAssoc</description>
<permission-service service-name="genericContentPermission" main-action="UPDATE"/>
<implements service="genericContentPermission" optional="true"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<!-- deprecated fields to be removed -->
@@ -277,7 +273,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="removeContentAssoc">
<description>Remove ContentAssoc</description>
<permission-service service-name="genericContentPermission" main-action="DELETE"/>
<implements service="genericContentPermission" optional="true"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<!-- deprecated fields to be removed -->
<attribute mode="IN" name="targetOperationList" optional="true" type="List"/>
@@ -303,7 +298,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="createContentRole">
<description>Create a ContentRole</description>
<permission-service service-name="genericContentPermission" main-action="UPDATE"/>
<implements service="genericContentPermission" optional="true"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<override name="fromDate" optional="true"/>
@@ -312,7 +306,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="updateContentRole">
<description>Update a ContentRole</description>
<permission-service service-name="genericContentPermission" main-action="UPDATE"/>
<implements service="genericContentPermission" optional="true"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
</service>
@@ -320,7 +313,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="deactivateAllContentRoles">
<description>Deactivate all ContentRoles</description>
<permission-service service-name="genericContentPermission" main-action="UPDATE"/>
<implements service="genericContentPermission" optional="true"/>
<attribute mode="IN" name="contentId" optional="false" type="String"/>
<attribute mode="IN" name="roleTypeId" optional="false" type="String"/>
<attribute mode="IN" name="partyId" optional="false" type="String"/>
@@ -329,7 +321,6 @@
location="org/ofbiz/content/content/ContentServices.xml" invoke="removeContentRole">
<description>Remove ContentRole</description>
<permission-service service-name="genericContentPermission" main-action="UPDATE"/>
<implements service="genericContentPermission" optional="true"/>
<auto-attributes entity-name="ContentRole" include="pk" mode="IN" optional="false"/>
</service>
</services>
@@ -197,19 +197,22 @@ public class DataServices {
// obtain a reference to the file
File file = null;
if (UtilValidate.isEmpty(dataResourceTypeId) || dataResourceTypeId.equals("LOCAL_FILE")) {
if (UtilValidate.isEmpty(dataResourceTypeId) || dataResourceTypeId.equals("LOCAL_FILE") || dataResourceTypeId.equals("LOCAL_FILE_BIN")) {
file = new File(objectInfo);
if (!file.isAbsolute()) {
return ServiceUtil.returnError("DataResource LOCAL_FILE does not point to an absolute location");
}
} else if (dataResourceTypeId.equals("OFBIZ_FILE")) {
} else if (dataResourceTypeId.equals("OFBIZ_FILE") || dataResourceTypeId.equals("OFBIZ_FILE_BIN")) {
prefix = System.getProperty("ofbiz.home");
if (objectInfo.indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
sep = "/";
}
file = new File(prefix + sep + objectInfo);
} else if (dataResourceTypeId.equals("CONTEXT_FILE")) {
} else if (dataResourceTypeId.equals("CONTEXT_FILE") || dataResourceTypeId.equals("CONTEXT_FILE_BIN")) {
prefix = (String) context.get("rootDir");
if (UtilValidate.isEmpty(prefix)) {
return ServiceUtil.returnError("Cannot find CONTEXT_FILE with an empty context root!");
}
if (objectInfo.indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
sep = "/";
}
@@ -233,7 +233,7 @@ under the License.
</form>
<form name="AddContentAssoc" target="createContentAssoc" title="" type="single"
header-row-style="header-row" default-table-style="basic-table">
<auto-fields-service service-name="createContentAssoc"/>
<auto-fields-entity entity-name="ContentAssoc"/>
<field name="contentId" widget-style="tabletext"><display description="${contentId}"/></field>
<field name="contentIdTo" map-name="currentValue">
<lookup target-form-name="LookupContent"/>
@@ -308,15 +308,14 @@ under the License.
</field>
</form>
<!-- ContentRole forms -->
<form name="AddContentRole" target="addContentRole" title="" type="single"
header-row-style="header-row" default-table-style="basic-table">
<auto-fields-service service-name="createContentRole"/>
<field name="contentId" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext" >
<field name="contentId" widget-style="buttontext" >
<lookup target-form-name="LookupContent" />
</field>
<field name="partyId" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext"><lookup target-form-name="LookupPerson"/></field>
<field name="partyId" widget-style="buttontext"><lookup target-form-name="LookupPerson"/></field>
<field name="roleTypeId">
<drop-down allow-empty="true">
<entity-options description="${description}" entity-name="RoleType" key-field-name="roleTypeId">
@@ -133,6 +133,17 @@ under the License.
<link target="WebSiteCms?webSiteId=${parameters.webSiteId}"/>
</menu-item>
</menu>
<menu name="blog" menu-container-style="button-bar tab-bar" default-selected-style="selected" default-menu-item-name="content" default-permission-operation="CONTENT_ADMIN"
default-permission-entity-action="_ADMIN" default-associated-content-id="${userLogin.userLoginId}" selected-menuitem-context-field-name="tabButtonItem"
title="" type="simple">
<menu-item name="EditBlog" title="${uiLabelMap.CommonEdit}">
<link target="editBlog?blogContentId=${parameters.blogContentId}"/>
</menu-item>
<menu-item name="Owners" title="${uiLabelMap.FormFieldTitle_roles}">
<link target="EditContentRole?contentId=${parameters.blogContentId}"/>
</menu-item>
</menu>
<menu name="blogSub" menu-container-style="button-bar button-style-2" default-menu-item-name="content" default-permission-operation="HAS_AUTHOR_ROLE|CONTENT_ADMIN"
default-permission-entity-action="_ADMIN" default-associated-content-id="${userLogin.userLoginId}" selected-menuitem-context-field-name="currentMenuItemName"
title="" type="simple">
@@ -35,12 +35,13 @@ under the License.
<field name="articles"><hyperlink target="blogContent?blogContentId=${contentId}" description="${uiLabelMap.ContentBlogActicleList}"/></field>
</form>
<form name="BlogContent" type="list" list-name="blogContent" separate-columns="true"
<form name="BlogContent" type="list" list-name="blogContent" separate-columns="true" paginate-target="blogContent"
odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
<field name="contentId"><hidden/></field>
<field name="contentName" widget-style="tabletext">
<hyperlink target="EditBlogArticle?articleContentId=${contentId}&amp;blogContentId=${parameters.blogContentId}" description="${contentName} [${contentId}]"/>
</field>
<field name="View" title="${uiLabelMap.CommonView}"><hyperlink target="ViewBlogArticle?articleContentId=${contentId}&amp;blogContentId=${parameters.blogContentId}" description="${uiLabelMap.CommonView}"/></field>
<field name="description"><display/></field>
<field name="statusId"><display-entity entity-name="StatusItem"></display-entity></field>
<field name="localeString"><display-entity entity-name="CountryCode" key-field-name="countryCode" description="${countryName}[${countryCode}]"></display-entity></field>
@@ -48,7 +48,28 @@ under the License.
</widgets>
</section>
</screen>
<screen name="blogDecorator">
<section>
<widgets>
<decorator-screen name="commonBlogDecorator">
<decorator-section name="body">
<section>
<condition>
<not><if-empty field-name="parameters.blogContentId"/></not>
</condition>
<widgets>
<include-menu name="blog" location="component://content/widget/content/ContentMenus.xml"/>
<include-menu name="blogSub" location="component://content/widget/content/ContentMenus.xml"/>
</widgets>
</section>
<decorator-section-include name="body"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="BlogMain">
<section>
<actions>
@@ -83,11 +104,12 @@ under the License.
<screen name="EditBlog">
<section>
<actions>
<set field="tabButtonItem" value="EditBlog"/>
<set field="contentId" from-field="parameters.blogContentId"/>
<entity-one entity-name="Content" value-name="content"/>
</actions>
<widgets>
<decorator-screen name="commonBlogDecorator">
<decorator-screen name="blogDecorator">
<decorator-section name="body">
<screenlet title="${uiLabelMap.ContentBlogEdit}">
<include-form name="EditBlog" location="component://content/widget/forum/BlogForms.xml"/>
@@ -115,7 +137,7 @@ under the License.
<decorator-screen name="commonBlogDecorator">
<decorator-section name="body">
<include-menu name="blogArtSub" location="component://content/widget/content/ContentMenus.xml"/>
<screenlet title="${uiLabelMap.ContentBlogActicleList}">
<screenlet title="${uiLabelMap.ContentBlogActicleList}" navigation-form-name="BlogContent">
<include-form name="BlogContent" location="component://content/widget/forum/BlogForms.xml"/>
</screenlet>
</decorator-section>
@@ -230,57 +252,15 @@ under the License.
<screen name="ViewArticle">
<section>
<actions>
<set field="articleContentId" from-field="parameters.articleContentId"/>
<set field="ownerContentId" from-field="parameters.ownerContentId"/>
<set field="blogContentId" from-field="parameters.blogContentId"/>
<entity-one entity-name="Content" value-name="content" use-cache="true">
<field-map field-name="contentId" env-name="articleContentId"/>
<field-map field-name="contentId" env-name="parameters.articleContentId"/>
</entity-one>
<set field="enableEdit" value="false"/>
<property-to-field property="root.publish.point.blog" field="webPutPt" resource="blog"/>
<set field="rsp.contentName" value="RE: ${content.contentName}"/>
<!-- for permission service -->
<set field="upPerm.contentOperationId" value="CONTENT_UPDATE"/>
<set field="upPerm.contentPurposeTypeId" value="ARTICLE"/>
<set field="upPerm.ownerContentId" from-field="ownerContentId"/>
<set field="upPerm.contentId" from-field="articleContentId"/>
</actions>
<widgets>
<decorator-screen name="commonBlogDecorator">
<decorator-section name="body">
<label text="&lt;p/&gt;"/>
<container style="bloghr">
<container style="leftjustify">
<label text="${content.contentName}: ${content.description}" style="blogtitle"/>
</container>
<section>
<condition>
<if-service-permission service-name="genericContentPermission" main-action="UPDATE" context-map="upPerm"/>
</condition>
<widgets>
<container style="rightjustify">
<link text="Edit" target="EditArticle?contentId=${articleContentId}&amp;blogContentId=${blogContentId}" style="buttontext"/>
</container>
</widgets>
</section>
</container>
<container style="blogcontentwrapper">
<container style="resposetext">
<label text="Posted: ${content.createdDate}" style="responsetext"/>
<label text="&lt;p/&gt;"/>
</container>
<content content-id="${articleContentId}"/>
</container>
<label text="&lt;p/&gt;"/>
<include-screen name="BlogResponses"/>
<label text="&lt;p/&gt;"/>
<!--
<link text="Latest" target="LatestResponses?ownerContentId=${webPubPt}" />
-->
<include-screen name="AddBlogResponse"/>
<label text="&lt;p/&gt;"/>
<label text="${content.contentName}: ${content.description}" style="h2"/>
<content content-id="${parameters.articleContentId}"/>
</decorator-section>
</decorator-screen>
</widgets>
@@ -246,33 +246,33 @@
</sort-order>
</form>
<form name="EditArticle" target="updateBlogArticle" title="" type="upload" skip-end="true"
<form name="EditArticle" target="updateBlogArticle" title="" type="upload" skip-end="true" default-map-name="blogEntry"
default-title-style="treeHeader" default-tooltip-style="tabletext" default-widget-style="inputBox">
<field name="contentId" entry-name="articleContentId" title="Blog ID" use-when="contentId!=null||contentId==&quot;&quot;">
<field name="contentId" title="Blog ID" use-when="contentId!=null&amp;&amp;contentId!=&quot;&quot;">
<display/>
</field>
<field name="contentName" title="Short title" map-name="content">
<field name="contentName" title="Short title">
<text size="40"/>
</field>
<field name="description" title="Slightly longer title (250 chars max)" map-name="content">
<field name="description" title="Slightly longer title (250 chars max)">
<textarea cols="40" rows="2"/>
</field>
<field name="summaryData" title="Summary" map-name="summaryText" entry-name="textData" widget-style="inputBox dojo-ResizableTextArea">
<field name="summaryData" title="Summary" entry-name="summary" widget-style="inputBox dojo-ResizableTextArea">
<textarea cols="60" rows="4"/>
</field>
<field name="textData" title="Article" map-name="mainText" widget-style="inputBox dojo-ResizableTextArea">
<field name="textData" title="Article" entry-name="article" widget-style="inputBox dojo-ResizableTextArea">
<textarea cols="60" rows="12"/>
</field>
<field name="uploadedFile" title="Image">
<file size="25"/>
</field>
<field name="dataResourceId" title="Template" map-name="content">
<field name="dataResourceId" title="Template" entry-name="templateDataResourceId">
<drop-down allow-empty="true">
<option key="BLOG_TPL_TOPLEFT" description="Top Left"/>
<option key="BLOG_TPL_TOPCENTER" description="Top Center"/>
</drop-down>
</field>
<field name="statusId" title="Status" map-name="content">
<field name="statusId" title="Status">
<drop-down no-current-selected-key="CTNT_INITIAL_DRAFT">
<option key="CTNT_PUBLISHED" description="Publish"/>
<option key="CTNT_INITIAL_DRAFT" description="Preview"/>
@@ -102,7 +102,7 @@
</section>
<decorator-screen name="CommonBlog" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<iterate-section list-name="blogList" entry-name="blog" view-size="${blogViewSize}" paginate="true" paginate-target="MainBlog?blogContentId=${blogContentId}&amp;ownerContentId=${parameters.ownerContentId}">
<iterate-section list-name="blogList" entry-name="blog" paginate="true" paginate-target="MainBlog">
<section name="firstBlog">
<condition>
<if-compare field-name="itemIndex" operator="equals" type="Integer" value="0"/>
@@ -131,7 +131,7 @@
<include-menu name="view_edit" location="component://ecommerce/widget/blog/BlogMenus.xml"/>
<label text="&lt;p/&gt;"/>
<!--<label text="${blog.contentName} [${blog.contentId}]" style="blogheader"/>-->
<link text="${blog.contentName} [${blog.contentId}]" target="ViewBlogArticle?articleContentId=${blog.contentId}&amp;blogContentId=${blogContentId}" style="blogheader" url-mode="inter-app"/>
<link text="${blog.contentName} [${blog.contentId}]" target="ViewBlogArticle?articleContentId=${blog.contentId}&amp;blogContentId=${blogContentId}" style="blogheader"/>
<!--
<link text="Latest" target="LatestResponses?ownerContentId=${blog.ownerContentId}" />
-->
@@ -192,50 +192,7 @@
<if-service-permission service-name="genericContentPermission" main-action="UPDATE" context-map="upPerm"/>
</condition>
<actions>
<set field="contentId" from-field="parameters.articleContentId"/>
<entity-one entity-name="Content" value-name="content">
<field-map env-name="contentId" field-name="contentId"/>
</entity-one>
<set field="content.contentId" from-field="content.contentId" default-value="${parameters.contentId}"/>
<set field="content.ownerContentId" from-field="content.ownerContentId" default-value="${parameters.blogContentId}"/>
<set field="content.contentTypeId" value="DOCUMENT"/>
<set field="thisContentId" from-field="content.contentId"/>
<!-- see if the main text is directly attached to the article (no template -->
<entity-one entity-name="ElectronicText" value-name="mainText" use-cache="true">
<field-map env-name="content.dataResourceId" field-name="dataResourceId"/>
</entity-one>
<!-- get the summary sub-content -->
<set field="summaryMapKey" value="SUMMARY"/>
<service service-name="getSubContent" result-map-name="result" auto-field-map="false">
<field-map field-name="contentId" env-name="content.contentId"/>
<field-map field-name="mapKey" env-name="summaryMapKey"/>
</service>
<entity-one entity-name="ElectronicText" value-name="summaryText" use-cache="false">
<field-map field-name="dataResourceId" env-name="result.view.dataResourceId"/>
</entity-one>
<!-- get the image sub-content -->
<set field="imageMapKey" value="IMAGE"/>
<service service-name="getSubContent" result-map-name="imageResult" auto-field-map="false">
<field-map field-name="contentId" env-name="content.contentId"/>
<field-map field-name="mapKey" env-name="imageMapKey"/>
</service>
<set field="imageContent" from-field="imageResult.view" type="Object"/>
<!-- the final main text if it doesn't already exist -->
<set field="mainMapKey" value="MAIN"/>
<service service-name="getSubContent" result-map-name="textResult" auto-field-map="false">
<field-map field-name="contentId" env-name="content.contentId"/>
<field-map field-name="mapKey" env-name="mainMapKey"/>
</service>
<set field="textContent" from-field="textResult.view" type="Object"/>
<entity-one entity-name="ElectronicText" value-name="mainText" use-cache="true">
<field-map env-name="textResult.view.dataResourceId" field-name="dataResourceId"/>
</entity-one>
<service service-name="getBlogEntry" result-map-name="blogEntry" auto-field-map="true"/>
</actions>
<widgets>
<decorator-screen name="CommonBlog" location="${parameters.mainDecoratorLocation}">
@@ -255,7 +212,7 @@
<screen name="ViewArticle">
<section>
<actions>
<set field="articleContentId" from-field="parameters.articleContentId"/>
<set field="articleContentId" from-field="parameters.articleContentId" default-value="${parameters.contentId}"/>
<set field="ownerContentId" from-field="parameters.ownerContentId"/>
<set field="blogContentId" from-field="parameters.blogContentId"/>
<entity-one entity-name="Content" value-name="content" use-cache="true">
@@ -291,7 +248,7 @@
</section>
</container>
<container style="blogcontentwrapper">
<container style="resposetext">
<container style="responsetext">
<label text="Posted: ${content.createdDate}" style="responsetext"/>
<label text="&lt;p/&gt;"/>
</container>