[Yanel-commits] rev 32392 - in
public/yanel/contributions/resources/tinymce: . src/build
src/java/org/wyona/yanel/impl/resources yanel-htdocs/doc
simon at wyona.com
simon at wyona.com
Sun Feb 24 21:52:56 CET 2008
Author: simon
Date: 2008-02-24 21:52:55 +0100 (Sun, 24 Feb 2008)
New Revision: 32392
Modified:
public/yanel/contributions/resources/tinymce/build.xml
public/yanel/contributions/resources/tinymce/src/build/dependencies.xml
public/yanel/contributions/resources/tinymce/src/java/org/wyona/yanel/impl/resources/TinyMCEResource.java
public/yanel/contributions/resources/tinymce/yanel-htdocs/doc/index.html
Log:
improves tinyMCE resource. allows to read write via modifiableV2. now it extends the ExecutableUsecaseResource. more documentation added inclusive examples.
Modified: public/yanel/contributions/resources/tinymce/build.xml
===================================================================
--- public/yanel/contributions/resources/tinymce/build.xml 2008-02-24 20:38:02 UTC (rev 32391)
+++ public/yanel/contributions/resources/tinymce/build.xml 2008-02-24 20:52:55 UTC (rev 32392)
@@ -15,6 +15,7 @@
<path id="classpath">
<pathelement path="${maven2.cp}"/>
+ <pathelement path="${maven2.resource.cp}"/>
</path>
<property name="resource.build.dir" value="${resource.home.dir}/build"/>
<property name="resource.classes.dir" value="${resource.build.dir}/classes"/>
Modified: public/yanel/contributions/resources/tinymce/src/build/dependencies.xml
===================================================================
--- public/yanel/contributions/resources/tinymce/src/build/dependencies.xml 2008-02-24 20:38:02 UTC (rev 32391)
+++ public/yanel/contributions/resources/tinymce/src/build/dependencies.xml 2008-02-24 20:52:55 UTC (rev 32392)
@@ -20,18 +20,22 @@
<artifact:dependencies pathId="maven2.classpath" filesetId="maven2.fileset">
<remoteRepository refid="wyona.remote.repository"/>
- <dependency groupId="wyona-org-yanel" artifactId="yanel-core"
- version="${yanel.source.version}"/>
+ <dependency groupId="wyona-org-yanel" artifactId="yanel-core" version="${yanel.source.version}"/>
+ <dependency groupId="wyona-org-yanel" artifactId="yanel-impl" version="${yanel.source.version}"/>
+ <dependency groupId="apache-jakarta-commons" artifactId="apache-jakarta-commons-lang" version="2.1"/>
+ <dependency groupId="apache-jakarta-commons" artifactId="apache-jakarta-commons-io" version="1.2"/>
<dependency groupId="javax.servlet" artifactId="servlet-api" version="2.3"/>
<dependency groupId="spring" artifactId="spring" version="2.0"/>
</artifact:dependencies>
<artifact:dependencies pathId="maven2.resource.classpath" filesetId="maven2.resource.fileset">
<remoteRepository refid="wyona.remote.repository"/>
- <!-- No resource specific libs yet -->
+ <dependency groupId="avalon-framework" artifactId="avalon-framework-api" version="4.3"/>
+ <dependency groupId="avalon-framework" artifactId="avalon-framework-impl" version="4.3"/>
</artifact:dependencies>
<property name="maven2.cp" refid="maven2.classpath"/>
+ <property name="maven2.resource.cp" refid="maven2.resource.classpath"/>
<!--<echo>Maven2 classpath: ${maven2.cp}</echo>-->
</target>
Modified: public/yanel/contributions/resources/tinymce/src/java/org/wyona/yanel/impl/resources/TinyMCEResource.java
===================================================================
--- public/yanel/contributions/resources/tinymce/src/java/org/wyona/yanel/impl/resources/TinyMCEResource.java 2008-02-24 20:38:02 UTC (rev 32391)
+++ public/yanel/contributions/resources/tinymce/src/java/org/wyona/yanel/impl/resources/TinyMCEResource.java 2008-02-24 20:52:55 UTC (rev 32392)
@@ -6,250 +6,128 @@
import java.io.BufferedInputStream;
import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
import org.wyona.yanel.core.Resource;
+import org.wyona.yanel.core.api.attributes.CreatableV2;
+import org.wyona.yanel.core.api.attributes.ModifiableV2;
import org.wyona.yanel.core.api.attributes.ViewableV2;
import org.wyona.yanel.core.attributes.viewable.View;
import org.wyona.yanel.core.navigation.Node;
import org.wyona.yanel.core.navigation.Sitetree;
import org.wyona.yanel.core.util.PathUtil;
+import org.wyona.yanel.core.util.ResourceAttributeHelper;
import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
+import org.wyona.yanel.impl.resources.BasicXMLResource;
+import org.wyona.yanel.impl.resources.usecase.ExecutableUsecaseResource;
+import org.wyona.yanel.impl.resources.usecase.UsecaseException;
+import org.wyona.yanel.impl.resources.xml.ConfigurableViewDescriptor;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationUtil;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.io.IOUtils;
+
+import sun.util.logging.resources.logging;
+
/**
*
*/
-public class TinyMCEResource extends Resource implements ViewableV2{
- private static Category log = Category.getInstance(TinyMCEResource.class);
- private boolean ajaxBrowser = false;
+public class TinyMCEResource extends ExecutableUsecaseResource {
- /**
- *
- */
- public TinyMCEResource() {
- }
+ private static Logger log = Logger.getLogger(TinyMCEResource.class);
- /**
- *
- */
- public boolean exists() {
- return true;
- }
+ private static String PARAMETER_EDIT_PATH = "edit-path";
+ private static String PARAMETER_CONTINUE_PATH = "continue-path";
- /**
- *
- */
- public long getSize() {
- return -1;
- }
-
- /**
- *
- */
- public String getMimeType(String viewId) {
- if (viewId != null && viewId.equals("source")) return "application/xml";
- return "application/xhtml+xml";
- }
-
- /**
- *
- */
- public ViewDescriptor[] getViewDescriptors() {
- ViewDescriptor[] vd = new ViewDescriptor[2];
- vd[0] = new ViewDescriptor("default");
- vd[0].setMimeType(getMimeType(null));
- vd[1] = new ViewDescriptor("source");
- vd[1].setMimeType(getMimeType("source"));
- return vd;
- }
- /**
- *
- */
- public View getView(String viewId) {
- if(request.getHeader("User-Agent").indexOf("rv:1.7") < 0) {
- ajaxBrowser = true;
+ public void execute() throws UsecaseException {
+ String editPath = getEditPath();
+ String content = request.getParameter(editPath);
+ log.error(content);
+ try {
+ Resource resToEdit = getYanel().getResourceManager().getResource(getEnvironment(), getRealm(), editPath);
+ if (ResourceAttributeHelper.hasAttributeImplemented(resToEdit, "Modifiable", "2")) {
+ OutputStream os = ((ModifiableV2) resToEdit).getOutputStream();
+ IOUtils.write(content, os);
+ addInfoMessage("Successfully saved.");
+ setParameter(PARAMETER_CONTINUE_PATH, PathUtil.backToRealm(getPath()) + editPath.substring(1)); // allow jelly template to show link to new event
+ } else {
+ addError("The resource you wanted to edit does not implement VieableV2 and is therefor not editable with this editor.");
+ log.error("The resource you wanted to edit does not implement VieableV2 and is therefor not editable with this editor.");
+ }
+ } catch (Exception e) {
+ log.error("Exception: " + e);
+ throw new UsecaseException(e.getMessage(), e);
}
-
- View view = new View();
- String mimeType = getMimeType(viewId);
- view.setMimeType(mimeType);
-
- if (viewId != null && viewId.equals("source")) {
- view.setInputStream(new java.io.StringBufferInputStream(getScreen()));
- view.setMimeType(getMimeType(viewId));
- return view;
- }
-
- view.setInputStream(new java.io.StringBufferInputStream(getScreen()));
- return view;
}
- /**
- * Flow
- */
- private String getScreen() {
- StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
- sb.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
- sb.append("<head><title>tinyMCE</title>");
- sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + PathUtil.getResourcesHtdocsPath(this) + "css/tinymce-resource.css\"/>");
- sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-css/progressBar.css\"/>");
- sb.append("<script src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-js/prototype.js\" type=\"text/javascript\"></script>");
- sb.append("<script src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-js/progressBar.js\" type=\"text/javascript\"></script>");
- sb.append("<script src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-js/sorttable.js\" type=\"text/javascript\"></script>");
- sb.append("<script src=\"" + PathUtil.getResourcesHtdocsPath(this)+ "js/ajaxlookup.js\" type=\"text/javascript\"></script>");
-
-
- sb.append("<script language=\"javascript\" type=\"text/javascript\" src=\"" + PathUtil.getResourcesHtdocsPath(this)+ "tinymce/jscripts/tiny_mce/tiny_mce.js\"></script>");
- sb.append("<script language=\"javascript\" type=\"text/javascript\">");
- sb.append("tinyMCE.init({");
- sb.append(" theme : \"advanced\",");
- sb.append(" mode : \"textareas\"");
- sb.append("});");
- sb.append("</script>");
-
- sb.append("</head>");
- sb.append("<body>");
+ public void cancel() throws UsecaseException {
+ addInfoMessage("Cancled.");
+ setParameter(PARAMETER_CONTINUE_PATH, PathUtil.backToRealm(getPath()) + getEditPath().substring(1)); // allow jelly template to show link to new event
+ }
+ public StringBuffer getEditorForm() throws UsecaseException {
+ StringBuffer editableDoc = new StringBuffer();
+ StringBuffer sb = new StringBuffer();
+ String path;
+
Enumeration parameters = request.getParameterNames();
if (!parameters.hasMoreElements()) {
- sb.append(getLookUp());
+ sb.append("no parameter edit-path found in the request. don't know what to edit");
+ return sb;
} else {
- if (request.getParameter("lookup") != null) {
- return getLookUp().toString();
- }
- if (request.getParameter("edit-path") != null) {
- sb.append(getEditorForm(request.getParameter("edit-path")));
+ if (request.getParameter(PARAMETER_EDIT_PATH) == null) {
+ sb.append("no parameter edit-path found in the request. don't know what to edit");
+ return sb;
} else {
- sb.append(getLookUp());
+ path = request.getParameter(PARAMETER_EDIT_PATH);
}
}
-
- sb.append("</body>");
- sb.append("</html>");
- return sb.toString();
- }
-
- private StringBuffer getEditorForm(String path) {
- StringBuffer editableDoc = new StringBuffer();
- StringBuffer sb = new StringBuffer();
-
try {
- InputStream is = getRealm().getRepository().getNode(path).getInputStream();
- BufferedReader ib = new BufferedReader(new InputStreamReader(is));
- String temp = ib.readLine();
- while (temp !=null){
- editableDoc.append (temp);
- editableDoc.append ("\n");
- temp = ib.readLine();
+ Resource resToEdit = getYanel().getResourceManager().getResource(getEnvironment(), getRealm(), path);
+ if (ResourceAttributeHelper.hasAttributeImplemented(resToEdit, "Modifiable", "2")) {
+
+ InputStream is = ((ModifiableV2) resToEdit).getInputStream();
+ BufferedReader ib = new BufferedReader(new InputStreamReader(is));
+ String temp = ib.readLine();
+ while (temp !=null){
+ editableDoc.append (temp);
+ editableDoc.append ("\n");
+ temp = ib.readLine();
+ }
+ } else {
+ log.error("The resource you wanted to edit does not implement VieableV2 and is therefor not editable with this editor.");
+ sb.append("The resource you wanted to edit does not implement VieableV2 and is therefor not editable with this editor.");
}
} catch (Exception e) {
- sb.append("Exception: " + e);
+ log.error("Exception: " + e);
+ throw new UsecaseException(e.getMessage(), e);
}
- String html;
- try {
- String beforeHtml = editableDoc.toString().split("<html.*>")[0];
- String tailedHtml = editableDoc.toString().split("<html.*>")[1];
- html = tailedHtml.toString().split("</html>")[0];
- String afterHtml = tailedHtml.toString().split("</html>")[1];
- } catch (Exception e) {
- sb.append("The document: " + path + "seems not to be an html document. please use another editor.");
- return sb;
- }
-
-
sb.append("<form method=\"post\" action=\"\">");
- sb.append("<textarea id=\"elm1\" name=\"elm1\" rows=\"15\" cols=\"80\" style=\"width: 100%\">");
- sb.append(html);
+ sb.append("<input type=\"hidden\" name=\"" + PARAMETER_EDIT_PATH + "\" value=\"" + request.getParameter(PARAMETER_EDIT_PATH) + "\"/>");
+ sb.append("<textarea id=\"" + request.getParameter(PARAMETER_EDIT_PATH) + "\" name=\"" + request.getParameter(PARAMETER_EDIT_PATH) + "\" rows=\"15\" cols=\"80\" style=\"width: 100%\">");
+ sb.append(StringEscapeUtils.escapeXml(editableDoc.toString()));
sb.append("</textarea>");
sb.append("<br />");
- sb.append("<input type=\"submit\" name=\"save\" value=\"Submit\" />");
- sb.append("<input type=\"reset\" name=\"reset\" value=\"Reset\" />");
+ sb.append("<input type=\"submit\" name=\"submit\" value=\"Save\" />");
+ sb.append("<input type=\"submit\" name=\"cancel\" value=\"Cancel\" />");
sb.append("</form>");
return sb;
}
- private StringBuffer getLookUp() {
- StringBuffer sb = new StringBuffer("");
- Sitetree sitetree = (Sitetree) getYanel().getBeanFactory().getBean("repo-navigation");
- Node node = null;
- String lookinPath = getRequest().getParameter("lookin");
- if (lookinPath != null) {
- node = sitetree.getNode(getRealm(), lookinPath);
- } else {
- node = sitetree.getNode(getRealm(), getPath());
- }
- if (node.isCollection()) {
- if(log.isDebugEnabled()) log.debug("Is Collection: " + node.getName());
- } else if (node.isResource()) {
- if (log.isDebugEnabled()) log.debug("Is Resource: " + node.getName());
- node = node.getParent();
- } else {
- log.error("Neither collection nor resource: " + getPath());
- }
-
- sb.append("<div id=\"lookup\">");
- sb.append("<table id=\"resourceCreatorSaveAsTable\"><tr><td colspan=\"2\">Select a file for editing with tinyMCE</td></tr>");
- sb.append("<tr><td>Look in: " + node.getPath() + "   </td><td>");
-
- String parent = "/";
- if (!node.getPath().equals("/")) {
- parent = new org.wyona.commons.io.Path(node.getPath()).getParent().toString();
- }
- if (log.isDebugEnabled()) log.debug("Parent: " + parent);
-
- if (ajaxBrowser) {
- sb.append("<a href='JavaScript:ajaxlookup(\"" + parent + "\")'><img src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-img/icons/go-up.png\" alt=\"go up\" border=\"0\"/></a>");
- } else {
- sb.append("<a href=\"?lookin=" + parent + "\"><img src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-img/icons/go-up.png\" alt=\"go up\" border=\"0\"/></a>");
- }
- sb.append("</td></tr>");
-
- sb.append("<tr><td colspan=\"2\">");
-
- sb.append("<div id=\"lookupfiles\">");
- sb.append("<table id=\"lookupfilesTable\" class=\"sortable\">");
- sb.append("<thead>");
- sb.append("<tr><th>Type</th><th>Name</th><th>Resource Type</th></tr>");
- sb.append("</thead>");
- sb.append("<tbody>");
- Node[] children = node.getChildren();
- for (int i = 0; i < children.length; i++) {
- String resourceTypeName;
- try {
- resourceTypeName = yanel.getResourceManager().getResource(getEnvironment(), realm, children[i].getPath()).getResourceTypeLocalName();
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- resourceTypeName = "?";
- }
- if (children[i].isCollection()) {
- // TODO: Also append resource specific parameters (AJAX ...)
- if (ajaxBrowser) {
- sb.append("<tr><td sorttable_customkey=\"Collection\"><img src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-img/icons/folder.png\" alt=\"Collection:\"/></td><td><a href='JavaScript:ajaxlookup(\"" + node.getPath() + children[i].getName() + "/\")'>" + children[i].getName() + "</a></td><td>" + resourceTypeName + "</td></tr>");
- } else {
- sb.append("<tr><td sorttable_customkey=\"Collection\"><img src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-img/icons/folder.png\" alt=\"Collection:\"/></td><td><a href=\"?lookin=" + node.getPath() + children[i].getName() + "/\">" + children[i].getName() + "</a></td><td>" + resourceTypeName + "</td></tr>");
- }
- } else if (children[i].isResource()) {
- sb.append("<tr><td sorttable_customkey=\"Resource\"><img src=\"" + PathUtil.getGlobalHtdocsPath(this) + "yanel-img/icons/text-x-generic.png\" alt=\"Resource:\"/></td><td><a href=\"?edit-path=" + children[i].getPath() + "\">"+children[i].getName() + "</a></td><td>" + resourceTypeName + "</td></tr>");
- } else {
- sb.append("<tr><td>?</td><td>"+children[i].getName()+"</td><td>-</td></tr>");
- }
- }
-
- sb.append("</tbody>");
- sb.append("</table>");
- sb.append("</div>");
- sb.append("</td></tr>");
- sb.append("</table>");
- sb.append("</div>");
-
- return sb;
- }
+ private String getEditPath() {
+ return request.getParameter(PARAMETER_EDIT_PATH);
+ }
}
Modified: public/yanel/contributions/resources/tinymce/yanel-htdocs/doc/index.html
===================================================================
--- public/yanel/contributions/resources/tinymce/yanel-htdocs/doc/index.html 2008-02-24 20:38:02 UTC (rev 32391)
+++ public/yanel/contributions/resources/tinymce/yanel-htdocs/doc/index.html 2008-02-24 20:52:55 UTC (rev 32392)
@@ -1,20 +1,176 @@
<html>
<head>
- <title>tbd</title>
+ <style>
+h2 {
+ font-size: 130%;
+ color: #ffffff;
+ background-color: #525D76;
+}
+pre {
+ background-color: efefef;
+}
+td {
+ background-color: eeeeee;
+ color: 000000;
+}
+
+/* first row */
+table tr:first-child td {
+ background-color: cccccc;
+ color: 000000;
+}
+
+/* or th as first row */
+table th {
+ background-color: cccccc;
+ color: 000000;
+}
+ </style>
+ <title>TinyMCE Resource</title>
</head>
<body>
- <h1>from-scratch</h1>
+ <h1>TinyMCE Resource</h1>
<dl>
<dt>Name:</dt>
- <dd>tbd</dd>
+ <dd>tinymce</dd>
<dt>Namespace:</dt>
- <dd>tbd</dd>
+ <dd>http://www.wyona.org/yanel/resource/1.0</dd>
<dt>UniversalName</dt>
- <dd>tbd</dd>
+ <dd>http://www.wyona.org/yanel/resource/1.0::tinymce</dd>
<dt>Description:</dt>
- <dd>tbd</dd>
+ <dd>tinyMCE to edit xhtml</dd>
<dt>Java Class:</dt>
- <dd>tbd</dd>
+ <dd>org.wyona.yanel.impl.resources.TinyMCEResource</dd>
</dl>
+
+ <h2>Views</h2>
+ <table border="1">
+ <tr><th>View ID</th><th>Mime type</th><th>Type</th></tr>
+ <tr><td>DEFAULT</td><td>text/html</td><td>jelly</td></tr>
+ <tr><td>done</td><td>text/html</td><td>jelly</td></tr>
+ <tr><td>cancel</td><td>text/html</td><td>jelly</td></tr>
+ </table>
+ <h2>Request Parameter</h2>
+ <table border="1">
+ <tr><th>View ID</th><th>Name</th><th>Explanations</th></tr>
+ <tr><td>DEFAULT</td><td>edit-path</td><td>a data repository path. points to the document you want to edit</td></tr>
+ </table>
+
+ <h2>Examples</h2>
+ <h3>.yanel-rc Example</h3>
+<pre>
+<?xml version="1.0"?>
+<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
+ <yanel:rti name="tinymce" namespace="http://www.wyona.org/yanel/resource/1.0"/>
+ <yanel:custom-config>
+ <views>
+ <view id="default" type="jelly">
+ <template>tinymce.jelly</template>
+ <xslt>/xslt/global.xsl</xslt>
+ <mime-type>text/html</mime-type>
+ </view>
+ <view id="done" type="jelly">
+ <template>tinymce-status.jelly</template>
+ <xslt>/xslt/global.xsl</xslt>
+ </view>
+ <view id="cancel" type="jelly">
+ <template>tinymce-status.jelly</template>
+ <xslt>/xslt/global.xsl</xslt>
+ </view>
+ </views>
+ </yanel:custom-config>
+</yanel:resource-config>
+</pre>
+
+ <h3>tinymce.jelly Example</h3>
+<pre>
+<?xml version="1.0" encoding="utf-8"?>
+<j:jelly xmlns:j="jelly:core">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>tinyMCE</title>
+ <link rel="stylesheet" type="text/css" href="${yanel.back2realm}${yanel.reservedPrefix}/resource-types/http://www.wyona.org/yanel/resource/1.0::tinymce/css/tinymce-resource.css"/>
+ <script language="javascript" type="text/javascript" src="${yanel.back2realm}${yanel.reservedPrefix}/resource-types/http://www.wyona.org/yanel/resource/1.0::tinymce/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
+ <script language="javascript" type="text/javascript">
+ tinyMCE.init({
+ mode : "textareas",
+ theme : "advanced",
+ theme_advanced_layout_manager: "RowLayout",
+ theme_advanced_containers: "container1,mceEditor",
+ theme_advanced_container_container1: "bold,italic,underline,separator,bullist,separator,undo,redo,separator,link,unlink,separator,formatselect,image,code",
+ plugins : "fullpage",
+ entity_encoding : "raw"
+ });
+ </script>
+ </head>
+ <body>
+ ${resource.getEditorForm()}
+ </body>
+ </html>
+</j:jelly>
+</pre>
+
+ <h3>tinymce.jelly Example</h3>
+<pre>
+<?xml version="1.0" encoding="utf-8"?>
+<j:jelly xmlns:j="jelly:core">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>tinyMCE</title>
+ </head>
+ <body>
+ <p class="yanel-usecase-error">${resource.getErrorMessages()}</p>
+ <p>${resource.getInfoMessages()}</p>
+ <form action="">
+ <input type="button" name="finish" value="Finish" onclick="window.location.href='${resource.getParameterAsString('continue-path')}'"/>
+ </form>
+ </body>
+ </html>
+</j:jelly>
+</pre>
+
+<h2>Explanations</h2>
+
+<p>
+Once you registered the tinymce resource in yanel (add <resource-type src="$TINYMCE_RESOURCE_HOME" compile="true"/> to yanels resource-types.xml)
+<br/>and you added the above mentioned jelly files to your realms data repository (e.g. /tinymce.jelly, /tinymce.jelly) <br/>and added the above mentioned .yanel-rc to
+your realms resource-config (e.g. /usecases/tinymce.yanel-rc) repository
+<br/>you can access tinymce via browser e.g. https://localhost:8443/yanel/$YOUR_REALM/usecases/tinymce.html?edit-path=/de/ueber.html.
+</p>
+<p>you have to provide a request parameter "edith-path" in order to allow the tinymce resource to know which document to edit.</p>
+
+<p>you can configure the tinymce by editing the javascript tinyMCE.init in the tinymce.jelly. See: <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Index">tinyMCE wiki</a></p>
+<h3>Menu Example</h3>
+<p>an example how to add this resource to the menu</p>
+<pre>
+Index: src/realms/yanel-website/src/java/org/wyona/yanel/servlet/menu/impl/YanelWebsiteMenu.java
+===================================================================
+--- src/realms/yanel-website/src/java/org/wyona/yanel/servlet/menu/impl/YanelWebsiteMenu.java (revision 31673)
++++ src/realms/yanel-website/src/java/org/wyona/yanel/servlet/menu/impl/YanelWebsiteMenu.java (working copy)
+@@ -61,7 +61,15 @@
+
+ sb.append("<ul><li>");
+ sb.append("<div id=\"yaneltoolbar_menutitle\">Edit</div><ul>");
+- sb.append("<li class=\"haschild\">Open with&#160;&#160;&#160;<ul><li>Source editor</li><li>WYSIWYG editor</li></ul></li>");
++ sb.append("<li class=\"haschild\">Open with&#160;&#160;&#160;");
++ sb.append("<ul><li>Source editor</li>");
++ sb.append("<li>WYSIWYG editor</li>");
++ if (ResourceAttributeHelper.hasAttributeImplemented(resource, "Modifiable", "2")) {
++ sb.append("<li><a href=\"" + backToRealm + "usecases/tinymce.html?edit-path=" + resource.getPath() + "\">Edit page with tinyMCE&#160;&#160;&#160;</a></li>");
++ } else {
++ sb.append("<li><a>Edit page with tinyMCE&#160;&#160;&#160;</a></li>");
++ }
++ sb.append("</ul></li>");
+
+ if (ResourceAttributeHelper.hasAttributeImplemented(resource, "Versionable", "2")) {
+ RevisionInformation[] revisions = ((VersionableV2) resource).getRevisions();
+
+</pre>
+<h2>Todo</h2>
+<ul>
+<li>don't open all ModifiableV2 it could be something which tinyMCE doesn't like e.g. no html</li>
+<li>maybe provide a file lookup when request parameter "edit-path" is not provided</li>
+<li>integrate a lookup for inserting images and links</li>
+</ul>
</body>
</html>
More information about the Yanel-commits
mailing list