svn commit: r1058197 - in /ofbiz/trunk: applications/content/webapp/content/website/WebSiteCMSContent.ftl applications/content/webapp/content/website/WebSiteCMSNav.ftl framework/widget/templates/htmlFormMacroLibrary.ftl

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

svn commit: r1058197 - in /ofbiz/trunk: applications/content/webapp/content/website/WebSiteCMSContent.ftl applications/content/webapp/content/website/WebSiteCMSNav.ftl framework/widget/templates/htmlFormMacroLibrary.ftl

jleroux@apache.org
Author: jleroux
Date: Wed Jan 12 15:39:29 2011
New Revision: 1058197

URL: http://svn.apache.org/viewvc?rev=1058197&view=rev
Log:
A patch from Martin Kreidenweis "Adding content in CMS using add long text (right mouse click) doesn't work" (https://issues.apache.org/jira/browse/OFBIZ-4079) - OFBIZ-4079

Fixes some bugs in CMS introduced in svn r1036195 when migrating from dojo to jQuery:
* reverted accidental logic change in callDocument() that broke the "new ..." context menu items
* making elRTE "save" toolbar button work: same behavior as the regular "Save" button
* using regular form submit instead of ajax for new content for now
  o ajaxSubmitForm() can't handle new content, it won't reload the form because it doesn't know the new contentId
    + some controller changes would probably be necessary to make that work (return new contentId as JSON)
  o nav tree is not updated with ajax submit currently
* now always creating editor if corresponsing html element exists
  o editor was not initialized when WebSiteCMSContent screen was loaded by non-ajax call

Modified:
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl
    ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl
    ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl

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=1058197&r1=1058196&r2=1058197&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSContent.ftl Wed Jan 12 15:39:29 2011
@@ -18,6 +18,14 @@
   -->
 
 <script type="text/javascript">
+    jQuery(document).ready(function() {
+        // override elRTE save action to make "save" toolbar button work
+        elRTE.prototype.save = function() {
+            this.beforeSave();
+            cmsSave();
+        }
+    });
+
     function cmsSave() {
         var simpleFormAction = '<@ofbizUrl>/updateContentCms</@ofbizUrl>';
         var editor = jQuery("#cmseditor");
@@ -48,7 +56,13 @@
 
         // submit the form
         if (form != null) {
-            ajaxSubmitForm(form, "<#if content?has_content>${content.contentId!}</#if>");
+            <#if content?has_content>
+                ajaxSubmitForm(form, "${content.contentId!}");
+            <#else>
+                // for new content we need a real submit, so that the nav tree gets updated
+                // and because ajaxSubmitForm() cannot retrieve the new contentId, so subsequent saves would create more new contents
+                form.submit();
+            </#if>
         } else {
             showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CannotFindCmsform}");
         }

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=1058197&r1=1058196&r2=1058197&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl (original)
+++ ofbiz/trunk/applications/content/webapp/content/website/WebSiteCMSNav.ftl Wed Jan 12 15:39:29 2011
@@ -22,7 +22,8 @@
 <link href="/images/jquery/plugins/elrteEditor/css/elrte.full.css" rel="stylesheet" type="text/css">
 
 <script type="text/javascript">
-    jQuery(document).ready(loadTrees());
+    jQuery(document).ready(loadTrees);
+    jQuery(document).ready(createEditor);
 
     var contentRoot = '${contentRoot?if_exists}';
     var webSiteId = '${webSiteId?if_exists}';
@@ -332,10 +333,10 @@ var rawdata_errors = [
             ctx['contentIdFrom'] = contentId;
             ctx['contentAssocTypeId'] = 'SUB_CONTENT';
 
-        }
-
-        if (contentId != null && contentId.length) {
-            ctx['contentId'] = contentId;
+        } else {
+            if (contentId != null && contentId.length) {
+                ctx['contentId'] = contentId;
+            }
         }
 
         //jQuerry Ajax Request
@@ -357,14 +358,16 @@ var rawdata_errors = [
 
 <#-------------------------------------------------------------------------------------createEditor function-->
     function createEditor() {
-        var opts = {
-            cssClass : 'el-rte',
-            height   : 350,
-            toolbar  : 'maxi',
-            doctype  : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', //'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">',            
-            cssfiles : ['css/elrte-inner.css']
+        if($('#cmseditor').length) {
+            var opts = {
+                cssClass : 'el-rte',
+                height   : 350,
+                toolbar  : 'maxi',
+                doctype  : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', //'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">',
+                cssfiles : ['css/elrte-inner.css']
+            }
+            jQuery('#cmseditor').elrte(opts);
         }
-        jQuery('#cmseditor').elrte(opts);
     }
 <#-------------------------------------------------------------------------------------callMetaInfo function-->
 function callMetaInfo(contentId) {

Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1058197&r1=1058196&r2=1058197&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Wed Jan 12 15:39:29 2011
@@ -120,6 +120,17 @@ under the License.
                     buttonImageOnly: false,
                     dateFormat: 'yy-mm-dd'
                   });
+              <#if !(shortDateInput?exists && shortDateInput)>
+  jQuery.timepicker.regional['fr'] = {
+        currentText: 'Maintenant',
+        closeText: 'OK',
+        ampm: true,
+        timeText: 'Heure',
+        hourText: 'Heure',
+        secondText: 'Seconde'};
+              
+                 jQuery.timepicker.setDefaults(jQuery.timepicker.regional['fr']);
+              </#if>                  
           </script>
       </#if>
       <#if timeDropdown?has_content && timeDropdown=="time-dropdown">