svn commit: r546172 - in /ofbiz/trunk/applications/product: script/org/ofbiz/product/product/ servicedef/ src/org/ofbiz/product/product/ webapp/catalog/WEB-INF/ webapp/catalog/product/ widget/catalog/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r546172 - in /ofbiz/trunk/applications/product: script/org/ofbiz/product/product/ servicedef/ src/org/ofbiz/product/product/ webapp/catalog/WEB-INF/ webapp/catalog/product/ widget/catalog/

jacopoc
Author: jacopoc
Date: Mon Jun 11 08:30:08 2007
New Revision: 546172

URL: http://svn.apache.org/viewvc?view=rev&rev=546172
Log:
Misc cleanups and screen conversions from ftl/bsh/event to widget/minilang/service, including patches from Mario Cappellato (OFBIZ-1046)

Removed:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordSearch.java
Modified:
    ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
    ofbiz/trunk/applications/product/servicedef/services.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
    ofbiz/trunk/applications/product/webapp/catalog/product/EditProductAttributes.ftl
    ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml
    ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml?view=diff&rev=546172&r1=546171&r2=546172
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml Mon Jun 11 08:30:08 2007
@@ -884,4 +884,20 @@
             </else>
         </if-empty>
     </simple-method>
+    <!-- Product Attribute Services -->
+    <simple-method method-name="createProductAttribute" short-description="create a ProductAttribute">
+        <make-value entity-name="ProductAttribute" value-name="newEntity"/>
+        <set-pk-fields map-name="parameters" value-name="newEntity"/>
+        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
+        <create-value value-name="newEntity"/>
+    </simple-method>  
+    <simple-method method-name="updateProductAttribute" short-description="update a ProductAttribute">
+        <entity-one entity-name="ProductAttribute" value-name="lookedUpValue"/>
+        <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
+        <store-value value-name="lookedUpValue"/>
+    </simple-method>
+    <simple-method method-name="deleteProductAttribute" short-description="delete a ProductAttribute">
+        <entity-one entity-name="ProductAttribute" value-name="lookedUpValue"/>
+        <remove-value value-name="lookedUpValue"/>
+    </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?view=diff&rev=546172&r1=546171&r2=546172
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services.xml Mon Jun 11 08:30:08 2007
@@ -1094,4 +1094,25 @@
         <implements service="permissionInterface"/>
         <attribute type="String" mode="IN" name="productCategoryId" optional="true"/>
     </service>
