svn commit: r815651 - in /ofbiz/trunk: applications/content/config/ applications/content/webapp/content/WEB-INF/ applications/content/webapp/content/WEB-INF/actions/content/ applications/content/webapp/content/content/ applications/content/webapp/conte...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r815651 - in /ofbiz/trunk: applications/content/config/ applications/content/webapp/content/WEB-INF/ applications/content/webapp/content/WEB-INF/actions/content/ applications/content/webapp/content/content/ applications/content/webapp/conte...

hansbak-2
Author: hansbak
Date: Wed Sep 16 07:48:51 2009
New Revision: 815651

URL: http://svn.apache.org/viewvc?rev=815651&view=rev
Log:
all upload content screens (hopefully we did not forget any) can now also select an existing contentId which can be selected from a navigation tree. Added also the possibility when a file is uploaded to put it at a particular leave in the tree. Programmed by my employee Berm

Added:
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy   (with props)
    ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl   (with props)
Modified:
    ofbiz/trunk/applications/content/config/ContentUiLabels.xml
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml
    ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl
    ofbiz/trunk/applications/content/widget/content/ContentForms.xml
    ofbiz/trunk/applications/content/widget/content/ContentScreens.xml
    ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/order/widget/ordermgr/CustRequestForms.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventEvents.xml
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml

Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentUiLabels.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/config/ContentUiLabels.xml (original)
+++ ofbiz/trunk/applications/content/config/ContentUiLabels.xml Wed Sep 16 07:48:51 2009
@@ -4165,4 +4165,16 @@
         <value xml:lang="th">หัวข้อ WebSite</value>
         <value xml:lang="zh">网站内容</value>
     </property>
+    <property key="FormFieldTitle_contentStatusId">
+        <value xml:lang="en">Status Id</value>
+    </property>
+    <property key="FormFieldTitle_caCratedDate">
+        <value xml:lang="en">ca Created Date</value>
+    </property>
+    <property key="FormFieldTitle_existContentId">
+        <value xml:lang="en">Existing Content Id</value>
+    </property>
+    <property key="PageTitlePleaseSelectData">
+        <value xml:lang="en">Please select data</value>
+    </property>
 </resource>

Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy?rev=815651&view=auto
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy (added)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy Wed Sep 16 07:48:51 2009
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ import org.ofbiz.entity.condition.*;
+ import org.ofbiz.entity.util.*;
+ import org.ofbiz.entity.*;
+ import org.ofbiz.base.util.*;
+ import javolution.util.FastList;
+ import javolution.util.FastSet;
+ import javolution.util.FastMap;
+ import org.ofbiz.entity.transaction.TransactionUtil;
+ import org.ofbiz.entity.util.EntityListIterator;
+ import org.ofbiz.entity.GenericEntity;
+ import org.ofbiz.entity.model.ModelField;
+ import org.ofbiz.base.util.UtilValidate;
+ import org.ofbiz.entity.model.ModelEntity;
+ import org.ofbiz.entity.model.ModelReader;
+
+try {
+    viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue();
+} catch (NumberFormatException nfe) {
+     viewIndex = 0;
+}
+
+context.viewIndexFirst = 0;
+context.viewIndex = viewIndex;
+context.viewIndexPrevious = viewIndex-1;
+context.viewIndexNext = viewIndex+1;
+String curFindString="";
+
+ModelReader reader = delegator.getModelReader();
+ModelEntity modelEntity = reader.getModelEntity("ContentAssocViewTo");
+GenericEntity findByEntity = delegator.makeValue("ContentAssocViewTo");
+List errMsgList = FastList.newInstance();
+for (int fnum = 0; fnum <  modelEntity.getFieldsSize(); fnum++) {
+    ModelField field = modelEntity.getField(fnum);
+    String fval = parameters.get(field.getName());
+    if (fval != null) {
+        if (fval.length() > 0) {
+            curFindString = curFindString + "&" + field.getName() + "=" + fval;
+            try {
+                findByEntity.setString(field.getName(), fval);
+            } catch (NumberFormatException nfe) {
+                Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "GetContentLookupList.groovy");
+                errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName());
+            }
+        }
+    }
+}
+if (errMsgList) {
+    request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
+}
+
+curFindString = UtilFormatOut.encodeQuery(curFindString);
+context.curFindString = curFindString;
+try {
+ viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue();
+} catch (NumberFormatException nfe) {
+
+}
+
+context.viewSize = viewSize;
+
+int lowIndex = viewIndex*viewSize+1;
+int highIndex = (viewIndex+1)*viewSize;
+
+context.lowIndex = lowIndex;
+int arraySize = 0;
+List resultPartialList = null;
+ conditions = [EntityCondition.makeCondition("contentIdStart", EntityOperator.EQUALS,(String)parameters.get("contentId"))];
+
+if ((highIndex - lowIndex + 1) > 0) {
+ // get the results as an entity list iterator
+ boolean beganTransaction = false;
+ if(resultPartialList==null){
+    try {
+     beganTransaction = TransactionUtil.begin();
+     allConditions = EntityCondition.makeCondition( conditions, EntityOperator.AND );
+     fieldsToSelect = FastSet.newInstance();
+     //fieldsToSelect=["contentId", "contentName", "mimeTypeId"] as Set;
+     findOptions = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
+     EntityListIterator listIt=null;
+     listIt = delegator.find("ContentAssocViewTo", allConditions, null, null, ["contentId ASC"], findOptions);
+     resultPartialList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1);
+    
+     arraySize = listIt.getResultsSizeAfterPartialList();
+     if (arraySize < highIndex) {
+     highIndex = arraySize;
+     }
+     listIt.close();
+ } catch (GenericEntityException e) {
+ Debug.logError(e, "Failure in operation, rolling back transaction", "GetContentLookupList.groovy");
+ try {
+ // only rollback the transaction if we started one...
+ TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e);
+ } catch (GenericEntityException e2) {
+ Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "GetContentLookupList.groovy");
+ }
+ // after rolling back, rethrow the exception
+ throw e;
+ } finally {
+ // only commit the transaction if we started one... this will throw an exception if it fails
+ TransactionUtil.commit(beganTransaction);
+ }
+ }
+}
+context.highIndex = highIndex;
+context.arraySize = arraySize;
+context.resultPartialList = resultPartialList;
+
+viewIndexLast = (int) (arraySize/viewSize);
+context.viewIndexLast = viewIndexLast;
+contentAssoc = FastList.newInstance();
+context.contentAssoc=resultPartialList;
\ No newline at end of file

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml Wed Sep 16 07:48:51 2009
@@ -1760,6 +1760,14 @@
         <security auth="true" https="true"/>
         <response name="success" type="view" value="LookupSurveyResponse"/>
     </request-map>
