Package org.meshcms.util

Examples of org.meshcms.util.Path


   * path included).
   *
   * @param request used to get the theme name
   */
  public static String getFullThemeFolder(HttpServletRequest request) {
    Path themePath = (Path) request.getAttribute(HitFilter.THEME_PATH_ATTRIBUTE);
   
    return (themePath == null) ? "" :
      request.getContextPath() + "/" + themePath;
  }
View Full Code Here


   * folder, the default from the admin theme is returned.
   *
   * @param request used to get the theme name
   */
  public static String getFullMeshCSS(WebSite webSite, HttpServletRequest request) {
    Path themePath = (Path) request.getAttribute(HitFilter.THEME_PATH_ATTRIBUTE);
    Path cssPath = themePath.add(SiteMap.MESHCMS_CSS);
   
    if (!webSite.getFile(cssPath).exists()) {
      cssPath = webSite.getAdminThemePath().add(SiteMap.MESHCMS_CSS);
    }
   
View Full Code Here

   *
   * @param request used to get the theme name
   * @param pageDir path of the requested page folder
   */
  public static Path getThemeFolderPath(HttpServletRequest request, Path pageDir) {
    Path themePath = (Path) request.getAttribute(HitFilter.THEME_PATH_ATTRIBUTE);
    return (themePath == null) ? pageDir : themePath.getRelativeTo(pageDir);
  }
View Full Code Here

   * @param request used to get the theme name
   * @param pageDir path of the requested page folder
   */
  public static Path getMeshCSSPath(WebSite webSite, HttpServletRequest request,
      Path pageDir) {
    Path themePath = (Path) request.getAttribute(HitFilter.THEME_PATH_ATTRIBUTE);
    Path cssPath = themePath.add(SiteMap.MESHCMS_CSS);
   
    if (!webSite.getFile(cssPath).exists()) {
      cssPath = webSite.getAdminThemePath().add(SiteMap.MESHCMS_CSS);
    }
   
    return cssPath.getRelativeTo(pageDir);
  }
View Full Code Here

    }
  }
 
  public static Path getCorrespondingPath(WebSite webSite, Path path,
      String otherRoot) {
    Path cPath = path.replace(0, otherRoot);
    return webSite.getFile(cPath).exists() ? cPath : new Path(otherRoot);
  }
View Full Code Here

        Pattern.CASE_INSENSITIVE);
    Matcher m = p.matcher(html);
    StringBuffer sb = new StringBuffer(html.length());
   
    while(m.find()) {
      Path path = relative ? new Path(m.group(2)).getRelativeTo(root) :
        new Path(root, m.group(2));
      m.appendReplacement(sb, m.group(1) + path.getAsLink() + m.group(3));
    }
   
    m.appendTail(sb);
    return sb.toString();
  }
View Full Code Here

     
      if (attrMatcher.find()) {
        String url = attrMatcher.group(3).trim();

        if (url.indexOf("://") < 0) {
          Path path = null;

          if (url.startsWith("/")) {
            if (contextPath.length() > 0 && url.startsWith(contextPath)) {
              url = url.substring(contextPath.length());
            }

            path = new Path(url);
          } else {
            path = new Path(oldPage, url);
          }

          if (path != null) {
            path = path.getRelativeTo(newPage);
           
            if (path.isRoot()) {
              path = new Path(webSite.getSiteMap().getCurrentWelcome(newPage));
            }
           
            String newTag = attrMatcher.replaceFirst(attrMatcher.group(1) +
                "=\"" + path + "\"");
            tagMatcher.appendReplacement(sb, newTag);
View Full Code Here

       
        if (srcMatcher.find()) {
          String imgURL = srcMatcher.group(2).trim();
         
          if (imgURL.indexOf("://") < 0) {
            Path imgPath = null;
           
            if (imgURL.startsWith("/")) {
              if (contextPath.length() > 0 && imgURL.startsWith(contextPath)) {
                imgURL = imgURL.substring(contextPath.length());
              }
             
              imgPath = new Path(imgURL);
            } else {
              imgPath = new Path(webSite.getDirectory(pagePath), imgURL);
            }
           
            if (imgPath != null) {
              thumbMaker.setWidth(w);
              thumbMaker.setHeight(h);
              String thumbName = thumbMaker.getSuggestedFileName();
              Path thumbPath = thumbMaker.checkAndCreate(webSite, imgPath, thumbName);
             
              if (thumbPath != null) {
                String newImgTag = srcMatcher.replaceAll("src=\"" +
                    webSite.getLink(thumbPath, pagePath) + "\"");
                imgMatcher.appendReplacement(sb, newImgTag);
View Full Code Here

   */
  public VirtualWebSite getVirtualSite(String dirName) {
    VirtualWebSite vws = (VirtualWebSite) virtualSitesMap.get(dirName);

    if (vws == null) {
      Path sitePath = virtualSitesPath.add(dirName);
      File root = getFile(sitePath);
      Path cms = new CMSDirectoryFinder(root, true).getCMSPath();
      vws = VirtualWebSite.create(this, sitePath, cms);
      virtualSitesMap.put(dirName, vws);
    }

    return vws;
View Full Code Here

  }

  public static String icon(WebSite webSite, Path pagePath,
      String argument, UserInfo userInfo, String anchor, boolean grayIcon) {
    String lang = getHelpLang(webSite, userInfo);
    Path adminPath = webSite.getLink(webSite.getAdminPath(), pagePath);

    // grayIcon currently ignored
    return "<img src='" + adminPath.add("filemanager/images/",
        grayIcon ? "help.png" : "help.png") + "' title='Help: " + argument +
        "' alt='Help Icon' onclick=\"javascript:window.open('" +
        adminPath.add("help", lang).add(args.getProperty(argument, "index.html")) +
        (Utils.isNullOrEmpty(anchor) ? "" : "#" + anchor) +
        "', 'meshcmshelp', 'width=740,height=560,menubar=no,status=yes,toolbar=no,resizable=yes,scrollbars=yes').focus();\" />";
  }
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.