[OFBiz] SVN: r7781 - in trunk/applications/product: entitydef servicedef webapp/catalog/WEB-INF webapp/catalog/WEB-INF/actions/feature webapp/catalog/WEB-INF/actions/product webapp/catalog/feature widget/catalog
sichen@svn.ofbiz.org
sichen at svn.ofbiz.org
Tue Jun 13 10:59:54 CDT 2006
Author: sichen
Date: 2006-06-13 10:59:44 -0500 (Tue, 13 Jun 2006)
New Revision: 7781
Removed:
trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroupAppls.bsh
trunk/applications/product/webapp/catalog/feature/EditFeatureGroupAppls.ftl
Modified:
trunk/applications/product/entitydef/entitymodel.xml
trunk/applications/product/servicedef/services_feature.xml
trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh
trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
trunk/applications/product/webapp/catalog/feature/FeatureForms.xml
trunk/applications/product/widget/catalog/FeatureScreens.xml
Log:
Added new sequenceNum to ProductFeatureGroupAppls so feature groups could have sequence nums. Also re-factored some old FTL/BSH to screen and form widgets. From Scott Gray. Apache JIRA OFBIZ-18
Modified: trunk/applications/product/entitydef/entitymodel.xml
===================================================================
--- trunk/applications/product/entitydef/entitymodel.xml 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/entitydef/entitymodel.xml 2006-06-13 15:59:44 UTC (rev 7781)
@@ -946,6 +946,7 @@
<field name="productFeatureId" type="id-ne"></field>
<field name="fromDate" type="date-time"></field>
<field name="thruDate" type="date-time"></field>
+ <field name="sequenceNum" type="numeric"></field>
<prim-key field="productFeatureGroupId"/>
<prim-key field="productFeatureId"/>
<prim-key field="fromDate"/>
Modified: trunk/applications/product/servicedef/services_feature.xml
===================================================================
--- trunk/applications/product/servicedef/services_feature.xml 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/servicedef/services_feature.xml 2006-06-13 15:59:44 UTC (rev 7781)
@@ -178,6 +178,7 @@
<attribute name="productFeatureId" type="String" mode="IN" optional="false"/>
<attribute name="fromDate" type="java.sql.Timestamp" mode="IN" optional="true"/>
<attribute name="thruDate" type="java.sql.Timestamp" mode="IN" optional="true"/>
+ <attribute name="sequenceNum" type="Long" mode="IN" optional="true"/>
</service>
<service name="updateProductFeatureGroupAppl" engine="simple"
location="org/ofbiz/product/feature/ProductFeatureServices.xml" invoke="updateProductFeatureGroupAppl" auth="true">
@@ -186,6 +187,7 @@
<attribute name="productFeatureId" type="String" mode="IN" optional="false"/>
<attribute name="fromDate" type="java.sql.Timestamp" mode="IN" optional="false"/>
<attribute name="thruDate" type="java.sql.Timestamp" mode="IN" optional="true"/>
+ <attribute name="sequenceNum" type="Long" mode="IN" optional="true"/>
</service>
<service name="removeProductFeatureGroupAppl" engine="simple"
location="org/ofbiz/product/feature/ProductFeatureServices.xml" invoke="removeProductFeatureGroupAppl" auth="true">
Deleted: trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroupAppls.bsh
===================================================================
--- trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroupAppls.bsh 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroupAppls.bsh 2006-06-13 15:59:44 UTC (rev 7781)
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
- * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *@author Andy Zeneski (jaz at ofbiz.org)
- *@version $Rev$
- *@since 3.0
- */
-
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.*;
-
-security = request.getAttribute("security");
-delegator = request.getAttribute("delegator");
-groupId = request.getParameter("productFeatureGroupId");
-categoryId = request.getParameter("productFeatureCategoryId");
-
-if(security.hasEntityPermission("CATALOG", "_VIEW", session)) {
- context.put("hasPermission", Boolean.TRUE);
-} else {
- context.put("hasPermission", Boolean.FALSE);
-}
-
-featureGroupAppls = delegator.findByAnd("ProductFeatureGroupAppl", UtilMisc.toMap("productFeatureGroupId", groupId));
-context.put("featureGroupAppls", featureGroupAppls);
-
-productFeatureCategories = delegator.findAll("ProductFeatureCategory");
-context.put("productFeatureCategories", productFeatureCategories);
-
-if (categoryId != null) {
- productFeatures = delegator.findByAnd("ProductFeature", UtilMisc.toMap("productFeatureCategoryId", categoryId), UtilMisc.toList("productFeatureTypeId", "description"));
- context.put("productFeatures", productFeatures);
-}
\ No newline at end of file
Modified: trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh
===================================================================
--- trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh 2006-06-13 15:59:44 UTC (rev 7781)
@@ -31,14 +31,18 @@
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericEntity;
productFeatureGroupId = parameters.get("productFeatureGroupId");
if ((productFeatureGroupId != null) && !(productFeatureGroupId.equals(""))) {
productFeatureGroup = delegator.findByPrimaryKey("ProductFeatureGroup", UtilMisc.toMap("productFeatureGroupId", productFeatureGroupId));
productFeatures = new LinkedList();
- productFeatureGroupAppls = productFeatureGroup.getRelated("ProductFeatureGroupAppl");
+ productFeatureGroupAppls = productFeatureGroup.getRelated("ProductFeatureGroupAppl", UtilMisc.toList("sequenceNum"));
for (pFGAi = productFeatureGroupAppls.iterator(); pFGAi.hasNext(); ) {
- productFeatures.add(pFGAi.next().getRelatedOne("ProductFeature"));
+ productFeatureGroupAppl = (GenericEntity)pFGAi.next();
+ productFeature = (GenericEntity)productFeatureGroupAppl.getRelatedOne("ProductFeature");
+ productFeature.set("defaultSequenceNum", productFeatureGroupAppl.getLong("sequenceNum"));
+ productFeatures.add(productFeature);
}
context.put("productFeatureGroup", productFeatureGroup);
context.put("productFeatures", productFeatures);
Modified: trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
===================================================================
--- trunk/applications/product/webapp/catalog/WEB-INF/controller.xml 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/webapp/catalog/WEB-INF/controller.xml 2006-06-13 15:59:44 UTC (rev 7781)
@@ -1066,10 +1066,16 @@
</request-map>
<request-map uri="UpdateProductFeatureGroupAppl">
<security https="true" auth="true"/>
- <event type="service" invoke="updateProductFeatureGroupAppl"/>
+ <event type="service-multi" invoke="updateProductFeatureGroupAppl"/>
<response name="success" type="view" value="EditFeatureGroupAppls"/>
<response name="error" type="view" value="EditFeatureGroupAppls"/>
</request-map>
+ <request-map uri="ApplyFeaturesFromCategoryToGroup">
+ <security https="true" auth="true"/>
+ <event type="service-multi" invoke="createProductFeatureGroupAppl"/>
+ <response name="success" type="view" value="EditFeatureGroupAppls"/>
+ <response name="error" type="view" value="EditFeatureGroupAppls"/>
+ </request-map>
<request-map uri="RemoveProductFeatureGroupAppl">
<security https="true" auth="true"/>
<event type="service" invoke="removeProductFeatureGroupAppl"/>
Deleted: trunk/applications/product/webapp/catalog/feature/EditFeatureGroupAppls.ftl
===================================================================
--- trunk/applications/product/webapp/catalog/feature/EditFeatureGroupAppls.ftl 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/webapp/catalog/feature/EditFeatureGroupAppls.ftl 2006-06-13 15:59:44 UTC (rev 7781)
@@ -1,124 +0,0 @@
-<#--
- * Copyright (c) 2003-2005 The Open For Business Project - www.ofbiz.org
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
- * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
- * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *@author Andy Zeneski (jaz at ofbiz.org)
- *@version $Rev$
- *@since 3.0
--->
-
-<div class="head1">${uiLabelMap.ProductEditFeatureGroupAppls}</div>
-
-<br/>
-<table border="1" cellpadding='2' cellspacing='0'>
- <tr>
- <td><div class="tableheadtext">${uiLabelMap.CommonId}</div></td>
- <td><div class="tableheadtext">${uiLabelMap.ProductFeature}</div></td>
- <td><div class="tableheadtext">${uiLabelMap.CommonType}</div></td>
- <td><div class="tableheadtext">${uiLabelMap.ProductFeatureCategory}</div></td>
- <td><div class="tableheadtext"> </div></td>
- </tr>
-
- <#list featureGroupAppls as groupAppl>
- <#assign feature = groupAppl.getRelatedOne("ProductFeature")>
- <#assign type = feature.getRelatedOne("ProductFeatureType")>
- <#assign category = feature.getRelatedOne("ProductFeatureCategory")>
- <tr>
- <td><div class="tabletext">${feature.productFeatureId}</div></td>
- <td><div class="tabletext">${feature.description?if_exists}</div></td>
- <td><div class="tabletext">${type.get("description",locale)}</div></td>
- <td><div class="tabletext">${category.description} (${category.productFeatureCategoryId})</div></td>
- <td><a href="<@ofbizUrl>RemoveProductFeatureGroupAppl?productFeatureGroupId=${groupAppl.productFeatureGroupId}&productFeatureId=${groupAppl.productFeatureId}&fromDate=${groupAppl.fromDate?string}</@ofbizUrl>" class="buttontext">[${uiLabelMap.CommonRemove}]</a>
- </tr>
- </#list>
-</table>
-
-<br/>
-<form method="post" action="<@ofbizUrl>CreateProductFeatureGroupAppl</@ofbizUrl>" style='margin: 0;'>
- <input type="hidden" name="productFeatureGroupId" value="${requestParameters.productFeatureGroupId}">
- <div class='head2'>${uiLabelMap.ProductQuickApplyFeature}:</div>
- <br/>
- <table>
- <tr>
- <td><div class='tabletext'>${uiLabelMap.ProductFeatureId}:</div></td>
- <td><input type="text" class='inputBox' size='30' name='productFeatureId' value=''></td>
- </tr>
- <tr>
- <td colspan='2'><input type="submit" value="${uiLabelMap.CommonCreate}"></td>
- </tr>
- </table>
-</form>
-
-<br/>
-<#if !productFeatures?has_content>
- <form method="post" action="<@ofbizUrl>EditFeatureGroupAppls</@ofbizUrl>" style='margin: 0;'>
- <input type="hidden" name="productFeatureGroupId" value="${requestParameters.productFeatureGroupId}">
- <div class='head2'>${uiLabelMap.ProductApplyFeaturesFromCategory}:</div>
- <br/>
- <table>
- <tr>
- <td><div class='tabletext'>${uiLabelMap.ProductFeatureCategory}:</div></td>
- <td>
- <select class="selectBox" name="productFeatureCategoryId">
- <#list productFeatureCategories as category>
- <option value="${category.productFeatureCategoryId}">${category.description}</option>
- </#list>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan='2'><input type="submit" value="${uiLabelMap.CommonContinue}"></td>
- </tr>
- </table>
- </form>
-<#else>
-
-
- <div class='head2'${uiLabelMap.ProductApplyFeaturesFromCategory}:</div>
- <br/>
- <table border="1" cellpadding='2' cellspacing='0'>
- <tr>
- <td><div class='tableheadtext'>${uiLabelMap.CommonId}</div></td>
- <td><div class='tableheadtext'>${uiLabelMap.CommonType}</div></td>
- <td><div class='tableheadtext'>${uiLabelMap.CommonDescription}</div></td>
- <td><div class='tableheadtext'>${uiLabelMap.CommonIdCode}</div></td>
- <td><div class='tableheadtext'>${uiLabelMap.ProductAbbrev}</div></td>
- <td><div class='tableheadtext'> </div></td>
- </tr>
-
- <#list productFeatures as feature>
- <#assign type = feature.getRelatedOne("ProductFeatureType")>
- <form method="post" action="<@ofbizUrl>CreateProductFeatureGroupAppl</@ofbizUrl>" style='margin: 0;'>
- <input type="hidden" name="productFeatureGroupId" value="${requestParameters.productFeatureGroupId}">
- <input type="hidden" name="productFeatureCategoryId" value="${requestParameters.productFeatureCategoryId}">
- <input type="hidden" name="productFeatureId" value="${feature.productFeatureId}">
- <tr>
- <td><div class="tabletext">${feature.productFeatureId}</div></td>
- <td><div class="tabletext">${type.description}</div></td>
- <td><div class="tabletext">${feature.description?if_exists}</div></td>
- <td><div class="tabletext">${feature.idCode?if_exists}</div></td>
- <td><div class="tabletext">${feature.abbrev?if_exists}</div></td>
- <td><input type="submit" value="${uiLabelMap.CommonApply}">
- </tr>
- </form>
- </#list>
- </table>
- <a href="<@ofbizUrl>EditFeatureGroupAppls?productFeatureGroupId=${requestParameters.productFeatureGroupId}</@ofbizUrl>" class="buttontext">[${uiLabelMap.ProductFeatureFinishedWithCategories}]</a>
-</#if>
Modified: trunk/applications/product/webapp/catalog/feature/FeatureForms.xml
===================================================================
--- trunk/applications/product/webapp/catalog/feature/FeatureForms.xml 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/webapp/catalog/feature/FeatureForms.xml 2006-06-13 15:59:44 UTC (rev 7781)
@@ -144,6 +144,64 @@
</field>
<field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
-
+ <form name="ListFeatureGroupAppls" type="multi" use-row-submit="false"
+ list-name="productFeatureGroupAndAppls" target="UpdateProductFeatureGroupAppl?productFeatureGroupId=${productFeatureGroupId}"
+ default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext" title="">
+ <field name="productFeatureGroupId"><hidden/></field>
+ <field name="fromDate"><hidden/></field>
+ <field name="productFeatureId" title="${uiLabelMap.CommonId}"><display/></field>
+ <field name="description" title="${uiLabelMap.ProductFeature}"><display/></field>
+ <field name="productFeatureTypeId" title="${uiLabelMap.CommonType}">
+ <display-entity entity-name="ProductFeatureType"/>
+ </field>
+ <field name="productFeatureCategoryId" title="${uiLabelMap.ProductFeatureCategory}">
+ <display-entity entity-name="ProductFeatureCategory"/>
+ </field>
+ <field name="sequenceNum"><text size="3"/></field>
+ <field name="removeFeatureGroupAppl" title="${uiLabelMap.CommonRemove}" widget-style="buttontext">
+ <hyperlink target="RemoveProductFeatureGroupAppl?productFeatureGroupId=${productFeatureGroupId}&productFeatureId=${productFeatureId}&fromDate=${fromDate}" description="[${uiLabelMap.CommonRemove}]"/>
+ </field>
+ <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit">
+ <submit/>
+ </field>
+ </form>
+ <form name="QuickApplyFeatureToGroup" type="single"
+ target="CreateProductFeatureGroupAppl"
+ default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext" title="">
+ <field name="productFeatureGroupId"><hidden/></field>
+ <field name="productFeatureId" title="${uiLabelMap.ProductFeatureId}"><text/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit">
+ <submit button-type="button"/>
+ </field>
+ </form>
+ <form name="ApplyFeatureCategoryToGroup" type="single"
+ target="EditFeatureGroupAppls"
+ default-widget-style="inputBox" default-tooltip-style="tabletext" title="" default-title-style="tableheadtext">
+ <field name="productFeatureGroupId"><hidden/></field>
+ <field name="productFeatureCategoryId">
+ <drop-down>
+ <list-options key-name="productFeatureCategoryId" list-name="productFeatureCategories" description="${description}"/>
+ </drop-down>
+ </field>
+ <field name="submitButton" title="${uiLabelMap.CommonContinue}" widget-style="smallSubmit">
+ <submit button-type="button"/>
+ </field>
+ </form>
+ <form name="ApplyFeaturesFromCategoryToGroup" type="multi" use-row-submit="true"
+ list-name="productFeatures" target="ApplyFeaturesFromCategoryToGroup?productFeatureGroupId=${productFeatureGroupId}"
+ default-widget-style="tabletext" default-title-style="tableheadtext" default-tooltip-style="tabletext" title="">
+ <field name="productFeatureGroupId"><hidden/></field>
+ <field name="productFeatureId" title="${uiLabelMap.CommonId}"><display/></field>
+ <field name="productFeatureTypeId" title="${uiLabelMap.CommonType}">
+ <display-entity entity-name="ProductFeatureType"/>
+ </field>
+ <field name="description" title="${uiLabelMap.ProductFeature}"><display/></field>
+ <field name="idCode" title="${uiLabelMap.CommonIdCode}"><display/></field>
+ <field name="abbrev" title="${uiLabelMap.ProductAbbrev}"><display/></field>
+ <field name="_rowSubmit" title="${uiLabelMap.CommonSelect}"><check/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit">
+ <submit/>
+ </field>
+ </form>
</forms>
Modified: trunk/applications/product/widget/catalog/FeatureScreens.xml
===================================================================
--- trunk/applications/product/widget/catalog/FeatureScreens.xml 2006-06-13 08:30:09 UTC (rev 7780)
+++ trunk/applications/product/widget/catalog/FeatureScreens.xml 2006-06-13 15:59:44 UTC (rev 7781)
@@ -202,19 +202,40 @@
<screen name="EditFeatureGroupAppls">
<section>
<actions>
- <set field="title" value="Edit Product Feature Categories"/>
- <set field="titleProperty" value="PageTitleEditFeatureCategoryFeatures"/>
+ <set field="title" value="Product Feature Group Applications"/>
+ <set field="titleProperty" value="ProductEditFeatureGroupAppls"/>
<set field="headerItem" value="featurecats"/>
<set field="tabButtonItem" value="FeatureGroup"/>
-
- <script location="component://product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroupAppls.bsh"/>
+
+ <set field="productFeatureGroupId" from-field="parameters.productFeatureGroupId"/>
+ <set field="productFeatureCategoryId" from-field="parameters.productFeatureCategoryId"/>
+ <entity-and entity-name="ProductFeatureGroupAndAppl" list-name="productFeatureGroupAndAppls">
+ <field-map field-name="productFeatureGroupId"/>
+ <order-by field-name="sequenceNum"/>
+ </entity-and>
+ <entity-condition entity-name="ProductFeatureCategory" list-name="productFeatureCategories">
+ <order-by field-name="description"/>
+ </entity-condition>
+ <entity-and entity-name="ProductFeature" list-name="productFeatures">
+ <field-map field-name="productFeatureCategoryId"/>
+ </entity-and>
</actions>
<widgets>
<decorator-screen name="CommonFeatureDecorator">
<decorator-section name="body">
- <platform-specific>
- <html><html-template location="component://product/webapp/catalog/feature/EditFeatureGroupAppls.ftl"/></html>
- </platform-specific>
+ <container>
+ <label style="head1">${uiLabelMap.${titleProperty}}</label>
+ </container>
+ <include-form name="ListFeatureGroupAppls" location="component://product/webapp/catalog/feature/FeatureForms.xml"/>
+ <container>
+ <label style="head2">${uiLabelMap.ProductQuickApplyFeature}:</label>
+ </container>
+ <include-form name="QuickApplyFeatureToGroup" location="component://product/webapp/catalog/feature/FeatureForms.xml"/>
+ <container>
+ <label style="head2">${uiLabelMap.ProductApplyFeaturesFromCategory}:</label>
+ </container>
+ <include-form name="ApplyFeatureCategoryToGroup" location="component://product/webapp/catalog/feature/FeatureForms.xml"/>
+ <include-form name="ApplyFeaturesFromCategoryToGroup" location="component://product/webapp/catalog/feature/FeatureForms.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
More information about the Svn
mailing list