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/11/15 04:20:32 UTC

svn commit: r1202024 - in /ofbiz/trunk/applications/content: webapp/content/website/WebSiteCMSContent.ftl webapp/content/website/WebSiteCMSNav.ftl widget/WebSiteScreens.xml

Author: hansbak
Date: Tue Nov 15 03:20:31 2011
New Revision: 1202024

URL: http://svn.apache.org/viewvc?rev=1202024&view=rev
Log:
update of the content -> website -> cms:  
1. can not update image 2. do not display mapKey field whan create new successful 3. do not display image and mapkey field when click on tree, all fixed

Modified:
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl
    ofbiz/trunk/applications/content/widget/WebSiteScreens.xml

Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl?rev=1202024&r1=1202023&r2=1202024&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl Tue Nov 15 03:20:31 2011
@@ -164,7 +164,6 @@
     <form name="cmsform" enctype="multipart/form-data" method="post" action="<@o...@ofbizUrl>" style="margin: 0;">
         <#if (content?has_content)>
             <input type="hidden" name="dataResourceId" value="${(dataResource.dataResourceId)?if_exists}"/>
-            <input type="hidden" name="mimeTypeId" value="${content.mimeTypeId?default(mimeTypeId)}"/>
             <input type="hidden" name="contentId" value="${content.contentId}"/>
 
             <#list requestParameters.keySet() as paramName>
@@ -176,11 +175,19 @@
             <input type="hidden" name="contentAssocTypeId" value="${contentAssocTypeId?default('SUBSITE')}"/>
             <input type="hidden" name="ownerContentId" value="${contentIdFrom?default(contentRoot)}"/>
             <input type="hidden" name="contentIdFrom" value="${contentIdFrom?default(contentRoot)}"/>
+        </#if>
+        <#if (dataResourceTypeId != 'IMAGE_OBJECT' && dataResourceTypeId != 'OTHER_OBJECT' && dataResourceTypeId != 'LOCAL_FILE' &&
+            dataResourceTypeId != 'OFBIZ_FILE' && dataResourceTypeId != 'VIDEO_OBJECT' && dataResourceTypeId != 'AUDIO_OBJECT')>
             <input type="hidden" name="mimeTypeId" value="${mimeTypeId}"/>
         </#if>
         <#if (dataResourceTypeId != 'NONE')>
+        <#if (dataResourceTypeId == 'IMAGE_OBJECT' || dataResourceTypeId == 'OTHER_OBJECT' || dataResourceTypeId == 'LOCAL_FILE' ||
+                dataResourceTypeId == 'OFBIZ_FILE' || dataResourceTypeId == 'VIDEO_OBJECT' || dataResourceTypeId == 'AUDIO_OBJECT')>
+            <input type="hidden" name="dataResourceTypeId" value="IMAGE_OBJECT"/>
+        <#else>
             <input type="hidden" name="dataResourceTypeId" value="${dataResourceTypeId}"/>
         </#if>
+        </#if>
         <input type="hidden" name="webSiteId" value="${webSiteId}"/>
         <input type="hidden" name="dataResourceName" value="${(dataResource.dataResourceName)?if_exists}"/>
 
@@ -331,10 +338,11 @@
           </tr>
 
           <#-- this all depends on the dataResourceTypeId which was selected -->
-          <#if (dataResourceTypeId == 'IMAGE_OBJECT' || dataResourceTypeId == 'OTHER_OBJECT' ||
-                dataResourceTypeId == 'VIDEO_OBJECT' || dataResourceTypeId == 'AUDIO_OBJECT')>
+          <#if (dataResourceTypeId == 'IMAGE_OBJECT' || dataResourceTypeId == 'OTHER_OBJECT' || dataResourceTypeId == 'LOCAL_FILE' ||
+                dataResourceTypeId == 'OFBIZ_FILE' || dataResourceTypeId == 'VIDEO_OBJECT' || dataResourceTypeId == 'AUDIO_OBJECT')>
             <tr>
