/**
   * Show Dependencies if any before deleting Survey
   *
   * @param context Description of the Parameter
   * @return Description of the Return Value
   */
  public String executeCommandConfirmDelete(ActionContext context) {
    Exception errorMessage = null;
    Connection db = null;
    Survey thisSurvey = null;

    HtmlDialog htmlDialog = new HtmlDialog();
    String id = null;

    if (!(hasPermission(context, "campaign-campaigns-surveys-delete"))) {
      return ("PermissionError");
    }

    if (context.getRequest().getParameter("id") != null) {
      id = context.getRequest().getParameter("id");
    }

    try {
      db = this.getConnection(context);
      SystemStatus systemStatus = this.getSystemStatus(context);
      thisSurvey = new Survey(db, id);
      if (!hasAuthority(context, thisSurvey.getEnteredBy())) {
        return ("PermissionError");
      }

      DependencyList dependencies = thisSurvey.processDependencies(db);
      dependencies.setSystemStatus(systemStatus);
      htmlDialog.addMessage(
          systemStatus.getLabel("confirmdelete.caution") + "\n" + dependencies.getHtmlString());
      htmlDialog.setTitle(systemStatus.getLabel("confirmdelete.title"));

      if (dependencies.size() == 0) {
        htmlDialog.setShowAndConfirm(false);
        htmlDialog.setDeleteUrl(
            "javascript:window.location.href='CampaignManagerSurvey.do?command=Delete&id="
                + id
                + "'");
      } else {
        htmlDialog.setHeader(systemStatus.getLabel("confirmdelete.surveyCampaignHeader"));
        htmlDialog.addButton(
            systemStatus.getLabel("button.ok"), "javascript:parent.window.close()");
      }

    } catch (Exception e) {
      errorMessage = e;
    } finally {
      this.freeConnection(context, db);
    }
    if (errorMessage == null) {
      context.getSession().setAttribute("Dialog", htmlDialog);
      return ("ConfirmDeleteOK");
    } else {
      context.getRequest().setAttribute("Error", errorMessage);
      return ("SystemError");
    }
  }
 /**
  * Description of the Method
  *
  * @param context Description of the Parameter
  * @return Description of the Return Value
  */
 public String executeCommandConfirmDelete(ActionContext context) {
   if (!(hasPermission(context, "tickets-tickets-tasks-delete"))) {
     return ("PermissionError");
   }
   Connection db = null;
   Task thisTask = null;
   HtmlDialog htmlDialog = new HtmlDialog();
   String id = context.getRequest().getParameter("id");
   String sourcePopup = context.getRequest().getParameter("sourcePopup");
   try {
     db = this.getConnection(context);
     SystemStatus systemStatus = this.getSystemStatus(context);
     thisTask = new Task(db, Integer.parseInt(id));
     htmlDialog.setTitle(systemStatus.getLabel("confirmdelete.title"));
     if (!hasAuthority(context, thisTask.getOwner())) {
       htmlDialog.setHeader(systemStatus.getLabel("confirmdelete.taskNotOwnerHeader"));
       htmlDialog.addButton(
           systemStatus.getLabel("button.ok"), "javascript:parent.window.close()");
     } else {
       DependencyList dependencies = thisTask.processDependencies(db);
       htmlDialog.addMessage(
           systemStatus.getLabel("confirmdelete.caution") + "\n" + dependencies.getHtmlString());
       if (dependencies.size() == 0) {
         htmlDialog.setShowAndConfirm(false);
         htmlDialog.setDeleteUrl(
             "javascript:window.location.href='TroubleTicketTasks.do?command=Delete&id="
                 + id
                 + "&sourcePopup="
                 + sourcePopup
                 + "'");
       } else {
         htmlDialog.setHeader(systemStatus.getLabel("confirmdelete.header"));
         htmlDialog.addButton(
             systemStatus.getLabel("button.delete"),
             "javascript:window.location.href='TroubleTicketTasks.do?command=Delete&id="
                 + id
                 + "&sourcePopup="
                 + sourcePopup
                 + "'");
         htmlDialog.addButton(
             systemStatus.getLabel("button.cancel"), "javascript:parent.window.close()");
       }
     }
   } catch (Exception e) {
     context.getRequest().setAttribute("Error", e);
     return ("SystemError");
   } finally {
     this.freeConnection(context, db);
   }
   context.getSession().setAttribute("Dialog", htmlDialog);
   return ("ConfirmDeleteOK");
 }
  public String executeCommandViewCustomTab(ActionContext context) {
    HashMap stack = (HashMap) context.getSession().getAttribute("stack");
    String action = context.getRequest().getParameter("action");
    if (action != null) {
      ModuleBean thisModule = new ModuleBean();
      thisModule.setMenuKey(action);
      context.getRequest().setAttribute("ModuleBean", thisModule);
    }
    String customtabId = (String) context.getRequest().getAttribute("customtabId");
    if (customtabId == null) {
      customtabId = (String) context.getRequest().getParameter("customtabId");
    }
    String moduleId = (String) context.getRequest().getAttribute("moduleId");
    if (moduleId == null) {
      moduleId = (String) context.getRequest().getParameter("moduleId");
    }

    if (moduleId == null || stack == null) {
      return "NoItems";
    }
    Connection db = null;
    try {
      db = this.getConnection(context);
      ArrayList rowColumnList = new ArrayList();

      ContainerMenuList container = new ContainerMenuList();
      container.buildList(db);
      String containerName = ((ContainerMenu) container.get(0)).getCname();
      context.getRequest().setAttribute("rowsColumns", rowColumnList);
      context.getRequest().setAttribute("moduleId", moduleId);
      context.getRequest().setAttribute("containerName", containerName);
      ContainerMenuClass dhvcontainer = (ContainerMenuClass) stack.get(containerName);
      ContainerMenuClass tmpcont = dhvcontainer;
      Stack dhvcontainers = new Stack();
      HashMap tmp = new HashMap();
      while (tmpcont != null) {
        dhvcontainers.push(tmpcont);
        tmp.put(tmpcont.getName(), tmpcont);
        tmpcont = tmpcont.getParent();
      }
      stack.clear();
      stack.putAll(tmp);
      context.getRequest().setAttribute("dhvcontainers", dhvcontainers);
    } catch (Exception e) {
      LOGGER.error(e, e);
      context.getRequest().setAttribute("Error", e);
      return ("SystemError");
    } finally {
      this.freeConnection(context, db);
    }
    return "ViewOK";
  }