ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r512581 - in /ofbiz/trunk/applications/content: webapp/content/WEB-INF/ webapp/content/WEB-INF/actions/website/ webapp/content/website/ widget/
Date Wed, 28 Feb 2007 02:52:08 GMT
Author: jaz
Date: Tue Feb 27 18:52:07 2007
New Revision: 512581

URL: http://svn.apache.org/viewvc?view=rev&rev=512581
Log:
added meta-data for content "pages" (quick entry, creates sub-content records); added new
data types to CMS, Image, Object, Video, etc

Added:
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh
  (with props)
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl   (with props)
Removed:
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSEditor.ftl
Modified:
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml
    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

Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh?view=auto&rev=512581
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh
(added)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh
Tue Feb 27 18:52:07 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.base.util.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.entity.util.*;
+
+if (content != null) {
+    // lookup assoc content
+    titles = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, "mapKey",
"title"), UtilMisc.toList("-fromDate"));
+    titles = EntityUtil.filterByDate(titles);
+    title = EntityUtil.getFirst(titles);
+    if (title != null) {
+        tc = title.getRelatedOne("ToContent");
+        tcdr = tc.getRelatedOne("DataResource");
+        context.put("title", tcdr);
+    }
+
+    titleProps = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId,
"mapKey", "titleProperty"), UtilMisc.toList("-fromDate"));
+    titleProps = EntityUtil.filterByDate(titleProps);
+    titleProp = EntityUtil.getFirst(titleProps);
+    if (titleProp != null) {
+        tpc = titleProp.getRelatedOne("ToContent");
+        tpcdr = tpc.getRelatedOne("DataResource");
+        context.put("titleProperty", tpcdr);
+    }
+
+    metaDescs = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId,
"mapKey", "metaDescription"), UtilMisc.toList("-fromDate"));
+    metaDescs = EntityUtil.filterByDate(metaDescs);
+    metaDesc = EntityUtil.getFirst(metaDescs);
+    if (metaDesc != null) {
+        mdc = metaDesc.getRelatedOne("ToContent");
+        mdcdr = mdc.getRelatedOne("DataResource");
+        context.put("metaDescription", mdcdr);
+    }
+
+    metaKeys = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId,
"mapKey", "metaKeywords"), UtilMisc.toList("-fromDate"));
+    metaKeys = EntityUtil.filterByDate(metaKeys);
+    metaKey = EntityUtil.getFirst(metaKeys);
+    if (metaKey != null) {
+        mkc = metaKey.getRelatedOne("ToContent");
+        mkcdr = mkc.getRelatedOne("DataResource");
+        context.put("metaKeywords", mkcdr);
+    }
+}
\ No newline at end of file

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh
------------------------------------------------------------------------------
    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?view=diff&rev=512581&r1=512580&r2=512581
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml Tue Feb 27 18:52:07
2007
@@ -286,15 +286,45 @@
     <request-map uri="updateTextContentCms">
         <security https="true" auth="true"/>
         <event type="service" invoke="updateTextContent"/>
-        <response name="success" type="request-redirect" value="WebSiteCms"/>
+        <response name="success" type="view" value="WebSiteCMS"/>
+        <response name="error" type="view" value="WebSiteCMS"/>
+    </request-map>
+    <request-map uri="createObjectContentCms">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createContentFromUploadedFile"/>
+        <response name="success" type="view" value="WebSiteCMS"/>
         <response name="error" type="view" value="WebSiteCMS"/>
     </request-map>
-    <request-map uri="updateTextContentCms">
+    <request-map uri="updateObjectContentCms">
         <security https="true" auth="true"/>
-        <event type="service" invoke="updateTextContent"/>
+        <event type="service" invoke="updateContentAndUploadedFile"/>
         <response name="success" type="view" value="WebSiteCMS"/>
         <response name="error" type="view" value="WebSiteCMS"/>
     </request-map>
+    <request-map uri="createContentCms">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createContent"/>
+        <response name="success" type="view" value="WebSiteCMS"/>
+        <response name="error" type="view" value="WebSiteCMS"/>
+    </request-map>
+    <request-map uri="updateContentCms">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateContent"/>
+        <response name="success" type="view" value="WebSiteCMS"/>
+        <response name="error" type="view" value="WebSiteCMS"/>
+    </request-map>
+    <request-map uri="createWebSiteMetaInfoJson">
+        <security https="true" auth="true"/>
+        <event type="json" invoke="createTextContent"/>
+        <response name="success" type="none"/>
+        <response name="error" type="none"/>
+    </request-map>
+    <request-map uri="updateWebSiteMetaInfoJson">
+        <security https="true" auth="true"/>
+        <event type="json" invoke="updateDataResource"/>
+        <response name="success" type="none"/>
+        <response name="error" type="none"/>
+    </request-map>
     <request-map uri="createWebSitePathAliasJson">
         <security https="true" auth="true"/>
         <event type="json" invoke="createWebSitePathAlias"/>
