You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/02/18 05:12:44 UTC
svn commit: r1071878 [1/2] - in /ofbiz/trunk: applications/product/config/
applications/product/script/org/ofbiz/product/imagemanagement/
applications/product/servicedef/
applications/product/src/org/ofbiz/product/image/
applications/product/src/org/of...
Author: hansbak
Date: Fri Feb 18 04:12:43 2011
New Revision: 1071878
URL: http://svn.apache.org/viewvc?rev=1071878&view=rev
Log:
Image management: make image file location and url configurable
Modified:
ofbiz/trunk/applications/product/config/ImageProperties.xml
ofbiz/trunk/applications/product/config/catalog.properties
ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml
ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml
ofbiz/trunk/applications/product/servicedef/services.xml
ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/automaticResize.groovy
ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageGallery.ftl
ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageWatermark.ftl
ofbiz/trunk/applications/product/widget/catalog/ImageManagementForms.xml
ofbiz/trunk/applications/product/widget/catalog/ImageManagementScreens.xml
ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml
Modified: ofbiz/trunk/applications/product/config/ImageProperties.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ImageProperties.xml?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ImageProperties.xml (original)
+++ ofbiz/trunk/applications/product/config/ImageProperties.xml Fri Feb 18 04:12:43 2011
@@ -67,4 +67,8 @@ under the License.
<dimension name="height" value="1200"/>
<dimension name="width" value="1600"/>
</size>
+ <size name="thumbnail">
+ <dimension name="height" value="300"/>
+ <dimension name="width" value="300"/>
+ </size>
</imageSize>
Modified: ofbiz/trunk/applications/product/config/catalog.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/catalog.properties?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/catalog.properties (original)
+++ ofbiz/trunk/applications/product/config/catalog.properties Fri Feb 18 04:12:43 2011
@@ -34,3 +34,7 @@ all.product.category=CATALOG1
# Flag to re-active products when they are received
reactivate.product.from.receipt=Y
+
+# Image upload path on the image management
+image.management.path=${sys:getProperty('ofbiz.home')}/framework/images/webapp/images/products/management
+image.management.url=/images/products/management
Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementEvents.xml Fri Feb 18 04:12:43 2011
@@ -47,7 +47,7 @@ under the License.
<if-not-empty field="productContentAndInfos">
<set field="setThumbnailMap.productId" from-field="parameters.productId"/>
<set field="setThumbnailMap.contentIdTo" from-field="parameters.contentIdTo"/>
- <call-service service-name="setThumbnail" in-map-name="setThumbnailMap"/>
+ <!--<call-service service-name="setThumbnail" in-map-name="setThumbnailMap"/>-->
</if-not-empty>
</simple-method>
</simple-methods>
Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/imagemanagement/ImageManagementServices.xml Fri Feb 18 04:12:43 2011
@@ -183,8 +183,10 @@ under the License.
<field-map field-name="dataResourceId" from-field="dataResourceId"/>
</entity-one>
+ <set field="removeImageFile.productId" from-field="parameters.productId"/>
<set field="removeImageFile.contentId" from-field="parameters.contentId"/>
<set field="removeImageFile.objectInfo" from-field="dataResource.objectInfo"/>
+ <set field="removeImageFile.dataResourceName" from-field="dataResource.dataResourceName"/>
<set-service-fields service-name="removeImageFileForImageManagement" map="removeImageFile" to-map="removeImageFileMap"/>
<call-service service-name="removeImageFileForImageManagement" in-map-name="removeImageFileMap"/>
Modified: ofbiz/trunk/applications/product/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services.xml Fri Feb 18 04:12:43 2011
@@ -1406,8 +1406,10 @@ under the License.
<service name="removeImageFileForImageManagement" engine="java"
location="org.ofbiz.product.imagemanagement.ImageManagementServices" invoke="removeImageFileForImageManagement" auth="true">
<description>Delete Image File</description>
+ <attribute mode="IN" name="productId" optional="false" type="String"/>
<attribute mode="IN" name="contentId" optional="false" type="String"/>
<attribute mode="IN" name="objectInfo" optional="false" type="String"/>
+ <attribute mode="IN" name="dataResourceName" optional="false" type="String"/>
</service>
<service name="addImageFrame" engine="java"
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/image/ScaleImage.java Fri Feb 18 04:12:43 2011
@@ -131,7 +131,7 @@ public class ScaleImage {
}
if (context.get("contentId") != null){
- resultBufImgMap.putAll(ImageTransform.getBufferedImage(imageServerPath + "/products/management/" + context.get("productId") + "/" + context.get("clientFileName"), locale));
+ 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));
@@ -288,7 +288,7 @@ public class ScaleImage {
}
if (context.get("contentId") != null){
- resultBufImgMap.putAll(ImageTransform.getBufferedImage(imageServerPath + "/products/management/" + context.get("productId") + "/" + context.get("clientFileName"), locale));
+ 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));
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/CropImage.java Fri Feb 18 04:12:43 2011
@@ -86,8 +86,9 @@ public class CropImage {
String filenameToUse = (String) contentResult.get("contentId") + ".jpg";
String filenameTouseThumb = (String) contentThumbResult.get("contentId") + ".jpg";
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
- BufferedImage bufImg = ImageIO.read(new File(imageServerPath + "/products/management/" + productId + "/" + imageName));
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ BufferedImage bufImg = ImageIO.read(new File(imageServerPath + "/" + productId + "/" + imageName));
int x = Integer.parseInt(imageX);
int y = Integer.parseInt(imageY);
@@ -96,16 +97,16 @@ public class CropImage {
BufferedImage bufNewImg = bufImg.getSubimage(x, y, w, h);
String mimeType = imageName.substring(imageName.lastIndexOf(".") + 1);
- ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/products/management/" + productId + "/" + filenameToUse));
+ ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/" + productId + "/" + filenameToUse));
double imgHeight = bufNewImg.getHeight();
double imgWidth = bufNewImg.getWidth();
Map<String, Object> resultResize = ImageManagementServices.resizeImageThumbnail(bufNewImg, imgHeight, imgWidth);
- ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/products/management/" + productId + "/" + filenameTouseThumb));
+ ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/" + productId + "/" + filenameTouseThumb));
- String imageUrlResource = "/images/products/management/" + productId + "/" + filenameToUse;
- String imageUrlThumb = "/images/products/management/" + productId + "/" + filenameTouseThumb;
+ String imageUrlResource = imageServerUrl + "/" + productId + "/" + filenameToUse;
+ String imageUrlThumb = imageServerUrl + "/" + productId + "/" + filenameTouseThumb;
ImageManagementServices.createContentAndDataResource(dctx, userLogin, filenameToUse, imageUrlResource, contentId, "image/jpeg");
ImageManagementServices.createContentAndDataResource(dctx, userLogin, filenameTouseThumb, imageUrlThumb, contentIdThumb, "image/jpeg");
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/FrameImage.java Fri Feb 18 04:12:43 2011
@@ -70,7 +70,8 @@ public class FrameImage {
Map<String, Object> result = FastMap.newInstance();
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
GenericValue userLogin = (GenericValue) context.get("userLogin");
String productId = (String) context.get("productId");
@@ -106,8 +107,8 @@ public class FrameImage {
if (UtilValidate.isNotEmpty(imageName)) {
// Image Frame
- BufferedImage bufImg1 = ImageIO.read(new File(imageServerPath + "/products/management/" + productId + "/" + imageName));
- BufferedImage bufImg2 = ImageIO.read(new File(imageServerPath + "/products/management/frame/"+frameImageName));
+ BufferedImage bufImg1 = ImageIO.read(new File(imageServerPath + "/" + productId + "/" + imageName));
+ BufferedImage bufImg2 = ImageIO.read(new File(imageServerPath + "/frame/"+frameImageName));
int bufImgType;
if (BufferedImage.TYPE_CUSTOM == bufImg1.getType()) {
@@ -152,16 +153,16 @@ public class FrameImage {
Image newImg2 = bufImg2.getScaledInstance((int) width , (int) 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 + "/products/management/" + productId + "/" + filenameToUse));
+ ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/" + productId + "/" + filenameToUse));
double imgHeight = bufNewImg.getHeight();
double imgWidth = bufNewImg.getWidth();
Map<String, Object> resultResize = ImageManagementServices.resizeImageThumbnail(bufNewImg, imgHeight, imgWidth);
- ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/products/management/" + productId + "/" + filenameTouseThumb));
+ ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/" + productId + "/" + filenameTouseThumb));
- String imageUrlResource = "/images/products/management/" + productId + "/" + filenameToUse;
- String imageUrlThumb = "/images/products/management/" + productId + "/" + filenameTouseThumb;
+ String imageUrlResource = imageServerUrl + "/" + productId + "/" + filenameToUse;
+ String imageUrlThumb = imageServerUrl + "/" + productId + "/" + filenameTouseThumb;
ImageManagementServices.createContentAndDataResource(dctx, userLogin, filenameToUse, imageUrlResource, contentId, "image/jpeg");
ImageManagementServices.createContentAndDataResource(dctx, userLogin, filenameTouseThumb, imageUrlThumb, contentIdThumb, "image/jpeg");
@@ -248,7 +249,8 @@ public class FrameImage {
GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
Map<String, Object> tempFile = LayoutWorker.uploadImageAndParameters(request, "uploadedFile");
String imageName = tempFile.get("imageFileName").toString();
String mimType = tempFile.get("uploadMimeType").toString();
@@ -269,7 +271,7 @@ public class FrameImage {
String contentId = null;
String dataResourceId = null;
try {
- String dirPath = "/products/management/frame/";
+ String dirPath = "/frame/";
File dir = new File(imageServerPath + dirPath);
if (!dir.exists()) {
boolean createDir = dir.mkdir();
@@ -278,7 +280,7 @@ public class FrameImage {
return "error";
}
}
- String imagePath = "/products/management/frame/" + imageName;
+ String imagePath = "/frame/" + imageName;
File file = new File(imageServerPath + imagePath);
if (file.exists()) {
request.setAttribute("_ERROR_MESSAGE_", "There is an existing frame, please select from the existing frame.");
@@ -290,7 +292,7 @@ public class FrameImage {
//create dataResource
Map<String, Object> dataResourceCtx = FastMap.newInstance();
- dataResourceCtx.put("objectInfo", "/images" + imagePath);
+ dataResourceCtx.put("objectInfo", imageServerUrl + imagePath);
dataResourceCtx.put("dataResourceName", imageName);
dataResourceCtx.put("userLogin", userLogin);
dataResourceCtx.put("dataResourceTypeId", "IMAGE_OBJECT");
@@ -320,7 +322,7 @@ public class FrameImage {
Delegator delegator = (Delegator) request.getAttribute("delegator");
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
HttpSession session = request.getSession();
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
String productId = request.getParameter("productId");
String imageName = request.getParameter("imageName");
@@ -349,11 +351,11 @@ public class FrameImage {
return "error";
}
if (UtilValidate.isNotEmpty(imageName)) {
- File file = new File(imageServerPath + "/products/management/previewImage.jpg");
+ File file = new File(imageServerPath + "/previewImage.jpg");
file.delete();
// Image Frame
- BufferedImage bufImg1 = ImageIO.read(new File(imageServerPath + "/products/management/" + productId + "/" + imageName));
- BufferedImage bufImg2 = ImageIO.read(new File(imageServerPath + "/products/management/frame/" + frameImageName));
+ BufferedImage bufImg1 = ImageIO.read(new File(imageServerPath + "/" + productId + "/" + imageName));
+ BufferedImage bufImg2 = ImageIO.read(new File(imageServerPath + "/frame/" + frameImageName));
int bufImgType;
if (BufferedImage.TYPE_CUSTOM == bufImg1.getType()) {
@@ -369,7 +371,7 @@ public class FrameImage {
Image newImg2 = bufImg2.getScaledInstance((int) width , (int) 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 + "/products/management/previewImage.jpg"));
+ ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/previewImage.jpg"));
}
else{
@@ -408,8 +410,8 @@ public class FrameImage {
}
public static String deleteFrameImage(HttpServletRequest request, HttpServletResponse response) {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
- File file = new File(imageServerPath + "/products/management/previewImage.jpg");
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ File file = new File(imageServerPath + "/previewImage.jpg");
if (file.exists()) {
file.delete();
}
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ImageManagementServices.java Fri Feb 18 04:12:43 2011
@@ -101,8 +101,9 @@ public class ImageManagementServices {
if (UtilValidate.isNotEmpty(uploadFileName)) {
String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
- String rootTargetDirectory = imageServerPath + "/products/management";
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ String rootTargetDirectory = imageServerPath;
File rootTargetDir = new File(rootTargetDirectory);
if (!rootTargetDir.exists()) {
boolean created = rootTargetDir.mkdirs();
@@ -139,7 +140,7 @@ public class ImageManagementServices {
sizeType = "1600x1200";
}
}
-
+
Map<String, Object> contentCtx = FastMap.newInstance();
contentCtx.put("contentTypeId", "DOCUMENT");
contentCtx.put("userLogin", userLogin);
@@ -170,7 +171,7 @@ public class ImageManagementServices {
} else if (fileContentType.equals("image/x-png")) {
fileContentType = "image/png";
}
-
+
List<GenericValue> fileExtension = FastList.newInstance();
try {
fileExtension = delegator.findByAnd("FileExtension", UtilMisc.toMap("mimeTypeId", fileContentType ));
@@ -178,14 +179,14 @@ public class ImageManagementServices {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
-
+
GenericValue extension = EntityUtil.getFirst(fileExtension);
if (extension != null) {
filenameToUse += "." + extension.getString("fileExtensionId");
}
// Create folder product id.
- String targetDirectory = imageServerPath + "/products/management/" + productId;
+ String targetDirectory = imageServerPath + "/" + productId;
File targetDir = new File(targetDirectory);
if (!targetDir.exists()) {
boolean created = targetDir.mkdirs();
@@ -196,9 +197,9 @@ public class ImageManagementServices {
}
}
- File file = new File(imageServerPath + "/products/management/" + productId + "/" + uploadFileName);
+ File file = new File(imageServerPath + "/" + productId + "/" + uploadFileName);
String imageName = null;
- imagePath = imageServerPath + "/products/management/" + productId + "/" + uploadFileName;
+ imagePath = imageServerPath + "/" + productId + "/" + uploadFileName;
file = checkExistsImage(file);
if (UtilValidate.isNotEmpty(file)) {
imageName = file.getPath();
@@ -223,7 +224,7 @@ public class ImageManagementServices {
}
// Scale Image in different sizes
if (UtilValidate.isNotEmpty(imageResize)) {
- File fileOriginal = new File(imageServerPath + "/products/management/" + imageName);
+ File fileOriginal = new File(imageServerPath + "/" + productId + "/" + imageName);
fileOriginal = checkExistsImage(fileOriginal);
uploadFileName = fileOriginal.getName();
@@ -259,8 +260,8 @@ public class ImageManagementServices {
String filenameToUseThumb = (String) contentThumbnail.get("filenameToUseThumb");
String contentIdThumb = (String) contentThumbnail.get("contentIdThumb");
- String imageUrl = "/images/products/management/" + productId + "/" + imageName;
- String imageUrlThumb = "/images/products/management/" + productId + "/" + filenameToUseThumb;
+ String imageUrl = imageServerUrl + "/" + productId + "/" + imageName;
+ String imageUrlThumb = imageServerUrl + "/" + productId + "/" + filenameToUseThumb;
createContentAndDataResource(dctx, userLogin, imageName, imageUrl, contentId, fileContentType);
createContentAndDataResource(dctx, userLogin, filenameToUseThumb, imageUrlThumb, contentIdThumb, fileContentType);
@@ -303,16 +304,17 @@ public class ImageManagementServices {
}
return result;
}
-
+
public static Map<String, Object> removeImageFileForImageManagement(DispatchContext dctx, Map<String, ? extends Object> context){
+ String productId = (String) context.get("productId");
String contentId = (String) context.get("contentId");
String objectInfo = (String) context.get("objectInfo");
+ String dataResourceName = (String) context.get("dataResourceName");
try {
if (UtilValidate.isNotEmpty(contentId)) {
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
- imageServerPath.substring(0, imageServerPath.lastIndexOf("/"));
- File file = new File(imageServerPath.substring(0, imageServerPath.lastIndexOf("/")) + objectInfo);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ File file = new File(imageServerPath + "/" + productId + "/" + dataResourceName);
file.delete();
}
} catch (Exception e) {
@@ -323,7 +325,7 @@ public class ImageManagementServices {
public static Map<String, Object> scaleImageMangementInAllSize(Map<String, ? extends Object> context, String filenameToUse, String resizeType, String productId)
throws IllegalArgumentException, ImagingOpException, IOException, JDOMException {
-
+
/* VARIABLES */
Locale locale = (Locale) context.get("locale");
List<String> sizeTypeList = null;
@@ -342,7 +344,7 @@ public class ImageManagementServices {
Map<String, Object> resultBufImgMap = FastMap.newInstance();
Map<String, Object> resultScaleImgMap = FastMap.newInstance();
Map<String, Object> result = FastMap.newInstance();
-
+
/* ImageProperties.xml */
String imgPropertyFullPath = System.getProperty("ofbiz.home") + "/applications/product/config/ImageProperties.xml";
resultXMLMap.putAll((Map<String, Object>) ImageTransform.getXMLValue(imgPropertyFullPath, locale));
@@ -354,7 +356,7 @@ public class ImageManagementServices {
result.put("errorMessage", errMsg);
return result;
}
-
+
/* IMAGE */
// get Name and Extension
index = filenameToUse.lastIndexOf(".");
@@ -362,25 +364,17 @@ public class ImageManagementServices {
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 imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+
String id = imgName;
- String type = "management";
-
- FlexibleStringExpander mainFilenameExpander = FlexibleStringExpander.getInstance(mainFilenameFormat);
- String fileLocation = mainFilenameExpander.expandString(UtilMisc.toMap("location", "products", "type", type, "id", filenameToUse));
- String filePathPrefix = "";
- if (fileLocation.lastIndexOf("/") != -1) {
- filePathPrefix = fileLocation.substring(0, fileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
- }
/* get original BUFFERED IMAGE */
- resultBufImgMap.putAll(ImageTransform.getBufferedImage(imageServerPath + "/" + filePathPrefix + filenameToUse, locale));
-
+ resultBufImgMap.putAll(ImageTransform.getBufferedImage(imageServerPath + "/" + productId + "/" + filenameToUse, locale));
+
if (resultBufImgMap.containsKey("responseMessage") && resultBufImgMap.get("responseMessage").equals("success")) {
bufImg = (BufferedImage) resultBufImgMap.get("bufferedImage");
-
+
// get Dimensions
imgHeight = (double) bufImg.getHeight();
imgWidth = (double) bufImg.getWidth();
@@ -390,27 +384,20 @@ public class ImageManagementServices {
result.put("errorMessage", errMsg);
return result;
}
-
+
/* scale Image for each Size Type */
Iterator<String> sizeIter = sizeTypeList.iterator();
while (sizeIter.hasNext()) {
String sizeType = sizeIter.next();
-
+
resultScaleImgMap.putAll(ImageTransform.scaleImage(bufImg, imgHeight, imgWidth, imgPropertyMap, sizeType, locale));
-
+
if (resultScaleImgMap.containsKey("responseMessage") && resultScaleImgMap.get("responseMessage").equals("success")) {
bufNewImg = (BufferedImage) resultScaleImgMap.get("bufferedImage");
-
+
// write the New Scaled Image
- String newFileLocation = null;
- newFileLocation = mainFilenameExpander.expandString(UtilMisc.toMap("location", "products", "type", "/management/"+ productId, "id", id));
- String newFilePathPrefix = "";
- if (newFileLocation.lastIndexOf("/") != -1) {
- newFilePathPrefix = newFileLocation.substring(0, newFileLocation.lastIndexOf("/") + 1); // adding 1 to include the trailing slash
- }
-
- String targetDirectory = imageServerPath + "/" + newFilePathPrefix;
+ String targetDirectory = imageServerPath + "/" + productId;
File targetDir = new File(targetDirectory);
if (!targetDir.exists()) {
boolean created = targetDir.mkdirs();
@@ -423,8 +410,8 @@ public class ImageManagementServices {
// write new image
try {
- ImageIO.write((RenderedImage) bufNewImg, imgExtension, new File(imageServerPath + "/" + newFilePathPrefix + filenameToUse));
- File deleteFile = new File(imageServerPath + "/products/management/" + filenameToUse);
+ ImageIO.write((RenderedImage) bufNewImg, imgExtension, new File(imageServerPath + "/" + productId + "/" + filenameToUse));
+ File deleteFile = new File(imageServerPath + "/" + filenameToUse);
deleteFile.delete();
//FIXME can be removed ?
// boolean check = deleteFile.delete();
@@ -439,19 +426,19 @@ public class ImageManagementServices {
result.put("errorMessage", errMsg);
return result;
}
-
+
/* write Return Result */
- String imageUrl = imageUrlPrefix + "/" + newFilePathPrefix + filenameToUse;
+ String imageUrl = imageServerUrl + "/" + productId + "/" + filenameToUse;
imgUrlMap.put(sizeType, imageUrl);
-
+
} // scaleImgMap
} // sizeIter
-
+
result.put("responseMessage", "success");
result.put("imageUrlMap", imgUrlMap);
result.put("original", resultBufImgMap);
return result;
-
+
} else {
String errMsg = UtilProperties.getMessage(resource, "ScaleImage.unable_to_scale_original_image", locale) + " : " + filenameToUse;
Debug.logError(errMsg, module);
@@ -473,7 +460,7 @@ public class ImageManagementServices {
dataResourceCtx.put("dataResourceTypeId", "IMAGE_OBJECT");
dataResourceCtx.put("mimeTypeId", fileContentType);
dataResourceCtx.put("isPublic", "Y");
-
+
Map<String, Object> dataResourceResult = FastMap.newInstance();
try {
dataResourceResult = dispatcher.runSync("createDataResource", dataResourceCtx);
@@ -481,9 +468,9 @@ public class ImageManagementServices {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
-
+
result.put("dataResourceFrameId", dataResourceResult.get("dataResourceId"));
-
+
Map<String, Object> contentUp = FastMap.newInstance();
contentUp.put("contentId", contentId);
contentUp.put("dataResourceId", dataResourceResult.get("dataResourceId"));
@@ -495,7 +482,7 @@ public class ImageManagementServices {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
-
+
GenericValue content = null;
try {
content = delegator.findOne("Content", UtilMisc.toMap("contentId", contentId), false);
@@ -503,7 +490,7 @@ public class ImageManagementServices {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
-
+
if (content != null) {
GenericValue dataResource = null;
try {
@@ -512,7 +499,7 @@ public class ImageManagementServices {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
-
+
if (dataResource != null) {
dataResourceCtx.put("dataResourceId", dataResource.getString("dataResourceId"));
try {
@@ -533,7 +520,7 @@ public class ImageManagementServices {
Locale locale = (Locale) context.get("locale");
//FIXME can be removed ?
// String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
// Create content for thumbnail
Map<String, Object> contentThumb = FastMap.newInstance();
@@ -557,7 +544,7 @@ public class ImageManagementServices {
if (fileLocationThumb.lastIndexOf("/") != -1) {
filenameToUseThumb = fileLocationThumb.substring(fileLocationThumb.lastIndexOf("/") + 1);
}
-
+
String fileContentType = (String) context.get("_uploadedFile_contentType");
if (fileContentType.equals("image/pjpeg")) {
fileContentType = "image/jpeg";
@@ -601,7 +588,7 @@ public class ImageManagementServices {
}
result.put("filenameToUseThumb", filenameToUseThumb);
// Create image file thumbnail to folder product id.
- File fileOriginalThumb = new File(imageServerPath + "/products/management/" + filenameToUseThumb);
+ File fileOriginalThumb = new File(imageServerPath + "/" + productId + "/" + filenameToUseThumb);
try {
RandomAccessFile outFileThumb = new RandomAccessFile(fileOriginalThumb, "rw");
outFileThumb.write(imageData.array());
@@ -620,7 +607,7 @@ public class ImageManagementServices {
Map<String, Object> resultResizeThumb = FastMap.newInstance();
try {
- resultResizeThumb.putAll(ImageManagementServices.scaleImageMangementInAllSize(context, filenameToUseThumb, "medium", productId));
+ resultResizeThumb.putAll(ImageManagementServices.scaleImageMangementInAllSize(context, filenameToUseThumb, "thumbnail", productId));
} catch (IOException e) {
String errMsg = "Scale additional image in all different sizes is impossible : " + e.toString();
Debug.logError(e, errMsg, module);
@@ -634,16 +621,16 @@ public class ImageManagementServices {
}
public static Map<String, Object> resizeImageThumbnail(BufferedImage bufImg, double imgHeight, double imgWidth) {
-
+
/* VARIABLES */
BufferedImage bufNewImg;
double defaultHeight, defaultWidth, scaleFactor;
Map<String, Object> result = FastMap.newInstance();
-
+
/* DIMENSIONS from ImageProperties */
- defaultHeight = 100;
- defaultWidth = 100;
-
+ defaultHeight = 300;
+ defaultWidth = 300;
+
/* SCALE FACTOR */
// find the right Scale Factor related to the Image Dimensions
if (imgHeight > imgWidth) {
@@ -660,7 +647,7 @@ public class ImageManagementServices {
scaleFactor = defaultHeight / imgHeight;
}
}
-
+
int bufImgType;
if (BufferedImage.TYPE_CUSTOM == bufImg.getType()) {
// apply a type for image majority
@@ -668,12 +655,12 @@ public class ImageManagementServices {
} else {
bufImgType = bufImg.getType();
}
-
+
// scale original image with new size
Image newImg = bufImg.getScaledInstance((int) (imgWidth * scaleFactor), (int) (imgHeight * scaleFactor), Image.SCALE_SMOOTH);
-
+
bufNewImg = ImageTransform.toBufferedImage(newImg, bufImgType);
-
+
result.put("bufferedImage", bufNewImg);
result.put("scaleFactor", scaleFactor);
return result;
@@ -813,10 +800,10 @@ public class ImageManagementServices {
try {
if (UtilValidate.isNotEmpty(contentIdTo)) {
String imageFilenameFormat = UtilProperties.getPropertyValue("catalog", "image.filename.format");
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
FlexibleStringExpander filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
- String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "type", "small", "id", productId));
+ String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "type", "medium", "id", productId));
String filePathPrefix = "";
String filenameToUse = fileLocation;
if (fileLocation.lastIndexOf("/") != -1) {
@@ -841,7 +828,7 @@ public class ImageManagementServices {
}
try {
- File f1 = new File(imageServerPath + "/products/management/" + productId + "/" + contentName);
+ File f1 = new File(imageServerPath + "/" + productId + "/" + contentName);
File f2 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse);
InputStream input = new FileInputStream(f1);
OutputStream out = new FileOutputStream(f2);
@@ -873,7 +860,7 @@ public class ImageManagementServices {
}
return ServiceUtil.returnSuccess();
}
-
+
public static File checkExistsImage(File file) {
if (!file.exists()) {
imageCount = 0;
@@ -887,4 +874,4 @@ public class ImageManagementServices {
return checkExistsImage(file);
}
-}
+}
\ No newline at end of file
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/ReplaceImage.java Fri Feb 18 04:12:43 2011
@@ -56,7 +56,7 @@ public class ReplaceImage{
public static String replaceImageToExistImage(HttpServletRequest request, HttpServletResponse response) throws MalformedURLException, FileNotFoundException, WatermarkerException, GenericEntityException, GenericServiceException {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
Delegator delegator = (Delegator) request.getAttribute("delegator");
GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
@@ -85,11 +85,11 @@ public class ReplaceImage{
}
try {
- File file = new File(imageServerPath + "/products/management/" + productId + "/" + imageName);
+ File file = new File(imageServerPath + "/" + productId + "/" + imageName);
file.delete();
- URL imageUrl = new URL("file:" + imageServerPath + "/products/management/" + productId + "/" + contentIdReplace + ".jpg");
- File outputImageFile = new File(imageServerPath + "/products/management/" + productId + "/" + imageName);
+ URL imageUrl = new URL("file:" + imageServerPath + "/" + productId + "/" + contentIdReplace + ".jpg");
+ File outputImageFile = new File(imageServerPath + "/" + productId + "/" + imageName);
OutputStream outputStream = new FileOutputStream(outputImageFile);
WatermarkerSettings watermarkerSettings = WatermarkerSettings.DEFAULT;
new DefaultWatermarker().watermark(imageUrl, " ", outputStream, watermarkerSettings);
@@ -100,8 +100,8 @@ public class ReplaceImage{
List<GenericValue> contentAssocReplaceList = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentIdReplace, "contentAssocTypeId", "IMAGE_THUMBNAIL"));
GenericValue contentAssocReplace = EntityUtil.getFirst(contentAssocReplaceList);
- URL imageThumbnailUrl = new URL("file:" + imageServerPath + "/products/management/" + productId + "/" + contentAssocReplace.get("contentIdTo") + ".jpg");
- File outputImageThumbnailFile = new File(imageServerPath + "/products/management/" + productId + "/" + contentAssocExist.get("contentIdTo") + ".jpg");
+ URL imageThumbnailUrl = new URL("file:" + imageServerPath + "/" + productId + "/" + contentAssocReplace.get("contentIdTo") + ".jpg");
+ File outputImageThumbnailFile = new File(imageServerPath + "/" + productId + "/" + contentAssocExist.get("contentIdTo") + ".jpg");
OutputStream outputStreamThumbnail = new FileOutputStream(outputImageThumbnailFile);
new DefaultWatermarker().watermark(imageThumbnailUrl, " ", outputStreamThumbnail, watermarkerSettings);
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/RotateImage.java Fri Feb 18 04:12:43 2011
@@ -85,8 +85,9 @@ public class RotateImage {
String filenameToUse = (String) contentResult.get("contentId") + ".jpg";
String filenameTouseThumb = (String) contentThumbResult.get("contentId") + ".jpg";
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
- BufferedImage bufImg = ImageIO.read(new File(imageServerPath + "/products/management/" + productId + "/" + imageName));
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
+ BufferedImage bufImg = ImageIO.read(new File(imageServerPath + "/" + productId + "/" + imageName));
int bufImgType;
if (BufferedImage.TYPE_CUSTOM == bufImg.getType()) {
@@ -104,16 +105,16 @@ public class RotateImage {
g.dispose();
String mimeType = imageName.substring(imageName.lastIndexOf(".") + 1);
- ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/products/management/" + productId + "/" + filenameToUse));
+ ImageIO.write((RenderedImage) bufNewImg, mimeType, new File(imageServerPath + "/" + productId + "/" + filenameToUse));
double imgHeight = bufNewImg.getHeight();
double imgWidth = bufNewImg.getWidth();
Map<String, Object> resultResize = ImageManagementServices.resizeImageThumbnail(bufNewImg, imgHeight, imgWidth);
- ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/products/management/" + productId + "/" + filenameTouseThumb));
+ ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/" + productId + "/" + filenameTouseThumb));
- String imageUrlResource = "/images/products/management/" + productId + "/" + filenameToUse;
- String imageUrlThumb = "/images/products/management/" + productId + "/" + filenameTouseThumb;
+ String imageUrlResource = imageServerUrl + "/" + productId + "/" + filenameToUse;
+ String imageUrlThumb = imageServerUrl + "/" + productId + "/" + filenameTouseThumb;
ImageManagementServices.createContentAndDataResource(dctx, userLogin, filenameToUse, imageUrlResource, contentId, "image/jpeg");
ImageManagementServices.createContentAndDataResource(dctx, userLogin, filenameTouseThumb, imageUrlThumb, contentIdThumb, "image/jpeg");
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java Fri Feb 18 04:12:43 2011
@@ -64,7 +64,8 @@ public class WatermarkImage{
public static String createWatermarkImage(HttpServletRequest request, HttpServletResponse response) throws WatermarkerException, IOException {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
+ String imageServerUrl = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.url"), context);
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
String watermarkText = null;
@@ -80,11 +81,11 @@ public class WatermarkImage{
String fontColor = request.getParameter("colorWatermark");
String fontSize = request.getParameter("sizeWatermark");
- File file = new File(imageServerPath + "/products/management/previewImage" + count + ".jpg");
+ File file = new File(imageServerPath + "/previewImage" + count + ".jpg");
file.delete();
try {
if (UtilValidate.isNotEmpty(imageName)) {
- imageUrl = new URL("file:" + imageServerPath + "/products/management/" + productId + "/" + imageName);
+ imageUrl = new URL("file:" + imageServerPath + "/" + productId + "/" + imageName);
} else {
String errMsg = "Please select Image.";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
@@ -172,24 +173,24 @@ public class WatermarkImage{
String contentId = (String) contentResult.get("contentId");
String filenameToUse = (String) contentResult.get("contentId") + ".jpg";
String filenameTouseThumb = (String) contentThumbResult.get("contentId") + ".jpg";
- File outputImageFile = new File(imageServerPath + "/products/management/" + productId + "/" + filenameToUse);
+ File outputImageFile = new File(imageServerPath + "/" + productId + "/" + filenameToUse);
OutputStream outputStream = new FileOutputStream(outputImageFile);
// *** Actual call to Watermarker#watermark(...) ***
new DefaultWatermarker().watermark(imageUrl, watermarkText, outputStream, watermarkerSettings);
- String imageUrlResource = "/images/products/management/" + productId + "/" + filenameToUse;
+ String imageUrlResource = imageServerUrl + "/" + productId + "/" + filenameToUse;
- BufferedImage bufNewImg = ImageIO.read(new File(imageServerPath + "/products/management/" + productId + "/" + filenameToUse));
+ BufferedImage bufNewImg = ImageIO.read(new File(imageServerPath + "/" + productId + "/" + filenameToUse));
double imgHeight = bufNewImg.getHeight();
double imgWidth = bufNewImg.getWidth();
String mimeType = imageName.substring(imageName.lastIndexOf(".") + 1);
Map<String, Object> resultResize = ImageManagementServices.resizeImageThumbnail(bufNewImg, imgHeight, imgWidth);
- ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/products/management/" + productId + "/" + filenameTouseThumb));
+ ImageIO.write((RenderedImage) resultResize.get("bufferedImage"), mimeType, new File(imageServerPath + "/" + productId + "/" + filenameTouseThumb));
- String imageUrlThumb = "/images/products/management/" + productId + "/" + filenameTouseThumb;
+ String imageUrlThumb = imageServerUrl + "/" + productId + "/" + filenameTouseThumb;
createContentAndDataResourceWaterMark(request, userLogin, filenameToUse, imageUrlResource, contentId, "image/jpeg");
createContentAndDataResourceWaterMark(request, userLogin, filenameTouseThumb, imageUrlThumb, contentIdThumb, "image/jpeg");
@@ -306,7 +307,7 @@ public class WatermarkImage{
}
public static String setPreviewWaterMark(HttpServletRequest request, HttpServletResponse response) {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
String productId = request.getParameter("productId");
String imageName = request.getParameter("imageName");
String text = request.getParameter("text");
@@ -324,7 +325,7 @@ public class WatermarkImage{
BigDecimal positionX = new BigDecimal(decimalFormat.format(Float.parseFloat(x)));
BigDecimal positionY = new BigDecimal(decimalFormat.format(Float.parseFloat(y)));
BigDecimal picWidth = new BigDecimal(decimalFormat.format(Float.parseFloat(width)));
- File file = new File(imageServerPath + "/products/management/previewImage" + count + ".jpg");
+ File file = new File(imageServerPath + "/previewImage" + count + ".jpg");
file.delete();
BigDecimal widthBase = new BigDecimal(600.00);
Integer currentPic = Integer.parseInt(count);
@@ -341,8 +342,8 @@ public class WatermarkImage{
watermarkerSettings.setWatermarkSettings(position);
watermarkerSettings.setAlphaComposite(alphaComposite);
try {
- URL imageUrl = new URL("file:" + imageServerPath + "/products/management/" + productId + "/" + imageName);
- File outputImageFile = new File(imageServerPath + "/products/management/previewImage" + nextPic + ".jpg");
+ URL imageUrl = new URL("file:" + imageServerPath + "/" + productId + "/" + imageName);
+ File outputImageFile = new File(imageServerPath + "/previewImage" + nextPic + ".jpg");
OutputStream outputStream = new FileOutputStream(outputImageFile);
new DefaultWatermarker().watermark(imageUrl, text, outputStream, watermarkerSettings);
@@ -356,9 +357,9 @@ public class WatermarkImage{
}
public static String deletePreviewWatermarkImage(HttpServletRequest request, HttpServletResponse response) {
Map<String, ? extends Object> context = UtilGenerics.checkMap(request.getParameterMap());
- String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+ String imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
String count = request.getParameter("count");
- File file = new File(imageServerPath + "/products/management/previewImage" + count + ".jpg");
+ File file = new File(imageServerPath + "/previewImage" + count + ".jpg");
file.delete();
return "success";
Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/automaticResize.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/automaticResize.groovy?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/automaticResize.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/imagemanagement/automaticResize.groovy Fri Feb 18 04:12:43 2011
@@ -27,7 +27,7 @@ context.nowTimestampString = UtilDateTim
// make the image file formats
imageFilenameFormat = UtilProperties.getPropertyValue('catalog', 'image.filename.format');
-imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.server.path"), context);
+imageServerPath = FlexibleStringExpander.expandString(UtilProperties.getPropertyValue("catalog", "image.management.path"), context);
imageUrlPrefix = UtilProperties.getPropertyValue('catalog', 'image.url.prefix');
context.imageFilenameFormat = imageFilenameFormat;
context.imageServerPath = imageServerPath;
@@ -102,7 +102,7 @@ if (fileType) {
imageUrl = imageUrlPrefix + "/" + filePathPrefix + java.net.URLEncoder.encode(filenameToUse, characterEncoding);
try {
- f1 = new File(imageServerPath + "/products/management/" + productId + "/" + clientFileName);
+ f1 = new File(imageServerPath + "/" + productId + "/" + clientFileName);
f2 = new File(imageServerPath + "/" + filePathPrefix, filenameToUse);
InputStream input = new FileInputStream(f1);
Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Fri Feb 18 04:12:43 2011
@@ -2813,11 +2813,6 @@ under the License.
<redirect-parameter name="dataResourceId"/>
</response>
</request-map>
- <request-map uri="img">
- <security auth="false" https="false"/>
- <event type="java" path="org.ofbiz.content.data.DataEvents" invoke="serveImage"/>
- <response name="success" type="none"/>
- </request-map>
<request-map uri="viewImage">
<security https="false" auth="false"/>
<response name="success" type="view" value="viewImage"/>
Modified: ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageGallery.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageGallery.ftl?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageGallery.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageGallery.ftl Fri Feb 18 04:12:43 2011
@@ -33,7 +33,7 @@ under the License.
<#assign ImageContent = delegator.findByPrimaryKey("Content", Static["org.ofbiz.base.util.UtilMisc"].toMap("contentId", contentAssoc.contentIdTo))?if_exists>
<#assign contentDataResourceView = delegator.findByPrimaryKey("ContentDataResourceView", Static["org.ofbiz.base.util.UtilMisc"].toMap("contentId", contentAssoc.contentIdTo, "drDataResourceId", ImageContent.dataResourceId))?if_exists>
<#assign contentName = productContentAndInfo.contentName>
- <#if imageIndex < 7>
+ <#if imageIndex < 5>
<td style="vertical-align:bottom">
<table>
<tbody>
@@ -70,7 +70,7 @@ under the License.
</td>
<#assign imageIndex = imageIndex+1>
</#if>
- </#list>
+ </#list>
</#if>
</#list>
</#if>
Modified: ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageWatermark.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageWatermark.ftl?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageWatermark.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/imagemanagement/ImageWatermark.ftl Fri Feb 18 04:12:43 2011
@@ -68,6 +68,7 @@ under the License.
jQuery('#ImageWatermarking_height').attr('value', height);
});
function getPreviewImage(next) {
+ var imageServerUrl = jQuery('#ImageWatermarking_imageServerUrl').val();
var productId = jQuery('#ImageWatermarking_productId').val();
var imageName = jQuery('#ImageWatermarking_imageName').val();
var width = jQuery('#ImageWatermarking_width').val();
@@ -84,7 +85,7 @@ under the License.
var imageData = {productId : productId, imageName : imageName, text : text, opacity : opacity, x : pointX, y : pointY,
width : width, count : previewCount, fontColor : fontColor, fontSize : fontSize};
jQuery.post("setPreviewWaterMark", imageData, function() {
- var path = "/images/products/management/previewImage" + next + ".jpg";
+ var path = imageServerUrl + "/previewImage" + next + ".jpg";
jQuery('td.img-src img').attr('src', path);
jQuery('#ImageWatermarking_previewCount').attr('value', next);
});
Modified: ofbiz/trunk/applications/product/widget/catalog/ImageManagementForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ImageManagementForms.xml?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/ImageManagementForms.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/ImageManagementForms.xml Fri Feb 18 04:12:43 2011
@@ -44,7 +44,7 @@ under the License.
<field-map field-name="contentId"/>
</entity-and>
</row-actions>
- <field name="drObjectInfo" title="Image"><image/></field>
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
<field name="drDataResourceName" title="Image Name">
<hyperlink target="${currentFormName}" description="${drDataResourceName}">
<parameter param-name="productId"/>
@@ -59,7 +59,7 @@ under the License.
<display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/>
</field>
<field name="viewButton" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
</form>
@@ -106,7 +106,7 @@ under the License.
</radio>
</field>
<field name="_rowSubmit" position="2" title=" " widget-style="hidden"><check all-checked="true"/></field>
- <field name="drObjectInfo" position="2" title="Image"><image/></field>
+ <field name="drObjectInfo" position="2" title="Image"><image width="100"/></field>
<field name="checkStatusId" position="2" title="Status">
<radio no-current-selected-key="${checkRadio}">
<option key="IM_APPROVED/${productId}" description="Approve"/>
@@ -119,7 +119,7 @@ under the License.
<field name="dataResourceId" position="2"><display/></field>
<field name="fromDate" position="2"><display/></field>
<field name="viewButton" position="2" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
<field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
@@ -153,13 +153,13 @@ under the License.
<field name="productId" title="Product Name [Product ID] - Category Name" entry-name="productId" position="1" use-when="${bsh:String prev=(String)previousItem.get("productId");return new Boolean(!(prev!=null&&prev.equals(productId)));}">
<display-entity entity-name="Product" key-field-name="productId" description="${internalName} [${productId}] - ${productCategory.categoryName}" also-hidden="false"/>
</field>
- <field name="drObjectInfo" position="2" title="Image"><image/></field>
+ <field name="drObjectInfo" position="2" title="Image"><image width="100"/></field>
<field name="drDataResourceName" position="2" title="Image Name"><display/></field>
<field name="contentId" position="2"><display/></field>
<field name="dataResourceId" position="2"><display/></field>
<field name="fromDate" position="2"><display/></field>
<field name="viewButton" position="2" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
</form>
@@ -193,7 +193,7 @@ under the License.
<display-entity entity-name="Product" key-field-name="productId" description="${internalName} [${productId}] - ${productCategory.categoryName}" also-hidden="false"/>
</field>
<field name="_rowSubmit" position="2" title=" " widget-style="hidden"><check all-checked="true"/></field>
- <field name="drObjectInfo" position="2" title="Image"><image/></field>
+ <field name="drObjectInfo" position="2" title="Image"><image width="100"/></field>
<field name="drDataResourceName" position="2" title="Image Name"><display/></field>
<field name="contentId" position="2"><display/></field>
<field name="dataResourceId" position="2"><display/></field>
@@ -209,7 +209,7 @@ under the License.
</drop-down>
</field>
<field name="viewButton" position="2" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
<field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
@@ -247,7 +247,7 @@ under the License.
<field name="productId" title="Product Name [Product ID] - Category Name" entry-name="productId" position="1" use-when="${bsh:String prev=(String)previousItem.get("productId");return new Boolean(!(prev!=null&&prev.equals(productId)));}">
<display-entity entity-name="Product" key-field-name="productId" description="${internalName} [${productId}] - ${productCategory.categoryName}" also-hidden="false"/>
</field>
- <field name="drObjectInfo" position="2" title="Image"><image/></field>
+ <field name="drObjectInfo" position="2" title="Image"><image width="100"/></field>
<field name="drDataResourceName" position="2" title="Image Name"><display/></field>
<field name="contentId" position="2"><display/></field>
<field name="dataResourceId" position="2"><display/></field>
@@ -259,7 +259,7 @@ under the License.
<field name="rejectedBy" position="2" title="Rejected By"><display/></field>
<field name="description" position="2" title="Rejected Reason"><display/></field>
<field name="viewButton" position="2" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
</form>
@@ -305,8 +305,8 @@ under the License.
<field name="dataResourceId"><hidden/></field>
<field name="fromDate"><hidden/></field>
<field name="_rowSubmit" title=" " widget-style="hidden"><check all-checked="true"/></field>
- <field name="drObjectInfo" title="Image"><image/></field>
- <field name="action" title="Action" event="onChange" action="javascript:
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
+ <field name="action" use-when="${groovy: return context.drMimeTypeId == 'image/jpeg';}" title="Action" event="onChange" action="javascript:
document.ListImageManage.action='checkAction?productId=${productId}&contentId=${contentId}&dataResourceId=${dataResourceId}';
document.ListImageManage.submit();">
<drop-down allow-empty="true">
@@ -316,10 +316,10 @@ under the License.
<option key="rotate" description="Rotate"/>
</drop-down>
</field>
- <field name="description" use-when="${groovy: return context.statusId == 'IM_APPROVED'; }" title="Caption"><text/></field>
- <field name="sequenceNum" use-when="${groovy: return context.statusId == 'IM_APPROVED'; }" title="Sort Order"><text maxlength="2" size="5"/></field>
- <field name="drIsPublic" use-when="${groovy: return context.statusId == 'IM_APPROVED'; }" title="Enable"><check/></field>
- <field name="thumbnail" use-when="${groovy: return context.statusId == 'IM_APPROVED'; }" title="Default Image" widget-style="buttontext">
+ <field name="description" use-when="${groovy: return context.statusId == 'IM_APPROVED';}" title="Caption"><text/></field>
+ <field name="sequenceNum" use-when="${groovy: return context.statusId == 'IM_APPROVED';}" title="Sort Order"><text maxlength="2" size="5"/></field>
+ <field name="drIsPublic" use-when="${groovy: return context.statusId == 'IM_APPROVED';}" title="Enable"><check/></field>
+ <field name="defaultImage" use-when="${groovy: return context.statusId == 'IM_APPROVED';}" title="Default Image" widget-style="buttontext">
<hyperlink target="setDefaultImage" description="Set Default">
<parameter param-name="productId"/>
<parameter param-name="contentId"/>
@@ -331,7 +331,7 @@ under the License.
<display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/>
</field>
<field name="viewButton" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
<field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
<sort-order>
@@ -365,7 +365,7 @@ under the License.
<field-map field-name="contentId"/>
</entity-and>
</actions>
- <field name="drObjectInfo" title=" "><image/></field>
+ <field name="drObjectInfo" title=" "><image width="100"/></field>
</form>
<form name="ImageFrames" type="single" title="" target="uploadFrame" header-row-style="header-row" default-table-style="basic-table" target-window="_self">
@@ -421,6 +421,7 @@ under the License.
</entity-one>
<set field="imageURL" from-field="contentDataResource.drObjectInfo"/>
</actions>
+ <field name="imageServerUrl"><hidden/></field>
<field name="productId"><hidden/></field>
<field name="contentId"><hidden/></field>
<field name="dataResourceId"><hidden/></field>
@@ -605,7 +606,7 @@ under the License.
<set field="drObjectInfo" from-field="contentDataResourceViews[0].drObjectInfo"/>
</row-actions>
<field name="productId"><hidden/></field>
- <field name="drObjectInfo" title="Image"><image/></field>
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
<field name="drDataResourceName" title="Image Name"><display/></field>
<field name="fromDate"><display/></field>
<field name="status"><display description="Uploaded"/></field>
@@ -643,7 +644,7 @@ under the License.
<field-map field-name="contentId"/>
</entity-and>
</row-actions>
- <field name="drObjectInfo" title="Image"><image/></field>
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
<field name="drDataResourceName" title="Image Name" widget-style="buttontext">
<hyperlink also-hidden="false" target-type="plain" description="${drDataResourceName}" target="javascript:set_value('${contentId}')"/>
</field>
@@ -654,7 +655,7 @@ under the License.
<display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/>
</field>
<field name="viewButton" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
</form>
@@ -694,7 +695,7 @@ under the License.
<set field="ApprovedBy" value="${userLoginAndPartyDetails[0].firstName} ${userLoginAndPartyDetails[0].middleName} ${userLoginAndPartyDetails[0].lastName}"/>
</row-actions>
<field name="productId"><hidden/></field>
- <field name="drObjectInfo" title="Image"><image/></field>
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
<field name="drDataResourceName" title="Image Name"><display/></field>
<field name="contentId"><display/></field>
<field name="dataResourceId"><display/></field>
@@ -703,7 +704,7 @@ under the License.
</field>
<field name="purchaseFromDate" title="Approved Date"><display/></field>
<field name="viewButton" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
</form>
@@ -731,7 +732,7 @@ under the License.
<field-map field-name="contentId"/>
</entity-and>
</row-actions>
- <field name="drObjectInfo" title="Image"><image/></field>
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
<field name="drDataResourceName" title="Image Name">
<hyperlink target="ListImageReplace" description="${drDataResourceName}">
<parameter param-name="productId"/>
@@ -744,7 +745,7 @@ under the License.
<display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/>
</field>
<field name="viewButton" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
</form>
@@ -772,7 +773,7 @@ under the License.
<field-map field-name="contentId"/>
</entity-and>
</row-actions>
- <field name="drObjectInfo" title="Image"><image/></field>
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
<field name="drDataResourceName" title="Image Name">
<hyperlink target="ListImageReplace" description="${drDataResourceName}">
<parameter param-name="productId"/>
@@ -787,7 +788,7 @@ under the License.
<display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/>
</field>
<field name="viewButton" title="${uiLabelMap.CommonView}" widget-style="buttontext">
- <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="new" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
+ <hyperlink target="${origContentDataResourceViews[0].drObjectInfo}" target-window="_blank" description="${uiLabelMap.CommonView}" also-hidden="false" target-type="content"/>
</field>
</form>
@@ -810,7 +811,7 @@ under the License.
<field name="dataResourceId"><display/></field>
<field name="createdDate"><display/></field>
<!--<field name="deleteButton" title="${uiLabelMap.CommonDelete}" widget-style="buttontext">
- <hyperlink target="deleteImageFrame" target-window="new" description="${uiLabelMap.CommonDelete}" also-hidden="false">
+ <hyperlink target="deleteImageFrame" target-window="_blank" description="${uiLabelMap.CommonDelete}" also-hidden="false">
<parameter param-name="contentId" from-field="contentId"/>
</hyperlink>
</field>-->
@@ -844,7 +845,7 @@ under the License.
<field-map field-name="contentId"/>
</entity-and>
</row-actions>
- <field name="drObjectInfo" title="Image"><image/></field>
+ <field name="drObjectInfo" title="Image"><image width="100"/></field>
<field name="drDataResourceName" title="Image Name"><display/></field>
<field name="contentId"><display/></field>
<field name="dataResourceId"><display/></field>
Modified: ofbiz/trunk/applications/product/widget/catalog/ImageManagementScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ImageManagementScreens.xml?rev=1071878&r1=1071877&r2=1071878&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/ImageManagementScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/ImageManagementScreens.xml Fri Feb 18 04:12:43 2011
@@ -532,7 +532,9 @@ under the License.
<field-map field-name="contentId" from-field="parameters.contentId"/>
<field-map field-name="drDataResourceId" from-field="parameters.dataResourceId"/>
</entity-one>
- <set field="imageURL" from-field="contentDataResource.drObjectInfo"/></actions>
+ <set field="imageURL" from-field="contentDataResource.drObjectInfo"/>
+ <property-to-field resource="catalog" property="image.management.url" field="imageServerUrl"/>
+ </actions>
<widgets>
<decorator-screen name="ImageManagementDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
@@ -773,8 +775,11 @@ under the License.
<screen name="ViewPreviewImage">
<section>
+ <actions>
+ <property-to-field resource="catalog" property="image.management.url" field="imageServerUrl"/>
+ </actions>
<widgets>
- <image src="/images/products/management/previewImage.jpg"></image>
+ <image src="${imageServerUrl}/previewImage.jpg"></image>
</widgets>
</section>
</screen>
@@ -977,7 +982,7 @@ under the License.
<if-has-permission permission="IMAGE_MANAGEMENT_ADMIN"/>
</condition>
<widgets>
- <screenlet title="${parameters.productId}">
+ <screenlet title="${uiLabelMap.CommonRemove}">
<include-form name="ImageRemove" location="component://product/widget/catalog/ImageManagementForms.xml"/>
</screenlet>
</widgets>