Package org.meshcms.util

Examples of org.meshcms.util.Path


  /**
   * Returns the user's home path.
   */
  public Path getHomePath() {
    return new Path(getValue(HOME_PATH));
  }
View Full Code Here


    if (Utils.isNullOrEmpty(username)) {
      return false;
    }

    boolean globalUser = false;
    Path userPath = getUserPath(webSite, username);

    if (!webSite.getFile(userPath).exists() &&
        webSite instanceof VirtualWebSite) {
      webSite = ((VirtualWebSite) webSite).getMainWebSite();
      userPath = getUserPath(webSite, username);
View Full Code Here

      w.write("\n<meta http-equiv=\"Content-Language\" content=\"" + locale + "\" />");
    }
  }

  public void writeEditTag() throws IOException {
    Path linkListPath = new Path(adminRelPath, "tinymce_linklist.jsp");
    Locale locale = WebUtils.getPageLocale(pageContext);
    ResourceBundle bundle = ResourceBundle.getBundle("org/meshcms/webui/Locales", locale);
    String langCode = bundle.getString("TinyMCELangCode");

    if (Utils.isNullOrEmpty(langCode)) {
      langCode = locale.getLanguage();
    }

    Writer w = getOut();
    w.write(getHeadContent());
    Path tinyMCEPath =
        webSite.getFile(webSite.getCMSPath().add("tiny_mce")).exists()
        ? webSite.getCMSPath() : webSite.getAdminScriptsPath();
    w.write("\n<script type='text/javascript' src='" +
      webSite.getLink(tinyMCEPath, pageDirPath) +
      "/tiny_mce/tiny_mce.js'></script>\n");
    w.write("<script type='text/javascript'>\n");
    w.write("// <![CDATA[\n");
    w.write(" var contextPath = \"" + request.getContextPath() + "\";\n");
    w.write(" var adminPath = \"" + webSite.getAdminPath() + "\";\n");
    w.write(" var languageCode = \"" + langCode + "\";\n");
    w.write(" var linkListPath = \"" + linkListPath + "\";\n");
    w.write(" var cssPath = \"" + WebUtils.getThemeCSSPath(request, pageDirPath) + "\";\n");
    w.write("// ]]>\n");
    w.write("</script>\n");
    Path p = webSite.getLink(webSite.getAdminScriptsPath(), pageDirPath);
    w.write("<script type='text/javascript' src='" +
        p.add("/jquery/jquery.min.js") + "'></script>\n");
    w.write("<script type='text/javascript' src='" +
        p.add("/editor.js") + "'></script>\n");
    Path tinyMCEInitPath =
        webSite.getFile(webSite.getCMSPath().add("tinymce_init.js")).exists()
        ? webSite.getCMSPath() : webSite.getAdminScriptsPath();
    w.write("<script type='text/javascript' src='" +
      webSite.getLink(tinyMCEInitPath, pageDirPath).add("tinymce_init.js") + "'></script>");
  }
