Update of /cvsroot/phpslash/phpslash-dev/public_html/scripts/fckeditor/_jsp/src/com/fredck/FCKeditor/tags
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6026/phpslash-dev/public_html/scripts/fckeditor/_jsp/src/com/fredck/FCKeditor/tags
Added Files:
FCKeditorConfigurationsTag.java FCKeditorTag.java package.html
Log Message:
complete fckeditor addition
--- NEW FILE: FCKeditorConfigurationsTag.java ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: FCKeditorConfigurationsTag.java
* FCKeditor Configuration tag.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-30 21:28:48
*
* File Authors:
* Simone Chiaretta (si...@pi...)
*/
package com.fredck.FCKeditor.tags;
import com.fredck.FCKeditor.FCKeditor;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
/**
* Custom Tag class to access the {@linkplain com.fredck.FCKeditor.FCKeditorConfigurations advanced settings}.<br>
* Used to override the settings specified in the config.js file.
* This tag is valid only inside an <FCK:editor>
* <p>
* <b>Simple usage</b>:
* <pre>
* <FCK:config name="StyleNames" value=";Style 1;Style 2; Style 3" />
* </pre>
*
* @author Simone Chiaretta (si...@pi...)
*/
public class FCKeditorConfigurationsTag extends TagSupport {
private String name = null;
private String value = null;
/**
* Get the name of the setting
*
* @return name
*/
public String getName() {
return name;
}
/**
* Set the name of the setting
*
* @param value name
*/
public void setName(String value) {
name=value;
}
/**
* Get the value of the setting
*
* @return name
*/
public String getValue() {
return value;
}
/**
* Set the value of the setting
*
* @param value value
*/
public void setValue(String value) {
this.value=value;
}
/**
* Update the configuration settings adding the specified value
*
* @return SKIP_BODY
* @throws JspException if tag used outside the <FCK:editor> tag
*/
public int doStartTag () throws JspException {
FCKeditorTag editorTag=(FCKeditorTag)findAncestorWithClass(this, FCKeditorTag.class);
if(editorTag==null)
throw new JspTagException("This tag cannot be used outside the <FCK:editor> tag");
editorTag.fcked.getConfig().put(name,value);
return SKIP_BODY;
}
}
--- NEW FILE: FCKeditorTag.java ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: FCKeditorTag.java
* FCKeditor tag.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-30 21:28:50
*
* File Authors:
* Simone Chiaretta (si...@pi...)
*/
package com.fredck.FCKeditor.tags;
import com.fredck.FCKeditor.FCKeditor;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;
/**
* Custom Tag class to access the {@linkplain com.fredck.FCKeditor.FCKeditor contaniner}.<br>
*<p>
* <b>Simple usage</b>:
* <pre>
* <FCK:editor
* id="EditorAccessibility"
* width="80%"
* height="120"
* toolbarSet="Accessibility"
* ">This is another test. <BR"><B">The "Second" row.</B"></FCK:editor">
* </pre>
*
*<p>In this example we set all the attribute for the fckedit tag.
*
*<p>
* <b>Advanced usage of the tag</b>:
* <pre>
* <FCK:editor id="EditorDefault" basePath="/FCKeditor/">
* <FCK:config name="StyleNames" value=";Style 1;Style 2; Style 3" />
* <FCK:config name="FontNames" value=";Arial;Courier New;Times New Roman;Verdana" />
* This is some <B>sample text</B>.
* </FCK:editor>
* </pre>
*<p>In this example we set the id and the basePath of the editor (since it is /FCKeditor/
* we could have omitted it because it's already the default value).<br>
* Then we used the inner tag <FCK:config> to set some advanced configuration settings.
*
* @author Simone Chiaretta (si...@pi...)
*/
public class FCKeditorTag extends BodyTagSupport {
private String id;
private String value = "";
private String basePath = null;
private String toolbarSet = null;
private String width = null;
private String height = null;
private String canUpload = null;
private String canBrowse = null;
/**
* The underlying FCKeditor object
*
*/
protected FCKeditor fcked = null;
/**
* Get the unique id of the editor
*
* @return id
*/
public String getId() {
return id;
}
/**
* Set the unique id of the editor
*
* @param value name
*/
public void setId(String value) {
id=value;
}
/**
* Get the dir where the FCKeditor files reside on the server
*
* @return path
*/
public String getBasePath() {
return basePath;
}
/**
* Set the dir where the FCKeditor files reside on the server
*
* @param value path
*/
public void setBasePath(String value) {
basePath=value;
}
/**
* Get the name of the toolbar to display
*
* @return toolbar name
*/
public String getToolbarSet() {
return toolbarSet;
}
/**
* Set the name of the toolbar to display
*
* @param value toolbar name
*/
public void setToolbarSet(String value) {
toolbarSet=value;
}
/**
* Get the width of the textarea
*
* @return width
*/
public String getWidth() {
return width;
}
/**
* Set the width of the textarea
*
* @param value width
*/
public void setWidth(String value) {
width=value;
}
/**
* Get the height of the textarea
*
* @return height
*/
public String getHeight() {
return height;
}
/**
* Set the height of the textarea
*
* @param value height
*/
public void setHeight(String value) {
height=value;
}
/**
* Get the capability to upload files or images from inside the editor
*
* @return true/false
*/
public String getCanUpload() {
return canUpload;
}
/**
* Set the capability to upload files or images from inside the editor
*
* @param value true/false
*/
public void setCanUpload(String value) {
canUpload=value;
}
/**
* Get the capability to browse files or images from inside the editor
*
* @return true/false
*/
public String getCanBrowse() {
return canBrowse;
}
/**
* Set the capability to browse files or images from inside the editor
*
* @param value true/false
*/
public void setCanBrowse(String value) {
canBrowse=value;
}
/**
* Initialize the FCKeditor container and set attributes
*
* @return EVAL_BODY_BUFFERED
* @throws JspException if canUpload or canBrowse are not of boolean value
*/
public int doStartTag() throws JspException {
fcked=new FCKeditor((HttpServletRequest)pageContext.getRequest(),id);
if(toolbarSet!=null)
fcked.setToolbarSet(toolbarSet);
if(basePath!=null)
fcked.setBasePath(basePath);
if(width!=null)
fcked.setWidth(width);
if(height!=null)
fcked.setHeight(height);
if(canUpload!=null)
if(canUpload.equals("true"))
fcked.setCanUpload(true);
else if (canUpload.equals("false"))
fcked.setCanUpload(false);
else
throw new JspTagException("Error evaluating FCKeditor Tag: canUpload must be a boolean value");
if(canBrowse!=null)
if(canBrowse.equals("true"))
fcked.setCanBrowse(true);
else if (canBrowse.equals("false"))
fcked.setCanBrowse(false);
else
throw new JspTagException("Error evaluating FCKeditor Tag: canBrowse must be a boolean value");
return EVAL_BODY_BUFFERED;
}
/**
* Retrive initial value to be edited and writes the HTML code in the page
*
* @return SKIP_BODY
* @throws JspException if an error occurs whie writing to the out buffer
*/
public int doAfterBody() throws JspException {
BodyContent body = getBodyContent();
JspWriter writer = body.getEnclosingWriter();
String bodyString = body.getString();
fcked.setValue(bodyString);
try {
writer.println(fcked.create());
}catch(IOException ioe) {
throw new JspException("Error: IOException while writing to the user");
}
return SKIP_BODY;
}
}
--- NEW FILE: package.html ---
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: package.html
* FCKeditor taglib package description
*
* Version: 2.0 Beta 1
* Modified: 2004-05-30 21:27:54
*
* File Authors:
* Simone Chiaretta (si...@pi...)
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.60 98/01/27
Copyright 1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This software is the confidential and proprietary information of Sun
Microsystems, Inc. ("Confidential Information"). You shall not
disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement you entered into
with Sun.
CopyrightVersion 1.2
-->
</head>
<body bgcolor="white">
JSP Tag to access and modify the FCKeditor objects.
<h2>Package Specification</h2>
This taglibrary is compliant to the taglib 1.1 specification.<br>
To use it put the FCKeditor.jar inside the <code>WEB-INF/lib</code> dir and FCKeditor.tld inside the <code>WEB-INF</code> directory of your website.<br>
Put the following declaration in each page that use the tags:<br>
<pre>
<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="FCK" %>
</pre>
<h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see:
<ul>
<li>_sample/jsp directory for example of how to implement FCKEditor in your application
</ul>
<!-- Put @see and @since tags down here. -->
</body>
</html>
|