[pal-cvs 2263] [74] fileupload supported.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 4月 22日 (日) 07:58:35 JST


Revision: 74
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=74
Author:   shinsuke
Date:     2007-04-22 07:58:35 +0900 (Sun, 22 Apr 2007)

Log Message:
-----------
fileupload supported.

Modified Paths:
--------------
    pal-wcm/trunk/.classpath
    pal-wcm/trunk/pom.xml
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/PALWcmConstants.java
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/portlet/PALWcmPortlet.java
    pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml
    pal-wcm/trunk/src/main/webapp/view/wcm/wcmEdit.jsp

Added Paths:
-----------
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileuploadServlet.java
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/
    pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/PALWcmUtil.java


-------------- next part --------------
Modified: pal-wcm/trunk/.classpath
===================================================================
--- pal-wcm/trunk/.classpath	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/.classpath	2007-04-21 22:58:35 UTC (rev 74)
@@ -3,13 +3,18 @@
   <classpathentry kind="src" path="src/main/resources"/>
   <classpathentry kind="output" path="target/classes"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/jp/sf/pal/common-utils/0.2-SNAPSHOT/common-utils-0.2-SNAPSHOT.jar" sourcepath="M2_REPO/jp/sf/pal/common-utils/0.2-SNAPSHOT/common-utils-0.2-SNAPSHOT-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/apache/pluto/pluto/1.0.1/pluto-1.0.1.jar"/>
   <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.3/commons-lang-2.3.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar"/>
   <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/portlet-api/portlet-api/1.0/portlet-api-1.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/portals/jetspeed-2/jetspeed-api/2.2-dev/jetspeed-api-2.2-dev.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4/mail-1.4.jar"/>
   <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar" sourcepath="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar" sourcepath="M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.3/commons-io-1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/portals/jetspeed-2/jetspeed-api/2.2-dev/jetspeed-api-2.2-dev.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
 </classpath>
\ No newline at end of file

Modified: pal-wcm/trunk/pom.xml
===================================================================
--- pal-wcm/trunk/pom.xml	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/pom.xml	2007-04-21 22:58:35 UTC (rev 74)
@@ -129,6 +129,11 @@
   </repositories>
   <dependencies>
     <dependency>
+      <groupId>jp.sf.pal</groupId>
+      <artifactId>common-utils</artifactId>
+      <version>0.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
       <groupId>portlet-api</groupId>
       <artifactId>portlet-api</artifactId>
       <version>1.0</version>
@@ -145,6 +150,16 @@
       <version>1.1.2</version>
     </dependency>
     <dependency>
+      <groupId>commons-fileupload</groupId>
+      <artifactId>commons-fileupload</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.3</version>
+    </dependency>
+    <dependency>
       <groupId>commons-lang</groupId>
       <artifactId>commons-lang</artifactId>
       <version>2.3</version>

Modified: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/PALWcmConstants.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/PALWcmConstants.java	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/PALWcmConstants.java	2007-04-21 22:58:35 UTC (rev 74)
@@ -16,4 +16,17 @@
 
     public static final String PORTAL_CONTEXT_PATH = PREFIX
             + "PortalContextPath";
+
+    public static final String NAME_SERVLET_PARAM = "name";
+
+    public static final String TYPE_SERVLET_PARAM = "type";
+
+    public static final String NAMESPACE_SERVLET_PARAM = "namespace";
+
+    public static final String DEFAULT_UPLOAD_DIR = "/WEB-INF/upload";
+
+    public static final String UPLOAD_DIRECTORY_KEY = "upload-directory";
+
+    public static final String LOGIN_USER_NAME = PREFIX + "LoginUserName";
+
 }

Modified: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/portlet/PALWcmPortlet.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/portlet/PALWcmPortlet.java	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/portlet/PALWcmPortlet.java	2007-04-21 22:58:35 UTC (rev 74)
@@ -28,6 +28,7 @@
 import javax.portlet.PortletMode;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSession;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 
@@ -108,6 +109,8 @@
     {
         response.setContentType("text/html");
 
+        storeLoginStatus(request);
+
         Fragment fragment = getCurrentFragment(request);
         String title = getFragmentPreferenceValue(fragment,
                 PALWcmConstants.TITLE, "");
@@ -258,4 +261,19 @@
         }
         return defaultValue;
     }
