A bunch of fixes to get the Content admin to upload and display the images under the "DataResource" tab.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@505079 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -610,8 +610,10 @@ Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, module);
|
||||
String mimeTypeId = (String) newDrContext.get("mimeTypeId");
|
||||
if (byteWrapper != null && (mimeTypeId == null || (mimeTypeId.indexOf("image") >= 0) || (mimeTypeId.indexOf("application") >= 0))) {
|
||||
mimeTypeId = (String) context.get("_imageData_contentType");
|
||||
String fileName = (String) context.get("_imageData_fileName");
|
||||
newDrContext.put("objectInfo", fileName);
|
||||
if (dataResourceTypeId.equals("IMAGE_OBJECT")) {
|
||||
String fileName = (String) context.get("_imageData_fileName");
|
||||
newDrContext.put("objectInfo", fileName);
|
||||
}
|
||||
newDrContext.put("mimeTypeId", mimeTypeId);
|
||||
}
|
||||
|
||||
@@ -697,7 +699,7 @@ Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, module);
|
||||
}
|
||||
if (hasData || "true".equalsIgnoreCase(forceElectronicText)) {
|
||||
fileContext.put("rootDir", context.get("rootDir"));
|
||||
fileContext.put("dataResourcetype", dataResourceTypeId);
|
||||
fileContext.put("dataResourceTypeId", dataResourceTypeId);
|
||||
fileContext.put("objectInfo", dataResource.get("objectInfo"));
|
||||
thisResult = dispatcher.runSync("updateFile", fileContext);
|
||||
errorMsg = ServiceUtil.getErrorMessage(thisResult);
|
||||
|
||||
@@ -388,7 +388,7 @@ public class DataServices {
|
||||
String fileName = "";
|
||||
String sep = "";
|
||||
try {
|
||||
if (UtilValidate.isEmpty(dataResourceTypeId) || dataResourceTypeId.equals("LOCAL_FILE")) {
|
||||
if (UtilValidate.isEmpty(dataResourceTypeId) || dataResourceTypeId.startsWith("LOCAL_FILE")) {
|
||||
fileName = prefix + sep + objectInfo;
|
||||
file = new File(fileName);
|
||||
if (file == null) {
|
||||
@@ -397,13 +397,13 @@ public class DataServices {
|
||||
if (!file.isAbsolute()) {
|
||||
throw new GenericServiceException("File: " + fileName + " is not absolute.");
|
||||
}
|
||||
} else if (dataResourceTypeId.equals("OFBIZ_FILE")) {
|
||||
} else if (dataResourceTypeId.startsWith("OFBIZ_FILE")) {
|
||||
prefix = System.getProperty("ofbiz.home");
|
||||
if (objectInfo.indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
|
||||
sep = "/";
|
||||
}
|
||||
file = new File(prefix + sep + objectInfo);
|
||||
} else if (dataResourceTypeId.equals("CONTEXT_FILE")) {
|
||||
} else if (dataResourceTypeId.startsWith("CONTEXT_FILE")) {
|
||||
prefix = (String) context.get("rootDir");
|
||||
if (objectInfo.indexOf("/") != 0 && prefix.lastIndexOf("/") != (prefix.length() - 1)) {
|
||||
sep = "/";
|
||||
|
||||
@@ -155,6 +155,9 @@ under the License.
|
||||
<entity-options description="${description}" entity-name="CharacterSet" key-field-name="characterSetId"/>
|
||||
</drop-down>
|
||||
</field>
|
||||
<field name="isPublic" >
|
||||
<check />
|
||||
</field>
|
||||
<field name="createButton" title="${uiLabelMap.CommonCreate}" use-when="currentValue==null" widget-style="smallSubmit"><submit button-type="button"/></field>
|
||||
<field name="updateButton" title="${uiLabelMap.CommonUpdate}" use-when="currentValue!=null" widget-style="smallSubmit"><submit button-type="button"/></field>
|
||||
</form>
|
||||
@@ -274,10 +277,11 @@ under the License.
|
||||
extends="AddDataResourceUrl">
|
||||
<field name="objectInfo" title="URL"><text/></field>
|
||||
</form>
|
||||
<form name="ImageUpload" target="uploadImage" title="" type="upload"
|
||||
<form name="ImageUpload" target="uploadImage" title="" type="upload" default-map-name="currentValue"
|
||||
default-title-style="tableheadtext" default-tooltip-style="tabletext" default-widget-style="inputBox">
|
||||
<field name="dataResourceId" widget-style="tabletext"><display/></field>
|
||||
<field name="objectInfo" widget-style="tabletext"><display description="${currentValue.objectInfo}"/></field>
|
||||
<field name="dataResourceTypeId" ><hidden/></field>
|
||||
<field name="objectInfo" widget-style="tabletext"><display /></field>
|
||||
<field name="imageData" entity-name="ImageDataResource"><file/></field>
|
||||
<field name="submitButton" title="${uiLabelMap.CommonUpload}" widget-style="smallSubmit"><submit button-type="button"/></field>
|
||||
</form>
|
||||
|
||||
@@ -107,6 +107,7 @@ under the License.
|
||||
<decorator-screen name="commonDataResourceDecorator" location="${parameters.mainDecoratorLocation}">
|
||||
<decorator-section name="body">
|
||||
<include-form name="ImageUpload" location="component://content/widget/content/DataResourceForms.xml"/>
|
||||
<content dataresource-id="${currentValue.dataResourceId}"/>
|
||||
</decorator-section>
|
||||
</decorator-screen>
|
||||
</widgets>
|
||||
|
||||
Reference in New Issue
Block a user