@@ -1633,6 +1663,7 @@
     <view-map name="WebSiteCMS" page="component://content/widget/WebSiteScreens.xml#WebSiteCMS"
type="screen"/>
     <view-map name="WebSiteCMSContent" page="component://content/widget/WebSiteScreens.xml#WebSiteCMSContent"
type="screen"/>
     <view-map name="WebSiteCMSEditor" page="component://content/widget/WebSiteScreens.xml#WebSiteCMSEditor"
type="screen"/>
+    <view-map name="WebSiteCMSMetaInfo" page="component://content/widget/WebSiteScreens.xml#WebSiteCMSMetaInfo"
type="screen"/>
     <view-map name="WebSiteCMSPathAlias" page="component://content/widget/WebSiteScreens.xml#WebSiteCMSPathAlias"
type="screen"/>
     <view-map name="WebSiteCMSNav" page="component://content/widget/WebSiteScreens.xml#WebSiteCMSNav"
type="screen"/>
     <view-map name="EditWebSiteParties" page="component://content/widget/WebSiteScreens.xml#EditWebSiteParties"
type="screen"/>

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?view=diff&rev=512581&r1=512580&r2=512581
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl Tue Feb
27 18:52:07 2007
@@ -17,131 +17,258 @@
   under the License.
   -->
 
-<#if (!contentRoot?has_content)>
-    <#assign contentRoot = parameters.contentRoot/>
-</#if>
-<#assign formAction = "/createTextContentCms"/>
-<#if (content?has_content)>
-    <#assign formAction = "/updateTextContentCms"/>
-</#if>
+<script type="text/javascript">
+    function cmsSave() {
+        var editor = dojo.widget.byId("w_editor");
+        if (editor) {
+            var cmsdata = dojo.byId("cmsdata");
+            cmsdata.value = editor.getEditorContent();
+        }
+
+        // get the cmsform
+        var form = document.cmsform;
+
+        // set the data resource name
+        form.dataResourceName.value = form.contentName.value;
+
+        // submit the form
+        if (form != null) {
+            form.submit();
+        } else {
+            alert("Cannot find the cmsform!");
+        }
+
+        return false;
+    }
+
+    function selectDataType(contentId) {
+        var selectObject = document.forms['cmsdatatype'].elements['dataResourceTypeId'];
+        var typeValue = selectObject.options[selectObject.selectedIndex].value;
+        callEditor(true, contentId, '', typeValue);
+    }
+</script>
 
-<!-- cms menu bar -->
+<#-- cms menu bar -->
 <div id="cmsmenu" style="margin-bottom: 8px;">
     <#if (content?has_content)>        
-        <a href="javascript:void(0);" onclick="javascript:callEditor(true, '${content.contentId}');"
class="tabButton">New Content</a>
+        <a href="javascript:void(0);" onclick="javascript:callEditor(true, '${content.contentId}',
'', 'ELECTRONIC_TEXT');" class="tabButton">Quick Sub-Content</a>
         <a href="javascript:void(0);" onclick="javascript:callPathAlias('${content.contentId}');"
class="tabButton">New PathAlias</a>
+        <a href="javascript:void(0);" onclick="javascript:callMetaInfo('${content.contentId}');"
class="tabButton">Meta Data</a>
     </#if>
 </div>
 
+<#-- content info -->
 <#if (!content?has_content)>
     <div class="tabletext" style="margin-bottom: 8px;">
         New <b>${contentAssocTypeId?default("SUBSITE")}</b> attached to Content:
${contentIdFrom?default(contentRoot)}</b>
     </div>
 </#if>
 