+    <request-map uri="LookupTreeContent">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupTreeContent"/>
+    </request-map>
+    <request-map uri="LookupDetailContentTree">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="LookupDetailContentTree"/>
+    </request-map>
 
     <!-- lookup other components -->
     <request-map uri="LookupPerson"><security auth="true" https="true"/><response name="success" type="view" value="LookupPerson"/></request-map>
@@ -1948,6 +1956,8 @@
 
     <!-- lookup content component -->
     <view-map name="LookupContent" page="component://content/widget/content/ContentScreens.xml#LookupContent" type="screen"/>
+    <view-map name="LookupTreeContent" page="component://content/widget/content/ContentScreens.xml#LookupContentTree" type="screen"/>
+    <view-map name="LookupDetailContentTree" page="component://content/widget/content/ContentScreens.xml#LookupDetailContentTree" type="screen"/>
     <view-map name="LookupDataResource" page="component://content/widget/content/DataResourceScreens.xml#LookupDataResource" type="screen"/>
     <view-map name="LookupSurvey" page="component://content/widget/SurveyScreens.xml#LookupSurvey" type="screen"/>
     <view-map name="LookupSurveyResponse" page="component://content/widget/SurveyScreens.xml#LookupSurveyResponse" type="screen"/>
@@ -1965,6 +1975,8 @@
     <view-map name="EditDocumentTree" type="screen" page="component://content/widget/content/ContentScreens.xml#EditDocumentTree"/>
     <view-map name="EditDocument" type="screen" page="component://content/widget/content/ContentScreens.xml#EditDocument"/>
     <view-map name="ListDocument" type="screen" page="component://content/widget/content/ContentScreens.xml#ListDocument"/>
+    <view-map name="ListContentTree" type="screen" page="component://content/widget/content/ContentScreens.xml#ListContentTree"/>
+    <view-map name="ViewContentDetail" type="screen" page="component://content/widget/content/ContentScreens.xml#ViewContentDetail"/>
     <view-map name="showContent" type="screen" page="component://content/widget/content/ContentScreens.xml#ShowContent"/>
     <view-map name="showContentPdf" type="screen" page="component://content/widget/content/ContentScreens.xml#ShowContent"  content-type="application/pdf" encoding="none"/>
     

Modified: ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/content/ContentNav.ftl Wed Sep 16 07:48:51 2009
@@ -77,6 +77,13 @@
 
 <#-------------------------------------------------------------------------------------call ofbiz function-->
     function callDocument(ctx) {
+     var tabitem='${tabButtonItem?if_exists}';
+     if(tabitem=="navigateContent")
+ listDocument='<@ofbizUrl>/views/ListDocument</@ofbizUrl>';
+        if(tabitem=="LookupContentTree")
+     listDocument='<@ofbizUrl>/views/ListContentTree</@ofbizUrl>';
+        if(tabitem=="LookupDetailContentTree")
+         listDocument='<@ofbizUrl>/views/ViewContentDetail</@ofbizUrl>';
         var bindArgs = {
             url: listDocument,
             method: 'POST',
@@ -87,7 +94,7 @@
             },
             load: function(type, data, evt) {
                 var innerPage = dojo.byId('Document');
-                innerPage.innerHTML = data;
+                innerPage.innerHTML = data;
             }
         };
         dojo.io.bind(bindArgs);
@@ -190,6 +197,23 @@
         };
         dojo.io.bind(bindArgs);
     }
+ <#------------------------------------------------------pagination function -->
+    function nextPrevDocumentList(url){
+     url= '<@ofbizUrl>'+url+'</@ofbizUrl>';
+     var bindArgs = {
+            url: url,
+            method: 'POST',
+            mimetype: 'text/html',
+            error: function(type, data, evt) {
+                alert("An error occured loading content! : " + data);
+            },
+            load: function(type, data, evt) {
+                var innerPage = dojo.byId('Document');
+                innerPage.innerHTML = data;
+            }
+        };
+        dojo.io.bind(bindArgs);
+    }
 </script>
 
 <style>
@@ -197,6 +221,14 @@
     background-color: #ccc;
     font-size: 10px;
 }
+<#if tabButtonItem?has_content>
+ <#if tabButtonItem=="LookupContentTree"||tabButtonItem=="LookupDetailContentTree">
+body{background:none;}
+.left-border{float:left;width:25%;}
+.contentarea{margin: 0 0 0 0.5em;padding:0 0 0 0.5em;}
+.leftonly{float:none;min-height:25em;}
+ </#if>
+</#if>
 </style>
 
 <#-- looping macro -->