-              <td colspan="2" align="right">
+              <td class="label"></td>
+              <td>
                 <#if ((content.contentId)?has_content)>
                     <@renderContentAsText contentId="${content.contentId}" ignoreTemplate="true"/>
                 </#if>

Modified: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl?rev=1202024&r1=1202023&r2=1202024&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl Tue Nov 15 03:20:31 2011
@@ -46,84 +46,87 @@
     }
 
 <#-- creating the JSON Data -->
+<#macro fillTreeSubsites assocList>
+      <#if (assocList?has_content)>
+        <#list assocList as assoc>
+            <#assign content = assoc.getRelatedOne("ToContent")/>
+            {
+            "data": {"title" : cutNameLength("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('', '${assoc.contentIdTo}', jQuery('#${assoc.contentIdTo}'), '');"}},
+           
+            <#assign assocChilds  = content.getRelated("FromContentAssoc")?if_exists/>
+                "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "fromDate" : "${assoc.fromDate}", "contentAssocTypeId" : "${assoc.contentAssocTypeId}"}
+            <#if assocChilds?has_content>
+                ,"children": [
+                    <@fillTreeSubsites assocList = assocChilds/>
+                ]
+            </#if>
+            <#if assoc_has_next>
+            },
+            <#else>
+            }
+            </#if>
+        </#list>
+      </#if>
+</#macro>
+<#macro fillTreeMenus assocList>
+      <#if (assocList?has_content)>
+        <#list assocList as assoc>
+            <#assign content = assoc.getRelatedOne("ToContent")/>
+            {
+            "data": {"title" : cutNameLength("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('${assoc.contentIdTo}');"}},
+            <#assign assocChilds  = content.getRelated("FromContentAssoc")?if_exists/>
+                "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "fromDate" : "${assoc.fromDate}"}
+            <#if assocChilds?has_content>
+                ,"children": [
+                    <@fillTreeMenus assocList = assocChilds/>
+                ]
+            </#if>
+            <#if assoc_has_next>
+            },
+            <#else>
+            }
+            </#if>
+        </#list>
+      </#if>
+</#macro>
+
+<#macro fillTreeError assocList>
+      <#if (assocList?has_content)>
+        <#list assocList as assoc>
+            <#assign content = assoc.getRelatedOne("ToContent")/>
+            {
+            "data": {"title" : cutNameLength("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('', '${assoc.contentIdTo}', '', '');"}},
+            <#assign assocChilds  = content.getRelated("FromContentAssoc")?if_exists/>
+                "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "fromDate" : "${assoc.fromDate}"}
+            <#if assocChilds?has_content>
+                ,"children": [
+                    <@fillTreeError assocList = assocChilds/>
+                ]
+            </#if>
+            <#if assoc_has_next>
+            },
+            <#else>
+            }
+            </#if>
+        </#list>
+      </#if>
+</#macro>
+
 var rawdata_subsites = [
     <#if (subsites?has_content)>
-        <@fillTree assocList = subsites/>
-        <#macro fillTree assocList>
-              <#if (assocList?has_content)>
-                <#list assocList as assoc>
-                    <#assign content = assoc.getRelatedOne("ToContent")/>
-                    {
-                    "data": {"title" : cutNameLength("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('', '${assoc.contentIdTo}', '', '');"}},
-                    <#assign assocChilds  = content.getRelated("FromContentAssoc")?if_exists/>
-                        "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "fromDate" : "${assoc.fromDate}"}
-                    <#if assocChilds?has_content>
-                        ,"children": [
-                            <@fillTree assocList = assocChilds/>
-                        ]
-                    </#if>
-                    <#if assoc_has_next>
-                    },
-                    <#else>
-                    }
-                    </#if>
-                </#list>
-              </#if>
-        </#macro>
+        <@fillTreeSubsites assocList = subsites/>
     </#if>
 ];
 
 var rawdata_menus = [
     <#if (menus?has_content)>
-        <@fillTree assocList = menus/>
-        <#macro fillTree assocList>
-              <#if (assocList?has_content)>
-                <#list assocList as assoc>
-                    <#assign content = assoc.getRelatedOne("ToContent")/>
-                    {
-                    "data": {"title" : cutNameLength("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('${assoc.contentIdTo}');"}},
-                    <#assign assocChilds  = content.getRelated("FromContentAssoc")?if_exists/>
-                        "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "fromDate" : "${assoc.fromDate}"}
-                    <#if assocChilds?has_content>
-                        ,"children": [
-                            <@fillTree assocList = assocChilds/>
-                        ]
-                    </#if>
-                    <#if assoc_has_next>
-                    },
-                    <#else>
-                    }
-                    </#if>
-                </#list>
-              </#if>
-        </#macro>
+        <@fillTreeMenus assocList = menus/>
     </#if>
 ];
 
 var rawdata_errors = [
     <#if (errors?has_content)>
-        <@fillTree assocList = errors/>
-        <#macro fillTree assocList>
-              <#if (assocList?has_content)>
-                <#list assocList as assoc>
-                    <#assign content = assoc.getRelatedOne("ToContent")/>
-                    {
-                    "data": {"title" : cutNameLength("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('', '${assoc.contentIdTo}', '', '');"}},
-                    <#assign assocChilds  = content.getRelated("FromContentAssoc")?if_exists/>
-                        "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "fromDate" : "${assoc.fromDate}"}
-                    <#if assocChilds?has_content>
-                        ,"children": [
-                            <@fillTree assocList = assocChilds/>
-                        ]
-                    </#if>
-                    <#if assoc_has_next>
-                    },
-                    <#else>
-                    }
-                    </#if>
-                </#list>
-              </#if>
-        </#macro>
+        <@fillTreeError assocList = errors/>
     </#if>
 ];
 
