示例#1
0
  @Override
  protected String getPage() {
    if (FileAvailabilityUtil.isAvailable(servletContext, _PAGE)) {
      return _PAGE;
    }

    String url = getUrl();

    if (url.startsWith("javascript:")) {
      url = url.substring(11);
    }

    if (url.startsWith(Http.HTTP_WITH_SLASH) || url.startsWith(Http.HTTPS_WITH_SLASH)) {

      url = "submitForm(document.hrefFm, '".concat(HttpUtil.encodeURL(url)).concat("');");
    }

    StringBundler sb = new StringBundler(5);

    sb.append("javascript:if (confirm('");
    sb.append(UnicodeLanguageUtil.get(pageContext, "are-you-sure-you-want-to-deactivate-this"));
    sb.append("')) { ");
    sb.append(url);
    sb.append(" } else { self.focus(); }");

    url = sb.toString();

    setImage("deactivate");
    setUrl(url);

    return super.getPage();
  }
  @Override
  protected String getPage() {
    if (FileAvailabilityUtil.isAvailable(servletContext, _PAGE)) {
      return _PAGE;
    }

    PortletDisplay portletDisplay = (PortletDisplay) pageContext.getAttribute("portletDisplay");

    if (!portletDisplay.isShowBackIcon()) {
      return null;
    }

    setCssClass("portlet-back portlet-back-icon");
    setImage("../portlet/back");
    setMessage("back");
    setToolTip(false);
    setUrl(portletDisplay.getURLBack());

    return super.getPage();
  }
  @Override
  protected String getPage() {
    if (FileAvailabilityUtil.isAvailable(getServletContext(), _PAGE)) {
      return _PAGE;
    }

    PortletDisplay portletDisplay = (PortletDisplay) pageContext.getAttribute("portletDisplay");

    if (!portletDisplay.isShowExportImportIcon()) {
      return null;
    }

    setCssClass("portlet-export-import portlet-export-import-icon");
    setImage("download");
    setMessage("export-import");
    setMethod("get");
    setToolTip(false);
    setUrl(portletDisplay.getURLExportImport());

    return super.getPage();
  }
  protected void doInvokeDeploy(HotDeployEvent hotDeployEvent) throws Exception {

    ServletContext servletContext = hotDeployEvent.getServletContext();

    String servletContextName = servletContext.getServletContextName();

    if (_log.isDebugEnabled()) {
      _log.debug("Invoking deploy for " + servletContextName);
    }

    String xml =
        HttpUtil.URLtoString(
            servletContext.getResource("/WEB-INF/ext-" + servletContextName + ".xml"));

    if (xml == null) {
      return;
    }

    if (_log.isInfoEnabled()) {
      _log.info("Registering extension environment for " + servletContextName);
    }

    if (ExtRegistry.isRegistered(servletContextName)) {
      if (_log.isInfoEnabled()) {
        _log.info("Extension environment for " + servletContextName + " has been applied.");
      }

      return;
    }

    Map<String, Set<String>> conflicts = ExtRegistry.getConflicts(servletContext);

    if (!conflicts.isEmpty()) {
      StringBundler sb = new StringBundler();

      sb.append(
          "Extension environment for "
              + servletContextName
              + " cannot be applied because of detected conflicts:");

      for (Map.Entry<String, Set<String>> entry : conflicts.entrySet()) {
        String conflictServletContextName = entry.getKey();
        Set<String> conflictFiles = entry.getValue();

        sb.append("\n\t");
        sb.append(conflictServletContextName);
        sb.append(":");

        for (String conflictFile : conflictFiles) {
          sb.append("\n\t\t");
          sb.append(conflictFile);
        }
      }

      _log.error(sb.toString());

      return;
    }

    installExt(servletContext, hotDeployEvent.getContextClassLoader());

    FileAvailabilityUtil.reset();

    if (_log.isInfoEnabled()) {
      _log.info(
          "Extension environment for "
              + servletContextName
              + " has been applied. You must reboot the server and "
              + "redeploy all other plugins.");
    }
  }
示例#5
0
  protected int processEndTag() throws Exception {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    IntegerWrapper iconCount =
        (IntegerWrapper) request.getAttribute("liferay-ui:icon-menu:icon-count");

    request.removeAttribute("liferay-ui:icon-menu:icon-count");

    Boolean singleIcon = (Boolean) request.getAttribute("liferay-ui:icon-menu:single-icon");

    request.removeAttribute("liferay-ui:icon-menu:single-icon");

    JspWriter jspWriter = pageContext.getOut();

    if ((iconCount != null)
        && (iconCount.getValue() >= 1)
        && ((singleIcon == null) || _showWhenSingleIcon)) {

      if (!FileAvailabilityUtil.isAvailable(pageContext.getServletContext(), getStartPage())) {

        if (_showExpanded) {
          jspWriter.write("<div class=\"lfr-component ");
          jspWriter.write("lfr-menu-list lfr-menu-expanded align-");
          jspWriter.write(_align);
          jspWriter.write(" ");
          jspWriter.print(_cssClass);
          jspWriter.write("\" id=\"");
          jspWriter.write(_id);
          jspWriter.write("\">");
        } else {
          jspWriter.write("<span title=\"");
          jspWriter.write(LanguageUtil.get(pageContext, _message));
          jspWriter.write("\"><ul class='lfr-component lfr-actions ");
          jspWriter.write("align-");
          jspWriter.write(_align);
          jspWriter.write(" direction-");
          jspWriter.write(_direction);
          jspWriter.write(" max-display-items-");
          jspWriter.write(String.valueOf(_maxDisplayItems));
          jspWriter.write(" ");

          if (Validator.isNotNull(_cssClass)) {
            jspWriter.print(_cssClass);
          }

          if (_disabled) {
            jspWriter.write(" disabled");
          }

          if (_extended) {
            jspWriter.write(" lfr-extended");
          }

          if (_showArrow) {
            jspWriter.write(" show-arrow");
          }

          jspWriter.write("\' id=\"");
          jspWriter.write(_id);
          jspWriter.write("\">");
          jspWriter.write("<li class=\"lfr-trigger\"><strong>");
          jspWriter.write("<a class=\"nobr\" href=\"javascript:;\">");

          if (Validator.isNotNull(_icon)) {
            jspWriter.write("<img alt=\"\" src=\"");
            jspWriter.write(_icon);
            jspWriter.write("\" />");
          }

          jspWriter.write("<span class=\"taglib-text\">");
          jspWriter.write(LanguageUtil.get(pageContext, _message));
          jspWriter.write("</span></a></strong>");
        }

        jspWriter.write("<ul>");
      } else {
        PortalIncludeUtil.include(pageContext, getStartPage());
      }
    }

    writeBodyContent(jspWriter);

    if ((iconCount != null)
        && (iconCount.getValue() >= 1)
        && ((singleIcon == null) || _showWhenSingleIcon)) {

      if (!FileAvailabilityUtil.isAvailable(pageContext.getServletContext(), getEndPage())) {

        jspWriter.write("</ul>");

        if (_showExpanded) {
          jspWriter.write("</div>");

          ScriptTag.doTag(
              null, "liferay-menu", "Liferay.Menu.handleFocus('#" + _id + "menu');", pageContext);
        } else {
          jspWriter.write("</li></ul></span>");
        }
      } else {
        PortalIncludeUtil.include(pageContext, getEndPage());
      }
    }

    request.removeAttribute("liferay-ui:icon-menu:showWhenSingleIcon");

    return EVAL_PAGE;
  }