return stringbuf.toString();
}
private StringBuffer getTrail(Host host, StringBuffer stringbuffer, String openPath,int idxOf, String path, HashSet listItems) throws DotSecurityException, DotStateException, DotDataException {
Folder folder = fapi.findFolderByPath(openPath,host,APILocator.getUserAPI().getSystemUser(),false);
String folderPath = APILocator.getIdentifierAPI().find(folder).getPath();
if (idxOf!=-1) {
Logger.debug(CrumbTrailBuilder.class, "getTrail: idxOf");
if (listItems.add(folder.getTitle())) {
stringbuffer.append("<li><a href=\"" + folderPath + "\">");
stringbuffer.append(folder.getTitle() + "</a> > </li>");
}
}
else {
int idxTrail = path.lastIndexOf("/");
if (idxTrail!=(path.length()-1)) {
openPath = path.substring(0,idxTrail+1);
if (path.indexOf(".")!=-1) {
String pagePath = path.substring(idxTrail+1,path.length());
Logger.debug(CrumbTrailBuilder.class, "getTrail: Page Path=" + pagePath);
Logger.debug(CrumbTrailBuilder.class, "getTrail: Path=" + openPath);
if (!pagePath.equals("index." + Config.getStringProperty("VELOCITY_PAGE_EXTENSION"))) {
HTMLPage page = HTMLPageFactory.getLiveHTMLPageByPath(openPath + "index." + Config.getStringProperty("VELOCITY_PAGE_EXTENSION"), host);
if (InodeUtils.isSet(page.getInode())) {
if (listItems.add(folder.getTitle())) {
stringbuffer.append("<li><a href=\"" + folderPath + "\">");
stringbuffer.append(folder.getTitle() + "</a> > </li>");
}
}
Logger.debug(CrumbTrailBuilder.class, "getTrail: it's not index.html");
stringbuffer = getPageTrail(host, stringbuffer, openPath, pagePath,listItems);
}
else {
Logger.debug(CrumbTrailBuilder.class, "getTrail: it's index.html");
if (listItems.add(folder.getTitle())) {
stringbuffer.append("<li>" + folder.getTitle() + "</li>");
}
}
}
}
else {
Logger.debug(CrumbTrailBuilder.class, "getTrail: there isn't a page name");
if (listItems.add(folder.getTitle())) {
stringbuffer.append("<li>" + folder.getTitle() + " > </li>");
}
}
}
return stringbuffer;