/** @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions() */
  @Override
  @SuppressWarnings("unchecked")
  public void executeListMultiActions() throws IOException, ServletException, CmsRuntimeException {

    if (getParamListAction().equals(LIST_MACTION_COPY)) {

      // create absolute RFS path and store it in dialog object
      Map<String, String> params = new HashMap<String, String>();
      List<CmsListItem> items = this.getSelectedItems();
      List<String> paths = new LinkedList<String>();
      for (CmsListItem item : items) {
        paths.add(String.valueOf(item.get(LIST_COLUMN_PATH)));
      }
      params.put(
          CmsLanguageCopyFolderAndLanguageSelectDialog.PARAM_COPYRESOURCES,
          CmsStringUtil.collectionAsString(paths, ","));
      // the source language
      params.put(PARAM_SOURCE_LANGUAGE, getParamSourcelanguage());
      // the target language
      params.put(PARAM_TARGET_LANGUAGE, getParamTargetlanguage());
      // set style to display report in correct layout
      params.put(PARAM_STYLE, CmsToolDialog.STYLE_NEW);
      // set close link to get back to overview after finishing the import
      params.put(PARAM_CLOSELINK, CmsToolManager.linkForToolPath(getJsp(), "/contenttools"));
      // redirect to the report output JSP
      getToolManager()
          .jspForwardPage(
              this,
              CmsWorkplace.PATH_WORKPLACE + "admin/contenttools/languagecopy/report.jsp",
              params);
    }
    listSave();
  }
  /**
   * Performs the re-initialization report, will be called by the JSP page.
   *
   * <p>
   *
   * @throws JspException if including the error JSP element fails
   */
  public void actionReport() throws JspException {

    // save initialized instance of this class in request attribute for included sub-elements
    getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
    switch (getAction()) {
      case ACTION_CONFIRMED:
      default:
        try {
          Map params = new HashMap();
          params.put(PARAM_MODULE, getParamModule());
          // set style to display report in correct layout
          params.put(PARAM_STYLE, CmsToolDialog.STYLE_NEW);
          // set close link to get back to overview after finishing the import
          params.put(PARAM_CLOSELINK, CmsToolManager.linkForToolPath(getJsp(), "/modules"));
          // redirect to the report output JSP
          getToolManager().jspForwardPage(this, DELETE_ACTION_REPORT, params);

          actionCloseDialog();
        } catch (Throwable e) {
          // create a new Exception with custom message
          includeErrorpage(this, e);
        }
        break;
    }
  }
  /** @see org.opencms.workplace.administration.A_CmsImportFromHttp#actionCommit() */
  public void actionCommit() throws IOException, ServletException {

    try {
      copyFileToServer(
          OpenCms.getSystemInfo().getPackagesRfsPath()
              + File.separator
              + CmsSystemInfo.FOLDER_MODULES);
    } catch (CmsException e) {
      // error copying the file to the OpenCms server
      if (LOG.isErrorEnabled()) {
        LOG.error(e.getLocalizedMessage(getLocale()), e);
      }
      setException(e);
      return;
    }
    /// copied
    CmsConfigurationException exception = null;
    CmsModule module = null;
    try {
      String importpath = OpenCms.getSystemInfo().getPackagesRfsPath();
      importpath =
          OpenCms.getSystemInfo()
              .getAbsoluteRfsPathRelativeToWebInf(importpath + "modules/" + getParamImportfile());
      module = CmsModuleImportExportHandler.readModuleFromImport(importpath);

      // check if all dependencies are fulfilled
      List dependencies =
          OpenCms.getModuleManager()
              .checkDependencies(module, CmsModuleManager.DEPENDENCY_MODE_IMPORT);
      if (!dependencies.isEmpty()) {
        StringBuffer dep = new StringBuffer(32);
        for (int i = 0; i < dependencies.size(); i++) {
          CmsModuleDependency dependency = (CmsModuleDependency) dependencies.get(i);
          dep.append("\n - ");
          dep.append(dependency.getName());
          dep.append(" (Version: ");
          dep.append(dependency.getVersion());
          dep.append(")");
        }
        exception =
            new CmsConfigurationException(
                Messages.get()
                    .container(
                        Messages.ERR_ACTION_MODULE_DEPENDENCY_2,
                        getParamImportfile(),
                        new String(dep)));
      }
    } catch (CmsConfigurationException e) {
      exception = e;
    }

    if ((module != null) && (exception == null)) {

      // refresh the list
      Map objects = (Map) getSettings().getListObject();
      if (objects != null) {
        objects.remove(CmsModulesList.class.getName());
      }

      // redirect
      Map param = new HashMap();
      param.put(CmsModulesList.PARAM_MODULE, getParamImportfile());
      param.put(PARAM_STYLE, CmsToolDialog.STYLE_NEW);
      param.put(PARAM_CLOSELINK, CmsToolManager.linkForToolPath(getJsp(), "/modules"));
      if (OpenCms.getModuleManager().hasModule(module.getName())) {
        param.put(CmsModulesUploadFromServer.PARAM_MODULENAME, module.getName());
        getToolManager()
            .jspForwardPage(this, CmsModulesUploadFromServer.REPLACE_ACTION_REPORT, param);
      } else {
        getToolManager()
            .jspForwardPage(this, CmsModulesUploadFromServer.IMPORT_ACTION_REPORT, param);
      }
    } else {
      if (exception != null) {
        // log it
        if (LOG.isErrorEnabled()) {
          LOG.error(exception.getLocalizedMessage(getLocale()), exception);
        }
        // then throw to avoid blank page telling nothing due to missing forward
        throw new CmsRuntimeException(exception.getMessageContainer(), exception);
      }
    }
  }