@@ -343,6 +346,11 @@ var rawdata_errors = [
             if (contentId != null && contentId.length) {
                 ctx['contentId'] = contentId;
             }
+            if (objstr) {
+                ctx['contentIdFrom'] = objstr.attr('contentid');
+                ctx['fromDate'] = objstr.attr('fromdate');
+                ctx['contentAssocTypeId'] = objstr.attr('contentassoctypeid');
+            }
         }
 
         //jQuerry Ajax Request

Modified: ofbiz/trunk/applications/content/widget/WebSiteScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/WebSiteScreens.xml?rev=1202024&r1=1202023&r2=1202024&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/WebSiteScreens.xml (original)
+++ ofbiz/trunk/applications/content/widget/WebSiteScreens.xml Tue Nov 15 03:20:31 2011
@@ -219,12 +219,16 @@ under the License.
                 </entity-one>
                 
                 <set field="parameters.fromDate" type="Timestamp" from-field="parameters.fromDate"/>
-                <entity-one entity-name="ContentAssoc" value-field="assoc">
-                    <field-map field-name="contentId" from-field="parameters.contentIdFrom"/>
-                    <field-map field-name="contentIdTo" from-field="parameters.contentId"/>
-                    <field-map field-name="contentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
-                    <field-map field-name="fromDate" from-field="parameters.fromDate"/>
-                </entity-one>
+                <entity-condition list="assocs" entity-name="ContentAssoc">
+                    <condition-list>
+                        <condition-expr field-name="contentId" from-field="parameters.contentIdFrom"/>
+                        <condition-expr field-name="contentIdTo" from-field="parameters.contentId"/>
+                        <condition-expr field-name="fromDate" from-field="parameters.fromDate" ignore-if-empty="true"/>
+                        <condition-expr field-name="contentAssocTypeId" from-field="parameters.contentAssocTypeId" ignore-if-empty="true"/>
+                    </condition-list>
+                    <order-by field-name="-fromDate"/>
+                </entity-condition>
+                <set field="assoc" value="${assocs[0]}"/>
                 <entity-and entity-name="ContentPurpose" list="currentPurposes">
                     <field-map field-name="contentId" from-field="contentId"/>
                 </entity-and>