CmsNewResourceUpload.java
Upload User: fp99766
Upload Date: 2017-03-15
Package Size: 19375k
Code Size: 27k
Category:

Ajax

Development Platform:

Java

  1. /*
  2.  * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/explorer/CmsNewResourceUpload.java,v $
  3.  * Date   : $Date: 2006/03/27 14:52:30 $
  4.  * Version: $Revision: 1.22 $
  5.  *
  6.  * This library is part of OpenCms -
  7.  * the Open Source Content Mananagement System
  8.  *
  9.  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
  10.  *
  11.  * This library is free software; you can redistribute it and/or
  12.  * modify it under the terms of the GNU Lesser General Public
  13.  * License as published by the Free Software Foundation; either
  14.  * version 2.1 of the License, or (at your option) any later version.
  15.  *
  16.  * This library is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19.  * Lesser General Public License for more details.
  20.  *
  21.  * For further information about Alkacon Software GmbH, please see the
  22.  * company website: http://www.alkacon.com
  23.  *
  24.  * For further information about OpenCms, please see the
  25.  * project website: http://www.opencms.org
  26.  * 
  27.  * You should have received a copy of the GNU Lesser General Public
  28.  * License along with this library; if not, write to the Free Software
  29.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  30.  */
  31. package org.opencms.workplace.explorer;
  32. import org.opencms.db.CmsDbSqlException;
  33. import org.opencms.db.CmsImportFolder;
  34. import org.opencms.file.CmsFile;
  35. import org.opencms.file.CmsProject;
  36. import org.opencms.file.CmsProperty;
  37. import org.opencms.file.CmsPropertyDefinition;
  38. import org.opencms.file.CmsResource;
  39. import org.opencms.file.CmsResourceFilter;
  40. import org.opencms.file.types.I_CmsResourceType;
  41. import org.opencms.jsp.CmsJspActionElement;
  42. import org.opencms.main.OpenCms;
  43. import org.opencms.util.CmsStringUtil;
  44. import org.opencms.workplace.CmsWorkplace;
  45. import org.opencms.workplace.CmsWorkplaceException;
  46. import org.opencms.workplace.CmsWorkplaceSettings;
  47. import org.opencms.workplace.commons.CmsChtype;
  48. import java.util.ArrayList;
  49. import java.util.Iterator;
  50. import java.util.List;
  51. import java.util.Map;
  52. import javax.servlet.http.HttpServletRequest;
  53. import javax.servlet.http.HttpServletResponse;
  54. import javax.servlet.http.HttpSession;
  55. import javax.servlet.jsp.JspException;
  56. import javax.servlet.jsp.PageContext;
  57. import org.apache.commons.fileupload.FileItem;
  58. /**
  59.  * The new resource upload dialog handles the upload of single files or zipped files.<p>
  60.  * 
  61.  * The following files use this class:
  62.  * <ul>
  63.  * <li>/commons/newresource_upload.jsp
  64.  * </ul>
  65.  * <p>
  66.  * 
  67.  * @author Andreas Zahner 
  68.  * 
  69.  * @version $Revision: 1.22 $ 
  70.  * 
  71.  * @since 6.0.0 
  72.  */
  73. public class CmsNewResourceUpload extends CmsNewResource {
  74.     /** The value for the resource upload applet action. */
  75.     public static final int ACTION_APPLET = 140;
  76.     /** The value for the resource name form action. */
  77.     public static final int ACTION_NEWFORM2 = 120;
  78.     /** The value for the resource upload applet action: error occured. */
  79.     public static final int ACTION_SHOWERROR = 150;
  80.     /** The value for the resource name form submission action. */
  81.     public static final int ACTION_SUBMITFORM2 = 130;
  82.     /** The name for the resource form submission action. */
  83.     public static final String DIALOG_SHOWERROR = "showerror";
  84.     /** The name for the resource form submission action. */
  85.     public static final String DIALOG_SUBMITFORM2 = "submitform2";
  86.     /** Request parameter name for the new resource file name. */
  87.     public static final String PARAM_NEWRESOURCENAME = "newresourcename";
  88.     /** Request parameter name for the redirect url. */
  89.     public static final String PARAM_REDIRECTURL = "redirecturl";
  90.     /** Request parameter name for the redirect target frame name. */
  91.     public static final String PARAM_TARGETFRAME = "targetframe";
  92.     /** Request parameter name for the upload file unzip flag. */
  93.     public static final String PARAM_UNZIPFILE = "unzipfile";
  94.     /** Request parameter name for the upload file name. */
  95.     public static final String PARAM_UPLOADERROR = "uploaderror";
  96.     /** Request parameter name for the upload file name. */
  97.     public static final String PARAM_UPLOADFILE = "uploadfile";
  98.     /** Request parameter name for the upload folder name. */
  99.     public static final String PARAM_UPLOADFOLDER = "uploadfolder";
  100.     private String m_paramNewResourceName;
  101.     private String m_paramRedirectUrl;
  102.     private String m_paramTargetFrame;
  103.     private String m_paramUnzipFile;
  104.     private String m_paramUploadError;
  105.     private String m_paramUploadFile;
  106.     private String m_paramUploadFolder;
  107.     /**
  108.      * Public constructor with JSP action element.<p>
  109.      * 
  110.      * @param jsp an initialized JSP action element
  111.      */
  112.     public CmsNewResourceUpload(CmsJspActionElement jsp) {
  113.         super(jsp);
  114.     }
  115.     /**
  116.      * Public constructor with JSP variables.<p>
  117.      * 
  118.      * @param context the JSP page context
  119.      * @param req the JSP request
  120.      * @param res the JSP response
  121.      */
  122.     public CmsNewResourceUpload(PageContext context, HttpServletRequest req, HttpServletResponse res) {
  123.         this(new CmsJspActionElement(context, req, res));
  124.     }
  125.     /**
  126.      * Used to close the current JSP dialog.<p>
  127.      * 
  128.      * This method overwrites the close dialog method in the super class,
  129.      * because in case a new file was uploaded and the cancel button pressed,
  130.      * the uploaded file has to be deleted.<p>
  131.      *  
  132.      * It tries to include the URI stored in the workplace settings.
  133.      * This URI is determined by the frame name, which has to be set 
  134.      * in the framename parameter.<p>
  135.      * 
  136.      * @throws JspException if including an element fails
  137.      */
  138.     public void actionCloseDialog() throws JspException {
  139.         if (getAction() == ACTION_CANCEL) {
  140.             try {
  141.                 CmsResource res = getCms().readResource(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
  142.                 if (res.getState() == CmsResource.STATE_NEW) {
  143.                     // only delete new resource
  144.                     getCms().deleteResource(getParamResource(), CmsResource.DELETE_PRESERVE_SIBLINGS);
  145.                 }
  146.                 if (res.getState() == CmsResource.STATE_CHANGED) {
  147.                     // resource is changed, restore content of resource from online project
  148.                     CmsProject currentProject = getCms().getRequestContext().currentProject();
  149.                     byte[] onlineContents = null;
  150.                     try {
  151.                         // switch to online project and get online file contents
  152.                         getCms().getRequestContext().setCurrentProject(getCms().readProject(CmsProject.ONLINE_PROJECT_ID));
  153.                         CmsFile onlineFile = getCms().readFile(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
  154.                         onlineContents = onlineFile.getContents();
  155.                         
  156.                     } finally {
  157.                         // switch back to current project
  158.                         getCms().getRequestContext().setCurrentProject(currentProject);
  159.                     }
  160.                     if (onlineContents != null) {
  161.                         // write online contents back to offline file
  162.                         CmsFile modFile = getCms().readFile(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
  163.                         modFile.setContents(onlineContents);
  164.                         getCms().writeFile(modFile);
  165.                     }
  166.                 }
  167.             } catch (Exception e) {
  168.                 // file was not present
  169.             }
  170.         }
  171.         super.actionCloseDialog();
  172.     }
  173.     /**
  174.      * Updates the file type and renames the file if desired.<p>
  175.      * 
  176.      * @throws JspException if inclusion of error dialog fails
  177.      */
  178.     public void actionUpdateFile() throws JspException {
  179.         try {
  180.             CmsResource res = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
  181.             I_CmsResourceType oldType = OpenCms.getResourceManager().getResourceType(res.getTypeId());
  182.             if (!oldType.getTypeName().equals(getParamNewResourceType())) {
  183.                 // change the type of the uploaded resource
  184.                 int newType = OpenCms.getResourceManager().getResourceType(getParamNewResourceType()).getTypeId();
  185.                 getCms().chtype(getParamResource(), newType);
  186.             }
  187.             if (getParamNewResourceName() != null && !getParamResource().endsWith(getParamNewResourceName())) {
  188.                 String newResourceName = CmsResource.getFolderPath(getParamResource()) + getParamNewResourceName();
  189.                 // rename the resource
  190.                 getCms().renameResource(getParamResource(), newResourceName);
  191.                 setParamResource(newResourceName);
  192.             }
  193.         } catch (Throwable e) {
  194.             // error updating file, show error dialog
  195.             setParamMessage(Messages.get().getBundle(getLocale()).key(Messages.ERR_UPLOAD_FILE_0));
  196.             includeErrorpage(this, e);
  197.         }
  198.     }
  199.     /**
  200.      * Uploads the specified file and unzips it, if selected.<p>
  201.      * 
  202.      * @throws JspException if inclusion of error dialog fails
  203.      */
  204.     public void actionUpload() throws JspException {
  205.         // determine the type of upload
  206.         boolean unzipFile = Boolean.valueOf(getParamUnzipFile()).booleanValue();
  207.         // Suffix for error messages (e.g. when exceeding the maximum file upload size)
  208.         try {
  209.             // get the file item from the multipart request
  210.             Iterator i = getMultiPartFileItems().iterator();
  211.             FileItem fi = null;
  212.             while (i.hasNext()) {
  213.                 fi = (FileItem)i.next();
  214.                 if (fi.getName() != null) {
  215.                     // found the file object, leave iteration
  216.                     break;
  217.                 } else {
  218.                     // this is no file object, check next item
  219.                     continue;
  220.                 }
  221.             }
  222.             if (fi != null) {
  223.                 String fileName = fi.getName();
  224.                 long size = fi.getSize();
  225.                 long maxFileSizeBytes = OpenCms.getWorkplaceManager().getFileBytesMaxUploadSize(getCms());
  226.                 // check file size
  227.                 if (maxFileSizeBytes > 0 && size > maxFileSizeBytes) {
  228.                     // file size is larger than maximum allowed file size, throw an error
  229.                     throw new CmsWorkplaceException(Messages.get().container(
  230.                         Messages.ERR_UPLOAD_FILE_SIZE_TOO_HIGH_1,
  231.                         new Long(maxFileSizeBytes / 1024)));
  232.                 }
  233.                 byte[] content = fi.get();
  234.                 fi.delete();
  235.                 if (unzipFile) {
  236.                     // zip file upload
  237.                     String currentFolder = getParamUploadFolder();
  238.                     if (CmsStringUtil.isEmpty(currentFolder)) {
  239.                         // no upload folder parameter found, get current folder
  240.                         currentFolder = getParamCurrentFolder();
  241.                     }
  242.                     if (CmsStringUtil.isEmpty(currentFolder) || !currentFolder.startsWith("/")) {
  243.                         // no folder information found, guess upload folder
  244.                         currentFolder = computeCurrentFolder();
  245.                     }
  246.                     // import the zip contents
  247.                     new CmsImportFolder(content, currentFolder, getCms(), false);
  248.                 } else {
  249.                     // single file upload
  250.                     String newResname = CmsResource.getName(fileName.replace('\', '/'));
  251.                     // determine Title property value to set on new resource
  252.                     String title = newResname;
  253.                     if (title.lastIndexOf('.') != -1) {
  254.                         title = title.substring(0, title.lastIndexOf('.'));
  255.                     }
  256.                     List properties = new ArrayList(1);
  257.                     CmsProperty titleProp = new CmsProperty();
  258.                     titleProp.setName(CmsPropertyDefinition.PROPERTY_TITLE);
  259.                     if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
  260.                         titleProp.setStructureValue(title);
  261.                     } else {
  262.                         titleProp.setResourceValue(title);
  263.                     }
  264.                     properties.add(titleProp);
  265.                     newResname = getCms().getRequestContext().getFileTranslator().translateResource(newResname);
  266.                     setParamNewResourceName(newResname);
  267.                     setParamResource(newResname);
  268.                     setParamResource(computeFullResourceName());
  269.                     // determine the resource type id from the given information
  270.                     int resTypeId = OpenCms.getResourceManager().getDefaultTypeForName(newResname).getTypeId();
  271.                     if (! getCms().existsResource(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION)) {
  272.                         try {
  273.                             // create the resource
  274.                             getCms().createResource(getParamResource(), resTypeId, content, properties);
  275.                         } catch (CmsDbSqlException sqlExc) {
  276.                             // SQL error, probably the file is too large for the database settings, delete file
  277.                             getCms().lockResource(getParamResource());
  278.                             getCms().deleteResource(getParamResource(), CmsResource.DELETE_PRESERVE_SIBLINGS);
  279.                             throw sqlExc;
  280.                         }
  281.                     } else {
  282.                         checkLock(getParamResource());
  283.                         CmsFile file = getCms().readFile(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
  284.                         byte[] contents = file.getContents();
  285.                         try {
  286.                             getCms().replaceResource(getParamResource(), resTypeId, content, null);
  287.                         } catch (CmsDbSqlException sqlExc) {
  288.                             // SQL error, probably the file is too large for the database settings, restore content
  289.                             file.setContents(contents);
  290.                             getCms().writeFile(file);
  291.                             throw sqlExc;
  292.                         }
  293.                     }
  294.                 }
  295.             } else {
  296.                 throw new CmsWorkplaceException(Messages.get().container(Messages.ERR_UPLOAD_FILE_NOT_FOUND_0));
  297.             }
  298.         } catch (Throwable e) {
  299.             // error uploading file, show error dialog
  300.             setParamMessage(Messages.get().getBundle(getLocale()).key(Messages.ERR_UPLOAD_FILE_0));
  301.             setAction(ACTION_SHOWERROR);
  302.             includeErrorpage(this, e);
  303.         }
  304.     }
  305.     /**
  306.      * Builds the list of possible types for the uploaded file.<p>
  307.      * 
  308.      * @return the list of possible files for the uploaded resource
  309.      */
  310.     public String buildTypeList() {
  311.         return CmsChtype.buildTypeList(this, false);
  312.     }
  313.     /**
  314.      * Creates the HTML code of the file upload applet with all required parameters.<p>
  315.      * 
  316.      * @return string containing the applet HTML code
  317.      */
  318.     public String createAppletCode() {
  319.         StringBuffer applet = new StringBuffer(2048);
  320.         // collect some required server data first
  321.         String scheme = getJsp().getRequest().getScheme();
  322.         String host = getJsp().getRequest().getServerName();
  323.         String path = OpenCms.getSystemInfo().getContextPath() + OpenCms.getSystemInfo().getServletPath();
  324.         int port = getJsp().getRequest().getServerPort();
  325.         String webapp = scheme + "://" + host + ":" + port + OpenCms.getSystemInfo().getContextPath();
  326.         // get all file extensions
  327.         String fileExtensions = new String("");
  328.         Map extensions = OpenCms.getResourceManager().getExtensionMapping();
  329.         Iterator keys = extensions.keySet().iterator();
  330.         while (keys.hasNext()) {
  331.             String key = (String)keys.next();
  332.             String value = (String)extensions.get(key);
  333.             fileExtensions += key + "=" + value + ",";
  334.         }
  335.         fileExtensions = fileExtensions.substring(0, fileExtensions.length() - 1);
  336.         // get the file size upload limitation value (value is in bytes for the applet)
  337.         long maxFileSize = OpenCms.getWorkplaceManager().getFileBytesMaxUploadSize(getCms());
  338.         // get the current folder
  339.         String currentFolder = getParamCurrentFolder();
  340.         // get the current session id
  341.         HttpSession session = getJsp().getRequest().getSession(false);
  342.         String sessionId = session.getId();
  343.         // define the required colors.
  344.         // currently this is hard coded here       
  345.         String colors = "bgColor=#C0C0C0,outerBorderRightBottom=#333333,outerBorderLeftTop=#C0C0C0";
  346.         colors += ",innerBorderRightBottom=#777777,innerBorderLeftTop=#F0F0F0";
  347.         colors += ",bgHeadline=#000066,colorHeadline=#FFFFFF";
  348.         colors += ",colorText=#000000,progessBar=#E10050";
  349.         // create the upload applet html code
  350.         applet.append("<applet code="org.opencms.applet.upload.FileUploadApplet.class" archive="");
  351.         applet.append(webapp);
  352.         applet.append("/resources/components/upload_applet/upload.jar" width="500" height="100">n");
  353.         applet.append("<param name="opencms" value="");
  354.         applet.append(scheme);
  355.         applet.append("://");
  356.         applet.append(host);
  357.         applet.append(":");
  358.         applet.append(port);
  359.         applet.append(getSkinUri());
  360.         applet.append("filetypes/">n");
  361.         applet.append("<param name="target" value="");
  362.         applet.append(scheme);
  363.         applet.append("://");
  364.         applet.append(host);
  365.         applet.append(":");
  366.         applet.append(port);
  367.         applet.append(path);
  368.         applet.append("/system/workplace/commons/newresource_upload.jsp">n");
  369.         applet.append("<param name="redirect" value="");
  370.         applet.append(scheme);
  371.         applet.append("://");
  372.         applet.append(host);
  373.         applet.append(":");
  374.         applet.append(port);
  375.         applet.append(path);
  376.         // check if the redirect url is given by request parameter. if not use the default
  377.         if (CmsStringUtil.isEmpty(getParamRedirectUrl())) {
  378.             applet.append(CmsWorkplace.FILE_EXPLORER_FILELIST);
  379.         } else {
  380.             applet.append(getParamRedirectUrl());
  381.         }
  382.         // append some parameters to prevent caching of URL by Applet
  383.         applet.append("?time=" + System.currentTimeMillis());
  384.         applet.append("">n");
  385.         applet.append("<param name="targetframe" value="");
  386.         applet.append(getParamTargetFrame());
  387.         applet.append("">n");
  388.         applet.append("<param name=error value="");
  389.         applet.append(scheme);
  390.         applet.append("://");
  391.         applet.append(host);
  392.         applet.append(":");
  393.         applet.append(port);
  394.         applet.append(path);
  395.         applet.append("/system/workplace/action/explorer_files_new_upload.html">n");
  396.         applet.append("<param name="sessionId" value="");
  397.         applet.append(sessionId);
  398.         applet.append("">n");
  399.         applet.append("<param name="filelist" value="");
  400.         applet.append(currentFolder);
  401.         applet.append("">n");
  402.         applet.append("<param name="colors" value="");
  403.         applet.append(colors);
  404.         applet.append("">n");
  405.         applet.append("<param name="fileExtensions" value="");
  406.         applet.append(fileExtensions);
  407.         applet.append("">nn");
  408.         applet.append("<param name="maxsize" value="");
  409.         applet.append(maxFileSize);
  410.         applet.append("">n");
  411.         applet.append("<param name="actionOutputSelect" value="");
  412.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_ACTION_SELECT_0)); 
  413.         applet.append("">n");
  414.         applet.append("<param name="actionOutputCount"value="");
  415.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_ACTION_COUNT_0));
  416.         applet.append("">n");
  417.         applet.append("<param name="actionOutputCreate" value="");
  418.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_ACTION_CREATE_0));
  419.         applet.append("">n");
  420.         applet.append("<param name="actionOutputUpload" value="");
  421.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_ACTION_UPLOAD_0));
  422.         applet.append("">n");
  423.         applet.append("<param name="messageOutputUpload" value="");
  424.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_MESSAGE_UPLOAD_0));
  425.         applet.append("">n");
  426.         applet.append("<param name="messageOutputErrorZip" value="");
  427.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_MESSAGE_ERROR_ZIP_0));
  428.         applet.append("">n");
  429.         applet.append("<param name="messageOutputErrorSize" value="");
  430.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_MESSAGE_ERROR_SIZE_0));
  431.         applet.append("">n");
  432.         applet.append("<param name="messageNoPreview" value="");
  433.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_MESSAGE_NOPREVIEW_0));
  434.         applet.append("">n");
  435.         applet.append("<param name="messageOutputAdding" value="");
  436.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_MESSAGE_ADDING_0));
  437.         applet.append(" ">n");
  438.         applet.append("<param name="errorTitle" value="");
  439.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_ERROR_TITLE_0));
  440.         applet.append(" ">n");
  441.         applet.append("<param name="errorLine1" value="");
  442.         applet.append(Messages.get().getBundle(getLocale()).key(Messages.GUI_UPLOADAPPLET_ERROR_LINE1_0));
  443.         applet.append(" ">n");
  444.         applet.append("</applet>n");
  445.         return applet.toString();
  446.     }
  447.     /**
  448.      * Returns the new resource name of the uploaded file.<p>
  449.      * 
  450.      * @return the new resource name of the uploaded file
  451.      */
  452.     public String getParamNewResourceName() {
  453.         return m_paramNewResourceName;
  454.     }
  455.     /**
  456.      * Returns the paramRedirectUrl.<p>
  457.      *
  458.      * @return the paramRedirectUrl
  459.      */
  460.     public String getParamRedirectUrl() {
  461.         return m_paramRedirectUrl;
  462.     }
  463.     /**
  464.      * Returns the paramTargetFrame.<p>
  465.      *
  466.      * @return the paramTargetFrame
  467.      */
  468.     public String getParamTargetFrame() {
  469.         if (CmsStringUtil.isEmpty(m_paramTargetFrame)) {
  470.             return new String("explorer_files");
  471.         }
  472.         return m_paramTargetFrame;
  473.     }
  474.     /**
  475.      * Returns true if the upload file should be unzipped, otherwise false.<p>
  476.      * 
  477.      * @return true if the upload file should be unzipped, otherwise false
  478.      */
  479.     public String getParamUnzipFile() {
  480.         return m_paramUnzipFile;
  481.     }
  482.     /**
  483.      * Returns the upload error message for the error dialog.<p>
  484.      * 
  485.      * @return the upload error message for the error dialog
  486.      */
  487.     public String getParamUploadError() {
  488.         return m_paramUploadError;
  489.     }
  490.     /**
  491.      * Returns the upload file name.<p>
  492.      * 
  493.      * @return the upload file name
  494.      */
  495.     public String getParamUploadFile() {
  496.         return m_paramUploadFile;
  497.     }
  498.     /**
  499.      * Returns the upload folder name.<p>
  500.      * 
  501.      * @return the upload folder name
  502.      */
  503.     public String getParamUploadFolder() {
  504.         return m_paramUploadFolder;
  505.     }
  506.     /**
  507.      * Sets the new resource name of the uploaded file.<p>
  508.      * 
  509.      * @param newResourceName the new resource name of the uploaded file
  510.      */
  511.     public void setParamNewResourceName(String newResourceName) {
  512.         m_paramNewResourceName = newResourceName;
  513.     }
  514.     /**
  515.      * Sets the paramRedirectUrl.<p>
  516.      *
  517.      * @param paramRedirectUrl the paramRedirectUrl to set
  518.      */
  519.     public void setParamRedirectUrl(String paramRedirectUrl) {
  520.         m_paramRedirectUrl = paramRedirectUrl;
  521.     }
  522.     /**
  523.      * Sets the paramTargetFrame.<p>
  524.      *
  525.      * @param paramTargetFrame the paramTargetFrame to set
  526.      */
  527.     public void setParamTargetFrame(String paramTargetFrame) {
  528.         m_paramTargetFrame = paramTargetFrame;
  529.     }
  530.     /**
  531.      * Sets if the upload file should be unzipped.<p>
  532.      * 
  533.      * @param unzipFile true if the upload file should be unzipped
  534.      */
  535.     public void setParamUnzipFile(String unzipFile) {
  536.         m_paramUnzipFile = unzipFile;
  537.     }
  538.     /**
  539.      * Sets the upload error message for the error dialog.<p>
  540.      * 
  541.      * @param uploadError the upload error message for the error dialog
  542.      */
  543.     public void setParamUploadError(String uploadError) {
  544.         m_paramUploadError = uploadError;
  545.     }
  546.     /**
  547.      * Sets the upload file name.<p>
  548.      * 
  549.      * @param uploadFile the upload file name
  550.      */
  551.     public void setParamUploadFile(String uploadFile) {
  552.         m_paramUploadFile = uploadFile;
  553.     }
  554.     /**
  555.      * Sets the upload folder name.<p>
  556.      * 
  557.      * @param uploadFolder the upload folder name
  558.      */
  559.     public void setParamUploadFolder(String uploadFolder) {
  560.         m_paramUploadFolder = uploadFolder;
  561.     }
  562.     /**
  563.      * Returns if the upload file should be unzipped.<p>
  564.      * 
  565.      * @return true if the upload file should be unzipped, otherwise false
  566.      */
  567.     public boolean unzipUpload() {
  568.         return Boolean.valueOf(getParamUnzipFile()).booleanValue();
  569.     }
  570.     /**
  571.      * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
  572.      */
  573.     protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest request) {
  574.         // fill the parameter values in the get/set methods
  575.         fillParamValues(request);
  576.         // set the dialog type
  577.         setParamDialogtype(DIALOG_TYPE);
  578.         // set the action for the JSP switch 
  579.         if (DIALOG_OK.equals(getParamAction())) {
  580.             setAction(ACTION_OK);
  581.         } else if (DIALOG_SUBMITFORM.equals(getParamAction())) {
  582.             setAction(ACTION_SUBMITFORM);
  583.         } else if (DIALOG_SUBMITFORM2.equals(getParamAction())) {
  584.             setAction(ACTION_SUBMITFORM2);
  585.         } else if (DIALOG_CANCEL.equals(getParamAction())) {
  586.             setAction(ACTION_CANCEL);
  587.         } else {
  588.             if (getSettings().getUserSettings().useUploadApplet()) {
  589.                 setAction(ACTION_APPLET);
  590.             } else {
  591.                 setAction(ACTION_DEFAULT);
  592.             }
  593.             // build title for new resource dialog     
  594.             setParamTitle(key(Messages.GUI_NEWRESOURCE_UPLOAD_0));
  595.         }
  596.     }
  597. }