+    <!-- Product Attribute Services -->
+    <service name="createProductAttribute" default-entity-name="ProductAttribute" engine="simple"
+            location="org/ofbiz/product/product/ProductServices.xml" invoke="createProductAttribute" auth="true">
+        <description>Create a ProductAttribute</description>
+        <permission-service service-name="productGenericPermission" main-action="CREATE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="updateProductAttribute" default-entity-name="ProductAttribute" engine="simple"
+            location="org/ofbiz/product/product/ProductServices.xml" invoke="updateProductAttribute" auth="true">
+        <description>Update a ProductAttribute</description>
+        <permission-service service-name="productGenericPermission" main-action="UPDATE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+    <service name="deleteProductAttribute" default-entity-name="ProductAttribute" engine="simple"
+            location="org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductAttribute" auth="true">
+        <description>Delete a ProductAttribute</description>
+        <permission-service service-name="productGenericPermission" main-action="DELETE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
 </services>

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?view=diff&rev=546172&r1=546171&r2=546172
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Mon Jun 11 08:30:08 2007
@@ -65,205 +65,6 @@
     public static final String resource = "ProductUiLabels";
 
     /**
-     * Updates ProductKeyword information according to UPDATE_MODE parameter, only support CREATE and DELETE, no modify becuse all fields are PKs
-     *
-     * @param request
-     *                The HTTPRequest object for the current request
-     * @param response
-     *                The HTTPResponse object for the current request
-     * @return String specifying the exit status of this event
-     */
-    public static String updateProductKeyword(HttpServletRequest request, HttpServletResponse response) {
-        GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-        Security security = (Security) request.getAttribute("security");
-        List errMsgList = new LinkedList();
-
-        String updateMode = request.getParameter("UPDATE_MODE");
-
-        if (updateMode == null || updateMode.length() <= 0) {
-            String errMsg = UtilProperties.getMessage(resource,"productevents.updatemode_not_specified", UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            Debug.logWarning("[ProductEvents.updateProductKeyword] Update Mode was not specified, but is required", module);
-            return "error";
-        }
-
-        // check permissions before moving on...
-        if (!security.hasEntityPermission("CATALOG", "_" + updateMode, request.getSession())) {
-            Map messageMap = UtilMisc.toMap("updateMode", updateMode);
-            String errMsg = UtilProperties.getMessage(resource,"productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        String productId = request.getParameter("PRODUCT_ID");
-        String keyword = request.getParameter("KEYWORD");
-        String relevancyWeightString = request.getParameter("relevancyWeight");
-        Long relevancyWeight = null;
-        if (UtilValidate.isNotEmpty(relevancyWeightString)) {
-            try {
-                relevancyWeight = Long.valueOf(relevancyWeightString);
-            } catch (NumberFormatException e) {
-                String errMsg = "Bad format for relevancyWeight [" + relevancyWeightString + "]: " + e.toString();
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                return "error";
-            }
-        }
-
-        String errMsgTemp = "";
-        if (!UtilValidate.isNotEmpty(productId)) {
-            errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_ID_missing", UtilHttp.getLocale(request)));
-        }
-        if (!UtilValidate.isNotEmpty(keyword)) {
-            errMsgList.add(UtilProperties.getMessage(resource,"productevents.keyword_missing", UtilHttp.getLocale(request)));
-        }
-        if (errMsgList.size() > 0) {
-            request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
-            return "error";
-        }
-
-        if (updateMode.equals("CREATE")) {
-            keyword = keyword.toLowerCase();
-
-            GenericValue productKeyword = delegator.makeValue("ProductKeyword", UtilMisc.toMap("productId", productId, "keyword", keyword, "relevancyWeight", relevancyWeight));
-            GenericValue newValue = null;
-
-            try {
-                newValue = delegator.findByPrimaryKey(productKeyword.getPrimaryKey());
-            } catch (GenericEntityException e) {
-                Debug.logWarning(e.getMessage(), module);
-                newValue = null;
-            }
-
-            if (newValue != null) {
-                String errMsg = UtilProperties.getMessage(resource,"productevents.could_not_create_productkeyword_entry_exists", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                return "error";
-            }
-
-            try {
-                productKeyword = productKeyword.create();
-            } catch (GenericEntityException e) {
-                Debug.logWarning(e.getMessage(), module);
-                productKeyword = null;
-            }
-            if (productKeyword == null) {
-                String errMsg = UtilProperties.getMessage(resource,"productevents.could_not_create_productkeyword_entry_write", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                return "error";
-            }
-        } else if (updateMode.equals("DELETE")) {
-            GenericValue productKeyword = null;
-
-            try {
-                productKeyword = delegator.findByPrimaryKey("ProductKeyword", UtilMisc.toMap("productId", productId, "keyword", keyword));
-            } catch (GenericEntityException e) {
-                Debug.logWarning(e.getMessage(), module);
-                productKeyword = null;
-            }
-            if (productKeyword == null) {
-                String errMsg = UtilProperties.getMessage(resource,"productevents.could_not_remove_productkeyword_entry_notexists", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                return "error";
-            }
-            try {
-                productKeyword.remove();
-            } catch (GenericEntityException e) {
-                String errMsg = UtilProperties.getMessage(resource,"productevents.could_not_remove_productkeyword_entry_writeerror", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                Debug.logWarning("[ProductEvents.updateProductKeyword] Could not remove product-keyword (write error); message: " + e.getMessage(), module);
-                return "error";
-            }
-        } else {
-            Map messageMap = UtilMisc.toMap("updateMode", updateMode);
-            String errMsg = UtilProperties.getMessage(resource,"productevents.specified_update_mode_not_supported", messageMap, UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        return "success";
-    }
-
-    /**
-     * Update (create/induce or delete) all keywords for a given Product
-     *
-     * @param request
-     *                The HTTPRequest object for the current request
-     * @param response
-     *                The HTTPResponse object for the current request
-     * @return String specifying the exit status of this event
-     */
-    public static String updateProductKeywords(HttpServletRequest request, HttpServletResponse response) {
-        String errMsg = "";
-        GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-        Security security = (Security) request.getAttribute("security");
-
-        String updateMode = request.getParameter("UPDATE_MODE");
-
-        if (updateMode == null || updateMode.length() <= 0) {
-            errMsg = UtilProperties.getMessage(resource,"productevents.updatemode_not_specified", UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            Debug.logWarning("[ProductEvents.updateProductKeywords] Update Mode was not specified, but is required", module);
-            return "error";
-        }
-
-        // check permissions before moving on...
-        if (!security.hasEntityPermission("CATALOG", "_" + updateMode, request.getSession())) {
-            errMsg = UtilProperties.getMessage(resource,"productevents.not_sufficient_permissions", UtilHttp.getLocale(request));
-            request.setAttribute( "_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        String productId = request.getParameter("PRODUCT_ID");
-
-        if (!UtilValidate.isNotEmpty(productId)) {
-            errMsg = UtilProperties.getMessage(resource,"productevents.no_product_ID_specified_keywords", UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        GenericValue product = null;
-
-        try {
-            product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));
-        } catch (GenericEntityException e) {
-            Debug.logWarning(e.getMessage(), module);
-            product = null;
-        }
-        if (product == null) {
-            Map messageMap = UtilMisc.toMap("productId", productId);
-            errMsg = UtilProperties.getMessage(resource,"productevents.product_with_productId_not_found_keywords", messageMap, UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        if (updateMode.equals("CREATE")) {
-            try {
-                KeywordSearch.induceKeywords(product, true);
-            } catch (GenericEntityException e) {
-                errMsg = UtilProperties.getMessage(resource,"productevents.could_not_create_keywords_write", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                return "error";
-            }
-        } else if (updateMode.equals("DELETE")) {
-            try {
-                product.removeRelated("ProductKeyword");
-            } catch (GenericEntityException e) {
-                errMsg = UtilProperties.getMessage(resource,"productevents.could_not_remove_keywords_write", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                Debug.logWarning("[ProductEvents.updateProductKeywords] Could not remove product-keywords (write error); message: " + e.getMessage(), module);
-                return "error";
-            }
-        } else {
-            Map messageMap = UtilMisc.toMap("updateMode", updateMode);
-            errMsg = UtilProperties.getMessage(resource,"productevents.specified_update_mode_not_supported", messageMap, UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        return "success";
-    }
-
-    /**
      * Updates/adds keywords for all products
      *
      * @param request HTTPRequest object for the current request
@@ -330,7 +131,7 @@
             GenericValue product;
             while ((product = (GenericValue) entityListIterator.next()) != null) {
                 try {
-                    KeywordSearch.induceKeywords(product, "Y".equals(doAll));
+                    KeywordIndex.indexKeywords(product, "Y".equals(doAll));
                 } catch (GenericEntityException e) {
                     //errMsg = UtilProperties.getMessage(resource,"productevents.could_not_create_keywords_write", UtilHttp.getLocale(request));
                     //request.setAttribute("_ERROR_MESSAGE_", errMsg);
@@ -574,88 +375,6 @@
                 errMsg = UtilProperties.getMessage(resource,"productevents.could_not_update_product_association_write", UtilHttp.getLocale(request));
                 request.setAttribute("_ERROR_MESSAGE_", errMsg);
                 Debug.logWarning("[ProductEvents.updateProductAssoc] Could not update product association (write error); message: " + e.getMessage(), module);
-                return "error";
-            }
-        } else {
-            Map messageMap = UtilMisc.toMap("updateMode", updateMode);
-            errMsg = UtilProperties.getMessage(resource,"productevents.specified_update_mode_not_supported", messageMap, UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        return "success";
-    }
-
-    public static String updateAttribute(HttpServletRequest request, HttpServletResponse response) {
-        String errMsg = "";
-        List errMsgList = new LinkedList();
-        GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-        Security security = (Security) request.getAttribute("security");
-
-        String updateMode = request.getParameter("UPDATE_MODE");
-
-        if (updateMode == null || updateMode.length() <= 0) {
-            errMsg = UtilProperties.getMessage(resource,"productevents.updatemode_not_specified", UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            Debug.logWarning("[CategoryEvents.updateCategory] Update Mode was not specified, but is required", module);
-            return "error";
-        }
-
-        // check permissions before moving on...
-        if (!security.hasEntityPermission("CATALOG", "_" + updateMode, request.getSession())) {
-            Map messageMap = UtilMisc.toMap("updateMode", updateMode);
-            errMsg = UtilProperties.getMessage(resource,"productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        String productId = request.getParameter("PRODUCT_ID");
-        String attrName = request.getParameter("ATTRIBUTE_NAME");
-        String attrValue = request.getParameter("ATTRIBUTE_VALUE");
-        String attrType = request.getParameter("ATTRIBUTE_TYPE");
-
-        if (!UtilValidate.isNotEmpty(productId))
-            errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_ID_missing", UtilHttp.getLocale(request)));
-        if (!UtilValidate.isNotEmpty(attrName))
-            errMsgList.add(UtilProperties.getMessage(resource,"productevents.attribute_name_missing", UtilHttp.getLocale(request)));
-        if (errMsgList.size() > 0) {
-            request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
-            return "error";
-        }
-
-        List toBeStored = new LinkedList();
-        GenericValue attribute = delegator.makeValue("ProductAttribute", null);
-
-        toBeStored.add(attribute);
-        attribute.set("productId", productId);
-        attribute.set("attrName", attrName);
-        attribute.set("attrValue", attrValue);
-        attribute.set("attrType", attrType);
-
-        if (updateMode.equals("CREATE")) {
-            try {
-                delegator.storeAll(toBeStored);
-            } catch (GenericEntityException e) {
-                errMsg = UtilProperties.getMessage(resource,"productevents.could_not_create_attribute_write", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                return "error";
-            }
-        } else if (updateMode.equals("UPDATE")) {
-            try {
-                delegator.storeAll(toBeStored);
-            } catch (GenericEntityException e) {
-                errMsg = UtilProperties.getMessage(resource,"productevents.could_not_update_attribute_write", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                Debug.logWarning("[ProductEvents.updateAttribute] Could not update attribute (write error); message: " + e.getMessage(), module);
-                return "error";
-            }
-        } else if (updateMode.equals("DELETE")) {
-            try {
-                delegator.removeByAnd("ProductAttribute", UtilMisc.toMap("productId", productId, "attrName", attrName));
-            } catch (GenericEntityException e) {
-                errMsg = UtilProperties.getMessage(resource,"productevents.could_not_delete_attribute_write", UtilHttp.getLocale(request));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                Debug.logWarning("[ProductEvents.updateAttribute] Could not delete attribute (write error); message: " + e.getMessage(), module);
                 return "error";
             }
         } else {

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?view=diff&rev=546172&r1=546171&r2=546172
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Mon Jun 11 08:30:08 2007
@@ -754,25 +754,42 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="EditProductKeyword"/>
     </request-map>
-    <request-map uri="UpdateProductKeyword">
+    <request-map uri="UpdateAllKeywords">
         <security https="true" auth="true"/>
-        <event type="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateProductKeyword"/>
+        <event type="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateAllKeywords"/>
+        <response name="success" type="view" value="main"/>
+        <response name="error" type="view" value="main"/>
+    </request-map>
+    <request-map uri="updateProductKeyword">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="updateProductKeyword"/>
         <response name="success" type="view" value="EditProductKeyword"/>
         <response name="error" type="view" value="EditProductKeyword"/>
     </request-map>
-    <request-map uri="UpdateProductKeywords">
+    <request-map uri="createProductKeyword">
         <security https="true" auth="true"/>
-        <event type="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateProductKeywords"/>
+        <event type="service" path="" invoke="createProductKeyword"/>
         <response name="success" type="view" value="EditProductKeyword"/>
         <response name="error" type="view" value="EditProductKeyword"/>
     </request-map>
-    <request-map uri="UpdateAllKeywords">
+    <request-map uri="deleteProductKeyword">
         <security https="true" auth="true"/>
-        <event type="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateAllKeywords"/>
-        <response name="success" type="view" value="main"/>
-        <response name="error" type="view" value="main"/>
+        <event type="service" path="" invoke="deleteProductKeyword"/>
+        <response name="success" type="view" value="EditProductKeyword"/>
+        <response name="error" type="view" value="EditProductKeyword"/>
+    </request-map>
+    <request-map uri="deleteProductKeywords">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="deleteProductKeywords"/>
+        <response name="success" type="view" value="EditProductKeyword"/>
+        <response name="error" type="view" value="EditProductKeyword"/>
+    </request-map>
+    <request-map uri="forceIndexProductKeywords">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="forceIndexProductKeywords"/>
+        <response name="success" type="view" value="EditProductKeyword"/>
+        <response name="error" type="view" value="EditProductKeyword"/>
     </request-map>
-
     <!-- ================ Product Associations Requests ================= -->
     <request-map uri="EditProductAssoc">
         <security https="true" auth="true"/>
@@ -829,9 +846,21 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="EditProductAttributes"/>
     </request-map>
-    <request-map uri="UpdateProductAttribute">
+    <request-map uri="createProductAttribute">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="createProductAttribute"/>
+        <response name="success" type="view" value="EditProductAttributes"/>
+        <response name="error" type="view" value="EditProductAttributes"/>
+    </request-map>
+    <request-map uri="updateProductAttribute">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="updateProductAttribute"/>
+        <response name="success" type="view" value="EditProductAttributes"/>
+        <response name="error" type="view" value="EditProductAttributes"/>
+    </request-map>
+    <request-map uri="deleteProductAttribute">
         <security https="true" auth="true"/>
-        <event type="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateAttribute"/>
+        <event type="service" path="" invoke="deleteProductAttribute"/>
         <response name="success" type="view" value="EditProductAttributes"/>
         <response name="error" type="view" value="EditProductAttributes"/>
     </request-map>

Modified: ofbiz/trunk/applications/product/webapp/catalog/product/EditProductAttributes.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/EditProductAttributes.ftl?view=diff&rev=546172&r1=546171&r2=546172
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/product/EditProductAttributes.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/product/EditProductAttributes.ftl Mon Jun 11 08:30:08 2007
@@ -1,57 +0,0 @@
-<#--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<#if productId?exists && product?exists>
-    <table border="1" cellpadding="2" cellspacing="0">
-        <tr>
-            <td><div class="tabletext"><b>${uiLabelMap.ProductName}</b></div></td>
-            <td><div class="tabletext"><b>${uiLabelMap.ProductValueType}</b></div></td>
-        </tr>
-        <#list productAttributes as productAttribute>
-        <tr valign="middle">
-            <td><div class="tabletext">${(productAttribute.attrName)?if_exists}</div></td>
-            <td>
-                <form method="post" action="<@ofbizUrl>UpdateProductAttribute?UPDATE_MODE=UPDATE</@ofbizUrl>">
-                    <input type="hidden" name="productId" value="${productAttribute.productId}"/>
-                    <input type="hidden" name="PRODUCT_ID" value="${productAttribute.productId}"/>
-                    <input type="hidden" name="ATTRIBUTE_NAME" value="${productAttribute.attrName}"/>
-                    <input type="text" class="inputBox" size="50" name="ATTRIBUTE_VALUE" value="${(productAttribute.attrValue)?if_exists}"/>
-                    <input type="text" class="inputBox" size="15" name="ATTRIBUTE_TYPE" value="${(productAttribute.attrType)?if_exists}"/>
-                    <input type="submit" value="${uiLabelMap.CommonUpdate}"/>
-                </form>
-            </td>
-            <td>
-            <a href="<@ofbizUrl>UpdateProductAttribute?UPDATE_MODE=DELETE&productId=${productAttribute.productId}&PRODUCT_ID=${productAttribute.productId}&ATTRIBUTE_NAME=${productAttribute.attrName}</@ofbizUrl>" class="buttontext">
-            [${uiLabelMap.CommonDelete}]</a>
-            </td>
-        </tr>
-        </#list>
-    </table>
-    <br/>
-    <form method="post" action="<@ofbizUrl>UpdateProductAttribute</@ofbizUrl>" style="margin: 0;">
-        <input type="hidden" name="productId" value="${productId}"/>
-        <input type="hidden" name="PRODUCT_ID" value="${productId}"/>
-        <input type="hidden" name="UPDATE_MODE" value="CREATE"/>
-        <input type="hidden" name="useValues" value="true"/>
-        <div class="head2">${uiLabelMap.ProductAddProductAttributeNameValueType}:</div>
-        <input type="text" class="inputBox" name="ATTRIBUTE_NAME" size="15"/>&nbsp;
-        <input type="text" class="inputBox" name="ATTRIBUTE_VALUE" size="50"/>&nbsp;
-        <input type="text" class="inputBox" name="ATTRIBUTE_TYPE" size="15"/>&nbsp;
-        <input type="submit" value="${uiLabelMap.CommonAdd}"/>
-    </form>
-</#if>

Modified: ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml?view=diff&rev=546172&r1=546171&r2=546172
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/product/ProductForms.xml Mon Jun 11 08:30:08 2007
@@ -249,15 +249,14 @@
         </field>
         <field name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
-    <form name="UpdateProductPrice" type="list" target="updateProductPrice" title="" list-name="productPrices"
-        default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+    <form name="UpdateProductPrice" type="list" target="updateProductPrice" title="" list-name="productPrices">
         <auto-fields-service service-name="updateProductPrice" map-name="productPrice"/>
         <field name="productId"><hidden/></field>
-        <field name="productPriceTypeId" title="${uiLabelMap.ProductPriceType}" widget-style="tabletext"><display-entity entity-name="ProductPriceType"/></field>
-        <field name="productPricePurposeId" title="${uiLabelMap.CommonPurpose}" widget-style="tabletext"><display-entity entity-name="ProductPricePurpose"/></field>
-        <field name="currencyUomId" title="${uiLabelMap.ProductCurrency}" widget-style="tabletext"><display-entity entity-name="Uom" key-field-name="uomId" description="${description} [${uomId}]"/></field>
-        <field name="productStoreGroupId" title="${uiLabelMap.ProductProductStoreGroup}" widget-style="tabletext"><display-entity entity-name="ProductStoreGroup" description="${productStoreGroupName}"/></field>
-        <field name="fromDate" title="${uiLabelMap.CommonFromDateTime}" widget-style="tabletext"><display/></field>
+        <field name="productPriceTypeId" title="${uiLabelMap.ProductPriceType}"><display-entity entity-name="ProductPriceType"/></field>
+        <field name="productPricePurposeId" title="${uiLabelMap.CommonPurpose}"><display-entity entity-name="ProductPricePurpose"/></field>
+        <field name="currencyUomId" title="${uiLabelMap.ProductCurrency}" ><display-entity entity-name="Uom" key-field-name="uomId" description="${description} [${uomId}]"/></field>
+        <field name="productStoreGroupId" title="${uiLabelMap.ProductProductStoreGroup}"><display-entity entity-name="ProductStoreGroup" description="${productStoreGroupName}"/></field>
+        <field name="fromDate" title="${uiLabelMap.CommonFromDateTime}"><display/></field>
 
         <field name="termUomId">
             <drop-down allow-empty="true">
@@ -269,11 +268,11 @@
             </drop-down>
         </field>
         
-        <field name="lastUpdatedByText" title="${uiLabelMap.ProductLastModifiedBy}:" widget-style="tabletext">
+        <field name="lastUpdatedByText" title="${uiLabelMap.ProductLastModifiedBy}:">
             <display description="[${lastModifiedByUserLogin}] ${uiLabelMap.CommonOn} ${lastModifiedDate}" also-hidden="false"/>
         </field>
 
-        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
         <field name="deleteLink" title="" widget-style="buttontext">
             <hyperlink target="deleteProductPrice?productId=${productId}&amp;productPriceTypeId=${productPriceTypeId}&amp;productPricePurposeId=${productPricePurposeId}&amp;currencyUomId=${currencyUomId}&amp;productStoreGroupId=${productStoreGroupId}&amp;fromDate=${fromDate}"
                 description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
@@ -1378,8 +1377,7 @@
         </field>
         <field name="submitButton" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
     </form>
-    <form name="UpdateProductGoodIdentifications" type="list" target="updateGoodIdentification" title="" list-name="goodIdentifications"
-        default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
+    <form name="UpdateProductGoodIdentifications" type="list" target="updateGoodIdentification" title="" list-name="goodIdentifications">
         <auto-fields-service service-name="updateGoodIdentification" map-name="updateGoodIdentification"/>
         <field name="goodIdentificationTypeId" title="${uiLabelMap.ProductIdType}"><display-entity entity-name="GoodIdentificationType"/></field>
         <field name="productId"><hidden/></field>
@@ -1391,20 +1389,33 @@
         </field>
     </form>
     <!-- ProductKeywords -->
-    <form name="AddProductKeyword" type="single" target="UpdateProductKeyword" title="">
+    <form name="AddProductKeyword" type="single" target="createProductKeyword" title="">
+        <auto-fields-service service-name="createProductKeyword"/>
         <field name="productId"><hidden/></field>
-        <field name="UPDATE_MODE"><hidden value="CREATE"/></field>
-        <field name="PRODUCT_ID" entry-name="productId"><hidden/></field>
-        <field name="KEYWORD" title="${uiLabelMap.ProductKeyword}"><text/></field>
         <field name="relevancyWeight" title="${uiLabelMap.Weight}"><text default-value="1"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
     </form>
-    <form name="UpdateProductKeyword" type="list" target="UpdateProductKeyword" title="" list-name="productKeywords">
+    <form name="UpdateProductKeyword" type="list" target="deleteProductKeyword" title="" list-name="productKeywords">
+        <auto-fields-entity entity-name="ProductKeyword" default-field-type="display"/>
         <field name="productId"><hidden/></field>
-        <field name="relevancyWeight" title="${uiLabelMap.Weight}"><display/></field>
-        <field name="keyword" title="${uiLabelMap.ProductKeyword}"><display/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonDelete}"><submit button-type="button"/></field>
+    </form>
+    <!-- ProductAttribute -->
+    <form name="AddProductAttribute" type="single" target="createProductAttribute" title="">
+        <auto-fields-service service-name="createProductAttribute"/>
+        <field name="productId"><hidden/></field>
+        <field name="attrName" title="${uiLabelMap.AttributeName}"></field>
+        <field name="submitButton" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
+    </form>
+    <form name="UpdateProductAttribute" type="list" target="updateProductAttribute" title="" list-name="productAttributes">
+        <auto-fields-service service-name="updateProductAttribute" map-name="updateProductAttribute"/>
+        <field name="attrName" title="${uiLabelMap.AttributeName}"><display/></field>
+        <field name="productId"><hidden/></field>
+        <field name="attrType"><text/></field>
+        <field name="attrValue"><text/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
         <field name="deleteLink" title="" widget-style="buttontext">
-            <hyperlink target="UpdateProductKeyword?productId=${productId}&amp;keyword=${keyword}&amp;UPDATE_MODE=DELETE&amp;PRODUCT_ID=${productId}&amp;KEYWORD=${keyword}"
+            <hyperlink target="deleteProductAttribute?productId=${productId}&amp;attrName=${attrName}"
                 description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
         </field>
     </form>

Modified: ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?view=diff&rev=546172&r1=546171&r2=546172
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Mon Jun 11 08:30:08 2007
@@ -438,8 +438,8 @@
                 <decorator-screen name="CommonProductDecorator"  location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                       <container>
-                          <link target="UpdateProductKeywords?UPDATE_MODE=CREATE&amp;PRODUCT_ID=${productId}&amp;productId=${productId}" text="${uiLabelMap.ProductReInduceKeywords}" style="buttontext"/>
-                          <link target="UpdateProductKeywords?UPDATE_MODE=DELETE&amp;PRODUCT_ID=${productId}&amp;productId=${productId}" text="${uiLabelMap.ProductDeleteAllKeywords}" style="buttontext"/>
+                          <link target="forceIndexProductKeywords?productId=${productId}" text="${uiLabelMap.ProductReInduceKeywords}" style="buttontext"/>
+                          <link target="deleteProductKeywords?productId=${productId}" text="${uiLabelMap.ProductDeleteAllKeywords}" style="buttontext"/>
                       </container>
                       <container>
                           <label style="head2">${uiLabelMap.ProductAddProductKeyword}</label>
@@ -713,10 +713,12 @@
             <widgets>
                 <decorator-screen name="CommonProductDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                        <platform-specific>
-                            <html><html-template location="component://product/webapp/catalog/product/EditProductAttributes.ftl"/></html>
-                        </platform-specific>
-                    </decorator-section>
+                        <include-form name="UpdateProductAttribute" location="component://product/webapp/catalog/product/ProductForms.xml"/>
+                        <container>
+                            <label style="head2">${uiLabelMap.ProductAddProductAttributeNameValueType}</label>
+                        </container>
+                        <include-form name="AddProductAttribute" location="component://product/webapp/catalog/product/ProductForms.xml"/>
+                     </decorator-section>
                 </decorator-screen>
             </widgets>
         </section>