You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/03/21 02:45:52 UTC
svn commit: r1083661 - in /ofbiz/trunk/applications/product: config/
script/org/ofbiz/product/imagemanagement/
src/org/ofbiz/product/imagemanagement/
Author: hansbak
Date: Mon Mar 21 01:45:51 2011
New Revision: 1083661
URL: http://svn.apache.org/viewvc?rev=1083661&view=rev
Log:
set default image from image management to product entity
Modified:
ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml
ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
Modified: ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=1083661&r1=1083660&r2=1083661&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml Mon Mar 21 01:45:51 2011
@@ -77,6 +77,9 @@
<value xml:lang="zh">æ æ³ç¼©æ¾åå§å¾å</value>
<value xml:lang="zh_TW">ç¡æ³ç¸®æ¾åå§åå</value>
</property>
+ <property key="ImageManagementErrorMessageResizeImage">
+ <value xml:lang="en">Cannot resize image format not jpg.</value>
+ </property>
<property key="ProductCreateCommunicationEventProductPermissionError">
<value xml:lang="en">Create Communication Event Product Permission Error</value>
<value xml:lang="it">Errore di permesso durante la creazione evento comunicazione prodotto</value>
Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml?rev=1083661&r1=1083660&r2=1083661&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml Mon Mar 21 01:45:51 2011
@@ -42,12 +42,19 @@ under the License.
<entity-and list="productContentAndInfos" entity-name="ProductContentAndInfo">
<field-map field-name="productId" from-field="parameters.productId"/>
<field-map field-name="contentId" from-field="parameters.contentId"/>
- <field-map field-name="productContentTypeId" value="IMAGE"/>
+ <field-map field-name="productContentTypeId" value="DEFAULT_IMAGE"/>
</entity-and>
<if-not-empty field="productContentAndInfos">
- <set field="setThumbnailMap.productId" from-field="parameters.productId"/>
+ <first-from-list entry="productContentAndInfo" list="productContentAndInfos"/>
+ <entity-one value-field="product" entity-name="Product">
+ <field-map field-name="productId" from-field="parameters.productId"/>
+ </entity-one>
+ <set field="product.originalImageUrl" from-field="productContentAndInfo.drObjectInfo"/>
+ <store-value value-field="product"/>
+
+ <!--<set field="setThumbnailMap.productId" from-field="parameters.productId"/>
<set field="setThumbnailMap.contentIdTo" from-field="parameters.contentIdTo"/>
- <!--<call-service service-name="setThumbnail" in-map-name="setThumbnailMap"/>-->
+ <call-service service-name="setThumbnail" in-map-name="setThumbnailMap"/>-->
</if-not-empty>
</simple-method>
</simple-methods>
Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml?rev=1083661&r1=1083660&r2=1083661&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml Mon Mar 21 01:45:51 2011
@@ -154,7 +154,9 @@ under the License.
<entity-and list="contentRoles" entity-name="ContentRole" >
<field-map field-name="contentId" from-field="parameters.contentId"/>
</entity-and>
- <remove-value value-field="contentRoles[0]"/>
+ <if-not-empty field="contentRoles">
+ <remove-value value-field="contentRoles[0]"/>
+ </if-not-empty>
<entity-condition entity-name="ContentApproval" list="contentApprovals">
<condition-list combine="and">
@@ -178,7 +180,9 @@ under the License.
<entity-and list="dataResourceRoles" entity-name="DataResourceRole" >
<field-map field-name="dataResourceId" from-field="dataResourceId"/>
</entity-and>
- <remove-value value-field="dataResourceRoles[0]"/>
+ <if-not-empty field="dataResourceRoles">
+ <remove-value value-field="dataResourceRoles[0]"/>
+ </if-not-empty>
<entity-one value-field="dataResource" entity-name="DataResource">
<field-map field-name="dataResourceId" from-field="dataResourceId"/>
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1083661&r1=1083660&r2=1083661&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java Mon Mar 21 01:45:51 2011
@@ -921,6 +921,7 @@ public class ImageManagementServices {
public static Map<String, Object> resizeImageOfProduct(DispatchContext dctx, Map<String, ? extends Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
String productId = (String) context.get("productId");
@@ -970,6 +971,11 @@ public class ImageManagementServices {
return ServiceUtil.returnError(e.getMessage());
}
}
+ else{
+ String errMsg = UtilProperties.getMessage(resource, "ImageManagementErrorMessageResizeImage", locale);
+ Debug.logError(errMsg, module);
+ return ServiceUtil.returnError(errMsg);
+ }
}
} catch (Exception e) {
Debug.logError(e, module);