Added: ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl?rev=815651&view=auto
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl (added)
+++ ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl Wed Sep 16 07:48:51 2009
@@ -0,0 +1,101 @@
+<#--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+<div class="screenlet">
+<table cellspacing="0" width="100%">
+ <tr colspan="3">
+   <td align="left">
+                    <#if (viewIndex > 0)>
+                     <#assign url='/views/'+tabButtonItem+'?'+curFindString+'&amp;VIEW_SIZE='+viewSize+'&amp;VIEW_INDEX='+viewIndexFirst>
+                        <a href="javascript:nextPrevDocumentList('${url}');" class="nav-next">${uiLabelMap.CommonFirst}</a>|
+                       <#assign url='/views/'+tabButtonItem+'?'+curFindString+'&amp;VIEW_SIZE='+viewSize+'&amp;VIEW_INDEX='+viewIndexPrevious>
+ <a href="javascript:nextPrevDocumentList('${url}');" class="nav-previous">${uiLabelMap.CommonPrevious}</a>|
+                    </#if>
+                    <#if (arraySize > 0)>
+ ${lowIndex} - ${highIndex} ${uiLabelMap.CommonOf} ${arraySize}
+                    </#if>
+                    <#if (arraySize > highIndex)>
+                     <#assign url='/views/'+tabButtonItem+'?'+curFindString+'&amp;VIEW_SIZE='+viewSize+'&amp;VIEW_INDEX='+viewIndexNext>|
+                     <a href="javascript:nextPrevDocumentList('${url}');" class="nav-next">${uiLabelMap.CommonNext}</a>
+                        <#assign url='/views/'+tabButtonItem+'?'+curFindString+'&amp;VIEW_SIZE='+viewSize+'&amp;VIEW_INDEX='+viewIndexLast>|
+                        <a href="javascript:nextPrevDocumentList('${url}');" class="nav-next">${uiLabelMap.CommonLast}</a>
+                    </#if>
+        </td>
+        <td></td>
+        <td></td>
+  </tr>
+   <#if (arraySize > 0)>
+   <tr><td colspan="3"><hr/></td></tr>
+   </#if>
+</table>
+<table class="basic-table hover-bar" cellspacing="0">
+<#if tabButtonItem=="ListContentTree">
+<#--Form ListContentTree-->
+  <tr class="header-row">
+    <td>${uiLabelMap.FormFieldTitle_contentId}</td>
+    <td>${uiLabelMap.FormFieldTitle_coContentName}</td>
+    <td>${uiLabelMap.FormFieldTitle_mimeTypeId}</td>
+  </tr>
+<#elseif tabButtonItem=="ListDocument">
+<#--Form ListDocument-->
+ <tr class="header-row">
+    <td>${uiLabelMap.FormFieldTitle_contentId}</td>
+    <td>${uiLabelMap.FormFieldTitle_contentTypeId}</td>
+    <td>${uiLabelMap.FormFieldTitle_mimeTypeId}</td>
+    <td>${uiLabelMap.FormFieldTitle_contentStatusId}</td>
+    <td>${uiLabelMap.FormFieldTitle_caCratedDate}</td>
+    <td>${uiLabelMap.CommonDelete}</td>
+  </tr>
+</#if>
+<#if contentAssoc?has_content>  
+   <#assign alt_row = false/>
+   <#assign listcount=0>
+   <#list contentAssoc as contentData>
+   <#if tabButtonItem=="ListContentTree">
+ <#--Form ListContentTree-->
+   <tr <#if alt_row> class="alternate-row"</#if>>
+   <td><a class="plain" href="javascript:set_value('${contentData.contentId?if_exists}')">${contentData.contentId?if_exists}</a></td>
+   <td>${contentData.contentName?if_exists}</td>
+   <td>${contentData.mimeTypeId?if_exists}</td>
+   </tr>
+   <#elseif tabButtonItem=="ListDocument">
+   <#--Form ListDocument-->
+   <tr <#if alt_row> class="alternate-row"</#if>>
+   <td><a class="plain" href="/content/control/editContent?contentId=${contentData.contentId?if_exists}">${contentData.contentId?if_exists}</a></td>
+   <td>${contentData.contentTypeId?if_exists}</td>
+   <td>${contentData.mimeTypeId?if_exists}</td>
+   <td>${contentData.statusId?if_exists}</td>
+   <#if contentData.caFromDate?has_content>
+             <#assign caFromDate = Static["org.ofbiz.base.util.UtilDateTime"].toDateString(contentData.caFromDate, "dd/MM/yyyy")/>
+            </#if>
+   <td>${caFromDate?if_exists}</td>
+   <td><a href="javascript:document.listDocumentForm_${listcount}.submit()" >${uiLabelMap.CommonDelete}</a></td>
+   </tr>
+   <form action="<@ofbizUrl>removeDocumentFromTree</@ofbizUrl>" name="listDocumentForm_${listcount}" method="post">
+         <input type="hidden" name="contentId" value="${contentData.contentIdStart?if_exists}"/>
+         <input type="hidden" name="contentIdTo" value="${contentData.contentId?if_exists}"/>
+         <input type="hidden" name="contentAssocTypeId" value="${contentData.caContentAssocTypeId?if_exists}"/>
+         <input type="hidden" name="fromDate" value="${contentData.fromDate?if_exists}"/>
+   </form>
+ </#if>
+ <#assign alt_row = !alt_row/>
+ <#assign listcount=listcount+1>
+   </#list>
+</#if>
+</table>
+</div>

Propchange: ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/content/webapp/content/lookup/ContentTreeLookupList.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/content/widget/content/ContentForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentForms.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/ContentForms.xml (original)
+++ ofbiz/trunk/applications/content/widget/content/ContentForms.xml Wed Sep 16 07:48:51 2009
@@ -557,8 +557,8 @@
             </hyperlink>
         </field>
     </form>