-<form name="cmsform" method="post" action="<@ofbizUrl>${formAction}</@ofbizUrl>"
style="margin: 0;">
+<#-- dataResourceTypeId -->
+<#if (!dataResourceTypeId?has_content)>
+    <#if (dataResource?has_content)>
+        <#assign dataResourceTypeId = dataResource.dataResourceTypeId/>
+    <#elseif (content?has_content)>
+        <#assign dataResourceTypeId = "NONE"/>
+    <#else>       
+        <form name="cmsdatatype">
+            <table>
+                <tr>
+                    <td><div class="tableheadtext">Data Type</div></td>
+                    <td>            
+                        <select class="inputBox" name="dataResourceTypeId">
+                            <option value="NONE">None (Tree, Category, etc)</option>
+                            <option value="SHORT_TEXT">Short Text (255 chars.)</option>
+                            <option value="ELECTRONIC_TEXT">Long Text</option>
+                            <option value="IMAGE_OBJECT">Image</option>
+                            <option value="VIDEO_OBJECT">Video</option>
+                            <option value="AUDIO_OBJECT">Audio</option>
+                            <option value="OTHER_OBJECT">Other</option>
+                        </select>
+                    </td>
+                </tr>
+                <tr>
+                    <td align="center" colspan="2">
+                        <a href="javascript:void(0);" onclick="javascript:selectDataType('${contentIdFrom?default(contentRoot)}');"
class="buttontext">Continue</a>
+                    </td>
+                </tr>
+                <#list 0..15 as x>
+                    <tr><td colspan="2">&nbsp;</td></tr>
+                </#list>
+            </table>           
+        </form>        
+    </#if>    
+</#if>
+
+<#-- form action -->
+<#if (dataResourceTypeId?has_content)>
+    <#assign actionSuffix = "ContentCms"/>
+    <#if (dataResourceTypeId == "NONE" || (content?has_content && !content.dataResourceId?has_content))>
+        <#assign actionMiddle = ""/>
+    <#else>
+        <#if (dataResourceTypeId?ends_with("_OBJECT"))>
+            <#assign actionMiddle = "Object"/>
+        <#else>
+            <#assign actionMiddle = "Text"/>
+        </#if>
+    </#if>
+
+    <#if (!contentRoot?has_content)>
+        <#assign contentRoot = parameters.contentRoot/>
+    </#if>
     <#if (content?has_content)>
-        <input type="hidden" name="dataResourceId" value="${(dataText.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>
-            <#if (paramName == 'contentIdFrom' || paramName == 'contentAssocTypeId' ||
paramName == 'fromDate')>
-                <input type="hidden" name="${paramName}" value="${requestParameters.get(paramName)}"/>
-            </#if>
-        </#list>
+        <#assign actionPrefix = "/update"/>
     <#else>
-        <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)}"/>
-        <input type="hidden" name="mimeTypeId" value="${mimeTypeId}"/>
+        <#assign actionPrefix = "/create"/>
     </#if>
-    <input type="hidden" name="webSiteId" value="${webSiteId}"/>
-    <input type="hidden" name="dataResourceName" value=""/>
-              
-    <table>
-      <#if (content?has_content)>
-        <tr>
-            <td><div class="tableheadtext">Content ID</div></td>
-            <td><div class="tabletext">${content.contentId}</div></td>
-        </tr>
-      </#if>
-      <tr>
-        <td><div class="tableheadtext">Name</div></td>
-        <td>
-            <input type="text" name="contentName" class="inputBox" value="${(content.contentName)?if_exists}"
size="40"/>
-        </td>
-      </tr>
-      <tr>
-        <td><div class="tableheadtext">Description</div></td>
-        <td>
-            <textarea name="description" class="inputBox" cols="40" rows="6">${(content.description)?if_exists}</textarea>
-        </td>
-      </tr>
-      <tr>
-        <td><div class="tableheadtext">Key</div></td>
-        <td>
-            <input type="text" name="mapKey" class="inputBox" value="${(assoc.mapKey)?if_exists}"
size="40"/>
-        </td>
-      </tr>
-      <tr>
-        <td><div class="tableheadtext">Data Type</div></td>
-        <td>
-            <select name="dataTemplateTypeId" class="selectBox">
-                <#if (dataResource?has_content)>
-                    <#if (dataResource.dataTemplateTypeId?has_content)>
-                        <#assign thisType = dataResource.getRelatedOne("DataTemplateType")?if_exists/>
-                        <option value="${thisType.dataTemplateTypeId}">${thisType.description}</option>
-                        <option value="${thisType.dataTemplateTypeId}">----</option>
-                    </#if>
+    <#assign formAction = actionPrefix + actionMiddle + actionSuffix/>
+<#else>
+    <#assign formAction = "javascript:void(0);"/>
+</#if>
+
+<#-- main content form -->
+<#if (dataResourceTypeId?has_content)>
+    <form name="cmsform" enctype="multipart/form-data" method="post" action="<@ofbizUrl>${formAction}</@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>
+                <#if (paramName == 'contentIdFrom' || paramName == 'contentAssocTypeId'
|| paramName == 'fromDate')>
+                    <input type="hidden" name="${paramName}" value="${requestParameters.get(paramName)}"/>
                 </#if>
