Author: hansbak
Date: Wed Jun 15 06:48:10 2011 New Revision: 1135934 URL: http://svn.apache.org/viewvc?rev=1135934&view=rev Log: add the function to be able to upload images and video/url to a productCategory Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml ofbiz/trunk/applications/product/data/ProductTypeData.xml ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml ofbiz/trunk/applications/product/servicedef/services.xml ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategoryContentContent.groovy ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=1135934&r1=1135933&r2=1135934&view=diff ============================================================================== --- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original) +++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Wed Jun 15 06:48:10 2011 @@ -24366,6 +24366,10 @@ <property key="ProductUpdateSEOContentCategory"> <value xml:lang="en">Update SEO Content for Category</value> </property> + <property key="ProductUpdateDownloadContentCategory"> + <value xml:lang="en">Update Download Content for Category</value> + <value xml:lang="th">à¸à¸±à¸à¹à¸à¸à¸§à¸´à¸à¸µà¹à¸à¸ªà¸³à¸«à¸£à¸±à¸à¸«à¸¡à¸§à¸à¸«à¸¡à¸¹à¹</value> + </property> <property key="ProductUpdateShipping"> <value xml:lang="de">Lieferung aktualisieren</value> <value xml:lang="en">Update Shipping</value> Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=1135934&r1=1135933&r2=1135934&view=diff ============================================================================== --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Wed Jun 15 06:48:10 2011 @@ -223,6 +223,7 @@ under the License. <ProductCategoryContentType description="Description" hasTable="N" parentTypeId="" prodCatContentTypeId="DESCRIPTION"/> <ProductCategoryContentType description="Description - Long" hasTable="N" parentTypeId="" prodCatContentTypeId="LONG_DESCRIPTION"/> <ProductCategoryContentType description="Alternative URL" hasTable="N" parentTypeId="" prodCatContentTypeId="ALTERNATIVE_URL"/> + <ProductCategoryContentType description="Category Image" hasTable="N" parentTypeId="" prodCatContentTypeId="CATEGORY_IMAGE"/> <ProductCategoryContentType description="Category Image URL" hasTable="N" parentTypeId="" prodCatContentTypeId="CATEGORY_IMAGE_URL"/> <ProductCategoryContentType description="Category Image Alt Text" hasTable="N" parentTypeId="" prodCatContentTypeId="CATEGORY_IMAGE_ALT"/> <ProductCategoryContentType description="Link 1 Alt Text" hasTable="N" parentTypeId="" prodCatContentTypeId="LINK1_ALT_TEXT"/> @@ -232,6 +233,8 @@ under the License. <ProductCategoryContentType description="Meta Keyword" hasTable="N" parentTypeId="" prodCatContentTypeId="META_KEYWORD"/> <ProductCategoryContentType description="Meta Description" hasTable="N" parentTypeId="" prodCatContentTypeId="META_DESCRIPTION"/> <ProductCategoryContentType description="Related URL" hasTable="N" parentTypeId="" prodCatContentTypeId="RELATED_URL"/> + <ProductCategoryContentType description="Video" hasTable="N" parentTypeId="" prodCatContentTypeId="VIDEO"/> + <ProductCategoryContentType description="Video URL" hasTable="N" parentTypeId="" prodCatContentTypeId="VIDEO_URL"/> <ProductContentType description="Online Access" hasTable="N" parentTypeId="" productContentTypeId="ONLINE_ACCESS"/> <ProductContentType description="Digital Download" hasTable="N" parentTypeId="" productContentTypeId="DIGITAL_DOWNLOAD"/> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml?rev=1135934&r1=1135933&r2=1135934&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml Wed Jun 15 06:48:10 2011 @@ -183,4 +183,43 @@ under the License. <set field="updateContent.localeString" from-field="parameters.localeString"/> <call-service service-name="updateContent" in-map-name="updateContent"/> </simple-method> + + <simple-method method-name="createDownloadContentForCategory" short-description="Create Download Content For Category"> + <set-service-fields service-name="createCategoryContent" map="parameters" to-map="createCategoryContent"/> + <!-- Create Data Resource --> + <set field="data.dataResourceTypeId" from-field="parameters.dataResourceTypeId"/> + <set field="data.dataResourceName" from-field="parameters._imageData_fileName"/> + <set field="data.mimeTypeId" from-field="parameters._imageData_contentType"/> + <set field="data.uploadedFile" from-field="parameters.imageData"/> + <call-service service-name="createDataResource" in-map-name="data"> + <result-to-field result-name="dataResourceId" field="parameters.dataResourceId"/> + </call-service> + <!-- Create attach upload to data resource --> + <set-service-fields service-name="attachUploadToDataResource" map="parameters" to-map="attachMap"/> + <set field="attachMap.uploadedFile" from-field="parameters.imageData"/> + <set field="attachMap._uploadedFile_fileName" from-field="parameters._imageData_fileName"/> + <set field="attachMap._uploadedFile_contentType" from-field="parameters._imageData_contentType"/> + <call-service service-name="attachUploadToDataResource" in-map-name="attachMap"/> + <!-- Create content from dataResource --> + <set-service-fields service-name="createContentFromDataResource" map="parameters" to-map="contentMap"/> + <set field="contentMap.contentTypeId" value="DOCUMENT"/> + <call-service service-name="createContentFromDataResource" in-map-name="contentMap"> + <result-to-field result-name="contentId" field="createCategoryContent.contentId"/> + </call-service> + + <set field="createCategoryContent.contentId" from-field="parameters.contentId"/> + <call-service service-name="createCategoryContent" in-map-name="createCategoryContent"/> + </simple-method> + + <simple-method method-name="updateDownloadContentForCategory" short-description="Update Download Content For Category"> + <set field="attachMap.uploadedFile" from-field="parameters.imageData"/> + <set field="attachMap._uploadedFile_fileName" from-field="parameters._imageData_fileName"/> + <set field="attachMap._uploadedFile_contentType" from-field="parameters._imageData_contentType"/> + <set field="attachMap.mimeTypeId" from-field="parameters._imageData_contentType"/> + <set field="attachMap.dataResourceId" from-field="parameters.fileDataResourceId"/> + <call-service service-name="attachUploadToDataResource" in-map-name="attachMap"/> + + <set-service-fields service-name="updateCategoryContent" map="parameters" to-map="updateCategoryContent"/> + <call-service service-name="updateCategoryContent" in-map-name="updateCategoryContent"/> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/product/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=1135934&r1=1135933&r2=1135934&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services.xml Wed Jun 15 06:48:10 2011 @@ -1004,6 +1004,28 @@ under the License. <attribute name="localeString" type="String" mode="IN" optional="true"/> </service> + <service name="createDownloadContentForCategory" default-entity-name="ProductCategoryContent" engine="simple" + location="component://product/script/org/ofbiz/product/category/CategoryContentServices.xml" invoke="createDownloadContentForCategory" auth="true"> + <auto-attributes include="pk" mode="IN" optional="true"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes include="nonpk" mode="IN" entity-name="Content" optional="true"/> + <attribute mode="IN" name="imageData" optional="true" type="java.nio.ByteBuffer"/> + <attribute mode="IN" name="_imageData_contentType" optional="true" type="String"/> + <attribute mode="IN" name="_imageData_fileName" optional="true" type="String"/> + <attribute name="dataResourceTypeId" type="String" mode="IN" optional="true"/> + <override name="prodCatContentTypeId" optional="false"/> + </service> + <service name="updateDownloadContentForCategory" default-entity-name="ProductCategoryContent" engine="simple" + location="component://product/script/org/ofbiz/product/category/CategoryContentServices.xml" invoke="updateDownloadContentForCategory" auth="true"> + <auto-attributes include="pk" mode="IN" optional="false"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes mode="IN" entity-name="Content" optional="true"/> + <attribute mode="IN" name="imageData" optional="true" type="java.nio.ByteBuffer"/> + <attribute mode="IN" name="_imageData_contentType" optional="true" type="String"/> + <attribute mode="IN" name="_imageData_fileName" optional="true" type="String"/> + <attribute name="fileDataResourceId" type="String" mode="IN" optional="true"/> + </service> + <!-- ProductFeatureDataResource services --> <service name="createProductFeatureDataResource" default-entity-name="ProductFeatureDataResource" engine="simple" location="component://product/script/org/ofbiz/product/product/ProductContentServices.xml" invoke="createProductFeatureDataResource" auth="true"> Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategoryContentContent.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategoryContentContent.groovy?rev=1135934&r1=1135933&r2=1135934&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategoryContentContent.groovy (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategoryContentContent.groovy Wed Jun 15 06:48:10 2011 @@ -49,4 +49,16 @@ if ("RELATED_URL".equals(prodCatContentT } context.contentFormName = "EditCategoryContentRelatedUrl"; context.contentFormTitle = "${uiLabelMap.ProductUpdateRelatedURLContentCategory}"; +}else if ("VIDEO".equals(prodCatContentTypeId) || "CATEGORY_IMAGE".equals(prodCatContentTypeId)) { + if (UtilValidate.isNotEmpty(content)) { + context.fileDataResourceId = content.dataResourceId; + } + if("CATEGORY_IMAGE".equals(prodCatContentTypeId)){ + context.dataResourceTypeId = "IMAGE_OBJECT"; + }else{ + context.dataResourceTypeId = "VIDEO_OBJECT"; + } + context.contentFormName = "EditCategoryContentDownload"; + context.contentFormTitle = "${uiLabelMap.ProductUpdateDownloadContentCategory}"; + } Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1135934&r1=1135933&r2=1135934&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Wed Jun 15 06:48:10 2011 @@ -640,7 +640,19 @@ under the License. <response name="success" type="view" value="EditCategoryContent"/> <response name="error" type="view" value="EditCategoryContentContent"/> </request-map> - + <request-map uri="updateDownloadContentForCategory"> + <security https="true" auth="true"/> + <event type="service" path="" invoke="updateDownloadContentForCategory"/> + <response name="success" type="view" value="EditCategoryContent"/> + <response name="error" type="view" value="EditCategoryContentContent"/> + </request-map> + <request-map uri="createDownloadContentForCategory"> + <security https="true" auth="true"/> + <event type="service" path="" invoke="createDownloadContentForCategory"/> + <response name="success" type="view" value="EditCategoryContent"/> + <response name="error" type="view" value="EditCategoryContentContent"/> + </request-map> + <!-- ================ Product Content Requests ================= --> <request-map uri="EditProductContent"> <security https="true" auth="true"/> Modified: ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml?rev=1135934&r1=1135933&r2=1135934&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml Wed Jun 15 06:48:10 2011 @@ -250,7 +250,7 @@ under the License. </hyperlink> </field> - <field name="productCategoryTypeId" sort-field="true"><display/></field> + <field name="productCategoryTypeId" sort-field="true"><display-entity entity-name="ProductCategoryType" description="${description}"/></field> <field name="primaryParentCategoryId" sort-field="true"><display/></field> <field name="categoryName" sort-field="true"><display/></field> <field name="description" sort-field="true"><display/></field> @@ -290,4 +290,31 @@ under the License. <field use-when="content == null" name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field> <field use-when="content != null" name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> + + <form name="EditCategoryContentDownload" type="upload" target="updateDownloadContentForCategory" title="${uiLabelMap.ProductUpdateDownloadContentCategory}"> + <alt-target use-when="contentId==null" target="createDownloadContentForCategory"/> + <auto-fields-entity entity-name="ProductCategoryContent" map-name="productCategoryContentData"/> + <field name="fromDate" use-when="contentId==null" title="${uiLabelMap.CommonFromDate}*" ><date-time/></field> + <field name="fromDate" use-when="contentId!=null" title="${uiLabelMap.CommonFromDate}" ><display/></field> + <field name="thruDate" title="${uiLabelMap.CommonThruDate}"></field> + <field name="purchaseFromDate" title="${uiLabelMap.ProductPurchaseFromDate}"></field> + <field name="purchaseThruDate" title="${uiLabelMap.ProductPurchaseThruDate}"></field> + <field name="useCountLimit" title="${uiLabelMap.ProductUseCountLimit}"></field> + <field name="useDaysLimit" title="${uiLabelMap.ProductUseTime}"></field> + + <field name="description" title="${uiLabelMap.ProductCategoryDescription}" map-name="content"><text size="40"/></field> + <field use-when="contentId == null" name="contentId" title="${uiLabelMap.ProductContentId}" tooltip="${uiLabelMap.ProductOptional}"><text maxlength="20"/></field> + <field use-when="contentId != null" name="contentId" title="${uiLabelMap.ProductContentId}" tooltip="${uiLabelMap.ProductNotModificationRecrationProductContentAssociation}" map-name="productContentData" > + <hyperlink description="${contentId} ${contentName}" target="/content/control/editContent" target-type="inter-app"> + <parameter param-name="contentId"/> + </hyperlink> + </field> + <field name="imageData" title="${uiLabelMap.ProductFile}"><file/></field> + <field name="fileDataResourceId"><hidden/></field> + <field name="productCategoryId"><hidden/></field> + <field name="prodCatContentTypeId"><hidden/></field> + <field name="dataResourceTypeId"><hidden/></field> + <field use-when="contentId == null" name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field> + <field use-when="contentId != null" name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field> + </form> </forms> |
Free forum by Nabble | Edit this page |