-    <form name="ListDocument"  target="" type="list"  list-name="contentAssoc" paginate-target="navigateContent"
-        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+    <!--form name="ListDocument"  target="" type="list"  list-name="contentAssoc" paginate-target="navigateContent"
+        odd-row-style="alternate-row" header-row-style="header-row" default-table-style="basic-table hover-bar">
         <field name="contentId" use-when="&quot;application/pdf&quot;.equals(mimeTypeId)">
             <hyperlink also-hidden="false" description="${contentName} [${contentId}]" target="showContentPdf?contentId=${contentId}" target-window="_blank"/>
         </field>
@@ -583,7 +583,7 @@
                 <parameter param-name="fromDate"/>
             </hyperlink>
         </field>
-    </form>
+    </form-->
     <form name="AddDocument"  target="addDocumentToTree" title="" type="single"
         header-row-style="header-row" default-table-style="basic-table">
         <actions>
@@ -616,4 +616,18 @@
         </field>
         <field name="submit" title="${uiLabelMap.CommonSubmit}"><submit/></field>
     </form>
+    <form name="ViewContentDetail" type="single" default-map-name="lookupContentDetail">
+        <field name="contentId" widget-style="buttontext">
+            <hyperlink also-hidden="false" target-type="plain" description="${contentId}" target="javascript:set_value('${contentId}')"/>
+        </field>
+        <field name="contentName"><display/></field>
+        <field name="contentTypeId"><display/></field>
+        <field name="ownerContentId"><display/></field>
+        <field name="mimeTypeId"><display/></field>
+        <field name="select" widget-style="buttontext" title=" " use-when="contentId!=null">
+            <hyperlink also-hidden="true"
+                target-type="plain" description="${uiLabelMap.CommonSelect}"
+                target="javascript:set_value('${contentId}')"/>            
+        </field>
+    </form>
 </forms>

Modified: ofbiz/trunk/applications/content/widget/content/ContentScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentScreens.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/ContentScreens.xml (original)
+++ ofbiz/trunk/applications/content/widget/content/ContentScreens.xml Wed Sep 16 07:48:51 2009
@@ -139,14 +139,23 @@
             <actions>
                 <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="tabButtonItem" value="ListDocument"/>
                 <set field="contentIdTo" from-field="parameters.contentIdTo"/>
                 <set field="contentId" from-field="parameters.contentId"/>
-                <entity-condition entity-name="ContentAssocViewTo" list="contentAssoc">
+                <set field="viewSize" value="${parameters.VIEW_SIZE}" default-value="30" type="Integer"/>
+                <set field="viewIndex" value="${parameters.VIEW_INDEX}" default-value="0" type="Integer"/>
+               <!-- <entity-condition entity-name="ContentAssocViewTo" list="contentAssoc">
                     <condition-expr field-name="contentIdStart" from-field="contentId" operator="equals"/>
-                </entity-condition>
+                    </entity-condition>-->
+                <script location="component://content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy"/>
             </actions>
             <widgets>
-                <include-form name="ListDocument" location="component://content/widget/content/ContentForms.xml"/>
+<!--                <include-form name="ListDocument" location="component://content/widget/content/ContentForms.xml"/>-->
+                <platform-specific>
+                    <html>
+                        <html-template location="component://content/webapp/content/lookup/ContentTreeLookupList.ftl"/>
+                    </html>
+                </platform-specific>
             </widgets>
         </section>
     </screen>
@@ -496,4 +505,140 @@
             </widgets>
         </section>
     </screen>
+    
+    <screen name="ListContentTree">
+        <section>
+            <actions>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/dojo/dojo.js" global="true"/>
+                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="tabButtonItem" value="ListContentTree"/>
+                <set field="contentIdTo" from-field="parameters.contentIdTo"/>
+                <set field="contentId" from-field="parameters.contentId"/>
+                <set field="viewSize" value="${parameters.VIEW_SIZE}" default-value="30" type="Integer"/>
+                <set field="viewIndex" value="${parameters.VIEW_INDEX}" default-value="0" type="Integer"/>
+                <script location="component://content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy"/>
+            </actions>
+            <widgets>
+                <container id="Document">
+                    <platform-specific>
+                        <html>
+                            <html-template location="component://content/webapp/content/lookup/ContentTreeLookupList.ftl"/>
+                        </html>
+                    </platform-specific>
+                </container>
+            </widgets>
+        </section>
+    </screen>
+    
+    <screen name="LookupContentTree">
+        <section>
+            <actions>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/dojo/dojo.js" global="true"/>
+                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="title" value="${uiLabelMap.PageTitleLookupContent}"/>
+                <set field="tabButtonItem" value="LookupContentTree"/>
+                <set field="labelTitleProperty" value="PageTitleNavigateContent"/>
+                <entity-and entity-name="ContentAssoc" list="contentAssoc">
+                    <field-map field-name="contentId" value="TREE_ROOT"/>
+                    <field-map field-name="contentAssocTypeId" value="TREE_CHILD"/>
+                </entity-and>
+            </actions>
+            <widgets>
+                <decorator-screen name="LookupDecorator" location="component://commonext/widget/HelpScreens.xml">
+                    <decorator-section name="body">
+                        <section>
+                            <widgets>
+                                <screenlet title="${uiLabelMap.PageTitleLookupContent}">
+                                    <container style="left-border">
+                                        <platform-specific>
+                                            <html>
+                                                <html-template location="component://content/webapp/content/content/ContentNav.ftl"/>
+                                            </html>
+                                        </platform-specific>
+                                    </container>
+                                    <container style="leftonly">
+                                        <include-screen name="ListContentTree"/>
+                                    </container>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>    
+            </widgets>
+        </section>
+    </screen>
+    
+    <screen name="LookupDetailContentTree">
+        <section>
+            <actions>
+                <set field="layoutSettings.javaScripts[+0]" value="/images/dojo/dojo.js" global="true"/>
+                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="title" value="${uiLabelMap.PageTitleLookupContent}"/>
+                <set field="tabButtonItem" value="LookupDetailContentTree"/>
+                <set field="labelTitleProperty" value="PageTitleNavigateContent"/>
+                <entity-and entity-name="ContentAssoc" list="contentAssoc">
+                    <field-map field-name="contentId" value="TREE_ROOT"/>
+                    <field-map field-name="contentAssocTypeId" value="TREE_CHILD"/>
+                </entity-and>
+            </actions>
+            <widgets>
+                <section>
+                    <widgets>
+                        <decorator-screen name="LookupDecorator" location="component://commonext/widget/HelpScreens.xml">
+                            <decorator-section name="body">
+                                <screenlet title="${uiLabelMap.PageTitleLookupContent}">
+                                    <container style="left-border">
+                                        <platform-specific>
+                                            <html>
+                                                <html-template location="component://content/webapp/content/content/ContentNav.ftl"/>
+                                            </html>
+                                        </platform-specific>
+                                    </container>
+                                    <container style="leftonly">
+                                        <container style="contentarea">
+                                            <include-screen name="ViewContentDetail"/>
+                                        </container>
+                                    </container>
+                                </screenlet>
+                            </decorator-section>
+                        </decorator-screen>
+                    </widgets>
+                </section>
+            </widgets>
+        </section>
+    </screen>
+    
+    <screen name="ViewContentDetail">
+        <section>
+            <actions>
+                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="contentIdTo" from-field="parameters.contentIdTo"/>
+                <set field="contentId" from-field="parameters.contentId"/>
+                <entity-one entity-name="Content" value-field="lookupContentDetail">
+                    <field-map field-name="contentId" from-field="contentId"/>
+                </entity-one>
+            </actions>
+            <widgets>
+                <section>
+                    <condition>
+                        <if-empty field="lookupContentDetail"/>
+                    </condition>
+                    <widgets>
+                        <container id="Document">
+                            <label style="" text="${uiLabelMap.PageTitlePleaseSelectData}"></label>
+                        </container>
+                    </widgets>
+                    <fail-widgets>
+                        <container id="Document">
+                            <include-form name="ViewContentDetail" location="component://content/widget/content/ContentForms.xml"/>
+                        </container>
+                    </fail-widgets>
+                </section>
+            </widgets>
+        </section>
+    </screen>
 </screens>

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestEvents.xml Wed Sep 16 07:48:51 2009
@@ -77,6 +77,24 @@
                 <set field="context.contentId" from-field="formInput.formInput.contentId"/>
             </else>
         </if-empty>
