> Author: byersa
> Date: Thu Feb 8 15:01:41 2007
> New Revision: 505079
>
> URL:
http://svn.apache.org/viewvc?view=rev&rev=505079> Log:
> A bunch of fixes to get the Content admin to upload and display the
> images under the "DataResource" tab.
>
> Modified:
> ofbiz/trunk/applications/content/src/org/ofbiz/content/
> ContentManagementServices.java
> ofbiz/trunk/applications/content/src/org/ofbiz/content/data/
> DataServices.java
> ofbiz/trunk/applications/content/widget/content/
> DataResourceForms.xml
> ofbiz/trunk/applications/content/widget/content/
> DataResourceScreens.xml
>
> Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/
> ContentManagementServices.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/
> src/org/ofbiz/content/ContentManagementServices.java?
> view=diff&rev=505079&r1=505078&r2=505079
> ======================================================================
> ========
> --- ofbiz/trunk/applications/content/src/org/ofbiz/content/
> ContentManagementServices.java (original)
> +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/
> ContentManagementServices.java Thu Feb 8 15:01:41 2007
> @@ -610,8 +610,10 @@
> 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 @@
> }
> 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);
>
> Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/
> data/DataServices.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/
> src/org/ofbiz/content/data/DataServices.java?
> view=diff&rev=505079&r1=505078&r2=505079
> ======================================================================
> ========
> --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/
> DataServices.java (original)
> +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/
> DataServices.java Thu Feb 8 15:01:41 2007
> @@ -388,7 +388,7 @@
> 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 @@
> 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 = "/";
>
> Modified: ofbiz/trunk/applications/content/widget/content/
> DataResourceForms.xml
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/
> widget/content/DataResourceForms.xml?
> view=diff&rev=505079&r1=505078&r2=505079
> ======================================================================
> ========
> --- ofbiz/trunk/applications/content/widget/content/
> DataResourceForms.xml (original)
> +++ ofbiz/trunk/applications/content/widget/content/
> DataResourceForms.xml Thu Feb 8 15:01:41 2007
> @@ -155,6 +155,9 @@
> <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 @@
> 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>
>
> Modified: ofbiz/trunk/applications/content/widget/content/
> DataResourceScreens.xml
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/
> widget/content/DataResourceScreens.xml?
> view=diff&rev=505079&r1=505078&r2=505079
> ======================================================================
> ========
> --- ofbiz/trunk/applications/content/widget/content/
> DataResourceScreens.xml (original)
> +++ ofbiz/trunk/applications/content/widget/content/
> DataResourceScreens.xml Thu Feb 8 15:01:41 2007
> @@ -107,6 +107,7 @@
> <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>
>
>