Package org.meshcms.core

Examples of org.meshcms.core.UserInfo


  public void setStyle(String style) {
    this.style = style;
  }

  public void writeTag() throws IOException {
    UserInfo user = (UserInfo) pageContext.getAttribute("userInfo",
      PageContext.SESSION_SCOPE);
    Locale locale = WebUtils.getPageLocale(pageContext);
    ResourceBundle bundle = ResourceBundle.getBundle("org/meshcms/webui/Locales", locale);

    String a1 = "<a" +
      (Utils.isNullOrEmpty(style) ? "" : " class=\"" + style + "\"") +
      " href=\"";
    String a2 = "\">";
    String a3 = "</a>";
    List l = new ArrayList();

    if (user == null || user.isGuest()) {
      if ((mode == null || mode.equals(MODE_NORMAL)) &&
          !org.meshcms.extra.StaticExporter.isExportRequest(request)) {
        l.add(a1 + adminRelPath.add("login.jsp") + a2 + bundle.getString("adminLogin") + a3);
      }
    } else {
      l.add(a1 + adminRelPath.add("index.jsp") + a2 + bundle.getString("homeTitle") + a3);

      if (!isEdit) {
        if (user.canWrite(webSite, pagePath)) {
          if (webSite.isVisuallyEditable(pagePath)) {
            l.add(a1 + request.getRequestURI() + '?' + HitFilter.ACTION_NAME +
                '=' + HitFilter.ACTION_EDIT + a2 +
                bundle.getString("adminEditPage") + a3);
          }

          if (FileTypes.isPage(pagePath.getLastElement())) {
            l.add(a1 + adminRelPath.add("editsrc.jsp") + "?path=" + pagePath + a2 +
                bundle.getString("adminEditText") + a3);

            l.add(a1 + adminRelPath.add("editsrc.jsp") + "?path=" + pagePath + "&amp;tidy=true" +
                a2 + bundle.getString("adminTidy") + a3);

            Path pathInMenu = webSite.getSiteMap().getPathInMenu(pagePath);

            if (!pathInMenu.isRoot()) {
              Path parentPath = pathInMenu.getParent();

              if (user.canWrite(webSite, parentPath)) {
                l.add(a1 + adminRelPath.add("createpage.jsp") + "?popup=false&amp;path=" +
                    parentPath + a2 + bundle.getString("adminNewPage") + a3);
              }
            }
View Full Code Here

TOP

Related Classes of org.meshcms.core.UserInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.