+        
+        <!-- create ContentAssoc-->
+        <set-service-fields service-name="createContentAssoc" map="formInput.formInput" to-map="contentMap"/>
+        <if-not-empty field="formInput.formInput.contentIdFrom">
+            <set field="contentMap.contentAssocTypeId" value="SUB_CONTENT"/>
+            <set field="contentMap.contentIdFrom" from-field="formInput.formInput.contentIdFrom"/>
+            <set field="contentMap.contentId" from-field="formInput.formInput.contentIdFrom"/>
+            <set field="contentMap.contentIdTo" from-field="context.contentId"/>
+            <now-timestamp field="contentMap.fromDate"/>
+            <entity-and entity-name="ContentAssoc" list="contentAssoList">
+                <field-map field-name="contentId" from-field="contentMap.contentId"/>
+                <field-map field-name="contentIdTo" from-field="contentMap.contentIdTo"/>
+            </entity-and>
+            <if-empty field="contentAssonList">
+                <call-service service-name="createContentAssoc" in-map-name="contentMap"/>          
+            </if-empty>
+        </if-not-empty>
+        
         <set field="context.custRequestId" from-field="formInput.formInput.custRequestId"/>
         <call-map-processor in-map-name="context" out-map-name="custRequestContext">
             <simple-map-processor name="newCustRequestContent">

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Wed Sep 16 07:48:51 2009
@@ -22,6 +22,7 @@
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">
     <include location="component://common/webcommon/WEB-INF/common-controller.xml"/>
     <include location="component://commonext/webapp/WEB-INF/controller.xml"/>
+    <include location="component://content/webapp/content/WEB-INF/controller.xml"/>
     <description>Order Manager Module Site Configuration File</description>
     <owner>Copyright 2001-2009 The Apache Software Foundation</owner>
 

Modified: ofbiz/trunk/applications/order/widget/ordermgr/CustRequestForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/CustRequestForms.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/CustRequestForms.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/CustRequestForms.xml Wed Sep 16 07:48:51 2009
@@ -561,8 +561,8 @@
             </entity-one>
         </actions>
         <field name="custRequestId" map-name="parameters"><hidden/></field>
-        <field name="contentId">
-            <lookup target-form-name="LookupContent"/>
+        <field name="contentId" title="Existing Content Id">
+            <lookup target-form-name="LookupTreeContent"/>
         </field>
         <field name="contentTypeId">
             <drop-down allow-empty="false" no-current-selected-key="DOCUMENT">
@@ -591,7 +591,7 @@
             </drop-down>
         </field-->
         <field name="dataResourceName" title="${uiLabelMap.CommonUpload}*"><file/></field>
-        <field name="dataCategoryId" use-when="dataResource==null">
+       <!-- <field name="dataCategoryId" use-when="dataResource==null">
             <drop-down allow-empty="false">
                 <entity-options description="${categoryName}" entity-name="DataCategory" key-field-name="dataCategoryId"/>
             </drop-down>
@@ -604,7 +604,8 @@
                 </entity-options>
                 <entity-options description="${categoryName}" entity-name="DataCategory" key-field-name="dataCategoryId"/>
             </drop-down>