-                <#list templateTypes as type>
-                    <option value="${type.dataTemplateTypeId}">${type.description}</option>
-                </#list>
-            </select>
-        </td>
-      </tr>
-      <tr>
-        <td><div class="tableheadtext">Template</div></td>
-        <td>
-            <select name="templateDataResourceId" class="selectBox">
-                <#if (content?has_content)>
-                    <#if (content.templateDataResourceId?has_content && content.templateDataResourceId
!= "NONE")>
-                        <#assign template = content.getRelatedOne("TemplateDataResource")/>
-                        <option value="${template.dataResourceId}">${template.dataResourceName}</option>
-                        <option value="${template.dataResourceId}">----</option>
+            </#list>
+        <#else>
+            <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)}"/>
+            <input type="hidden" name="mimeTypeId" value="${mimeTypeId}"/>
+        </#if>
+        <#if (dataResourceTypeId != 'NONE')>                  
+            <input type="hidden" name="dataResourceTypeId" value="${dataResourceTypeId}"/>
+        </#if>
+        <input type="hidden" name="webSiteId" value="${webSiteId}"/>
+        <input type="hidden" name="dataResourceName" value="${(dataResource.dataResourceName)?if_exists}"/>
+
+        <table>
+          <#if (content?has_content)>
+            <tr>
+                <td><div class="tableheadtext">Content ID</div></td>
+                <td><div class="tabletext">${content.contentId}</div></td>
+            </tr>
+          </#if>
+          <tr>
+            <td><div class="tableheadtext">Name</div></td>
+            <td>
+                <input type="text" name="contentName" class="inputBox" value="${(content.contentName)?if_exists}"
size="40"/>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="tableheadtext">Description</div></td>
+            <td>
+                <textarea name="description" class="inputBox" cols="40" rows="6">${(content.description)?if_exists}</textarea>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="tableheadtext">Key</div></td>
+            <td>
+                <input type="text" name="mapKey" class="inputBox" value="${(assoc.mapKey)?if_exists}"
size="40"/>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="tableheadtext">Data Type</div></td>
+            <td>
+                <select name="dataTemplateTypeId" class="selectBox">
+                    <#if (dataResource?has_content)>
+                        <#if (dataResource.dataTemplateTypeId?has_content)>
+                            <#assign thisType = dataResource.getRelatedOne("DataTemplateType")?if_exists/>
+                            <option value="${thisType.dataTemplateTypeId}">${thisType.description}</option>
+                            <option value="${thisType.dataTemplateTypeId}">----</option>
+                        </#if>
                     </#if>
-                </#if>
-                <option value="">None</option>
-                <#list templates as template>
-                    <option value="${template.dataResourceId}">${template.dataResourceName}</option>
                 
-                </#list>
-            </select>
-        </td>
-      </tr>
-      <tr>
-        <td><div class="tableheadtext">Status</div></td>
-        <td>
-            <select name="statusId" class="selectBox">
-                <#if (content?has_content)>
-                    <#if (content.statusId?has_content)>
-                        <#assign statusItem = content.getRelatedOne("StatusItem")/>
-                        <option value="${statusItem.statusId}">${statusItem.description}</option>
-                        <option value="${statusItem.statusId}">----</option>
+                    <#list templateTypes as type>
+                        <option value="${type.dataTemplateTypeId}">${type.description}</option>
+                    </#list>
+                </select>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="tableheadtext">Template</div></td>
+            <td>
+                <select name="templateDataResourceId" class="selectBox">
+                    <#if (content?has_content)>
+                        <#if (content.templateDataResourceId?has_content && content.templateDataResourceId
!= "NONE")>
+                            <#assign template = content.getRelatedOne("TemplateDataResource")/>
+                            <option value="${template.dataResourceId}">${template.dataResourceName}</option>
+                            <option value="${template.dataResourceId}">----</option>
+                        </#if>
+                    </#if>
+                    <option value="">None</option>
+                    <#list templates as template>
+                        <option value="${template.dataResourceId}">${template.dataResourceName}</option>
+                    </#list>
+                </select>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="tableheadtext">Status</div></td>
+            <td>
+                <select name="statusId" class="selectBox">
+                    <#if (content?has_content)>
+                        <#if (content.statusId?has_content)>
+                            <#assign statusItem = content.getRelatedOne("StatusItem")/>
+                            <option value="${statusItem.statusId}">${statusItem.description}</option>
+                            <option value="${statusItem.statusId}">----</option>
+                        </#if>
                     </#if>
+                    <#list statuses as status>
+                        <option value="${status.statusId}">${status.description}</option>
+                    </#list>
+                </select>
+            </td>
+          </tr>
+          <tr>
+            <td colspan="2">
+              <textarea id="cmsdata" name="textData" class="inputBox" cols="40" rows="6"
style="display: none;">
+                <#if (dataText?has_content)>
+                    ${dataText.textData}
                 </#if>
