You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2011/03/24 08:23:50 UTC
svn commit: r1084863 [5/11] - in /ofbiz/branches/jackrabbit20100709: ./
applications/accounting/data/
applications/accounting/src/org/ofbiz/accounting/invoice/
applications/accounting/src/org/ofbiz/accounting/payment/
applications/accounting/src/org/of...
Modified: ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/image/ScaleImage.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/image/ScaleImage.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/image/ScaleImage.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/image/ScaleImage.java Thu Mar 24 07:23:42 2011
@@ -104,38 +104,42 @@ public class ScaleImage {
/* IMAGE */
// get Name and Extension
index = filenameToUse.lastIndexOf(".");
- String imgName = filenameToUse.substring(0, index - 1);
String imgExtension = filenameToUse.substring(index + 1);
// paths
- String mainFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
String imageUrlPrefix = UtilProperties.getPropertyValue("catalog", "image.url.prefix");
-
- String id = null;
+
+ FlexibleStringExpander filenameExpander;
+ String fileLocation = null;
String type = null;
+ String id = null;
if (viewType.toLowerCase().contains("main")) {
- type = "original";
+ String filenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
+ filenameExpander = FlexibleStringExpander.getInstance(filenameFormat);
id = (String) context.get("productId");
+ fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "type", "original"));
+ Debug.logWarning("fileLocation for view type = MAIN : " + fileLocation,module);
} else if (viewType.toLowerCase().contains("additional") && viewNumber != null && !viewNumber.equals("0")) {
- type = "additional";
- id = imgName + "_View_" + viewNumber;
+ String filenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format");
+ filenameExpander = FlexibleStringExpander.getInstance(filenameFormat);
+ id = (String) context.get("productId");
+ if (filenameFormat.endsWith("${id}")) {
+ id = id + "_View_" + viewNumber;
+ } else {
+ viewType = "additional" + viewNumber;
+ }
+ fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "viewtype", viewType, "sizetype", "original"));
} else {
- return ServiceUtil.returnError(UtilProperties.getMessage(resource,
- "ProductImageViewType", UtilMisc.toMap("viewType", type), locale));
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductImageViewType", UtilMisc.toMap("viewType", type), locale));
}
- FlexibleStringExpander mainFilenameExpander = FlexibleStringExpander.getInstance(mainFilenameFormat);
- String fileLocation = mainFilenameExpander.expandString(UtilMisc.toMap("location", "products", "id", context.get("productId"), "type", type));
- String filePathPrefix = "";
+
if (fileLocation.lastIndexOf("/") != -1) {
- filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
+ fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
}
- if (context.get("contentId") != null){
- resultBufImgMap.putAll(ImageTransform.getBufferedImage(imageServerPath + "/" + context.get("productId") + "/" + context.get("clientFileName"), locale));
- } else {
- /* get original BUFFERED IMAGE */
- resultBufImgMap.putAll(ImageTransform.getBufferedImage(imageServerPath + "/" + filePathPrefix + filenameToUse, locale));
- }
+ /* get original BUFFERED IMAGE */
+ resultBufImgMap.putAll(ImageTransform.getBufferedImage(imageServerPath + "/" + fileLocation + "." + imgExtension, locale));
+
if (resultBufImgMap.containsKey("responseMessage") && resultBufImgMap.get("responseMessage").equals("success")) {
bufImg = (BufferedImage) resultBufImgMap.get("bufferedImage");
@@ -149,13 +153,6 @@ public class ScaleImage {
return result;
}
- // new Filename Format
- FlexibleStringExpander addFilenameExpander = mainFilenameExpander;
- if (viewType.toLowerCase().contains("additional")) {
- String addFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format");
- addFilenameExpander = FlexibleStringExpander.getInstance(addFilenameFormat);
- }
-
/* scale Image for each Size Type */
Iterator<String> sizeIter = sizeTypeList.iterator();
while (sizeIter.hasNext()) {
@@ -169,10 +166,11 @@ public class ScaleImage {
String newFileLocation = null;
filenameToUse = sizeType + filenameToUse.substring(filenameToUse.lastIndexOf("."));
if (viewType.toLowerCase().contains("main")) {
- newFileLocation = mainFilenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "type", sizeType));
+ newFileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "type", sizeType));
} else if (viewType.toLowerCase().contains("additional")) {
- newFileLocation = addFilenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "viewtype", viewType, "sizetype", sizeType));
+ newFileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "viewtype", viewType, "sizetype", sizeType));
}
+
String newFilePathPrefix = "";
if (newFileLocation.lastIndexOf("/") != -1) {
newFilePathPrefix = newFileLocation.substring(0, newFileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
@@ -191,7 +189,7 @@ public class ScaleImage {
// write new image
try {
- ImageIO.write(bufNewImg, imgExtension, new File(imageServerPath + "/" + newFilePathPrefix + filenameToUse));
+ ImageIO.write(bufNewImg, imgExtension, new File(imageServerPath + "/" + newFileLocation + "." + imgExtension));
} catch (IllegalArgumentException e) {
String errMsg = UtilProperties.getMessage(resource, "ScaleImage.one_parameter_is_null", locale) + e.toString();
Debug.logError(errMsg, module);
@@ -205,7 +203,7 @@ public class ScaleImage {
}
/* write Return Result */
- String imageUrl = imageUrlPrefix + "/" + newFilePathPrefix + filenameToUse;
+ String imageUrl = imageUrlPrefix + "/" + newFileLocation + "." + imgExtension;
imgUrlMap.put(sizeType, imageUrl);
} // scaleImgMap
@@ -248,7 +246,7 @@ public class ScaleImage {
/* ImageProperties.xml */
String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml";
- resultXMLMap.putAll((Map<String, Object>) ImageTransform.getXMLValue(imgPropertyFullPath, locale));
+ resultXMLMap.putAll(ImageTransform.getXMLValue(imgPropertyFullPath, locale));
if (resultXMLMap.containsKey("responseMessage") && resultXMLMap.get("responseMessage").equals("success")) {
imgPropertyMap.putAll(UtilGenerics.<Map<String, Map<String, String>>>cast(resultXMLMap.get("xml")));
} else {
Modified: ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java Thu Mar 24 07:23:42 2011
@@ -150,8 +150,8 @@ public class FrameImage {
String filenameToUse = (String) contentResult.get("contentId") + ".jpg";
String filenameTouseThumb = (String) contentResult.get("contentId") + nameOfThumb + ".jpg";
- Image newImg1 = bufImg1.getScaledInstance((int) width, (int) height , Image.SCALE_SMOOTH);
- Image newImg2 = bufImg2.getScaledInstance((int) width , (int) height , Image.SCALE_SMOOTH);
+ Image newImg1 = bufImg1.getScaledInstance(width, height , Image.SCALE_SMOOTH);
+ Image newImg2 = bufImg2.getScaledInstance(width , height , Image.SCALE_SMOOTH);
BufferedImage bufNewImg = combineBufferedImage(newImg1, newImg2, bufImgType);
String mimeType = imageName.substring(imageName.lastIndexOf(".") + 1);
ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/" + productId + "/" + filenameToUse));
@@ -344,8 +344,8 @@ public class FrameImage {
request.setAttribute("_ERROR_MESSAGE_", "Required frame image content ID or dataResource ID parameters. Please upload new frame image or choose the exist frame.");
return "error";
}
- String frameContentId = (String) request.getParameter("frameContentId");
- String frameDataResourceId = (String) request.getParameter("frameDataResourceId");
+ String frameContentId = request.getParameter("frameContentId");
+ String frameDataResourceId = request.getParameter("frameDataResourceId");
if (UtilValidate.isEmpty(request.getParameter("imageWidth")) || UtilValidate.isEmpty(request.getParameter("imageHeight"))) {
String errMsg = "Image Width and Image Height are required to preview the image. Please enter in Image Width and Image Height fields.";
@@ -380,8 +380,8 @@ public class FrameImage {
int width = Integer.parseInt(request.getParameter("imageWidth"));
int height= Integer.parseInt(request.getParameter("imageHeight"));
- Image newImg1 = bufImg1.getScaledInstance((int) width, (int) height , Image.SCALE_SMOOTH);
- Image newImg2 = bufImg2.getScaledInstance((int) width , (int) height , Image.SCALE_SMOOTH);
+ Image newImg1 = bufImg1.getScaledInstance(width, height , Image.SCALE_SMOOTH);
+ Image newImg2 = bufImg2.getScaledInstance(width , height , Image.SCALE_SMOOTH);
BufferedImage bufNewImg = combineBufferedImage(newImg1, newImg2, bufImgType);
String mimeType = imageName.substring(imageName.lastIndexOf(".") + 1);
ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/preview/" + "/previewImage.jpg"));
@@ -406,7 +406,7 @@ public class FrameImage {
return "error";
}
- String frameContentId = (String) request.getParameter("frameContentId");
+ String frameContentId = request.getParameter("frameContentId");
Delegator delegator = (Delegator) request.getAttribute("delegator");
String frameDataResourceId = null;
Modified: ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java Thu Mar 24 07:23:42 2011
@@ -347,7 +347,7 @@ public class ImageManagementServices {
/* ImageProperties.xml */
String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml";
- resultXMLMap.putAll((Map<String, Object>) ImageTransform.getXMLValue(imgPropertyFullPath, locale));
+ resultXMLMap.putAll(ImageTransform.getXMLValue(imgPropertyFullPath, locale));
if (resultXMLMap.containsKey("responseMessage") && resultXMLMap.get("responseMessage").equals("success")) {
imgPropertyMap.putAll(UtilGenerics.<Map<String, Map<String, String>>>cast(resultXMLMap.get("xml")));
} else {
@@ -682,7 +682,7 @@ public class ImageManagementServices {
FileItem imageFi = null;
byte[] imageBytes = {};
for (int i=0; i < lst.size(); i++) {
- fi = (FileItem)lst.get(i);
+ fi = lst.get(i);
String fieldName = fi.getFieldName();
if (fi.isFormField()) {
String fieldStr = fi.getString();
@@ -921,6 +921,7 @@ public class ImageManagementServices {
public static Map<String, Object> resizeImageOfProduct(DispatchContext dctx, Map<String, ? extends Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
String productId = (String) context.get("productId");
@@ -970,6 +971,11 @@ public class ImageManagementServices {
return ServiceUtil.returnError(e.getMessage());
}
}
+ else{
+ String errMsg = UtilProperties.getMessage(resource, "ImageManagementErrorMessageResizeImage", locale);
+ Debug.logError(errMsg, module);
+ return ServiceUtil.returnError(errMsg);
+ }
}
} catch (Exception e) {
Debug.logError(e, module);
@@ -1047,7 +1053,7 @@ public class ImageManagementServices {
List<GenericValue> contentAssocList = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, "contentAssocTypeId", "IMAGE_THUMBNAIL"));
if (contentAssocList.size() > 0) {
for (int i = 0; i < contentAssocList.size(); i++) {
- GenericValue contentAssoc = (GenericValue) contentAssocList.get(i);
+ GenericValue contentAssoc = contentAssocList.get(i);
List<GenericValue> dataResourceAssocList = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("contentId", contentAssoc.get("contentIdTo")));
GenericValue dataResourceAssoc = EntityUtil.getFirst(dataResourceAssocList);
Modified: ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java Thu Mar 24 07:23:42 2011
@@ -83,7 +83,7 @@ public class ReplaceImage{
List<GenericValue> contentAssocReplaceList = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentIdReplace, "contentAssocTypeId", "IMAGE_THUMBNAIL"));
if (contentAssocReplaceList.size() > 0) {
for (int i = 0; i < contentAssocReplaceList.size(); i++) {
- GenericValue contentAssocReplace = (GenericValue) contentAssocReplaceList.get(i);
+ GenericValue contentAssocReplace = contentAssocReplaceList.get(i);
List<GenericValue> dataResourceAssocReplaceList = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("contentId", contentAssocReplace.get("contentIdTo")));
GenericValue dataResourceAssocReplace = EntityUtil.getFirst(dataResourceAssocReplaceList);
Modified: ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Thu Mar 24 07:23:42 2011
@@ -145,7 +145,7 @@ public class InventoryServices {
UtilMisc.toMap("errorString", ""), locale), null, null, resultNew);
}
Map<String, Object> resultUpdate = dctx.getDispatcher().runSync("createInventoryItemDetail", createUpdateDetailMap);
- if (ServiceUtil.isError(resultNew)) {
+ if (ServiceUtil.isError(resultUpdate)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"ProductInventoryItemDetailCreateProblem",
UtilMisc.toMap("errorString", ""), locale), null, null, resultUpdate);
Modified: ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/product/ProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/product/ProductServices.java (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/src/org/ofbiz/product/product/ProductServices.java Thu Mar 24 07:23:42 2011
@@ -980,13 +980,19 @@ public class ProductServices {
Locale locale = (Locale) context.get("locale");
if (UtilValidate.isNotEmpty(context.get("_uploadedFile_fileName"))) {
- String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
+ String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.additionalviewsize.format");
String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
String imageUrlPrefix = UtilProperties.getPropertyValue("catalog", "image.url.prefix");
FlexibleStringExpander filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
- String id = productId + "_View_" + productContentTypeId.charAt(productContentTypeId.length() - 1);
- String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "type", "additional", "id", id));
+ String viewNumber = String.valueOf(productContentTypeId.charAt(productContentTypeId.length() - 1));
+ String viewType = "additional" + viewNumber;
+ String id = productId;
+ if (imageFilenameFormat.endsWith("${id}")) {
+ id = productId + "_View_" + viewNumber;
+ viewType = "additional";
+ }
+ String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "viewtype", viewType, "sizetype", "original"));
String filePathPrefix = "";
String filenameToUse = fileLocation;
if (fileLocation.lastIndexOf("/") != -1) {
@@ -1007,8 +1013,18 @@ public class ProductServices {
filenameToUse += "." + extension.getString("fileExtensionId");
}
- File file = new File(imageServerPath + "/" + filePathPrefix + filenameToUse);
-
+ /* Write the new image file */
+ String targetDirectory = imageServerPath + "/" + filePathPrefix;
+ File targetDir = new File(targetDirectory);
+ if (!targetDir.exists()) {
+ boolean created = targetDir.mkdirs();
+ if (!created) {
+ String errMsg = UtilProperties.getMessage(resource, "ScaleImage.unable_to_create_target_directory", locale) + " - " + targetDirectory;
+ Debug.logFatal(errMsg, module);
+ return ServiceUtil.returnError(errMsg);
+ }
+ }
+ File file = new File(imageServerPath + "/" + fileLocation + "." + extension.getString("fileExtensionId"));
try {
RandomAccessFile out = new RandomAccessFile(file, "rw");
out.write(imageData.array());
@@ -1024,7 +1040,6 @@ public class ProductServices {
}
/* scale Image in different sizes */
- String viewNumber = String.valueOf(productContentTypeId.charAt(productContentTypeId.length() - 1));
Map<String, Object> resultResize = FastMap.newInstance();
try {
resultResize.putAll(ScaleImage.scaleImageInAllSize(context, filenameToUse, "additional", viewNumber));
@@ -1038,7 +1053,7 @@ public class ProductServices {
"ProductImageViewParsingError", UtilMisc.toMap("errorString", e.toString()), locale));
}
- String imageUrl = imageUrlPrefix + "/" + filePathPrefix + filenameToUse;
+ String imageUrl = imageUrlPrefix + "/" + fileLocation + "." + extension.getString("fileExtensionId");
/* store the imageUrl version of the image, for backwards compatibility with code that does not use scaled versions */
Map<String, Object> result = addImageResource(dispatcher, delegator, context, imageUrl, productContentTypeId);
Modified: ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy Thu Mar 24 07:23:42 2011
@@ -17,56 +17,103 @@
* under the License.
*/
+/*
+ * This script is also referenced by the ecommerce's screens and
+ * should not contain order component's specific code.
+ */
+import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.base.util.*;
import org.ofbiz.product.catalog.*;
import org.ofbiz.product.category.*;
-import org.ofbiz.entity.GenericValue;
import javolution.util.FastMap;
import javolution.util.FastList;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entity.util.EntityUtil;
-import javax.servlet.http.HttpSession;
+import javolution.util.FastList.*;
+import org.ofbiz.entity.*;
+import java.util.List;
+
+// Put the result of CategoryWorker.getRelatedCategories into the fillTree function as attribute.
+// The fillTree function will return the complete list of category of given catalog.
+// PLEASE NOTE : The structure of the complete list of fillTree function is according to the JSON_DATA plugin of the jsTree.
+
+List fillTree(rootCat) {
+ if (rootCat) {
+ rootCat.sort{ it.productCategoryId }
+ def listTree = FastList.newInstance();
+ for (root in rootCat) {
+ preCatChilds = delegator.findByAnd("ProductCategoryRollup", ["parentProductCategoryId": root.productCategoryId]);
+ catChilds = EntityUtil.getRelated("CurrentProductCategory",preCatChilds);
+ def childList = FastList.newInstance();
+ def rootMap = FastMap.newInstance();
+ category = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId": root.productCategoryId]);
+ categoryContentWrapper = new CategoryContentWrapper(category, request);
+ context.title = categoryContentWrapper.CATEGORY_NAME;
+ categoryDescription = categoryContentWrapper.DESCRIPTION;
+
+ if (categoryContentWrapper.CATEGORY_NAME) {
+ rootMap["categoryName"] = categoryContentWrapper.CATEGORY_NAME;
+ } else {
+ rootMap["categoryName"] = root.categoryName;
+ }
+ if (categoryContentWrapper.DESCRIPTION) {
+ rootMap["categoryDescription"] = categoryContentWrapper.DESCRIPTION;
+ } else {
+ rootMap["categoryDescription"] = root.description;
+ }
+ rootMap["productCategoryId"] = root.productCategoryId;
+ rootMap["child"] = catChilds;
+ rootMap["isCatalog"] = false;
+ listTree.add(rootMap);
+
+ }
+ return listTree;
+ }
+}
+
+completedTree = FastList.newInstance();
-prodCatalogList = FastList.newInstance();
+// Get the Catalogs
prodCatalogs = delegator.findByAnd("ProdCatalog");
+
if (prodCatalogs.size() > 0) {
for (i = 0; i < prodCatalogs.size(); i++) {
prodCatalogMap = FastMap.newInstance();
prodCatalog = prodCatalogs[i];
prodCatalogId = prodCatalog.getString("prodCatalogId");
- prodCatalogMap.put("prodCatalogId", prodCatalogId);
- prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName"));
- prodCatalogMap.put("catalogName", prodCatalog.getString("catalogName"));
-
- //root category list of the catalog
- prodCategoryList = CatalogWorker.getProdCatalogCategories(request, prodCatalogId, null);
- rootCategoryList = FastList.newInstance();
- if (prodCategoryList.size() > 0) {
- for (j = 0; j < prodCategoryList.size(); j++) {
- prodCategory = prodCategoryList[j];
- rootCategory = delegator.findByPrimaryKey("ProductCategory", ["productCategoryId" : prodCategory.getString("productCategoryId")]);
- rootCategoryList.add(rootCategory);
- }
- }
-
- if (rootCategoryList) {
- prodCatalogMap.put("rootCategoryList", rootCategoryList);
- prodCatalogList.add(prodCatalogMap);
+ prodCatalogMap.put("productCategoryId", prodCatalogId);
+ prodCatalogMap.put("categoryName", prodCatalog.getString("catalogName"));
+ prodCatalogMap.put("isCatalog", true);
+
+ CategoryWorker.getRelatedCategories(request, "CatalogList_"+i, CatalogWorker.getCatalogTopCategoryId(request, prodCatalogId), true);
+ categoryList = null;
+ categoryList = request.getAttribute("CatalogList_"+i);
+ prodCatalogTree = FastList.newInstance();
+
+ if (categoryList) {
+ prodCatalogTree = fillTree(categoryList);
+ prodCatalogMap.put("child", prodCatalogTree);
+ completedTree.add(prodCatalogMap);
}
}
}
+// The complete tree list for the category tree
+context.completedTree = completedTree;
-context.prodCatalogList = prodCatalogList;
-
-openTree = false;
+stillInCatalogManager = true;
productCategoryId = null;
+prodCatalogId = null;
+showProductCategoryId = null;
+
+// Reset tree condition check. Are we still in the Catalog Manager ?. If not , then reset the tree.
if ((parameters.productCategoryId != null) || (parameters.showProductCategoryId != null)) {
- openTree = true;
- productCategoryId = (parameters.productCategoryId != null) ? parameters.productCategoryId : parameters.showProductCategoryId;
+ stillInCatalogManager = false;
+ productCategoryId = parameters.productCategoryId;
+ showProductCategoryId = parameters.showProductCategoryId;
+} else if (parameters.prodCatalogId != null) {
+ stillInCatalogManager = false;
+ prodCatalogId = parameters.prodCatalogId;
}
-
-context.openTree = openTree;
+context.stillInCatalogManager = stillInCatalogManager;
context.productCategoryId = productCategoryId;
+context.prodCatalogId = prodCatalogId;
+context.showProductCategoryId = showProductCategoryId;
Modified: ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/price/EditProductPriceRules.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/price/EditProductPriceRules.groovy?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/price/EditProductPriceRules.groovy (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/price/EditProductPriceRules.groovy Thu Mar 24 07:23:42 2011
@@ -26,6 +26,11 @@ context.condOperEnums = delegator.findLi
context.productPriceActionTypes = delegator.findList("ProductPriceActionType", null, null, ['description'], null, true);
String priceRuleId = request.getParameter("productPriceRuleId");
+
+if (!priceRuleId) {
+ priceRuleId = parameters.get("productPriceRuleId");
+}
+
if (priceRuleId) {
productPriceRules = [];
productPriceRules.add(delegator.findOne("ProductPriceRule", [productPriceRuleId : priceRuleId], false));
Modified: ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy Thu Mar 24 07:23:42 2011
@@ -140,6 +140,9 @@ if (productContentTypeId) {
context.contentFormName = "EditProductContentDownload";
}
}
+if (("PAGE_TITLE".equals(productContentTypeId))||("META_KEYWORD".equals(productContentTypeId))||("META_DESCRIPTION".equals(productContentTypeId))) {
+ context.contentFormName = "EditProductContentSEO";
+}
context.productContentData = productContentData;
context.content = content;
Modified: ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/controller.xml (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/WEB-INF/controller.xml Thu Mar 24 07:23:42 2011
@@ -340,7 +340,7 @@ under the License.
<response name="error" type="view" value="EditCategoryParties"/>
</request-map>
- <!-- ================ Category Content Requests ================= -->
+ <!-- ================ Category Content Requests ================= -->
<request-map uri="EditCategoryContent">
<security https="true" auth="true"/>
<response name="success" type="view" value="EditCategoryContent"/>
@@ -352,7 +352,7 @@ under the License.
<response name="error" type="view" value="EditCategoryContent"/>
</request-map>
- <!-- ================ Category Content Assoc Requests ================= -->
+ <!-- ================ Category Content Assoc Requests ================= -->
<request-map uri="EditCategoryContentContent">
<security https="true" auth="true"/>
<response name="success" type="view" value="EditCategoryContentContent"/>
@@ -508,6 +508,7 @@ under the License.
<response name="success" type="view" value="EditProductAssetUsage"/>
<response name="error" type="view" value="EditProductAssetUsage"/>
</request-map>
+
<!-- ================ Fixed Asset to Product Requests ================= -->
<request-map uri="showFixedAssetProduct">
<security https="true" auth="true"/>
@@ -561,8 +562,8 @@ under the License.
<response name="success" type="request-redirect" value="EditProductPrices"><redirect-parameter name="productId"/></response>
<response name="error" type="view" value="EditProductPrices"/>
</request-map>
- <!-- ================ Category Content Requests ================= -->
+ <!-- ================ Category Content Requests ================= -->
<request-map uri="EditCategoryContent">
<security https="true" auth="true"/>
<response name="success" type="view" value="EditCategoryContent"/>
@@ -573,6 +574,7 @@ under the License.
<response name="success" type="view" value="EditCategoryContent"/>
<response name="error" type="view" value="EditCategoryContent"/>
</request-map>
+
<!-- ================ Category Content Assoc Requests ================= -->
<request-map uri="EditCategoryContentContent">
<security https="true" auth="true"/>
@@ -612,6 +614,13 @@ under the License.
<response name="success" type="view" value="EditCategoryContent"/>
<response name="error" type="view" value="EditCategoryContentContent"/>
</request-map>
+ <request-map uri="updateContentSEOForCategory">
+ <security https="true" auth="true"/>
+ <event type="service" path="" invoke="updateContentSEOForCategory"/>
+ <response name="success" type="view" value="EditCategoryContent"/>
+ <response name="error" type="view" value="EditCategoryContentContent"/>
+ </request-map>
+
<!-- ================ Product Content Requests ================= -->
<request-map uri="EditProductContent">
<security https="true" auth="true"/>
@@ -627,6 +636,12 @@ under the License.
<security https="true" auth="true"/>
<response name="success" type="view" value="EditProductContent"/>
</request-map>
+ <request-map uri="updateContentSEOForProduct">
+ <security https="true" auth="true"/>
+ <event type="service" path="" invoke="updateContentSEOForProduct"/>
+ <response name="success" type="view" value="EditProductContent"/>
+ <response name="error" type="view" value="EditProductContentContent"/>
+ </request-map>
<!-- ================ Product Content Assoc Requests ================= -->
<request-map uri="EditProductContentContent">
@@ -1799,7 +1814,7 @@ under the License.
<request-map uri="createProductPriceRule">
<security https="true" auth="true"/>
<event type="service" path="" invoke="createProductPriceRule"/>
- <response name="success" type="view" value="FindPriceRules"/>
+ <response name="success" type="view" value="EditProductPriceRules"/>
<response name="error" type="view" value="FindPriceRules"/>
</request-map>
<request-map uri="updateProductPriceRule">
@@ -3061,6 +3076,12 @@ under the License.
<response name="error" type="view" value="EditProductPromoContent"/>
</request-map>
+ <request-map uri="getChild">
+ <security auth="false" https="true"/>
+ <event type="java" path="org.ofbiz.product.category.CategoryServices" invoke="getChildCategoryTree"/>
+ <response name="success" type="none"/>
+ </request-map>
+
<!-- View Mappings -->
<view-map name="main" type="screen" page="component://product/widget/catalog/CommonScreens.xml#main"/>
Modified: ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/category/CategoryTree.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/category/CategoryTree.ftl?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/category/CategoryTree.ftl (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/category/CategoryTree.ftl Thu Mar 24 07:23:42 2011
@@ -16,66 +16,31 @@ KIND, either express or implied. See th
specific language governing permissions and limitations
under the License.
-->
-<script language="javascript" type="text/javascript" src="<@o...@ofbizContentUrl>"></script>
-<script language="javascript" type="text/javascript" src="<@o...@ofbizContentUrl>"></script>
-<script type="application/javascript">
-<#-- some labels are not unescaped in the JSON object so we have to do this manuely -->
+<script type="text/javascript">
+<#-- some labels are not unescaped in the JSON object so we have to do this manualy -->
function unescapeHtmlText(text) {
return jQuery('<div />').html(text).text()
}
-
-createTree();
+
+jQuery(window).load(createTree());
<#-- creating the JSON Data -->
var rawdata = [
- <#if (prodCatalogList?has_content)>
- <@fillCatalogTree prodCatalogs = prodCatalogList/>
- </#if>
-
- <#macro fillCatalogTree prodCatalogs>
- <#if (prodCatalogs?has_content)>
- <#list prodCatalogs as catalog>
- <#assign catalogId = catalog.prodCatalogId/>
- <#if !catalogName?has_content>
-
- </#if>
- <#assign categoryList = catalog.rootCategoryList/>
- {
- <#if catalogId?has_content>
- "data": {"title" : unescapeHtmlText("<#if catalog.catalogName?has_content>${catalog.catalogName}<#else>${catalogId}</#if> <#if catalog.catalogName?has_content>[${catalogId}]</#if>"), "attr": {"href": "<@o...@ofbizUrl>", "onClick" : "callDocument('<@o...@ofbizUrl>');"}},
- "attr": {"id" : "${catalogId}", "rel" : "root"},
-
- </#if>
- <#if categoryList?has_content>
- "children": [
- <@fillCategoryTree childCategoryList = categoryList/>
- ]
- </#if>
- <#if catalog_has_next>
- },
- <#else>
- }
- </#if>
- </#list>
- </#if>
- </#macro>
+ <#if (completedTree?has_content)>
+ <@fillTree rootCat = completedTree/>
+ </#if>
- <#macro fillCategoryTree childCategoryList>
- <#if childCategoryList?has_content>
- <#list childCategoryList as childCategory>
+ <#macro fillTree rootCat>
+ <#if (rootCat?has_content)>
+ <#list rootCat as root>
{
- <#local productCategoryId = childCategory.productCategoryId/>
- <#local childCategorys = Static["org.ofbiz.product.category.CategoryWorker"].getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true)>
- "data": {"title" : unescapeHtmlText("<#if childCategory.categoryName?has_content>${childCategory.categoryName}<#else>${productCategoryId}</#if> <#if childCategory.categoryName?has_content>[${productCategoryId}]</#if>"), "attr": {"href": "<@o...@ofbizUrl>", "onClick" : "callDocument('<@o...@ofbizUrl>');"}},
- "attr": {"id" : "${productCategoryId}", "rel" : "CATEGORY"},
-
- <#if childCategoryList?has_content>
- "children": [
- <@fillCategoryTree childCategoryList = childCategorys/>
- ]
+ "data": {"title" : unescapeHtmlText("<#if root.categoryName?exists>${root.categoryName?js_string} [${root.productCategoryId}]<#else>${root.productCategoryId?js_string}</#if>"), "attr": {"onClick" : "window.location.href='<@o...@ofbizUrl>'; return false;"}},
+ "attr": {"id" : "${root.productCategoryId}", "rel" : "root", "isCatalog" : "${root.isCatalog?string}"}
+ <#if root.child?exists>
+ ,"state" : "closed"
</#if>
- <#if childCategory_has_next>
+ <#if root_has_next>
},
<#else>
}
@@ -84,61 +49,34 @@ var rawdata = [
</#if>
</#macro>
];
-
- <#-------------------------------------------------------------------------------------create Tree-->
+ <#-- create Tree-->
function createTree() {
jQuery(function () {
- <#if !openTree>
+ <#-- reset the tree when user browsing out of scope of catalog manager -->
+ <#if stillInCatalogManager>
$.cookie('jstree_select', null);
$.cookie('jstree_open', null);
<#else>
- $.cookie("jstree_select", "${productCategoryId}");
+ <#-- Coloring the category when type the product categoryId manualy at the url bar -->
+ $.cookie('jstree_select', "<#if productCategoryId?exists>${productCategoryId}<#elseif prodCatalogId?exists>${prodCatalogId}<#elseif showProductCategoryId?exists>${showProductCategoryId}</#if>");
</#if>
jQuery("#tree").jstree({
- "plugins" : [ "themes", "json_data", "cookies", "ui", "types"],
+ "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"],
"json_data" : {
- "data" : rawdata
- },
- "themes" : {
- "icons" : true
- },
- "cookies" : {
- "save_opened" : false
- },
- "types" : {
- "valid_children" : [ "root" ],
- "types" : {
- "CATEGORY" : {
- "icon" : {
- "image" : "/images/jquery/plugins/jsTree/themes/apple/d.png",
- "position" : "10px40px"
+ "data" : rawdata,
+ "ajax" : { "url" : "<@o...@ofbizUrl>", "type" : "POST",
+ "data" : function (n) {
+ return {
+ "isCatalog" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 ,
+ "productCategoryId" : n.attr ? n.attr("id").replace("node_","") : 1
+ };
}
}
}
- }
});
-
});
-
- }
-
- function callDocument(url) {
- $(location).attr('href', url);
}
-
</script>
<div id="tree"></div>
-<style type="text/css">
- .jstree-default a
- {
- white-space:normal !important;
- height: auto;
- }
- .jstree-default .jstree-leaf > ins
- {
- background-position:-36px 0;
- vertical-align: top;
- }
-</style>
Modified: ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/find/keywordsearch.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/find/keywordsearch.ftl?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/find/keywordsearch.ftl (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/webapp/catalog/find/keywordsearch.ftl Thu Mar 24 07:23:42 2011
@@ -73,18 +73,34 @@ under the License.
<td align="right">
<b>
<#if 0 < viewIndex?int>
- <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a>
+ </#if>
</#if>
<#if 0 < listSize?int>
${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}
</#if>
<#if highIndex?int < listSize?int>
- | <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ | <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+ </#if>
</#if>
<#if paging == "Y">
- <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a>
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a>
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a>
+ </#if>
<#else>
- <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a>
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a>
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a>
+ </#if>
</#if>
</b>
</td>
@@ -121,18 +137,34 @@ under the License.
<td align="right">
<b>
<#if 0 < viewIndex?int>
- <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> |
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a>
+ </#if>
</#if>
<#if 0 < listSize?int>
${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}
</#if>
<#if highIndex?int < listSize?int>
- | <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ | <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a>
+ </#if>
</#if>
<#if paging == "Y">
- <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a>
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a>
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a>
+ </#if>
<#else>
- <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a>
+ <#if parameters.ACTIVE_PRODUCT?has_content && parameters.GOOGLE_SYNCED?has_content && parameters.DISCONTINUED_PRODUCT?has_content>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a>
+ <#else>
+ <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a>
+ </#if>
</#if>
</b>
</td>
Modified: ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryForms.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryForms.xml (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryForms.xml Thu Mar 24 07:23:42 2011
@@ -254,4 +254,14 @@ under the License.
<field name="categoryName" sort-field="true"><display/></field>
<field name="description" sort-field="true"><display/></field>
</form>
+
+ <form name="EditCategoryContentSEO" type="single" target="updateContentSEOForCategory" title="${uiLabelMap.ProductUpdateSimpleTextContentCategory}"
+ header-row-style="header-row" default-table-style="basic-table">
+ <field name="title" title="${uiLabelMap.PageTitle}"><text size="40"/></field>
+ <field name="metaKeyword" title="${uiLabelMap.MetaKeywords}"><textarea cols="60" rows="5"/></field>
+ <field name="metaDescription" title="${uiLabelMap.MetaDescription}"><textarea cols="60" rows="5"/></field>
+ <field name="productCategoryId"><hidden/></field>
+ <field name="prodCatContentTypeId"><hidden/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+ </form>
</forms>
Modified: ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryScreens.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryScreens.xml (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CategoryScreens.xml Thu Mar 24 07:23:42 2011
@@ -205,6 +205,8 @@ under the License.
<set field="textDataMap.text" from-field="electronicText.textData"/>
<set field="textDataMap.textDataResourceId" from-field="content.dataResourceId"/>
<set field="contentId" from-field="content.contentId"/>
+
+ <script location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy"/>
</actions>
<widgets>
<decorator-screen name="CommonCategoryDecorator">
@@ -218,7 +220,21 @@ under the License.
</widgets>
</section>
<screenlet title="${uiLabelMap.ProductUpdateSimpleTextContentCategory}">
- <include-form name="EditCategoryContentSimpleText" location="component://product/widget/catalog/CategoryForms.xml"/>
+ <section>
+ <condition>
+ <or>
+ <if-compare operator="equals" value="PAGE_TITLE" field="parameters.prodCatContentTypeId"/>
+ <if-compare operator="equals" value="META_KEYWORD" field="parameters.prodCatContentTypeId"/>
+ <if-compare operator="equals" value="META_DESCRIPTION" field="parameters.prodCatContentTypeId"/>
+ </or>
+ </condition>
+ <widgets>
+ <include-form name="EditCategoryContentSEO" location="component://product/widget/catalog/CategoryForms.xml"/>
+ </widgets>
+ <fail-widgets>
+ <include-form name="EditCategoryContentSimpleText" location="component://product/widget/catalog/CategoryForms.xml"/>
+ </fail-widgets>
+ </section>
</screenlet>
<screenlet title="${uiLabelMap.ProductListAssociatedContentInfos}">
<include-form name="ListAssociatedContentInfos" location="component://product/widget/catalog/ProductForms.xml"/>
Modified: ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CommonScreens.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CommonScreens.xml (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/CommonScreens.xml Thu Mar 24 07:23:42 2011
@@ -41,6 +41,9 @@ under the License.
<set field="applicationMenuName" value="CatalogAppBar" global="true"/>
<set field="applicationMenuLocation" value="component://product/widget/catalog/CatalogMenus.xml" global="true"/>
<set field="applicationTitle" value="${uiLabelMap.ProductCatalogManagerApplication}" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/ui/development-bundle/external/jquery.cookie.js" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/plugins/jsTree/jquery.jstree.js" global="true"/>
+ <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.5.1.min.js" global="true"/>
</actions>
<widgets>
<include-screen name="ApplicationDecorator" location="component://commonext/widget/CommonScreens.xml"/>
@@ -343,7 +346,6 @@ under the License.
<screen name="categorytree">
<section>
<actions>
- <set field="layoutSettings.javaScripts[+0]" value="/images/jquery/jquery-1.4.2.min.js" global="true"/>
<script location="component://product/webapp/catalog/WEB-INF/actions/category/CategoryTree.groovy"></script>
</actions>
<widgets>
Modified: ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductForms.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductForms.xml (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductForms.xml Thu Mar 24 07:23:42 2011
@@ -815,6 +815,16 @@ under the License.
<field use-when="contentId != null" name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
+ <form name="EditProductContentSEO" type="single" target="updateContentSEOForProduct" title="${uiLabelMap.PageTitleEditProductContent}"
+ header-row-style="header-row" default-table-style="basic-table">
+ <field name="title" title="${uiLabelMap.PageTitle}"><text size="40"/></field>
+ <field name="metaKeyword" title="${uiLabelMap.MetaKeywords}"><textarea cols="60" rows="5"/></field>
+ <field name="metaDescription" title="${uiLabelMap.MetaDescription}"><textarea cols="60" rows="5"/></field>
+ <field name="productId"><hidden/></field>
+ <field name="productContentTypeId"><hidden/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+ </form>
+
<!-- SupplierProduct -->
<form name="AddSupplierProduct" type="single" target="updateSupplierProduct" title="" default-map-name="supplierProduct"
header-row-style="header-row" default-table-style="basic-table">
Modified: ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductScreens.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductScreens.xml (original)
+++ ofbiz/branches/jackrabbit20100709/applications/product/widget/catalog/ProductScreens.xml Thu Mar 24 07:23:42 2011
@@ -97,12 +97,13 @@ under the License.
<or>
<not><if-empty field="product"/></not>
<not><if-empty field="parameters.bypassIfNoProduct"/></not>
+ <if-empty field="productId"/>
</or>
</condition>
<widgets>
<decorator-section-include name="body"/>
</widgets>
- <fail-widgets>
+ <fail-widgets>
<label style="h3">${uiLabelMap.ProductNoExistingProductsFound}</label>
</fail-widgets>
</section>
@@ -983,6 +984,7 @@ under the License.
<entity-one entity-name="Product" value-field="product"/>
<entity-one entity-name="ProductContent" value-field="productContent"/>
<script location="component://product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy"/>
+ <script location="component://product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy"/>
</actions>
<widgets>
<decorator-screen name="CommonProductDecorator" location="${parameters.productDecoratorLocation}">
Modified: ofbiz/branches/jackrabbit20100709/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/build.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/build.xml (original)
+++ ofbiz/branches/jackrabbit20100709/build.xml Thu Mar 24 07:23:42 2011
@@ -19,7 +19,8 @@ under the License.
-->
<project name="OFBiz Main Build" default="build" basedir="."
- xmlns:ivy="antlib:org.apache.ivy.ant">
+ xmlns:ivy="antlib:org.apache.ivy.ant"
+ xmlns:sonar="antlib:org.sonar.ant">
<import file="macros.xml"/>
<property name="site.dir" value="../site"/>
@@ -47,6 +48,13 @@ under the License.
</classpath>
</taskdef>
</target>
+ <target name="sonar-init">
+ <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
+ <classpath>
+ <pathelement location="framework/base/lib/sonar-ant-task-1.0.jar" />
+ </classpath>
+ </taskdef>
+ </target>
<!-- ================================================================== -->
<!-- Removes all created files and directories -->
@@ -130,7 +138,7 @@ under the License.
</target>
<target name="download-selenium"
- description="Download the selenium files">
+ description="Download the selenium server v1.0.3 20.8 MB download">
<subant target="install-seleniumxml">
<filelist dir="." files="framework/testtools/build.xml"/>
</subant>
@@ -765,6 +773,65 @@ under the License.
</cobertura-report>
</target>
+ <target name="sonar" depends="download-sonar-ant-task, sonar-init"
+ description="Sonar code analysis. You need a Sonar instance running to use it. More info on http://www.sonarsource.org/">
+ <exec executable="svn" dir="." output="runtime/svninfo_tmp.xml">
+ <arg value="info"/>
+ <arg value="--xml"/>
+ </exec>
+ <xmlproperty file="runtime/svninfo_tmp.xml"/>
+ <sonar:sonar workDir="." key="org.apache:ofbiz" version="${info.entry.commit(revision)}">
+ <sources>
+ <!--framework-->
+ <path location="applications/appserver/src" />
+ <path location="applications/base/src" />
+ <path location="applications/bi/src" />
+ <path location="applications/catalina/src" />
+ <path location="applications/common/src" />
+ <path location="applications/datafile/src" />
+ <path location="applications/entity/src" />
+ <path location="applications/entityext/src" />
+ <path location="applications/example/src" />
+ <path location="applications/geronimo/src" />
+ <path location="applications/guiapp/src" />
+ <path location="applications/jetty/src" />
+ <path location="applications/minilang/src" />
+ <path location="applications/security/src" />
+ <path location="applications/service/src" />
+ <path location="applications/sql/src" />
+ <path location="applications/start/src" />
+ <path location="applications/testtools/src" />
+ <path location="applications/webapp/src" />
+ <path location="applications/webslinger/src" />
+ <path location="applications/webtools/src" />
+ <path location="applications/widget/src" />
+ <!--applications-->
+ <path location="applications/accounting/src" />
+ <path location="applications/commonext/src" />
+ <path location="applications/content/src" />
+ <path location="applications/humanres/src" />
+ <path location="applications/manufacturing/src" />
+ <path location="applications/marketing/src" />
+ <path location="applications/order/src" />
+ <path location="applications/party/src" />
+ <path location="applications/product/src" />
+ <path location="applications/securityext/src" />
+ <path location="applications/workeffort/src" />
+ <!--specialpurpose-->
+ <path location="specialpurpose/assetmaint/src" />
+ <path location="specialpurpose/ebay/src" />
+ <path location="specialpurpose/ebaystore/src" />
+ <path location="specialpurpose/ecommerce/src" />
+ <path location="specialpurpose/googlebase/src" />
+ <path location="specialpurpose/googlecheckout/src" />
+ <path location="specialpurpose/hhfacility/src" />
+ <path location="specialpurpose/oagis/src" />
+ <path location="specialpurpose/pos/src" />
+ </sources>
+ <property key="sonar.dynamicAnalysis" value="false" />
+ </sonar:sonar>
+ </target>
+
<!-- ================================================================== -->
<!-- Ivy targets, more info at http://ant.apache.org/ivy/ -->
<!-- ================================================================== -->
Modified: ofbiz/branches/jackrabbit20100709/framework/base/config/both-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/base/config/both-containers.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/base/config/both-containers.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/base/config/both-containers.xml Thu Mar 24 07:23:42 2011
@@ -120,7 +120,7 @@ under the License.
<!-- uncomment for cluster support
<property name="default-server-cluster" value="cluster">
<property name="rep-valve-filter">
- <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;</property-value>
+ <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;.*\.png;.*\.css;.*\.ico;.*\.htc;</property-value>
</property>
<property name="manager-class" value="org.apache.catalina.ha.session.DeltaManager"/>
<property name="debug" value="5"/>
@@ -256,8 +256,8 @@ under the License.
<property name="ciphers" value=""/>
</property>
</container>
-
-
+
+
<!-- load the JPOS devices -->
<container name="jpos.device-container" class="org.ofbiz.pos.container.JposDeviceContainer">
<property name="CashDrawer.1" value="NullCashDrawer"/>
Modified: ofbiz/branches/jackrabbit20100709/framework/base/config/ofbiz-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/base/config/ofbiz-containers.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/base/config/ofbiz-containers.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/base/config/ofbiz-containers.xml Thu Mar 24 07:23:42 2011
@@ -127,7 +127,7 @@ under the License.
<!-- uncomment for cluster support
<property name="default-server-cluster" value="cluster">
<property name="rep-valve-filter">
- <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;</property-value>
+ <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;.*\.png;.*\.css;.*\.ico;.*\.htc;</property-value>
</property>
<property name="manager-class" value="org.apache.catalina.ha.session.DeltaManager"/>
<property name="debug" value="5"/>
Modified: ofbiz/branches/jackrabbit20100709/framework/base/config/test-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/base/config/test-containers.xml?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/base/config/test-containers.xml (original)
+++ ofbiz/branches/jackrabbit20100709/framework/base/config/test-containers.xml Thu Mar 24 07:23:42 2011
@@ -87,7 +87,7 @@ under the License.
<!-- uncomment for cluster support
<property name="default-server-cluster" value="cluster">
<property name="rep-valve-filter">
- <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;</property-value>
+ <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;.*\.png;.*\.css;.*\.ico;.*\.htc;</property-value>
</property>
<property name="manager-class" value="org.apache.catalina.cluster.session.DeltaManager"/>
<property name="debug" value="5"/>
Modified: ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/ComponentContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/ComponentContainer.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/ComponentContainer.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/ComponentContainer.java Thu Mar 24 07:23:42 2011
@@ -48,6 +48,7 @@ public class ComponentContainer implemen
//protected static List loadedComponents2 = null;
protected Classpath classPath = new Classpath(System.getProperty("java.class.path"));
+ protected Classpath libraryPath = new Classpath(System.getProperty("java.library.path"));
protected String configFileLocation = null;
private boolean loaded = false;
private String instrumenterClassName;
@@ -137,6 +138,7 @@ public class ComponentContainer implemen
if (updateClasspath) {
classPath.instrument(instrumenterFile, instrumenterClassName);
System.setProperty("java.class.path", classPath.toString());
+ System.setProperty("java.library.path", libraryPath.toString());
ClassLoader cl = classPath.getClassLoader();
Thread.currentThread().setContextClassLoader(cl);
}
@@ -242,39 +244,47 @@ public class ComponentContainer implemen
configRoot = configRoot + "/";
}
if (classpathInfos != null) {
+ String nativeLibExt = System.mapLibraryName("someLib").replace("someLib", "").toLowerCase();
for (ComponentConfig.ClasspathInfo cp: classpathInfos) {
String location = cp.location.replace('\\', '/');
// set the location to not have a leading slash
if (location.startsWith("/")) {
location = location.substring(1);
}
- if ("dir".equals(cp.type)) {
- classPath.addComponent(configRoot + location);
- } else if ("jar".equals(cp.type)) {
- String dirLoc = location;
- if (dirLoc.endsWith("/*")) {
- // strip off the slash splat
- dirLoc = location.substring(0, location.length() - 2);
- }
- File path = FileUtil.getFile(configRoot + dirLoc);
- if (path.exists()) {
- if (path.isDirectory()) {
- // load all .jar and .zip files in this directory
- for (File file: path.listFiles()) {
- String fileName = file.getName();
- if (fileName.endsWith(".jar") || fileName.endsWith(".zip")) {
- classPath.addComponent(file);
- }
- }
- } else {
- // add a single file
+ if (!"jar".equals(cp.type) && !"dir".equals(cp.type)) {
+ Debug.logError("Classpath type '" + cp.type + "' is not supported; '" + location + "' not loaded", module);
+ continue;
+ }
+ String dirLoc = location;
+ if (dirLoc.endsWith("/*")) {
+ // strip off the slash splat
+ dirLoc = location.substring(0, location.length() - 2);
+ }
+ File path = FileUtil.getFile(configRoot + dirLoc);
+ if (path.exists()) {
+ if (path.isDirectory()) {
+ if ("dir".equals(cp.type)) {
classPath.addComponent(configRoot + location);
}
+ // load all .jar, .zip files and native libs in this directory
+ boolean containsNativeLibs = false;
+ for (File file: path.listFiles()) {
+ String fileName = file.getName().toLowerCase();
+ if (fileName.endsWith(".jar") || fileName.endsWith(".zip")) {
+ classPath.addComponent(file);
+ } else if (fileName.endsWith(nativeLibExt)) {
+ containsNativeLibs = true;
+ }
+ }
+ if (containsNativeLibs) {
+ libraryPath.addComponent(path);
+ }
} else {
- Debug.logWarning("Location '" + configRoot + dirLoc + "' does not exist", module);
+ // add a single file
+ classPath.addComponent(configRoot + location);
}
} else {
- Debug.logError("Classpath type '" + cp.type + "' is not supported; '" + location + "' not loaded", module);
+ Debug.logWarning("Location '" + configRoot + dirLoc + "' does not exist", module);
}
}
}
Modified: ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/Container.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/Container.java?rev=1084863&r1=1084862&r2=1084863&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/Container.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/base/src/org/ofbiz/base/container/Container.java Thu Mar 24 07:23:42 2011
@@ -19,30 +19,47 @@
package org.ofbiz.base.container;
/**
- * Container - Interface for containers
+ * An OFBiz container. A container can be thought of as a background process.
+ *
+ * <p>
+ * When OFBiz starts, the main thread will create the <code>Container</code> instance and
+ * then call the container's <code>init</code> method. If the method returns without
+ * throwing an exception the container will be added to a list of initialized containers.
+ * After all instances have been created and initialized, the main thread will call the
+ * <code>start</code> method of each container in the list. When OFBiz shuts down, a
+ * separate shutdown thread will call the <code>stop</code> method of each container.
+ * Implementations should anticipate asynchronous calls to the methods by different
+ * threads.
+ * </p>
+ *
+ * <p>Containers might be loaded more than once (have more than one instance).<p>
*/
public interface Container {
- /** Initialize the container
+ /** Initialize the container. This method must not block - implementations
+ * should initialize internal structures and then return.
*
- * @param args args from calling class
- * @param configFile Location of master OFBiz configuration file
- * @throws ContainerException
+ * @param args Command-line arguments.
+ * @param configFile Location of the configuration file used to load this container.
+ * @throws ContainerException If an error was encountered. Throwing this exception
+ * will halt container loading, so it should be thrown only when other containers
+ * might depend on this one.
*/
public void init(String[] args, String configFile) throws ContainerException;
/**
- * Start the container
+ * Start the container process. This method must not block - implementations
+ * that require thread blocking must create a separate thread and then return.
*
- * @return true if server started
- * @throws ContainerException
+ * @return <code>true</code> if the process started.
+ * @throws ContainerException If an error was encountered.
*/
public boolean start() throws ContainerException;
/**
- * Stop the container
+ * Stop the container process. This method must not block.
*
- * @throws ContainerException
+ * @throws ContainerException If an error was encountered.
*/
public void stop() throws ContainerException;
}