-        </field>
+            </field>-->
+        <field name="contentIdFrom" title="${uiLabelMap.ContentCompDocParentContentId}"><lookup target-form-name="LookupDetailContentTree"/></field>
         <field name="createButton"><submit button-type="button"/></field>
     </form>
     <form name="ListCustRequestContent" type="list" list-name="custRequestAndContents"

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventEvents.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventEvents.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventEvents.xml Wed Sep 16 07:48:51 2009
@@ -29,52 +29,53 @@
             <field field="request" type="javax.servlet.http.HttpServletRequest"/>
             <string value="uploadedFile"/>
         </call-class-method>
-        <if-empty field="formInput.imageFileName">
-            <add-error><fail-message message="Upload file is missing..."/></add-error>
+        <if-empty field="formInput.formInput.contentId">
+            <if-empty field="formInput.imageFileName">
+                <add-error><fail-message message="Upload file is missing..."/></add-error>
+            </if-empty>
+            <check-errors/>
+            
+            <set field="parameters.imageFileName" from-field="formInput.imageFileName"/>
+            
+            <!-- Create Data Resource -->
+            <set-service-fields service-name="createContentFromUploadedFile"
+                map="formInput.formInput" to-map="data"/>
+            <set field="data.dataResourceTypeId" value="LOCAL_FILE"/>
+            <set field="data.dataTemplateTypeId" value="NONE"/>
+            <set field="data.dataCategoryId" from-field="formInput.formInput.dataCategoryId"/>
+            
+            <set field="data.statusId" from-field="formInput.formInput.resourceStatusId"/>
+            <set field="data.dataResourceName" from-field="formInput.imageFileName"/>
+            <set field="data.mimeTypeId" from-field="mimeType.mimeTypeId"/>
+            <set field="data.uploadedFile" from-field="formInput.imageData"/>
+            <set field="data._uploadedFile_fileName" from-field="formInput.imageFileName"/>
+            <set field="data._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
+            <call-service service-name="createDataResource" in-map-name="data">
+                <result-to-field result-name="dataResourceId" field="parameters.dataResourceId"/>
+            </call-service>
+            
+            <!-- Create attach upload to data resource -->
+            <set-service-fields service-name="attachUploadToDataResource" map="formInput.formInput"
+                to-map="attachMap"/>
+            <set field="attachMap.uploadedFile" from-field="formInput.imageData"/>
+            <set field="attachMap._uploadedFile_fileName" from-field="formInput.imageFileName"/>
+            <set field="attachMap._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
+            <set field="attachMap.dataResourceId" from-field="parameters.dataResourceId"/>
+            <set field="attachMap.mimeTypeId" from-field="mimeType.mimeTypeId"/>
+            <call-service service-name="attachUploadToDataResource" in-map-name="attachMap"/>
+            
+            <!-- Create content from dataResource -->
+            <set-service-fields service-name="createContentFromDataResource"
+                map="formInput.formInput" to-map="contentMap"/>
+            <set field="contentMap.roleTypeId" from-field="formInput.formInput.roleTypeId"/>
+            <set field="contentMap.partyId" from-field="formInput.formInput.partyId"/>
+            <set field="contentMap.contentTypeId" from-field="formInput.formInput.contentTypeId"/>
+            <set field="contentMap.dataResourceId" from-field="parameters.dataResourceId"/>
+            <call-service service-name="createContentFromDataResource" in-map-name="contentMap">
+                <result-to-field result-name="contentId" field="parameters.contentId"/>
+            </call-service>
+            <log level="always" message=" Content : ${parameters.contentId}"/>
         </if-empty>
-        <check-errors/>
-        
-        <set field="parameters.imageFileName" from-field="formInput.imageFileName"/>
-
-        <!-- Create Data Resource -->
-        <set-service-fields service-name="createContentFromUploadedFile"
-            map="formInput.formInput" to-map="data"/>
-        <set field="data.dataResourceTypeId" value="LOCAL_FILE"/>
-        <set field="data.dataTemplateTypeId" value="NONE"/>
-        <set field="data.dataCategoryId" from-field="formInput.formInput.dataCategoryId"/>
-
-        <set field="data.statusId" from-field="formInput.formInput.resourceStatusId"/>
-        <set field="data.dataResourceName" from-field="formInput.imageFileName"/>
-        <set field="data.mimeTypeId" from-field="mimeType.mimeTypeId"/>
-        <set field="data.uploadedFile" from-field="formInput.imageData"/>
-        <set field="data._uploadedFile_fileName" from-field="formInput.imageFileName"/>
-        <set field="data._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
-        <call-service service-name="createDataResource" in-map-name="data">
-            <result-to-field result-name="dataResourceId" field="parameters.dataResourceId"/>
-        </call-service>
-
-        <!-- Create attach upload to data resource -->
-        <set-service-fields service-name="attachUploadToDataResource" map="formInput.formInput"
-            to-map="attachMap"/>
-        <set field="attachMap.uploadedFile" from-field="formInput.imageData"/>
-        <set field="attachMap._uploadedFile_fileName" from-field="formInput.imageFileName"/>
-        <set field="attachMap._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
-        <set field="attachMap.dataResourceId" from-field="parameters.dataResourceId"/>
-        <set field="attachMap.mimeTypeId" from-field="mimeType.mimeTypeId"/>
-        <call-service service-name="attachUploadToDataResource" in-map-name="attachMap"/>
-
-        <!-- Create content from dataResource -->
-        <set-service-fields service-name="createContentFromDataResource"
-            map="formInput.formInput" to-map="contentMap"/>
-        <set field="contentMap.roleTypeId" from-field="formInput.formInput.roleTypeId"/>
-        <set field="contentMap.partyId" from-field="formInput.formInput.partyId"/>
-        <set field="contentMap.contentTypeId" from-field="formInput.formInput.contentTypeId"/>
-        <set field="contentMap.dataResourceId" from-field="parameters.dataResourceId"/>
-        <call-service service-name="createContentFromDataResource" in-map-name="contentMap">
-            <result-to-field result-name="contentId" field="parameters.contentId"/>
-        </call-service>
-        <log level="always" message=" Content : ${parameters.contentId}"/>
-
         <!-- Create party content -->
         <set-service-fields service-name="createPartyContent" map="formInput.formInput"
             to-map="partycontent"/>
