svnno****@sourc*****
svnno****@sourc*****
2008年 5月 21日 (水) 15:38:44 JST
Revision: 943 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=943 Author: sone Date: 2008-05-21 15:38:44 +0900 (Wed, 21 May 2008) Log Message: ----------- added .tld file and updated upload, connect files Modified Paths: -------------- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FilesaveServlet.java pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml pal-wcm/trunk/src/main/webapp/index.jsp Added Paths: ----------- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/connector/ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/connector/ConnectorServlet.java pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/tags/ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/tags/FCKeditorTag.java pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/uploader/ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/uploader/SimpleUploaderServlet.java pal-wcm/trunk/src/main/webapp/WEB-INF/tld/ pal-wcm/trunk/src/main/webapp/WEB-INF/tld/FCKeditor.tld pal-wcm/trunk/src/main/webapp/WEB-INF/tld/portlet.tld -------------- next part -------------- Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/connector/ConnectorServlet.java =================================================================== --- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/connector/ConnectorServlet.java (rev 0) +++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/connector/ConnectorServlet.java 2008-05-21 06:38:44 UTC (rev 943) @@ -0,0 +1,321 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 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: ConnectorServlet.java + * Java Connector for Resource Manager class. + * + * Version: 2.3 + * Modified: 2005-08-11 16:29:00 + * + * File Authors: + * Simone Chiaretta (simo****@users*****) + */ + +package jp.sf.pal.wcm.connector; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.util.*; + + +import org.apache.commons.fileupload.*; + + +import javax.xml.parsers.*; +import org.w3c.dom.*; +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + + +/** + * Servlet to upload and browse files.<br> + * + * This servlet accepts 4 commands used to retrieve and create files and folders from a server directory. + * The allowed commands are: + * <ul> + * <li>GetFolders: Retrive the list of directory under the current folder + * <li>GetFoldersAndFiles: Retrive the list of files and directory under the current folder + * <li>CreateFolder: Create a new directory under the current folder + * <li>FileUpload: Send a new file to the server (must be sent with a POST) + * </ul> + * + * @author Simone Chiaretta (simo****@users*****) + */ + +public class ConnectorServlet extends HttpServlet { + + private static String baseDir; + private static boolean debug=false; + + /** + * Initialize the servlet.<br> + * Retrieve from the servlet configuration the "baseDir" which is the root of the file repository:<br> + * If not specified the value of "/UserFiles/" will be used. + * + */ + public void init() throws ServletException { + baseDir=getInitParameter("baseDir"); + debug=(new Boolean(getInitParameter("debug"))).booleanValue(); + if(baseDir==null) + baseDir="/UserFiles/"; + String realBaseDir=getServletContext().getRealPath(baseDir); + File baseFile=new File(realBaseDir); + if(!baseFile.exists()){ + baseFile.mkdir(); + } + } + + /** + * Manage the Get requests (GetFolders, GetFoldersAndFiles, CreateFolder).<br> + * + * The servlet accepts commands sent in the following format:<br> + * connector?Command=CommandName&Type=ResourceType&CurrentFolder=FolderPath<br><br> + * It execute the command and then return the results to the client in XML format. + * + */ + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + if (debug) System.out.println("--- BEGIN DOGET ---"); + + response.setContentType("text/xml; charset=UTF-8"); + response.setHeader("Cache-Control","no-cache"); + PrintWriter out = response.getWriter(); + + String commandStr=request.getParameter("Command"); + String typeStr=request.getParameter("Type"); + String currentFolderStr=request.getParameter("CurrentFolder"); + + String currentPath=baseDir+typeStr+currentFolderStr; + String currentDirPath=getServletContext().getRealPath(currentPath); + + File currentDir=new File(currentDirPath); + if(!currentDir.exists()){ + currentDir.mkdir(); + } + + Document document=null; + try { + DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + document=builder.newDocument(); + } catch (ParserConfigurationException pce) { + pce.printStackTrace(); + } + + Node root=CreateCommonXml(document,commandStr,typeStr,currentFolderStr,request.getContextPath()+currentPath); + + if (debug) System.out.println("Command = " + commandStr); + + if(commandStr.equals("GetFolders")) { + getFolders(currentDir,root,document); + } + else if (commandStr.equals("GetFoldersAndFiles")) { + getFolders(currentDir,root,document); + getFiles(currentDir,root,document); + } + else if (commandStr.equals("CreateFolder")) { + String newFolderStr=request.getParameter("NewFolderName"); + File newFolder=new File(currentDir,newFolderStr); + String retValue="110"; + + if(newFolder.exists()){ + retValue="101"; + } + else { + try { + boolean dirCreated = newFolder.mkdir(); + if(dirCreated) + retValue="0"; + else + retValue="102"; + }catch(SecurityException sex) { + retValue="103"; + } + + } + setCreateFolderResponse(retValue,root,document); + } + + document.getDocumentElement().normalize(); + try { + TransformerFactory tFactory = TransformerFactory.newInstance(); + Transformer transformer = tFactory.newTransformer(); + + DOMSource source = new DOMSource(document); + + StreamResult result = new StreamResult(out); + transformer.transform(source, result); + + if (debug) { + StreamResult dbgResult = new StreamResult(System.out); + transformer.transform(source, dbgResult); + System.out.println(""); + System.out.println("--- END DOGET ---"); + } + + + } catch (Exception ex) { + ex.printStackTrace(); + } + + + out.flush(); + out.close(); + } + + + /** + * Manage the Post requests (FileUpload).<br> + * + * The servlet accepts commands sent in the following format:<br> + * connector?Command=FileUpload&Type=ResourceType&CurrentFolder=FolderPath<br><br> + * It store the file (renaming it in case a file with the same name exists) and then return an HTML file + * with a javascript command in it. + * + */ + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + if (debug) System.out.println("--- BEGIN DOPOST ---"); + + response.setContentType("text/html; charset=UTF-8"); + response.setHeader("Cache-Control","no-cache"); + PrintWriter out = response.getWriter(); + + String commandStr=request.getParameter("Command"); + String typeStr=request.getParameter("Type"); + String currentFolderStr=request.getParameter("CurrentFolder"); + + String currentPath=baseDir+typeStr+currentFolderStr; + String currentDirPath=getServletContext().getRealPath(currentPath); + + if (debug) System.out.println(currentDirPath); + + String retVal="0"; + String newName=""; + + if(!commandStr.equals("FileUpload")) + retVal="203"; + else { + DiskFileUpload upload = new DiskFileUpload(); + try { + List items = upload.parseRequest(request); + + Map fields=new HashMap(); + + Iterator iter = items.iterator(); + while (iter.hasNext()) { + FileItem item = (FileItem) iter.next(); + if (item.isFormField()) + fields.put(item.getFieldName(),item.getString()); + else + fields.put(item.getFieldName(),item); + } + FileItem uplFile=(FileItem)fields.get("NewFile"); + String fileNameLong=uplFile.getName(); + fileNameLong=fileNameLong.replace('\\','/'); + String[] pathParts=fileNameLong.split("/"); + String fileName=pathParts[pathParts.length-1]; + + String nameWithoutExt=getNameWithoutExtension(fileName); + String ext=getExtension(fileName); + File pathToSave=new File(currentDirPath,fileName); + int counter=1; + while(pathToSave.exists()){ + newName=nameWithoutExt+"("+counter+")"+"."+ext; + retVal="201"; + pathToSave=new File(currentDirPath,newName); + counter++; + } + uplFile.write(pathToSave); + }catch (Exception ex) { + retVal="203"; + } + + } + + out.println("<script type=\"text/javascript\">"); + out.println("window.parent.frames['frmUpload'].OnUploadCompleted("+retVal+",'"+newName+"');"); + out.println("</script>"); + out.flush(); + out.close(); + + if (debug) System.out.println("--- END DOPOST ---"); + + } + + private void setCreateFolderResponse(String retValue,Node root,Document doc) { + Element myEl=doc.createElement("Error"); + myEl.setAttribute("number",retValue); + root.appendChild(myEl); + } + + + private void getFolders(File dir,Node root,Document doc) { + Element folders=doc.createElement("Folders"); + root.appendChild(folders); + File[] fileList=dir.listFiles(); + for(int i=0;i<fileList.length;++i) { + if(fileList[i].isDirectory()){ + Element myEl=doc.createElement("Folder"); + myEl.setAttribute("name",fileList[i].getName()); + folders.appendChild(myEl); + } + } + } + + private void getFiles(File dir,Node root,Document doc) { + Element files=doc.createElement("Files"); + root.appendChild(files); + File[] fileList=dir.listFiles(); + for(int i=0;i<fileList.length;++i) { + if(fileList[i].isFile()){ + Element myEl=doc.createElement("File"); + myEl.setAttribute("name",fileList[i].getName()); + myEl.setAttribute("size",""+fileList[i].length()/1024); + files.appendChild(myEl); + } + } + } + + private Node CreateCommonXml(Document doc,String commandStr, String typeStr, String currentPath, String currentUrl ) { + + Element root=doc.createElement("Connector"); + doc.appendChild(root); + root.setAttribute("command",commandStr); + root.setAttribute("resourceType",typeStr); + + Element myEl=doc.createElement("CurrentFolder"); + myEl.setAttribute("path",currentPath); + myEl.setAttribute("url",currentUrl); + root.appendChild(myEl); + + return root; + + } + + /* + * This method was fixed after Kris Barnhoorn (kurioskronic) submitted SF bug #991489 + */ + private static String getNameWithoutExtension(String fileName) { + return fileName.substring(0, fileName.lastIndexOf(".")); + } + + /* + * This method was fixed after Kris Barnhoorn (kurioskronic) submitted SF bug #991489 + */ + private String getExtension(String fileName) { + return fileName.substring(fileName.lastIndexOf(".")+1); + } + + +} + Modified: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FilesaveServlet.java =================================================================== --- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FilesaveServlet.java 2008-05-19 05:31:45 UTC (rev 942) +++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FilesaveServlet.java 2008-05-21 06:38:44 UTC (rev 943) @@ -15,29 +15,33 @@ */ package jp.sf.pal.wcm.servlet; -import java.io.IOException; - -import java.util.*; import java.io.File; import java.io.FileWriter; +import java.io.IOException; import java.io.PrintWriter; +import java.util.Enumeration; + import javax.servlet.ServletContext; - -import jp.sf.pal.wcm.*; - import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + /** - * @author takaaki sone + * @author takaaki * */ -public class FilesaveServlet extends HttpServlet { - @Override +public class FilesaveServlet extends HttpServlet { + + private static final Log log = LogFactory.getLog(FilesaveServlet.class); + + @Override protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { + HttpServletResponse response) throws ServletException, IOException { Enumeration params = request.getParameterNames(); String parameter = null; String reqParam = null; @@ -56,8 +60,7 @@ if (!fragIdDir.exists()) { if (!fragIdDir.mkdirs()) { // fail to mkdir - System.err.println("error:cannot mkdir" + - outputFilePath); + log.error("cannot mkdir : " + outputFilePath); } } FileWriter fw = new FileWriter(outputFilePath + outputFileName); @@ -65,6 +68,7 @@ writer.println(reqParam); fw.close(); } catch (Exception e) { + log.error(e); e.printStackTrace(); } } Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/tags/FCKeditorTag.java =================================================================== --- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/tags/FCKeditorTag.java (rev 0) +++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/tags/FCKeditorTag.java 2008-05-21 06:38:44 UTC (rev 943) @@ -0,0 +1,697 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 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 library. + * + * Version: 2.3 + * Modified: 2005-08-11 16:29:00 + * + * File Authors: + * Simone Chiaretta (simo****@users*****) + */ + + +package jp.sf.pal.wcm.tags; + +import jp.sf.pal.wcm.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 container}.<br> + *<p> + * <b>Simple usage</b>: + * <pre> + * <FCK:editor + * id="EditorAccessibility" + * width="80%" + * height="120" + * toolbarSet="Accessibility" + * ">This is another test. <BR><BR>The "Second" row.</BR></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/" + * styleNames=";Style 1;Style 2; Style 3" + * fontNames=";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 the optional attributes to set some advanced configuration settings. + * + + * @author Simone Chiaretta (simo****@users*****) + */ +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 customConfigurationsPath = null; + private String editorAreaCSS = null; + private String baseHref = null; + private String skinPath = null; + private String pluginsPath = null; + private String fullPage = null; + private String debug = null; + private String autoDetectLanguage = null; + private String defaultLanguage = null; + private String contentLangDirection = null; + private String enableXHTML = null; + private String enableSourceXHTML = null; + private String fillEmptyBlocks = null; + private String formatSource = null; + private String formatOutput = null; + private String formatIndentator = null; + private String geckoUseSPAN = null; + private String startupFocus = null; + private String forcePasteAsPlainText = null; + private String forceSimpleAmpersand = null; + private String tabSpaces = null; + private String useBROnCarriageReturn = null; + private String toolbarStartExpanded = null; + private String toolbarCanCollapse = null; + private String fontColors = null; + private String fontNames = null; + private String fontSizes = null; + private String fontFormats = null; + private String stylesXmlPath = null; + private String linkBrowserURL = null; + private String imageBrowserURL = null; + private String flashBrowserURL = null; + private String linkUploadURL = null; + private String imageUploadURL = null; + private String flashUploadURL = null; + + + + + /** + * The underlying FCKeditor object + * + */ + protected FCKeditor fcked = null; + + + /** + * Set the unique id of the editor + * + * @param value name + */ + public void setId(String value) { + id=value; + } + + /** + * Set the dir where the FCKeditor files reside on the server + * + * @param value path + */ + public void setBasePath(String value) { + basePath=value; + } + + /** + * Set the name of the toolbar to display + * + * @param value toolbar name + */ + public void setToolbarSet(String value) { + toolbarSet=value; + } + + /** + * Set the width of the textarea + * + * @param value width + */ + public void setWidth(String value) { + width=value; + } + + /** + * Set the height of the textarea + * + * @param value height + */ + public void setHeight(String value) { + height=value; + } + + /** + * Set the path of a custom file that can override some configurations.<br> + * It is recommended to use absolute paths (starting with /), like "/myfckconfig.js". + * + * @param value path + */ + public void setCustomConfigurationsPath(String value) { + customConfigurationsPath=value; + } + + + /** + * Set the CSS styles file to be used in the editing area.<br> + * In this way you can point to a file that reflects your web site styles. + * + * @param value path + */ + public void setEditorAreaCSS(String value) { + editorAreaCSS=value; + } + + + /** + * Base URL used to resolve links (on images, links, styles, etc.).<br> + * For example, if BaseHref is set to 'http://www.fredck.com', an image that points to "/images/Logo.gif" will be interpreted by the editor as "http://www.fredck.com/images/Logo.gif", without touching the "src" attribute of the image. + * + * @param value URL + */ + public void setBaseHref(String value) { + baseHref=value; + } + + + /** + * Sets the path to the skin (graphical interface settings) to be used by the editor. + * + * @param value path + */ + public void setSkinPath(String value) { + skinPath=value; + } + + + /** + * Sets the base path used when looking for registered plugins. + * + * @param value path + */ + public void setPluginsPath(String value) { + pluginsPath=value; + } + + + /** + * Enables full page editing (from <HTML> to </HTML>).<br> + * It also enables the "Page Properties" toolbar button. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setFullPage(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("fullPage attribute can only be true or false"); + fullPage=value; + } + + + /** + * Enables the debug window to be shown when calling the FCKDebug.Output() function. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setDebug(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("debug attribute can only be true or false"); + debug=value; + } + + + /** + * Tells the editor to automatically detect the user language preferences to adapt its interface language.<br> + * With Internet Explorer, the language configured in the Windows Control Panel is used.<br> + * With Firefox, the browser language is used. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setAutoDetectLanguage(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("autoDetectLanguage attribute can only be true or false: here was " + value); + autoDetectLanguage=value; + } + + + /** + * Sets the default language used for the editor's interface localization.<br> + * The default language is used when the AutoDetectLanguage options is disabled or when the user language is not available. + * + * @param value language code + */ + public void setDefaultLanguage(String value) { + defaultLanguage=value; + } + + + /** + * Sets the direction of the editor area contents.<br> + * The possible values are: + * <ul> + * <li>ltr - Left to Right + * <li>rtl - Right to Left + * </ul> + * + * @param value ltr/rtl + * @throws JspException if value is not ltr or rtl + */ + public void setContentLangDirection(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("debug attribute can only be ltr or rtl"); + contentLangDirection=value; + } + + + /** + * Tells the editor to process the HTML source to XHTML on form post. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setEnableXHTML(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("enableXHTML attribute can only be true or false"); + enableXHTML=value; + } + + + /** + * Tells the editor to process the HTML source to XHTML when switching from WYSIWYG to Source view + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setEnableSourceXHTML(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("enableSourceXHTML attribute can only be true or false"); + enableSourceXHTML=value; + } + + + /** + * Block elements (like P, DIV, H1, PRE, etc...) are forced to have content (a &nbsp;).<br> + * Empty blocks are "collapsed" by while browsing, so a empty <p></p> is not visible.<br> + * While editing, the editor "expand" empty blocks so you can insert content inside then.<br> + * Setting this option to "true" results useful to reflect the same output when browsing and editing. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setFillEmptyBlocks(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("fillEmptyBlocks attribute can only be true or false"); + fillEmptyBlocks=value; + } + + + /** + * The HTML shown by the editor, while switching from WYSIWYG to Source views, will be processed and formatted + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setFormatSource(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("formatSource attribute can only be true or false"); + formatSource=value; + } + + + /** + * The output HTML generated by the editor will be processed and formatted. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setFormatOutput(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("formatOutput attribute can only be true or false"); + formatOutput=value; + } + + /** + * Sets the characters to be used when indenting the HTML source when formatting it.<BR> + * Useful values are a sequence of spaces (' ') or a tab char ('\t'). + * + * @param value indentator + */ + public void setFormatIndentator(String value) { + formatIndentator=value; + } + + + /** + * Tells Gecko browsers to use SPAN instead of <B>, <I> and <U> for bold, italic an underline + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setGeckoUseSPAN(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("GeckoUseSPAN attribute can only be true or false"); + geckoUseSPAN=value; + } + + + /** + * Forces the editor to get the keyboard input focus on startup (page load) + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setStartupFocus(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("startupFocus attribute can only be true or false"); + startupFocus=value; + } + + + /** + * Converts the clipboard contents to pure text on pasting operations + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setForcePasteAsPlainText(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("forcePasteAsPlainText attribute can only be true or false"); + forcePasteAsPlainText=value; + } + + + /** + * Forces the ampersands (&) on tags attributes to not be converted to "&amp;"<BR> + * This conversion is a W3C requirement for XHTML, so it is recommended to leave this option to "false". + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setForceSimpleAmpersand(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("forceSimpleAmpersand attribute can only be true or false"); + forceSimpleAmpersand=value; + } + + + /** + * Set the number of spaces (&nbsp;) to be inserted when the user hits the "tab" key.<BR> + * This is an Internet Explorer only feature. Other browsers insert spaces automatically by default. + * + * @param value number of spaces + */ + public void setTabSpaces(String value) { + tabSpaces=value; + } + + + /** + * Inserts a <BR> tag when the user hits the "enter" key, instead of starting a new paragraph (<P> or <DIV>).<BR> + * This is an Internet Explorer only feature. Other browsers insert the <BR> tag by default. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setUseBROnCarriageReturn(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("useBROnCarriageReturn attribute can only be true or false"); + useBROnCarriageReturn=value; + } + + + /** + * The toolbar is Expanded on startup, otherwise it is Collapsed and the user must click on it to show it. + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setToolbarStartExpanded(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("ToolbarStartExpanded attribute can only be true or false"); + toolbarStartExpanded=value; + } + + + /** + * Tells the editor that the toolbar can be Collapsed/Expanded by the user when clicking the vertical bar placed on the left of it (on the right for "rtl" languages). + * + * @param value true/false + * @throws JspException if value is not true or false + */ + public void setToolbarCanCollapse(String value) throws JspException { + if(! value.equals("true") && ! value.equals("false")) + throw new JspException("ToolbarCanCollapse attribute can only be true or false"); + toolbarCanCollapse=value; + } + + + /** + * Sets the colors that must be shown in the colors panels (in the toolbar). + * + * @param value colors + */ + public void setFontColors(String value) { + fontColors=value; + } + + + /** + * Sets the list of fonts to be shown in the "Font" toolbar command. + * + * @param value fonts + */ + public void setFontNames(String value) { + fontNames=value; + } + + + /** + * Sets the list of font sizes to be shown in the "Size" toolbar command. + * + * @param value sizes + */ + public void setFontSizes(String value) { + fontSizes=value; + } + + + /** + * Sets the list of formats to be shown in the "Format" toolbar command. + * + * @param value format list + */ + public void setFontFormats(String value) { + fontFormats=value; + } + + + /** + * Sets the path to the XML file that has the definitions and rules of the styles used by the "Style" toolbar command + * + * @param value path + */ + public void setStylesXmlPath(String value) { + stylesXmlPath=value; + } + + + /** + * Sets the URL of the page called when the user clicks the "Browse Server" button in the "Link" dialog window.<BR> + * In this way, you can create your custom File Browser that is well integrated with your system. + * + * @param value path + */ + public void setLinkBrowserURL(String value) { + linkBrowserURL=value; + } + + + /** + * Sets the URL of the page called when the user clicks the "Browse Server" button in the "Image" dialog window.<BR> + * In this way, you can create your custom Image Browser that is well integrated with your system. + * + * @param value path + */ + public void setImageBrowserURL(String value) { + imageBrowserURL=value; + } + + /** + * Sets the URL of the page called when the user clicks the "Browse Server" button in the "Flash" dialog window.<BR> + * In this way, you can create your custom Flash Browser that is well integrated with your system. + * + * @param value path + */ + public void setFlashBrowserURL(String value) { + flashBrowserURL=value; + } + + + /** + * Sets the URL of the upload handler called when the user clicks the "Send it to server" button in the "Link" dialog window.<BR> + * In this way, you can create your custom Link Uploader that is well integrated with your system. + * + * @param value path + */ + public void setLinkUploadURL(String value) { + linkUploadURL=value; + } + + + /** + * Sets the URL of the upload handler called when the user clicks the "Send it to server" button in the "Image" dialog window.<BR> + * In this way, you can create your custom Image Uploader that is well integrated with your system. + * + * @param value path + */ + public void setImageUploadURL(String value) { + imageUploadURL=value; + } + + + /** + * Sets the URL of the upload handler called when the user clicks the "Send it to server" button in the "Flash" dialog window.<BR> + * In this way, you can create your custom Flash Uploader that is well integrated with your system. + * + * @param value path + */ + public void setFlashUploadURL(String value) { + flashUploadURL=value; + } + + + /** + * Initialize the FCKeditor container and set attributes + * + * @return EVAL_BODY_BUFFERED + */ + 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 (customConfigurationsPath != null) + fcked.getConfig().put("CustomConfigurationsPath",customConfigurationsPath); + if (editorAreaCSS != null) + fcked.getConfig().put("EditorAreaCSS",editorAreaCSS); + if (baseHref != null) + fcked.getConfig().put("BaseHref",baseHref); + if (skinPath != null) + fcked.getConfig().put("SkinPath",skinPath); + if (pluginsPath != null) + fcked.getConfig().put("PluginsPath",pluginsPath); + if (fullPage != null) + fcked.getConfig().put("FullPage",fullPage); + if (debug != null) + fcked.getConfig().put("Debug",debug); + if (autoDetectLanguage != null) + fcked.getConfig().put("AutoDetectLanguage",autoDetectLanguage); + if (defaultLanguage != null) + fcked.getConfig().put("DefaultLanguage",defaultLanguage); + if (contentLangDirection != null) + fcked.getConfig().put("ContentLangDirection",contentLangDirection); + if (enableXHTML != null) + fcked.getConfig().put("EnableXHTML",enableXHTML); + if (enableSourceXHTML != null) + fcked.getConfig().put("EnableSourceXHTML",enableSourceXHTML); + if (fillEmptyBlocks != null) + fcked.getConfig().put("FillEmptyBlocks",fillEmptyBlocks); + if (formatSource != null) + fcked.getConfig().put("FormatSource",formatSource); + if (formatOutput != null) + fcked.getConfig().put("FormatOutput",formatOutput); + if (formatIndentator != null) + fcked.getConfig().put("FormatIndentator",formatIndentator); + if (geckoUseSPAN != null) + fcked.getConfig().put("GeckoUseSPAN",geckoUseSPAN); + if (startupFocus != null) + fcked.getConfig().put("StartupFocus",startupFocus); + if (forcePasteAsPlainText != null) + fcked.getConfig().put("ForcePasteAsPlainText",forcePasteAsPlainText); + if (forceSimpleAmpersand != null) + fcked.getConfig().put("ForceSimpleAmpersand",forceSimpleAmpersand); + if (tabSpaces != null) + fcked.getConfig().put("TabSpaces",tabSpaces); + if (useBROnCarriageReturn != null) + fcked.getConfig().put("UseBROnCarriageReturn",useBROnCarriageReturn); + if (toolbarStartExpanded != null) + fcked.getConfig().put("ToolbarStartExpanded",toolbarStartExpanded); + if (toolbarCanCollapse != null) + fcked.getConfig().put("ToolbarCanCollapse",toolbarCanCollapse); + if (fontColors != null) + fcked.getConfig().put("FontColors",fontColors); + if (fontNames != null) + fcked.getConfig().put("FontNames",fontNames); + if (fontSizes != null) + fcked.getConfig().put("FontSizes",fontSizes); + if (fontFormats != null) + fcked.getConfig().put("FontFormats",fontFormats); + if (stylesXmlPath != null) + fcked.getConfig().put("StylesXmlPath",stylesXmlPath); + if (linkBrowserURL != null) + fcked.getConfig().put("LinkBrowserURL",linkBrowserURL); + if (imageBrowserURL != null) + fcked.getConfig().put("ImageBrowserURL",imageBrowserURL); + if (flashBrowserURL != null) + fcked.getConfig().put("FlashBrowserURL",flashBrowserURL); + if (linkUploadURL != null) + fcked.getConfig().put("LinkUploadURL",linkUploadURL); + if (imageUploadURL != null) + fcked.getConfig().put("ImageUploadURL",imageUploadURL); + if (flashUploadURL != null) + fcked.getConfig().put("FlashUploadURL",flashUploadURL); + + 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 while 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; + } + +} \ No newline at end of file Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/uploader/SimpleUploaderServlet.java =================================================================== --- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/uploader/SimpleUploaderServlet.java (rev 0) +++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/uploader/SimpleUploaderServlet.java 2008-05-21 06:38:44 UTC (rev 943) @@ -0,0 +1,252 @@ +/* + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2005 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: SimpleUploaderServlet.java + * Java File Uploader class. + * + * Version: 2.3 + * Modified: 2005-08-11 16:29:00 + * + * File Authors: + * Simone Chiaretta (simo****@users*****) + */ + +package jp.sf.pal.wcm.uploader; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.util.*; + + +import org.apache.commons.fileupload.*; + + +import javax.xml.parsers.*; +import org.w3c.dom.*; +import javax.xml.transform.*; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + + +/** + * Servlet to upload files.<br> + * + * This servlet accepts just file uploads, eventually with a parameter specifying file type + * + * @author Simone Chiaretta (simo****@users*****) + */ + +public class SimpleUploaderServlet extends HttpServlet { + + private static String baseDir; + private static boolean debug=false; + private static boolean enabled=false; + private static Hashtable allowedExtensions; + private static Hashtable deniedExtensions; + + /** + * Initialize the servlet.<br> + * Retrieve from the servlet configuration the "baseDir" which is the root of the file repository:<br> + * If not specified the value of "/UserFiles/" will be used.<br> + * Also it retrieve all allowed and denied extensions to be handled. + * + */ + public void init() throws ServletException { + + debug=(new Boolean(getInitParameter("debug"))).booleanValue(); + + if(debug) System.out.println("\r\n---- SimpleUploaderServlet initialization started ----"); + + baseDir=getInitParameter("baseDir"); + enabled=(new Boolean(getInitParameter("enabled"))).booleanValue(); + if(baseDir==null) + baseDir="/UserFiles/"; + String realBaseDir=getServletContext().getRealPath(baseDir); + File baseFile=new File(realBaseDir); + if(!baseFile.exists()){ + baseFile.mkdir(); + } + + allowedExtensions = new Hashtable(3); + deniedExtensions = new Hashtable(3); + + allowedExtensions.put("File",stringToArrayList(getInitParameter("AllowedExtensionsFile"))); + deniedExtensions.put("File",stringToArrayList(getInitParameter("DeniedExtensionsFile"))); + + allowedExtensions.put("Image",stringToArrayList(getInitParameter("AllowedExtensionsImage"))); + deniedExtensions.put("Image",stringToArrayList(getInitParameter("DeniedExtensionsImage"))); + + allowedExtensions.put("Flash",stringToArrayList(getInitParameter("AllowedExtensionsFlash"))); + deniedExtensions.put("Flash",stringToArrayList(getInitParameter("DeniedExtensionsFlash"))); + + if(debug) System.out.println("---- SimpleUploaderServlet initialization completed ----\r\n"); + + } + + + /** + * Manage the Upload requests.<br> + * + * The servlet accepts commands sent in the following format:<br> + * simpleUploader?Type=ResourceType<br><br> + * It store the file (renaming it in case a file with the same name exists) and then return an HTML file + * with a javascript command in it. + * + */ + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + if (debug) System.out.println("--- BEGIN DOPOST ---"); + + response.setContentType("text/html; charset=UTF-8"); + response.setHeader("Cache-Control","no-cache"); + PrintWriter out = response.getWriter(); + + + String typeStr=request.getParameter("Type"); + + String currentPath=baseDir+typeStr; + String currentDirPath=getServletContext().getRealPath(currentPath); + currentPath=request.getContextPath()+currentPath; + + if (debug) System.out.println(currentDirPath); + + String retVal="0"; + String newName=""; + String fileUrl=""; + String errorMessage=""; + + if(enabled) { + DiskFileUpload upload = new DiskFileUpload(); + try { + List items = upload.parseRequest(request); + + Map fields=new HashMap(); + + Iterator iter = items.iterator(); + while (iter.hasNext()) { + FileItem item = (FileItem) iter.next(); + if (item.isFormField()) + fields.put(item.getFieldName(),item.getString()); + else + fields.put(item.getFieldName(),item); + } + FileItem uplFile=(FileItem)fields.get("NewFile"); + String fileNameLong=uplFile.getName(); + fileNameLong=fileNameLong.replace('\\','/'); + String[] pathParts=fileNameLong.split("/"); + String fileName=pathParts[pathParts.length-1]; + + String nameWithoutExt=getNameWithoutExtension(fileName); + String ext=getExtension(fileName); + File pathToSave=new File(currentDirPath,fileName); + fileUrl=currentPath+"/"+fileName; + if(extIsAllowed(typeStr,ext)) { + int counter=1; + while(pathToSave.exists()){ + newName=nameWithoutExt+"("+counter+")"+"."+ext; + fileUrl=currentPath+"/"+newName; + retVal="201"; + pathToSave=new File(currentDirPath,newName); + counter++; + } + uplFile.write(pathToSave); + } + else { + retVal="202"; + errorMessage=""; + if (debug) System.out.println("Invalid file type: " + ext); + } + }catch (Exception ex) { + if (debug) ex.printStackTrace(); + retVal="203"; + } + } + else { + retVal="1"; + errorMessage="This file uploader is disabled. Please check the WEB-INF/web.xml file"; + } + + + out.println("<script type=\"text/javascript\">"); + out.println("window.parent.OnUploadCompleted("+retVal+",'"+fileUrl+"','"+newName+"','"+errorMessage+"');"); + out.println("</script>"); + out.flush(); + out.close(); + + if (debug) System.out.println("--- END DOPOST ---"); + + } + + + /* + * This method was fixed after Kris Barnhoorn (kurioskronic) submitted SF bug #991489 + */ + private static String getNameWithoutExtension(String fileName) { + return fileName.substring(0, fileName.lastIndexOf(".")); + } + + /* + * This method was fixed after Kris Barnhoorn (kurioskronic) submitted SF bug #991489 + */ + private String getExtension(String fileName) { + return fileName.substring(fileName.lastIndexOf(".")+1); + } + + + + /** + * Helper function to convert the configuration string to an ArrayList. + */ + + private ArrayList stringToArrayList(String str) { + + if(debug) System.out.println(str); + String[] strArr=str.split("\\|"); + + ArrayList tmp=new ArrayList(); + if(str.length()>0) { + for(int i=0;i<strArr.length;++i) { + if(debug) System.out.println(i +" - "+strArr[i]); + tmp.add(strArr[i].toLowerCase()); + } + } + return tmp; + } + + + /** + * Helper function to verify if a file extension is allowed or not allowed. + */ + + private boolean extIsAllowed(String fileType, String ext) { + + ext=ext.toLowerCase(); + + ArrayList allowList=(ArrayList)allowedExtensions.get(fileType); + ArrayList denyList=(ArrayList)deniedExtensions.get(fileType); + + if(allowList.size()==0) + if(denyList.contains(ext)) + return false; + else + return true; + + if(denyList.size()==0) + if(allowList.contains(ext)) + return true; + else + return false; + + return false; + } + +} + Added: pal-wcm/trunk/src/main/webapp/WEB-INF/tld/FCKeditor.tld =================================================================== --- pal-wcm/trunk/src/main/webapp/WEB-INF/tld/FCKeditor.tld (rev 0) +++ pal-wcm/trunk/src/main/webapp/WEB-INF/tld/FCKeditor.tld 2008-05-21 06:38:44 UTC (rev 943) @@ -0,0 +1,214 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> + +<taglib> + <tlibversion>2.3</tlibversion> + <jspversion>1.1</jspversion> + <shortname>FCKeditor</shortname> + <uri>http://fckeditor.net/tags-fckeditor</uri> + <info>FCKeditor taglib</info> + <tag> + <name>editor</name> + <tagclass>jp.sf.pal.wcm.tags.FCKeditorTag</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>id</name> + <required>true</required> + </attribute> + <attribute> + <name>basePath</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>toolbarSet</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>width</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>height</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>customConfigurationsPath</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>editorAreaCSS</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>baseHref</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>skinPath</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>pluginsPath</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>fullPage</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>debug</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>autoDetectLanguage</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>defaultLanguage</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>contentLangDirection</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>enableXHTML</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>enableSourceXHTML</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>fillEmptyBlocks</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>formatSource</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>formatOutput</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>formatIndentator</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>geckoUseSPAN</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>startupFocus</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>forcePasteAsPlainText</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>forceSimpleAmpersand</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>tabSpaces</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>useBROnCarriageReturn</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>toolbarStartExpanded</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>toolbarCanCollapse</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>fontColors</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>fontNames</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>fontSizes</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>fontFormats</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>stylesXmlPath</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>linkBrowserURL</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>imageBrowserURL</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>flashBrowserURL</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>linkUploadURL</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>imageUploadURL</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>flashUploadURL</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> +</taglib> \ No newline at end of file Added: pal-wcm/trunk/src/main/webapp/WEB-INF/tld/portlet.tld =================================================================== --- pal-wcm/trunk/src/main/webapp/WEB-INF/tld/portlet.tld (rev 0) +++ pal-wcm/trunk/src/main/webapp/WEB-INF/tld/portlet.tld 2008-05-21 06:38:44 UTC (rev 943) @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!-- +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. +--> +<!DOCTYPE taglib PUBLIC + "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" + "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> +<taglib> + <tlibversion>1.0</tlibversion> + <jspversion>1.1</jspversion> + <shortname>Tags for portlets</shortname> + <tag> + <name>defineObjects</name> + <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass> + <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass> + <bodycontent>empty</bodycontent> + </tag> + <tag> + <name>param</name> + <tagclass>org.apache.pluto.tags.ParamTag</tagclass> + <bodycontent>empty</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + <tag> + <name>actionURL</name> + <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass> + <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>windowState</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>portletMode</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>secure</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + <tag> + <name>renderURL</name> + <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass> + <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>windowState</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>portletMode</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>secure</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + <tag> + <name>namespace</name> + <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass> + <bodycontent>empty</bodycontent> + </tag> +</taglib> Modified: pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml =================================================================== --- pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml 2008-05-19 05:31:45 UTC (rev 942) +++ pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml 2008-05-21 06:38:44 UTC (rev 943) @@ -20,6 +20,7 @@ <web-app> <display-name>WCM Portlet</display-name> <description>Web Content Management for PAL Portal.</description> +<!-- <servlet> <servlet-name>FileuploadServlet</servlet-name> <servlet-class>jp.sf.pal.wcm.servlet.FileuploadServlet</servlet-class> @@ -32,10 +33,6 @@ <servlet-name>FileconnectorServlet</servlet-name> <servlet-class>jp.sf.pal.wcm.servlet.FileconnectorServlet</servlet-class> </servlet> - <servlet> - <servlet-name>FilesaveServlet</servlet-name> - <servlet-class>jp.sf.pal.wcm.servlet.FilesaveServlet</servlet-class> - </servlet> <servlet-mapping> <servlet-name>FileuploadServlet</servlet-name> <url-pattern>/fileupload</url-pattern> @@ -48,8 +45,81 @@ <servlet-name>FileconnectorServlet</servlet-name> <url-pattern>/fileconnector</url-pattern> </servlet-mapping> +--> + <servlet> + <servlet-name>FilesaveServlet</servlet-name> + <servlet-class>jp.sf.pal.wcm.servlet.FilesaveServlet</servlet-class> + </servlet> + + <servlet> + <servlet-name>Connector</servlet-name> + <servlet-class>jp.sf.pal.wcm.connector.ConnectorServlet</servlet-class> + <init-param> + <param-name>baseDir</param-name> + <param-value>/UserFiles/</param-value> + </init-param> + <init-param> + <param-name>debug</param-name> + <param-value>false</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet> + <servlet-name>SimpleUploader</servlet-name> + <servlet-class>jp.sf.pal.wcm.uploader.SimpleUploaderServlet</servlet-class> + <init-param> + <param-name>baseDir</param-name> + <param-value>/UserFiles/</param-value> + </init-param> + <init-param> + <param-name>debug</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>enabled</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>AllowedExtensionsFile</param-name> + <param-value></param-value> + </init-param> + <init-param> + <param-name>DeniedExtensionsFile</param-name> + <param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value> + </init-param> + <init-param> + <param-name>AllowedExtensionsImage</param-name> + <param-value>jpg|gif|jpeg|png|bmp</param-value> + </init-param> + <init-param> + <param-name>DeniedExtensionsImage</param-name> + <param-value></param-value> + </init-param> + <init-param> + <param-name>AllowedExtensionsFlash</param-name> + <param-value>swf|fla</param-value> + </init-param> + <init-param> + <param-name>DeniedExtensionsFlash</param-name> + <param-value></param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> <servlet-name>FilesaveServlet</servlet-name> <url-pattern>/filesave</url-pattern> </servlet-mapping> + + <servlet-mapping> + <servlet-name>Connector</servlet-name> + <url-pattern>/fckeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>SimpleUploader</servlet-name> + <url-pattern>/fckeditor/editor/filemanager/upload/simpleuploader</url-pattern> + </servlet-mapping> + </web-app> Modified: pal-wcm/trunk/src/main/webapp/index.jsp =================================================================== --- pal-wcm/trunk/src/main/webapp/index.jsp 2008-05-19 05:31:45 UTC (rev 942) +++ pal-wcm/trunk/src/main/webapp/index.jsp 2008-05-21 06:38:44 UTC (rev 943) @@ -1,3 +1,4 @@ +<%@ taglib uri="/WEB-INF/tld/FCKeditor.tld" prefix="FCK" %> <%@ page language="java" import="jp.sf.pal.wcm.*, java.util.*, java.io.File, java.io.FileReader, java.io.BufferedReader, javax.servlet.ServletContext" %> <!-- * FCKeditor - The text editor for internet @@ -55,12 +56,17 @@ } catch (Exception e){ e.printStackTrace(); } -FCKeditor oFCKeditor ; -oFCKeditor = new FCKeditor( request, "EditorDefault" ) ; -oFCKeditor.setBasePath( "/FCKeditor/" ) ; -oFCKeditor.setValue( contents ); -out.println( oFCKeditor.create() ) ; %> + <FCK:editor id="EditorDefault" basePath="fckeditor/" + imageBrowserURL="/pal-wcm/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" + linkBrowserURL="/pal-wcm/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" + flashBrowserURL="/pal-wcm/fckeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" + imageUploadURL="/pal-wcm/fckeditor/editor/filemanager/upload/simpleuploader?Type=Image" + linkUploadURL="/pal-wcm/fckeditor/editor/filemanager/upload/simpleuploader?Type=File" + flashUploadURL="/pal-wcm/fckeditor/editor/filemanager/upload/simpleuploader?Type=Flash"> + <%= contents %> + </FCK:editor> + <br> <input type="submit" value="Submit"> <input type="hidden" name="fragID" value="<%=fragID%>">