Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 22 23 package org.meshcms.taglib; 24 25 import java.io.*; 26 import org.meshcms.core.*; 27 import org.meshcms.util.*; 28 29 33 public final class SearchFile extends AbstractTag { 34 private String name; 35 private String defaultName; 36 37 public void writeTag() throws IOException { 38 if (!Utils.isNullOrEmpty(name)) { 39 Path found = null; 40 Path currentPath = webSite.getDirectory(pagePath); 41 42 while (found == null && !currentPath.isRelative()) { 43 Path p = currentPath.add(name); 44 currentPath = currentPath.getParent(); 45 46 if (webSite.getFile(p).exists()) { 47 found = p; 48 } 49 } 50 51 if (found == null && defaultName != null) { 52 Path themePath = (Path) request.getAttribute(HitFilter.THEME_PATH_ATTRIBUTE); 53 54 if (themePath != null) { 55 themePath = themePath.add(defaultName); 56 57 if (webSite.getFile(themePath).exists()) { 58 found = themePath; 59 } 60 } 61 } 62 63 if (found != null) { 64 getOut().write(cp + '/' + found); 65 } 66 } 67 } 68 69 public String getName() { 70 return name; 71 } 72 73 public void setName(String name) { 74 this.name = name; 75 } 76 77 public String getDefaultName() { 78 return defaultName; 79 } 80 81 public void setDefaultName(String defaultName) { 82 this.defaultName = defaultName; 83 } 84 } 85
| Popular Tags
|