You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2017/01/23 11:08:09 UTC

svn commit: r1779904 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main: java/org/apache/myfaces/tobago/example/demo/ webapp/content/20-component/110-wysiwyg/01-ckeditor/

Author: lofwyr
Date: Mon Jan 23 11:08:09 2017
New Revision: 1779904

URL: http://svn.apache.org/viewvc?rev=1779904&view=rev
Log:
improve demo
* tinymce.xhtml: fix an error if TinyMCE is not availabled
* ckeditor.xhtml: path adjusted
* ckeditor.xhtml: source code box improved
[developed by hnoeth]

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CkeditorController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TinyMceController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/110-wysiwyg/01-ckeditor/ckeditor.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CkeditorController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CkeditorController.java?rev=1779904&r1=1779903&r2=1779904&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CkeditorController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CkeditorController.java Mon Jan 23 11:08:09 2017
@@ -30,29 +30,15 @@ import java.io.Serializable;
 @Named
 public class CkeditorController extends SourceFileReader implements Serializable {
 
-  private boolean editorAvailable;
   private String contentSecurityPolicyMode;
   private String text;
-  private boolean collapsed;
 
   public CkeditorController() {
-/* XXX RM
-    editorAvailable = ResourceManagerUtils.getScripts(
-            FacesContext.getCurrentInstance(),
-            "content/20-component/110-wysiwyg/01-ckeditor/ckeditor/ckeditor.js")
-            .size() != 0;
-*/
-
     final TobagoConfig tobagoConfig = TobagoConfig.getInstance(FacesContext.getCurrentInstance());
     contentSecurityPolicyMode = tobagoConfig.getContentSecurityPolicy().getMode().getValue();
 
     text = "<p><strong>Sun</strong></p>"
-            + "<p>The sun is a star in our galaxy.</p>";
-    collapsed = true;
-  }
-
-  public boolean isEditorAvailable() {
-    return editorAvailable;
+        + "<p>The sun is a star in our galaxy.</p>";
   }
 
   public String getContentSecurityPolicyMode() {
@@ -67,19 +53,11 @@ public class CkeditorController extends
     this.text = text;
   }
 
-  public boolean isCollapsed() {
-    return collapsed;
-  }
-
-  public void setCollapsed(boolean collapsed) {
-    this.collapsed = collapsed;
-  }
-
-  public void switchCollapsed() {
-    collapsed = !collapsed;
+  public String getSource() {
+    return getSource("demo-ckeditor.js");
   }
 
-  public String getSource() {
-    return getSource("ckeditor.js");
+  public boolean isEditorAvailable() {
+    return getSource("ckeditor/ckeditor.js") != null;
   }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TinyMceController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TinyMceController.java?rev=1779904&r1=1779903&r2=1779904&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TinyMceController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TinyMceController.java Mon Jan 23 11:08:09 2017
@@ -47,6 +47,6 @@ public class TinyMceController extends S
   }
 
   public boolean isEditorAvailable() {
-    return !"error".equals(getSource("tinymce/js/tinymce/tinymce.min.js"));
+    return getSource("tinymce/js/tinymce/tinymce.min.js") != null;
   }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/110-wysiwyg/01-ckeditor/ckeditor.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/110-wysiwyg/01-ckeditor/ckeditor.xhtml?rev=1779904&r1=1779903&r2=1779904&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/110-wysiwyg/01-ckeditor/ckeditor.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/110-wysiwyg/01-ckeditor/ckeditor.xhtml Mon Jan 23 11:08:09 2017
@@ -19,11 +19,13 @@
 
 <ui:composition template="/main.xhtml"
                 xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
                 xmlns:ui="http://java.sun.com/jsf/facelets">
   <ui:param name="title" value="#{demoBundle.ckeditor}"/>
-  <tc:script file="content/20-component/110-wysiwyg/01-ckeditor/ckeditor/ckeditor.js"/>
-  <tc:script file="content/20-component/110-wysiwyg/01-ckeditor/demo-ckeditor.js"/>
+  <tc:script
+          file="#{request.contextPath}/content/20-component/110-wysiwyg/01-ckeditor/ckeditor/ckeditor.js"/>
+  <tc:script file="#{request.contextPath}/content/20-component/110-wysiwyg/01-ckeditor/demo-ckeditor.js"/>
 
   <tc:section label="Installation">
     <p>Download <tc:link link="http://ckeditor.com/" target="_blank" label="CKEditor"/>
@@ -38,8 +40,17 @@
       <code class="language-markup">&lt;tc:dataAttribute name="html-editor" value=""/></code>,
       to mark this textarea to be used as rich text editor. The rest does the script: demo-ckeditor.js</p>
 
-    <tc:button label="show/hide" action="#{ckeditorController.switchCollapsed}"/>
-    <tc:box label="demo-ckeditor.js" collapsed="#{ckeditorController.collapsed}">
+    <tc:box id="sourceCodeBox" label="demo-ckeditor.js" collapsed="true" collapsedMode="hidden">
+      <f:facet name="bar">
+        <tc:buttons>
+          <tc:button label="show" omit="true">
+            <tc:operation name="show" for="sourceCodeBox"/>
+          </tc:button>
+          <tc:button label="hide" omit="true">
+            <tc:operation name="hide" for="sourceCodeBox"/>
+          </tc:button>
+        </tc:buttons>
+      </f:facet>
       <pre><code class="language-javascript"><tc:out value="#{ckeditorController.source}"/></code></pre>
     </tc:box>