@@ -98,6 +99,23 @@
         <set-service-fields service-name="updateCommunicationEvent" map="formInput.formInput" to-map="updateMap"/>
         <call-service service-name="updateCommunicationEvent" in-map-name="updateMap"/>
 
+        <!-- create ContentAssoc-->
+        <set-service-fields service-name="createContentAssoc" map="formInput.formInput" to-map="contentMap"/>
+        <if-not-empty field="formInput.formInput.contentIdFrom">
+            <set field="contentMap.contentAssocTypeId" value="SUB_CONTENT"/>
+            <set field="contentMap.contentIdFrom" from-field="formInput.formInput.contentIdFrom"/>
+            <set field="contentMap.contentId" from-field="formInput.formInput.contentIdFrom"/>
+            <set field="contentMap.contentIdTo" from-field="parameters.contentId"/>
+            <now-timestamp field="contentMap.fromDate"/>
+            <entity-and entity-name="ContentAssoc" list="contentAssoList">
+                <field-map field-name="contentId" from-field="contentMap.contentId"/>
+                <field-map field-name="contentIdTo" from-field="contentMap.contentIdTo"/>
+            </entity-and>
+            <if-empty field="contentAssonList">
+                <call-service service-name="createContentAssoc" in-map-name="contentMap"/>          
+            </if-empty>
+        </if-not-empty>
+
         <!-- Return to request -->
         <field-to-request field="formInput.formInput.communicationEventId" request-name="communicationEventId"/>
         <set field="my" value="My"/>

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Wed Sep 16 07:48:51 2009
@@ -22,6 +22,7 @@
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">
     <include location="component://common/webcommon/WEB-INF/common-controller.xml"/>
     <include location="component://commonext/webapp/WEB-INF/controller.xml"/>
+    <include location="component://content/webapp/content/WEB-INF/controller.xml"/>
     <description>Party Manager Module Site Configuration File</description>
     <owner>Copyright 2001-2009 The Apache Software Foundation</owner>
 

Modified: ofbiz/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/CommunicationEventForms.xml Wed Sep 16 07:48:51 2009
@@ -802,14 +802,19 @@
         <field name="partyIdTo"><hidden/></field>
         <field name="datetimeStarted"><hidden/></field>
         <field name="my"><hidden value="${my}"/></field>
+        <field name="contentId" title="${uiLabelMap.FormFieldTitle_existContentId}"><lookup target-form-name="LookupTreeContent"/></field>
         <field name="uploadedFile"><file/></field>
+        <field name="contentIdFrom" title="${uiLabelMap.ContentCompDocParentContentId}"><lookup target-form-name="LookupDetailContentTree"/></field>        
         <field name="send" title=" ">
             <hyperlink also-hidden="true"
                 target-type="plain" description="${uiLabelMap.CommonUpload}"
                 target="javascript:(document.uploadContent.datetimeStarted.value=document.EditEmail.datetimeStarted.value),(document.uploadContent.partyIdTo.value=document.EditEmail.partyIdTo.value),(document.uploadContent.subject.value=document.EditEmail.subject.value),(document.uploadContent.content.value=document.EditEmail.content.value),(document.uploadContent.submit())"/>
         </field>
     </form>
-    <form name="uploadContent1" type="upload" extends="uploadContent" target="uploadAttachFile"/>    
+    <form name="uploadContent1" type="upload" extends="uploadContent" target="uploadAttachFile">
+        <field name="send"><ignored/></field>
+        <field name="submitButton" title="${uiLabelMap.CommonUpload}"><submit/></field>
+    </form>      
 
     <form name="editCommTextContent" type="single" target="uploadCommEventContent" default-map-name="commEventContentDataResource"
         header-row-style="header-row" default-table-style="basic-table">

Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml Wed Sep 16 07:48:51 2009
@@ -129,16 +129,19 @@
             <field field="request" type="javax.servlet.http.HttpServletRequest"/>
             <string value="dataResourceName"/>
         </call-class-method>
-
-        <set-service-fields service-name="createContentFromUploadedFile" map="formInput.formInput" to-map="inMap"/>
-        <set field="inMap._uploadedFile_fileName" from-field="formInput.imageFileName"/>
-        <set field="inMap.uploadedFile" from-field="formInput.imageData"/>
-        <set field="inMap._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
-
-        <call-service service-name="createContentFromUploadedFile" in-map-name="inMap">
-            <result-to-field result-name="contentId" field="context.contentId"/>
-        </call-service>
-
+        <if-empty field="formInput.formInput.contentIdTo">
+            <set-service-fields service-name="createContentFromUploadedFile" map="formInput.formInput" to-map="inMap"/>
+            <set field="inMap._uploadedFile_fileName" from-field="formInput.imageFileName"/>
+            <set field="inMap.uploadedFile" from-field="formInput.imageData"/>
+            <set field="inMap._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
+            
+            <call-service service-name="createContentFromUploadedFile" in-map-name="inMap">
+                <result-to-field result-name="contentId" field="context.contentId"/>
+            </call-service>
+            <else>
+                <set field="context.contentId" from-field="formInput.formInput.contentIdTo"/>
+            </else>
+        </if-empty>
         <if-empty field="formInput.formInput.workEffortId">
             <if-not-empty field="formInput.formInput.projectId">
                 <set field="context.workEffortId" from-field="formInput.formInput.projectId"/>
@@ -157,10 +160,33 @@
                 <process field="fromDate"><copy to-field="fromDate"/></process>
             </simple-map-processor>
         </call-map-processor>