-                <#list statuses as status>
-                    <option value="${status.statusId}">${status.description}</option>
-                </#list>
-            </select>
-        </td>
-      </tr>
-      <tr>
-        <td colspan="2">
-          <textarea id="cmsdata" name="textData" class="inputBox" cols="40" rows="6" style="display:
none;">
-            <#if (dataText?has_content)>
-                ${dataText.textData}
-            </#if>
-          </textarea>
-    </table>
-</form>
\ No newline at end of file
+              </textarea>
+            </td>
+          </tr>
+
+          <#-- this all depends on the dataResourceTypeId which was selected -->
+          <#if (dataResourceTypeId == 'IMAGE_OBJECT' || dataResourceTypeId == 'OTHER_OBJECT'
||
+                dataResourceTypeId == 'VIDEO_OBJECT' || dataResourceTypeId == 'AUDIO_OBJECT')>
+            <tr>
+              <td><div class="tableheadtext">Upload</div></td>
+              <td>
+                <input type="file" name="uploadedFile" class="inputBox" size="30"/>
+              </td>
+            </tr>
+          <#elseif (dataResourceTypeId == 'SHORT_TEXT')>
+            <tr>
+              <td><div class="tableheadtext">Text</div></td>
+              <td>
+                <input type="text" name="objectInfo" class="inputBox" size="40" maxsize="255"
value="${(dataResource.objectInfo)?if_exists}"/>
+              </td>
+            </tr>
+          <#elseif (dataResourceTypeId == 'ELECTRONIC_TEXT')>
+            <tr>
+              <td colspan="2">
+                <div id="editorcontainer" class="nocolumns">
+                    <div id="cmseditor" style="margin: 0; width: 100%; border: 1px solid
black;"></div>
+                </div>
+              </td>
+            </tr>
+          </#if>
+
+          <tr>
+            <td align="center" colspan="2">
+                <a href="javascript:void(0);" onclick="javascript:cmsSave();" class="buttontext">Save</a>
+            </td>
+          </tr>
+        </table>
+    </form>
+</#if>
\ No newline at end of file

Added: ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl?view=auto&rev=512581
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl (added)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSMeta.ftl Tue Feb 27
18:52:07 2007
@@ -0,0 +1,120 @@
+<#--
+  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.
+  -->
+
+<#macro cmsNewMetaRec>
+    <input type="hidden" name="contentTypeId" value="DOCUMENT"/>
+    <input type="hidden" name="dataResourceTypeId" value="SHORT_TEXT"/>
+    <input type="hidden" name="contentAssocTypeId" value="SUB_CONTENT"/>
+    <input type="hidden" name="statusId" value="CTNT_PUBLISHED"/>
+    <input type="hidden" name="ownerContentId" value="${(content.contentId)?if_exists}"/>
+    <input type="hidden" name="contentIdFrom" value="${(content.contentId)?if_exists}"/>
+</#macro>
+
+<#if (content?has_content)>
+    <div class="tabletext" style="margin-bottom: 8px;">
+        Set <b>Meta-Data</b> for Content: <b>${content.contentId}</b></b>
+    </div>
+</#if>
+
+<#if (title?has_content)>
+    <#assign titleAction = "/updateWebSiteMetaInfoJson"/>
+<#else>
+    <#assign titleAction = "/createWebSiteMetaInfoJson"/>
+</#if>
+<#if (titleProperty?has_content)>
+    <#assign titlePropertyAction = "/updateWebSiteMetaInfoJson"/>
+<#else>
+    <#assign titlePropertyAction = "/createWebSiteMetaInfoJson"/>
+</#if>
+<#if (metaDescription?has_content)>
+    <#assign metaDescriptionAction = "/updateWebSiteMetaInfoJson"/>
+<#else>
+    <#assign metaDescriptionAction = "/createWebSiteMetaInfoJson"/>
+</#if>
+<#if (metaKeywords?has_content)>
+    <#assign metaKeywordsAction = "/updateWebSiteMetaInfoJson"/>
+<#else>
+    <#assign metaKeywordsAction = "/createWebSiteMetaInfoJson"/>
+</#if>
+
+<form name="cmsmeta_title" action="<@ofbizUrl>/${titleAction}</@ofbizUrl>"
style="margin: 0;">
+    <#if (title?has_content)>
+        <input type="hidden" name="dataResourceId" value="${title.dataResourceId}"/>
+    <#else>
+        <input type="hidden" name="contentName" value="Meta-Title: ${contentId}"/>
+        <input type="hidden" name="mapKey" value="title"/>
+        <@cmsNewMetaRec/>
+    </#if>
+    <input type="hidden" name="objectInfo" value=""/>
+</form>
+<form name="cmsmeta_titleProperty" action="<@ofbizUrl>/${titlePropertyAction}</@ofbizUrl>"
style="margin: 0;">
+    <#if (titleProperty?has_content)>
+        <input type="hidden" name="dataResourceId" value="${titleProperty.dataResourceId}"/>
+    <#else>
+        <input type="hidden" name="contentName" value="Meta-TitleProperty: ${contentId}"/>
+        <input type="hidden" name="mapKey" value="titleProperty"/>
+        <@cmsNewMetaRec/>
+    </#if>
+    <input type="hidden" name="objectInfo" value=""/>
+</form>
+<form name="cmsmeta_metaDescription" action="<@ofbizUrl>/${metaDescriptionAction}</@ofbizUrl>"
style="margin: 0;">
+    <#if (metaDescription?has_content)>
+        <input type="hidden" name="dataResourceId" value="${metaDescription.dataResourceId}"/>
+    <#else>
+        <input type="hidden" name="contentName" value="Meta-Description: ${contentId}"/>
+        <input type="hidden" name="mapKey" value="metaDescription"/>
+        <@cmsNewMetaRec/>
+    </#if>
+    <input type="hidden" name="objectInfo" value=""/>
+</form>
+<form name="cmsmeta_metaKeywords" action="<@ofbizUrl>/${metaKeywordsAction}</@ofbizUrl>"
style="margin: 0;">
+    <#if (metaKeywords?has_content)>
+        <input type="hidden" name="dataResourceId" value="${metaKeywords.dataResourceId}"/>
+    <#else>
+        <input type="hidden" name="contentName" value="Meta-Keywords: ${contentId}"/>
+        <input type="hidden" name="mapKey" value="metaKeywords"/>
+        <@cmsNewMetaRec/>
+    </#if>
+    <input type="hidden" name="objectInfo" value=""/>
+</form>
+
+<form name="cmsmetaform" action="javascript:void(0);" style="margin: 0;">
+    <table>        
+        <tr>
+            <td><div class="tableheadtext">Page Title</div></td>
+            <td><input type="text" class="inputBox" name="title" value="${(title.objectInfo)?if_exists}"
size="40"></td>
+        </tr>
+        <tr>
+            <td><div class="tableheadtext">Title Property</div></td>
+            <td><input type="text" class="inputBox" name="titleProperty" value="${(titleProperty.objectInfo)?if_exists}"
size="40"></td>
+        </tr>
+        <tr>
+            <td><div class="tableheadtext">Meta-Description</div></td>
+            <td><input type="text" class="inputBox" name="metaDescription" value="${(metaDescription.objectInfo)?if_exists}"
size="40"></td>
+        </tr>
+        <tr>
+            <td><div class="tableheadtext">Meta-Keywords</div></td>
+            <td><input type="text" class="inputBox" name="metaKeywords" value="${(metaKeywords.objectInfo)?if_exists}"
size="40"></td>
+        </tr>
+        <tr><td colspan="2">&nbsp;</td></tr>        
+        <tr>
+            <td colspan="2" align="center"><input id="submit" type="button" onclick="javascript:saveMetaInfo(cmsmetaform);"
class="smallSubmit" value="Save"/></td>
+        </tr>
+    </table>
+</form>

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

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

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

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?view=diff&rev=512581&r1=512580&r2=512581
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl Tue Feb 27 18:52:07
2007
@@ -31,6 +31,7 @@
 	var webSiteId = '${webSiteId?if_exists}';        
     var editorUrl = '<@ofbizUrl>/views/WebSiteCMSContent</@ofbizUrl>';
     var aliasUrl = '<@ofbizUrl>/views/WebSiteCMSPathAlias</@ofbizUrl>';