+
+    protected void storeLoginStatus(PortletRequest request)
+    {
+        PortletSession portletSession = request.getPortletSession();
+        if (request.getRemoteUser() != null)
+        {
+            portletSession.setAttribute(PALWcmConstants.LOGIN_USER_NAME,
+                    request.getRemoteUser(), PortletSession.APPLICATION_SCOPE);
+        }
+        else
+        {
+            portletSession.removeAttribute(PALWcmConstants.LOGIN_USER_NAME,
+                    PortletSession.APPLICATION_SCOPE);
+        }
+    }
 }

Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileuploadServlet.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileuploadServlet.java	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileuploadServlet.java	2007-04-21 22:58:35 UTC (rev 74)
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2004-2006 the Seasar Foundation and the Others.
+ *
+ * Licensed 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.
+ */
+package jp.sf.pal.wcm.servlet;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import jp.sf.pal.wcm.PALWcmConstants;
+import jp.sf.pal.wcm.util.PALWcmUtil;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author shinsuke
+ *
+ */
+public class FileuploadServlet extends HttpServlet
+{
+
+    /**
+     * Logger for this class
+     */
+    private static final Log log = LogFactory.getLog(FileuploadServlet.class);
+
+    /**
+     * Serial Version UID
+     */
+    private static final long serialVersionUID = 2542877848615221862L;
+
+    /* (non-Javadoc)
+     * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException
+    {
+        printResponse(resp.getWriter(), HttpServletResponse.SC_NOT_IMPLEMENTED,
+                "", "", "GET method is not supported.");
+    }
+
+    /* (non-Javadoc)
+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    @Override
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException
+    {
+        // check login
+        //        if (req.getRemoteUser() == null)
+        if (req.getSession().getAttribute(PALWcmConstants.LOGIN_USER_NAME) == null)
+        {
+            printResponse(resp.getWriter(), HttpServletResponse.SC_FORBIDDEN,
+                    "", "", "Please login to Portal.");
+            return;
+        }
+
+        // check namespace
+        String namespace = req
+                .getParameter(PALWcmConstants.NAMESPACE_SERVLET_PARAM);
+        if (namespace == null)
+        {
+            printResponse(resp.getWriter(), HttpServletResponse.SC_BAD_REQUEST,
+                    "", "",
+                    "Invalid parameters. You needs to specify a namespace.");
+            return;
+        }
+
+        String type = req.getParameter(PALWcmConstants.TYPE_SERVLET_PARAM);
+        if (type == null)
+        {
+            printResponse(resp.getWriter(), HttpServletResponse.SC_BAD_REQUEST,
+                    "", "", "Invalid parameters. You needs to specify a type.");
+            return;
+        }
+
+        try
+        {
+            //          Create a factory for disk-based file items
+            FileItemFactory factory = new DiskFileItemFactory();
+
+            //             Create a new file upload handler
+            ServletFileUpload upload = new ServletFileUpload(factory);
+
+            //             Parse the request
+            List /* FileItem */items = upload.parseRequest(req);
+
+            Iterator ite = items.iterator();
+            while (ite.hasNext())
+            {
+                FileItem item = (FileItem) ite.next();
+                if (!item.isFormField())
+                {
+                    String clientFullFileName = item.getName();
+                    clientFullFileName = clientFullFileName.replace('\\', '/');
+                    String[] pathParts = clientFullFileName.split("/");
+                    String fileName = pathParts[pathParts.length - 1];
+
+                    String baseUploadDir = PALWcmUtil
+                            .getBaseUploadDir(getServletContext());
+                    checkUploadDir(baseUploadDir, namespace, type);
+
+                    String storeFileName = baseUploadDir + "/" + namespace
+                            + "/" + type + "/" + fileName;
+                    item.write(new File(storeFileName));
+
+                    String fileUrl = req.getContextPath() + "/fileview?"
+                            + PALWcmConstants.NAMESPACE_SERVLET_PARAM + "="
+                            + namespace + "&"
+                            + PALWcmConstants.TYPE_SERVLET_PARAM + "=" + type
+                            + "&" + PALWcmConstants.NAME_SERVLET_PARAM + "="
+                            + fileName;
+
+                    printResponse(resp.getWriter(), /*HttpServletResponse.SC_OK*/
+                            0, fileUrl, fileName, "");
+                    return;
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            printResponse(resp.getWriter(),
+                    HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "", "",
+                    "Internal server error. ");
+            log.error("Internal server error.", e);
+        }
+
+        printResponse(resp.getWriter(),
+                HttpServletResponse.SC_SERVICE_UNAVAILABLE, "", "",
+                "Could not find an upload file.");
+
+    }
+
+    protected void printResponse(PrintWriter writer, int retVal,
+            String fileUrl, String fileName, String errorMessage)
+    {
+        writer.print("<script type=\"text/javascript\">\n"
+                + "window.parent.OnUploadCompleted( " + retVal + ", '"
+                + fileUrl + "', '" + fileName + "','" + errorMessage + "') ;\n"
+                + "</script>");
+    }
+
+    protected boolean checkUploadDir(String baseDir, String namespace,
+            String type)
+    {
+        File baseUploadDir = new File(baseDir);
+        if (!baseUploadDir.exists())
+        {
+            if (!baseUploadDir.mkdir())
+            {
+                return false;
+            }
+        }
+
+        File namespaceDir = new File(baseDir + "/" + namespace);
+        if (!namespaceDir.exists())
+        {
+            if (!namespaceDir.mkdir())
+            {
+                return false;
+            }
+        }
+
+        File typeDir = new File(namespaceDir, type);
+        if (!typeDir.exists())
+        {
+            if (!typeDir.mkdir())
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+}


Property changes on: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileuploadServlet.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java	2007-04-21 22:58:35 UTC (rev 74)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2004-2006 the Seasar Foundation and the Others.
+ *
+ * Licensed 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.
+ */
+package jp.sf.pal.wcm.servlet;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import jp.sf.pal.common.util.DownloadUtil;
+import jp.sf.pal.wcm.PALWcmConstants;
+import jp.sf.pal.wcm.util.PALWcmUtil;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author shinsuke
+ *
+ */
+public class FileviewServlet extends HttpServlet
+{
+    /**
+     * Logger for this class
+     */
+    private static final Log log = LogFactory.getLog(FileviewServlet.class);
+
+    /**
+     * Serial Version UID
+     */
+    private static final long serialVersionUID = -3615197107588820314L;
+
+    /* (non-Javadoc)
+     * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException
+    {
+        String namespace = req
+                .getParameter(PALWcmConstants.NAMESPACE_SERVLET_PARAM);
+        String type = req.getParameter(PALWcmConstants.TYPE_SERVLET_PARAM);
+        String name = req.getParameter(PALWcmConstants.NAME_SERVLET_PARAM);
+        if (namespace == null || type == null || name == null)
+        {
+            resp.sendError(HttpServletResponse.SC_NOT_FOUND,
+                    "namespace or path are null.");
+            return;
+        }
+
+        String targetPath = PALWcmUtil.getBaseUploadDir(getServletContext())
+                + "/" + namespace + "/" + type + "/" + name;
+        File targetFile = new File(targetPath.replaceAll("\\.\\.", "")
+                .replaceAll("/+", "/"));
+
+        if (targetFile.exists())
+        {
+            // mime type
+            String mimeType = DownloadUtil.getMimeType(getServletContext(),
+                    name);
+            if (mimeType == null)
+            {
+                mimeType = DownloadUtil.OCTET_STREAM;
+            }
+            // store
+            DownloadUtil.writeResponse(req, resp, mimeType, name,
+                    new FileInputStream(targetFile));
+        }
+        else
+        {
+            resp.sendError(HttpServletResponse.SC_NOT_FOUND, targetPath
+                    + " was not found.");
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    @Override
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException
+    {
+        doGet(req, resp);
+    }
+
+}


Property changes on: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/servlet/FileviewServlet.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/PALWcmUtil.java
===================================================================
--- pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/PALWcmUtil.java	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/PALWcmUtil.java	2007-04-21 22:58:35 UTC (rev 74)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004-2006 the Seasar Foundation and the Others.
+ *
+ * Licensed 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.
+ */
+package jp.sf.pal.wcm.util;
+
+import javax.portlet.PortletContext;
+import javax.servlet.ServletContext;
+
+import jp.sf.pal.wcm.PALWcmConstants;
+
+/**
+ * @author shinsuke
+ *
+ */
+public class PALWcmUtil
+{
+    public static String getMimeType(Object context, String filename)
+    {
+        if (context instanceof ServletContext)
+        {
+            ServletContext servletContext = (ServletContext) context;
+            return servletContext.getMimeType(filename);
+        }
+        else if (context instanceof PortletContext)
+        {
+            PortletContext portletContext = (PortletContext) context;
+            return portletContext.getMimeType(filename);
+        }
+        return null;
+    }
+
+    public static String getBaseUploadDir(ServletContext servletContext)
+    {
+        String uploadDir = servletContext
+                .getInitParameter(PALWcmConstants.UPLOAD_DIRECTORY_KEY);
+        if (uploadDir == null)
+        {
+            uploadDir = servletContext
+                    .getRealPath(PALWcmConstants.DEFAULT_UPLOAD_DIR);
+        }
+        return uploadDir;
+    }
+}


Property changes on: pal-wcm/trunk/src/main/java/jp/sf/pal/wcm/util/PALWcmUtil.java
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml
===================================================================
--- pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/src/main/webapp/WEB-INF/web.xml	2007-04-21 22:58:35 UTC (rev 74)
@@ -20,4 +20,20 @@
 <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>
+  </servlet>
+  <servlet>
+      <servlet-name>FileviewServlet</servlet-name>
+      <servlet-class>jp.sf.pal.wcm.servlet.FileviewServlet</servlet-class>
+  </servlet>
+  <servlet-mapping>
+      <servlet-name>FileuploadServlet</servlet-name>
+      <url-pattern>/fileupload</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+      <servlet-name>FileviewServlet</servlet-name>
+      <url-pattern>/fileview</url-pattern>
+  </servlet-mapping>
 </web-app>

Modified: pal-wcm/trunk/src/main/webapp/view/wcm/wcmEdit.jsp
===================================================================
--- pal-wcm/trunk/src/main/webapp/view/wcm/wcmEdit.jsp	2007-04-21 22:55:58 UTC (rev 73)
+++ pal-wcm/trunk/src/main/webapp/view/wcm/wcmEdit.jsp	2007-04-21 22:58:35 UTC (rev 74)
@@ -34,13 +34,21 @@
   </div>
   
   <div style="clear:both;">
-<script type="text/javascript" src="<%= renderRequest.getAttribute(jp.sf.pal.wcm.PALWcmConstants.PORTAL_CONTEXT_PATH) %>/fckeditor/fckeditor.js"></script>
+<script type="text/javascript" src="<%= renderRequest.getContextPath() %>/fckeditor/fckeditor.js"></script>
 <script type="text/javascript">
 <!--
 var <portlet:namespace/>FCKeditor = new FCKeditor("<%= PALWcmConstants.CONTENT %>");
-<portlet:namespace/>FCKeditor.BasePath = "<%= renderRequest.getAttribute(jp.sf.pal.wcm.PALWcmConstants.PORTAL_CONTEXT_PATH) %>/fckeditor/";
+<portlet:namespace/>FCKeditor.BasePath = "<%= renderRequest.getContextPath() %>/fckeditor/";
 <portlet:namespace/>FCKeditor.Value = "<%= renderRequest.getAttribute(PALWcmConstants.CONTENT) %>";
 <portlet:namespace/>FCKeditor.Height = 480;
+var url = '<%= renderRequest.getContextPath() %>/filebrowse?namespace=<portlet:namespace/>';
+//<portlet:namespace/>FCKeditor.Config['LinkBrowserURL'] = url + '?Connector=' + connector + '&ServerPath=' + path;
+//<portlet:namespace/>FCKeditor.Config['ImageBrowserURL'] = url + '?Connector=' + connector + '&ServerPath=' + path + '&Type=Image';
+//<portlet:namespace/>FCKeditor.Config['FlashBrowserURL'] = url + '?Connector=' + connector + '&ServerPath=' + path + '&Type=Flash';
+url = '<%= renderRequest.getContextPath() %>/fileupload?namespace=<portlet:namespace/>';
+<portlet:namespace/>FCKeditor.Config['LinkUploadURL'] = url + '?type=Link';
+<portlet:namespace/>FCKeditor.Config['ImageUploadURL'] = url + '&type=Image';
+<portlet:namespace/>FCKeditor.Config['FlashUploadURL'] = url + '&type=Flash';
 <portlet:namespace/>FCKeditor.Create();
 //-->
 </script>


pal-cvs メーリングリストの案内
Back to archive index