Misc cleanups and screen conversions from ftl/bsh/event to widget/minilang/service, including patches from Mario Cappellato (OFBIZ-1046)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@546172 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -884,4 +884,20 @@ under the License.
|
||||
</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>
|
||||
|
||||
@@ -1094,4 +1094,25 @@ under the License.
|
||||
<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>
|
||||
|
||||
@@ -1,40 +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.
|
||||
*******************************************************************************/
|
||||
package org.ofbiz.product.product;
|
||||
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
|
||||
/**
|
||||
* These are left over utlity methods from the product search code, just calling over to KeywordIndex now; can probably remove soon.
|
||||
*/
|
||||
public class KeywordSearch {
|
||||
|
||||
public static final String module = KeywordSearch.class.getName();
|
||||
|
||||
public static void induceKeywords(GenericValue product) throws GenericEntityException {
|
||||
if (product == null) return;
|
||||
KeywordIndex.indexKeywords(product, false);
|
||||
}
|
||||
|
||||
public static void induceKeywords(GenericValue product, boolean doAll) throws GenericEntityException {
|
||||
if (product == null) return;
|
||||
KeywordIndex.indexKeywords(product, doAll);
|
||||
}
|
||||
}
|
||||
@@ -64,205 +64,6 @@ public class ProductEvents {
|
||||
public static final String module = ProductEvents.class.getName();
|
||||
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
|
||||
*
|
||||
@@ -330,7 +131,7 @@ public class ProductEvents {
|
||||
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);
|
||||
@@ -586,88 +387,6 @@ public class ProductEvents {
|
||||
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 {
|
||||
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";
|
||||
}
|
||||
|
||||
/** Event to clear the last viewed categories */
|
||||
public static String clearLastViewedCategories(HttpServletRequest request, HttpServletResponse response) {
|
||||
// just store a new empty list in the session
|
||||
|
||||
@@ -754,25 +754,42 @@ under the License.
|
||||
<security https="true" auth="true"/>
|
||||
<response name="success" type="view" value="EditProductKeyword"/>
|
||||
</request-map>
|
||||
<request-map uri="UpdateProductKeyword">
|
||||
<security https="true" auth="true"/>
|
||||
<event type="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateProductKeyword"/>
|
||||
<response name="success" type="view" value="EditProductKeyword"/>
|
||||
<response name="error" type="view" value="EditProductKeyword"/>
|
||||
</request-map>
|
||||
<request-map uri="UpdateProductKeywords">
|
||||
<security https="true" auth="true"/>
|
||||
<event type="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateProductKeywords"/>
|
||||
<response name="success" type="view" value="EditProductKeyword"/>
|
||||
<response name="error" type="view" value="EditProductKeyword"/>
|
||||
</request-map>
|
||||
<request-map uri="UpdateAllKeywords">
|
||||
<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"/>
|
||||
</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="createProductKeyword">
|
||||
<security https="true" auth="true"/>
|
||||
<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="deleteProductKeyword">
|
||||
<security https="true" auth="true"/>
|
||||
<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 @@ under the License.
|
||||
<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="java" path="org.ofbiz.product.product.ProductEvents" invoke="updateAttribute"/>
|
||||
<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="service" path="" invoke="deleteProductAttribute"/>
|
||||
<response name="success" type="view" value="EditProductAttributes"/>
|
||||
<response name="error" type="view" value="EditProductAttributes"/>
|
||||
</request-map>
|
||||
|
||||
@@ -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"/>
|
||||
<input type="text" class="inputBox" name="ATTRIBUTE_VALUE" size="50"/>
|
||||
<input type="text" class="inputBox" name="ATTRIBUTE_TYPE" size="15"/>
|
||||
<input type="submit" value="${uiLabelMap.CommonAdd}"/>
|
||||
</form>
|
||||
</#if>
|
||||
|
||||
@@ -249,15 +249,14 @@ under the License.
|
||||
</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 @@ under the License.
|
||||
</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}&productPriceTypeId=${productPriceTypeId}&productPricePurposeId=${productPricePurposeId}&currencyUomId=${currencyUomId}&productStoreGroupId=${productStoreGroupId}&fromDate=${fromDate}"
|
||||
description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
|
||||
@@ -1378,8 +1377,7 @@ under the License.
|
||||
</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 @@ under the License.
|
||||
</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}&keyword=${keyword}&UPDATE_MODE=DELETE&PRODUCT_ID=${productId}&KEYWORD=${keyword}"
|
||||
<hyperlink target="deleteProductAttribute?productId=${productId}&attrName=${attrName}"
|
||||
description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
@@ -438,8 +438,8 @@ under the License.
|
||||
<decorator-screen name="CommonProductDecorator" location="${parameters.mainDecoratorLocation}">
|
||||
<decorator-section name="body">
|
||||
<container>
|
||||
<link target="UpdateProductKeywords?UPDATE_MODE=CREATE&PRODUCT_ID=${productId}&productId=${productId}" text="${uiLabelMap.ProductReInduceKeywords}" style="buttontext"/>
|
||||
<link target="UpdateProductKeywords?UPDATE_MODE=DELETE&PRODUCT_ID=${productId}&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 @@ under the License.
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user