+    var metaUrl = '<@ofbizUrl>/views/WebSiteCMSMetaInfo</@ofbizUrl>';
         
     dojo.addOnLoad(function() {
 		dojo.event.topic.subscribe("webCmsNodeSelected",
@@ -39,9 +40,49 @@
                 callEditor(false, message.node.widgetId, message.node.object);
 			 }
 		);
+		dojo.event.topic.subscribe("newLong/engage",
+            function (menuItem) {
+                var node = menuItem.getTreeNode();
+                callEditor(true, node.widgetId, '', 'ELECTRONIC_TEXT');
+            }
+        );
+        dojo.event.topic.subscribe("newShort/engage",
+            function (menuItem) {
+                var node = menuItem.getTreeNode();
+                callEditor(true, node.widgetId, '', 'SHORT_TEXT');
+            }
+        );
+        dojo.event.topic.subscribe("newImage/engage",
+            function (menuItem) {
+                var node = menuItem.getTreeNode();
+                callEditor(true, node.widgetId, '', 'IMAGE_OBJECT');
+            }
+        );
+        dojo.event.topic.subscribe("newVideo/engage",
+            function (menuItem) {
+                var node = menuItem.getTreeNode();
+                callEditor(true, node.widgetId, '', 'VIDEO_OBJECT');
+            }
+        );
+        dojo.event.topic.subscribe("newAudio/engage",
+            function (menuItem) {
+                var node = menuItem.getTreeNode();
+                callEditor(true, node.widgetId, '', 'AUDIO_OBJECT');
+            }
+        );
+        dojo.event.topic.subscribe("newObject/engage",
+            function (menuItem) {
+                var node = menuItem.getTreeNode();
+                callEditor(true, node.widgetId, '', 'OTHER_OBJECT');
+            }
+        );
 
 		var cmsdata = dojo.byId("cmsdata");
-		createEditor(cmsdata.value);		
+		if (cmsdata) {
+		    createEditor(cmsdata.value);
+		} else {
+		    createEditor();
+        }
         //alert("On load called!");
 	});
 