View Full Code Here

  public void writeTag() throws IOException {
    Writer outWriter = getOut();
    boolean horizontal = orientation != null && orientation.equals(HORIZONTAL);

    if (part != null && part.equals(PART_HEAD)) {
      Path sp = webSite.getAdminScriptsPath().add("alib");
      String menuType = horizontal ? HORIZONTAL : VERTICAL;
      outWriter.write("<script src='" +
          webSite.getLink(sp.add("alib.common/script.js"), pageDirPath) +
          "' type='text/javascript'></script>\n");
      outWriter.write("<script src='" +
          webSite.getLink(sp.add("menu." + menuType + "/script.js"), pageDirPath) +
          "' type='text/javascript'></script>\n");
      outWriter.write("<link type='text/css' href='" +
          WebUtils.getThemeFolderPath(request, pageDirPath) + "/alib.css' rel='stylesheet' />\n");
    } else {
      SiteInfo siteInfo = webSite.getSiteInfo();
      Path rootPath = (path == null) ? siteInfo.getThemeRoot(pagePath) : new Path(path);
      Path pathInMenu = webSite.getSiteMap().getPathInMenu(pagePath);
      int baseLevel = rootPath.getElementCount() + 1;
      int lastLevel = rootPath.getElementCount();
      SiteMapIterator iter = new SiteMapIterator(webSite, rootPath);
      iter.setSkipHiddenSubPages(Utils.isTrue(allowHiding));
      boolean liUsed = false;
      boolean firstUl = true;

      while (iter.hasNext()) {
        PageInfo currentPageInfo = (PageInfo) iter.next();
        Path currentPath = currentPageInfo.getPath();
        int level = Math.max(baseLevel, currentPageInfo.getLevel());

        for (int i = lastLevel; i < level; i++) {
          if (firstUl) {
            writeIndented(outWriter, "<ul class=\"" +
View Full Code Here

    if (artisteer) {
      currentPathStyle = currentStyle = "active";
    }
   
    SiteInfo siteInfo = webSite.getSiteInfo();
    Path rootPath = siteInfo.getThemeRoot(pagePath);
   
    if (path != null) {
      if (path.equals("current")) {
        rootPath = pageDirPath;
      } else if (path.equals("parent")) {
        Path parent = pageDirPath.getParent();
       
        if (parent.isContainedIn(rootPath)) {
          rootPath = parent;
        }
      } else if (path.equals("root")) {
        rootPath = Path.ROOT;
      } else {
        rootPath = new Path(path);
      }
    }
   
    Path pathInMenu = webSite.getSiteMap().getPathInMenu(pagePath);
    int baseLevel = rootPath.getElementCount() + 1;
    Writer outWriter = getOut();
    int lastLevel = rootPath.getElementCount();
    SiteMapIterator iter = new SiteMapIterator(webSite, rootPath);
    iter.setSkipHiddenSubPages(Utils.isTrue(allowHiding));
    boolean styleNotApplied = !Utils.isNullOrEmpty(style);
    int showLastLevel = -1;
   
    while (iter.hasNext()) {
      PageInfo currentPageInfo = (PageInfo) iter.next();
      Path currentPath = currentPageInfo.getPath();
      int level = Math.max(baseLevel, currentPageInfo.getLevel());
     
      if (currentPageInfo.getLevel() <= showLastLevel) {
        showLastLevel = -1;
      }
     
      if (siteInfo.getHideSubmenu(currentPath) && showLastLevel == -1) {
        showLastLevel = currentPageInfo.getLevel();
      }
     
      boolean add = false;
     
      if (itemsAll) {
        add = true;
      } else {
        Path parentPath = currentPath.getParent();
       
        if (parentPath.isRelative() || pathInMenu.isContainedIn(parentPath)) {
          if (itemsOnPath && pathInMenu.isContainedIn(currentPath)) {
            add = true;
          } else if (level <= baseLevel) {
            add = itemsFirstLevel;
          } else if (currentPath.getElementCount() == pathInMenu.getElementCount()) {
View Full Code Here

  private String defaultName;
  private String include;

  public void writeTag() throws IOException, JspException {
    if (!Utils.isNullOrEmpty(name)) {
      Path found = null;
      Path currentPath = webSite.getDirectory(pagePath);

      while (found == null && !currentPath.isRelative()) {
        Path p = currentPath.add(name);
        currentPath = currentPath.getParent();

        if (webSite.getFile(p).exists()) {
          found = p;
        }
      }

      if (found == null && defaultName != null) {
        Path themePath = (Path) request.getAttribute(HitFilter.THEME_PATH_ATTRIBUTE);

        if (themePath != null) {
          themePath = themePath.add(defaultName);

          if (webSite.getFile(themePath).exists()) {
            found = themePath;
          }
        }
View Full Code Here

TOP

Related Classes of org.meshcms.util.Path

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.