You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/04/18 15:54:32 UTC

svn commit: r766320 - in /ofbiz/branches/release09.04: ./ applications/content/script/org/ofbiz/content/survey/ applications/content/src/org/ofbiz/content/survey/ specialpurpose/ecommerce/templates/survey/

Author: jleroux
Date: Sat Apr 18 13:54:31 2009
New Revision: 766320

URL: http://svn.apache.org/viewvc?rev=766320&view=rev
Log:
Applied fix from trunk for revision: 766293

Modified:
    ofbiz/branches/release09.04/   (props changed)
    ofbiz/branches/release09.04/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml
    ofbiz/branches/release09.04/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
    ofbiz/branches/release09.04/specialpurpose/ecommerce/templates/survey/genericresult.ftl

Propchange: ofbiz/branches/release09.04/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Apr 18 13:54:31 2009
@@ -1 +1 @@
-/ofbiz/trunk:765933,766011,766015
+/ofbiz/trunk:765933,766011,766015,766293

Modified: ofbiz/branches/release09.04/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml?rev=766320&r1=766319&r2=766320&view=diff
==============================================================================
--- ofbiz/branches/release09.04/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml (original)
+++ ofbiz/branches/release09.04/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml Sat Apr 18 13:54:31 2009
@@ -438,7 +438,6 @@
                 </if-not-empty>
             </if-not-empty>
         </if-compare>
-
         <!-- make sure we have answers to check -->
         <if-empty field="parameters.answers">
             <add-error><fail-message message="No answers were found"/></add-error>
@@ -721,14 +720,43 @@
                 <set field="responseAnswer.textResponse" from-field="answers[&quot;${currentFieldName}&quot;]"/>
             </if-compare>
             <if-compare field="surveyQuestionAndAppl.surveyQuestionTypeId" operator="equals" value="CONTENT">
-                <!-- <log level="always" message="Found CONTENT type question"/> -->
                 <if-instance-of field="answers[&quot;${currentFieldName}&quot;]" class="java.nio.ByteBuffer">
-                    <set from-field="answers._${surveyQuestionAndAppl.surveyQuestionId}_contentType" field="partyContent._uploadedFile_contentType"/>
+                    <!--set from-field="answers._${surveyQuestionAndAppl.surveyQuestionId}_contentType" field="partyContent._uploadedFile_contentType"/>
                     <set from-field="answers._${surveyQuestionAndAppl.surveyQuestionId}_fileName" field="partyContent._uploadedFile_fileName"/>
                     <set from-field="answers[&quot;${currentFieldName}&quot;]" field="partyContent.uploadedFile"/>
                     <set value="DOCUMENT" field="partyContent.contentTypeId"/>
                     <set value="PERSONAL" field="partyContent.dataCategoryId"/>
-                    <set value="CTNT_PUBLISHED" field="partyContent.statusId"/>
+                    <set value="CTNT_PUBLISHED" field="partyContent.statusId"/-->
+                    
+                    <!--  First create the Content record -->
+                    <make-value entity-name="Content" value-field="content"/>
+                    <sequenced-id field="content.contentId" sequence-name="Content"/>
+                    <set field="content.contentTypeId" value="DOCUMENT"/>
+                    <set field="content.statusId" value="CTNT_PUBLISHED" />
+                    <create-value value-field="content"/>
+                    
+                    <!-- Create the DataResource record -->
+                    <set field="dataResource.dataResourceTypeId" value="IMAGE_OBJECT"/>
+                    <set field="dataResource.mimeTypeId" from-field="answers._${surveyQuestionAndAppl.surveyQuestionId}_contentType"/>
+                    <set field="dataResource.objectInfo" from-field="answers._${surveyQuestionAndAppl.surveyQuestionId}_fileName"/>
+                    
+                    <call-service service-name="createDataResource" in-map-name="dataResource">
+                        <result-to-field result-name="dataResourceId"/>
+                    </call-service>
+                    
+                    <!-- Create the ImageDataResource record -->
+                    <set field="imageDataResource.dataResourceId" from-field="dataResourceId"/>
+                    <set field="imageDataResource.imageData" from-field="answers[&quot;${currentFieldName}&quot;]"/>
+                    <call-service service-name="createImageDataResource" in-map-name="imageDataResource"/>                    
+                    
+                    <!-- Associate the DataResource with the Content record -->
+                    <set field="content.dataResourceId" from-field="dataResourceId"/>
+                    <store-value value-field="content"/>
+                    
+                    <set field="partyContent.partyId" from-field="parameters.partyId"/>
+                    <set field="partyContent.contentId" from-field="content.contentId"/>
+                    <set field="partyContent.partyContentTypeId" value="INTERNAL"/>
+                    <set field="partyContent.fromDate" from-field="nowTimestamp"/>
                     <call-service service-name="createPartyContent" in-map-name="partyContent">
                         <result-to-field result-name="contentId" field="responseAnswer.contentId"/>
                     </call-service>

Modified: ofbiz/branches/release09.04/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java?rev=766320&r1=766319&r2=766320&view=diff
==============================================================================
--- ofbiz/branches/release09.04/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java (original)
+++ ofbiz/branches/release09.04/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java Sat Apr 18 13:54:31 2009
@@ -27,6 +27,7 @@
 import java.net.URL;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import javolution.util.FastList;
@@ -205,6 +206,7 @@
         templateContext.put("additionalFields", passThru);
         templateContext.put("defaultValues", defaultValues);
         templateContext.put("delegator", this.delegator);
+        templateContext.put("locale", Locale.getDefault());
 
         Template template = this.getTemplate(templateUrl);
         try {

Modified: ofbiz/branches/release09.04/specialpurpose/ecommerce/templates/survey/genericresult.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/specialpurpose/ecommerce/templates/survey/genericresult.ftl?rev=766320&r1=766319&r2=766320&view=diff
==============================================================================
--- ofbiz/branches/release09.04/specialpurpose/ecommerce/templates/survey/genericresult.ftl (original)
+++ ofbiz/branches/release09.04/specialpurpose/ecommerce/templates/survey/genericresult.ftl Sat Apr 18 13:54:31 2009
@@ -17,6 +17,8 @@
 under the License.
 -->
 
+<#assign uiLabelMap = Static["org.ofbiz.base.util.UtilProperties"].getResourceBundleMap("CommonUiLabels", locale)>
+
 <h1>${survey.description?if_exists}</h1>
 <br/>