@@ -57,13 +98,51 @@
         // get the editor tag
         var editorNode = dojo.byId("cmseditor");        
 
-        if (text) {
-            editorNode.innerHTML = text;
+        if (editorNode) {
+            if (text) {
+                editorNode.innerHTML = text;
+            }
+
+            // create the widget
+            dojo.widget.createWidget("Editor2", { id: 'w_editor', minHeight: '300px',
+                    htmlEditing: true }, editorNode);
         }
+    }
+
+    function callMetaInfo(contentId) {
+        var ctx = new Array();
+        ctx['contentId'] = contentId;
+        ctx['webSiteId'] = webSiteId;
 
-        // create the widget
-        dojo.widget.createWidget("Editor2", { id: 'w_editor', minHeight: '300px',
-                htmlEditing: true }, editorNode);
+        // deselect the tree
+        var tree = dojo.widget.byId("webCmsTreeSelector");
+        if (tree && treeSelected) {
+            tree.deselect();
+            treeSelected = false;
+        }
+
+        // destroy the editor
+        var editor = dojo.widget.byId("w_editor");
+        if (editor) {
+            editor.destroy(true);
+        }
+        //dojo.html.hide("editorcontainer");
+
+        // get the meta-info screen
+        var bindArgs = {
+            url: metaUrl,
+            method: 'POST',
+            mimetype: 'text/html',
+            content: ctx,
+            error: function(type, data, evt) {
+                alert("An error occured loading content! : " + data);
+            },
+            load: function(type, data, evt) {
+                var innerPage = dojo.byId('cmscontent');
+                innerPage.innerHTML = data;                
+            }
+        };
+        dojo.io.bind(bindArgs);
     }
 
     function callPathAlias(contentId) {
@@ -83,7 +162,7 @@
         if (editor) {
             editor.destroy(true);
         }
-        dojo.html.hide("editorcontainer");
+        //dojo.html.hide("editorcontainer");
 
         // get the alias screen
         var bindArgs = {
@@ -102,7 +181,7 @@
         dojo.io.bind(bindArgs);
     }
 
-	function callEditor(sub, contentId, objstr) {
+	function callEditor(sub, contentId, objstr, dataResourceTypeId) {
 	    var ctx = new Array();
 	    if (objstr != null && objstr.length > 0) {
 	        var obj = objstr.split("|");
@@ -115,12 +194,19 @@
         ctx['webSiteId'] = webSiteId;
 
         if (sub && contentId) {
+            if (dataResourceTypeId) {
+                ctx['dataResourceTypeId'] = dataResourceTypeId;
+            }
+
             ctx['contentIdFrom'] = contentId;
             ctx['contentAssocTypeId'] = 'SUB_CONTENT';
 
             // deselect the tree
             var tree = dojo.widget.byId("webCmsTreeSelector");
-            tree.deselect();
+            if (tree && treeSelected) {
+                tree.deselect();
+                treeSelected = false;
+            }
         } else {
             if (contentId != null && contentId.length > 0) {
                 ctx['contentId'] = contentId;
@@ -133,7 +219,7 @@
                 }
             }
         }
-
+                
         var bindArgs = {
             url: editorUrl,
             method: 'POST',
@@ -150,12 +236,34 @@
                 var cmsdata = dojo.byId("cmsdata");
 
                 // create the editor
-                createEditor(cmsdata.value);                                
+                if (cmsdata) {
+                    createEditor(cmsdata.value);
+                } else {
+                    createEditor();
+                }
             }
         };
         dojo.io.bind(bindArgs);        
     }
 
+    function saveMetaInfo(form) {
+        // save title
+        document.cmsmeta_title.objectInfo.value = form.title.value;
+        ajaxSubmitForm(document.cmsmeta_title);
+
+        // save title property
+        document.cmsmeta_titleProperty.objectInfo.value = form.titleProperty.value;
+        ajaxSubmitForm(document.cmsmeta_titleProperty);
+
+        // save meta-description
+        document.cmsmeta_metaDescription.objectInfo.value = form.metaDescription.value;
+        ajaxSubmitForm(document.cmsmeta_metaDescription);
+
+        // save meta-keywords
+        document.cmsmeta_metaKeywords.objectInfo.value = form.metaKeywords.value;
+        ajaxSubmitForm(document.cmsmeta_metaKeywords);
+    }
+
     function pathSave(contentId) {
         //dojo.html.hide("submit");
         
@@ -199,9 +307,34 @@
             }
         };
         dojo.io.bind(bindArgs);