-
+        <!-- create WorkEffortContent-->
         <call-service service-name="createWorkEffortContent" in-map-name="workEffortContext">
             <result-to-field result-name="contentId" field="contentId"/>
         </call-service>
+        
+        <!-- create ContentAssoc-->
+        <set field="context.contentAssocTypeId" value="SUB_CONTENT"/>
+        <if-not-empty field="formInput.formInput.contentIdFrom">
+            <set field="context.contentIdFrom" from-field="formInput.formInput.contentIdFrom"/>
+            <call-map-processor in-map-name="context" out-map-name="contentAssocContext">
+                <simple-map-processor name="newContentAssoc">
+                    <process field="contentIdFrom"><copy to-field="contentId"/></process>
+                    <process field="contentIdFrom"><copy to-field="contentIdFrom"/></process>
+                    <process field="contentId"><copy to-field="contentIdTo"/></process>
+                    <process field="contentAssocTypeId"><copy to-field="contentAssocTypeId"/></process>
+                    <process field="fromDate"><copy to-field="fromDate"/></process>
+                </simple-map-processor>
+            </call-map-processor>
+            <entity-and entity-name="ContentAssoc" list="contentAssoList">
+                <field-map field-name="contentId" from-field="contentAssocContext.contentId"/>
+                <field-map field-name="contentIdTo" from-field="contentAssocContext.contentIdTo"/>
+            </entity-and>
+            <if-empty field="contentAssonList">
+                <call-service service-name="createContentAssoc" in-map-name="contentAssocContext"/>          
+            </if-empty>
+        </if-not-empty>
+        
         <!-- set the partyId in the request -->
         <field-to-request field="context.workEffortId" request-name="workEffortId"/>
         <field-to-request field="context.projectId" request-name="projectId"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Wed Sep 16 07:48:51 2009
@@ -25,6 +25,7 @@
     <include location="component://accounting/webapp/accounting/WEB-INF/controller.xml"/>
     <include location="component://workeffort/webapp/workeffort/WEB-INF/controller.xml"/>
     <include location="component://humanres/webapp/humanres/WEB-INF/controller.xml"/>
+    <include location="component://content/webapp/content/WEB-INF/controller.xml"/>
 
     <description>Project Management Component Site Configuration File</description>
 

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=815651&r1=815650&r2=815651&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Wed Sep 16 07:48:51 2009
@@ -862,6 +862,10 @@
         <field name="workEffortId" map-name="parameters"><hidden/></field>
         <field name="projectId" map-name="parameters"><hidden/></field>
         <field use-when="content!=null" name="contentId" tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field>
+        <field use-when="content==null" name="contentIdTo" title="${uiLabelMap.FormFieldTitle_existContentId}">
+            <lookup target-form-name="LookupTreeContent"/>
+        </field>
+        
         <field name="workEffortContentTypeId">
             <drop-down allow-empty="false">
                 <entity-options description="${description}" entity-name="WorkEffortContentType" key-field-name="workEffortContentTypeId"/>
@@ -876,34 +880,35 @@
                 <entity-options description="${description}" entity-name="ContentType"/>
             </drop-down>
         </field>
-        <field name="statusId" use-when="content==null">
+        <!--field name="statusId" use-when="content==null">
             <drop-down allow-empty="false" no-current-selected-key="CTNT_AVAILABLE">
                 <entity-options description="${description}" entity-name="StatusItem" key-field-name="statusId">
                     <entity-constraint name="statusTypeId" value="CONTENT_STATUS"/>
                     <entity-order-by field-name="sequenceId"/>
                 </entity-options>
             </drop-down>
-        </field>
-        <field name="statusId" use-when="content!=null">
+        </field-->
+        <!--field name="statusId" use-when="content!=null">
             <drop-down allow-empty="false" current-description="${currentStatus.description}" no-current-selected-key="CTNT_AVAILABLE">
                 <entity-options entity-name="StatusValidChangeToDetail" key-field-name="statusIdTo" description="${transitionName} (${description})">
                     <entity-constraint name="statusId" value="${content.statusId}"/>
                     <entity-order-by field-name="sequenceId"/>
                 </entity-options>
             </drop-down>
-        </field>
-        <!--field name="mimeTypeId" >
+        </field-->
+        <field name="mimeTypeId" >
             <drop-down allow-empty="false">
                 <entity-options description="${description}" entity-name="MimeType" key-field-name="mimeTypeId"/>
             </drop-down>
-        </field-->
+        </field>
         <field name="dataResourceName" title="${uiLabelMap.CommonUpload}"><file/></field>
-        <field name="dataCategoryId" use-when="dataResource==null">
+        <field name="contentIdFrom" title="${uiLabelMap.ContentCompDocParentContentId}"><lookup target-form-name="LookupDetailContentTree"/></field>
+        <!--field name="dataCategoryId" use-when="dataResource==null">
             <drop-down allow-empty="false">
                 <entity-options description="${categoryName}" entity-name="DataCategory" key-field-name="dataCategoryId"/>
             </drop-down>
-        </field>
-        <field name="dataCategoryId" use-when="dataResource!=null">
+        </field-->
+        <!--field name="dataCategoryId" use-when="dataResource!=null">
             <drop-down allow-empty="false">
                 <entity-options description="${categoryName}" entity-name="DataCategory">
                     <entity-constraint name="dataCategoryId" value="${dataResource.dataCategoryId}"/>
@@ -911,7 +916,7 @@
                 </entity-options>
                 <entity-options description="${categoryName}" entity-name="DataCategory" key-field-name="dataCategoryId"/>
             </drop-down>
-        </field>
+        </field-->
         <field name="createButton" use-when="content==null"><submit button-type="button"/></field>
         <field name="updateButton" use-when="content!=null"><submit button-type="button"/></field>
     </form>