-    }    
+    }
+
+    function ajaxSubmitForm(form) {
+        if (form != null) {
+            var url = form.action;
+            var bindArgs = {
+                url: url,
+                method: "POST",
+                mimetype: "text/json",
+                formNode: form,
+                error: function(type, data, evt) {
+                    alert("An error occurred submitting form.");
+                },
+                load: function(type, data, evt) {                    
+                }
+            };
+            dojo.io.bind(bindArgs);
+        }
+    }
 </script>
 
+<style>
+.dojoContextMenu {
+	background-color: #ccc;
+	font-size: 10px;
+}
+</style>
+
 <#-- looping macro -->
 <#macro fillTree assocList>
   <#if (assocList?has_content)>
@@ -218,12 +351,26 @@
   </#if>
 </#macro>
 
+<dl dojoType="TreeContextMenu" id="webCmsContextMenu" style="font-size: 1em; color: #ccc;">
+    <dt dojoType="TreeMenuItem" id="newLong" caption="New Long Text"/>
+    <dt dojoType="TreeMenuItem" id="newShort" caption="New Short Text"/>
+    <dt dojoType="TreeMenuItem" id="newImage" caption="New Image"/>
+    <dt dojoType="TreeMenuItem" id="newVideo" caption="New Video"/>
+    <dt dojoType="TreeMenuItem" id="newAudio" caption="New Audio"/>
+    <dt dojoType="TreeMenuItem" id="newObject" caption="New Object"/>
+</dl>
+
 <div class="tableheadtext">
-    Website Content    
+    Website Content
+</div>
+<div class="tabletext">
+  *Right click to add sub-content
 </div>
+<div>&nbsp;</div>
+
 <dojo:TreeSelector widgetId="webCmsTreeSelector" eventNames="select:webCmsNodeSelected"></dojo:TreeSelector>
-<div dojoType="Tree" widgetId="webCmsTree" selector="webCmsTreeSelector" toggler="fade"
toggleDuration="500">
+<div dojoType="Tree" menu="webCmsContextMenu" widgetId="webCmsTree" selector="webCmsTreeSelector"
toggler="fade" toggleDuration="500">
     <#if (subsites?has_content)>
         <@fillTree assocList = subsites/>
     </#if>
-</div>
\ No newline at end of file
+</div>

Modified: ofbiz/trunk/applications/content/widget/WebSiteScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/WebSiteScreens.xml?view=diff&rev=512581&r1=512580&r2=512581
==============================================================================
--- ofbiz/trunk/applications/content/widget/WebSiteScreens.xml (original)
+++ ofbiz/trunk/applications/content/widget/WebSiteScreens.xml Tue Feb 27 18:52:07 2007
@@ -195,7 +195,6 @@
                                     <container id="cmscontent">
                                         <include-screen name="WebSiteCMSContent"/>
                                     </container>
-                                    <include-screen name="WebSiteCMSEditor"/>     
                              
                                 </container>                                      
                         
                             </widgets>
                             <fail-widgets>
@@ -232,7 +231,8 @@
         <section>
             <actions>
                 <set field="contentAssocTypeId" from-field="parameters.contentAssocTypeId"/>
-                <set field="contentIdFrom" from-field="parameters.contentIdFrom"/>

+                <set field="dataResourceTypeId" from-field="parameters.dataResourceTypeId"/>

+                <set field="contentIdFrom" from-field="parameters.contentIdFrom"/>
                 <set field="webSiteId" from-field="parameters.webSiteId"/>
                 <set field="contentId" from-field="parameters.contentId"/>
                 <set field="mimeTypeId" value="text/html"/>
@@ -258,7 +258,7 @@
                     <field-map field-name="statusTypeId" value="CONTENT_STATUS"/>
                     <order-by field-name="sequenceId"/>
                 </entity-and>
-                <entity-condition entity-name="DataTemplateType" list-name="templateTypes"/>

+                <entity-condition entity-name="DataTemplateType" list-name="templateTypes"/>
             </actions>
             <widgets>
                 <platform-specific>
@@ -295,7 +295,26 @@
         </section>
     </screen>
 
-   <screen name="WebSiteCMSPathAlias">
+    <screen name="WebSiteCMSMetaInfo">
+        <section>
+            <actions>
+                <set field="webSiteId" from-field="parameters.webSiteId"/>
+                <set field="contentId" from-field="parameters.contentId"/>
+                <entity-one entity-name="Content" value-name="content"/>
+
+                <script location="component://content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh"/>
+            </actions>
+            <widgets>
+                <platform-specific>
+                    <html>
+                        <html-template location="component://content/webapp/content/website/WebSiteCMSMeta.ftl"/>
+                    </html>
+                </platform-specific>
+            </widgets>
+        </section>
+    </screen>
+
+    <screen name="WebSiteCMSPathAlias">
         <section>
             <actions>
                 <set field="webSiteId" from-field="parameters.webSiteId"/>



Mime
View raw message