Пример #1
0
 private CharSequence printLinkListItem(String path) throws IOException {
   StringBuilder buf = new StringBuilder();
   Page page = pageStore.getPage(projectName, branchName, path, false);
   String title = page.getTitle();
   if (path.equals(this.path)) {
     buf.append(printActiveLinkListItem(path, title));
   } else {
     buf.append(printRegularLinkListItem(path, title));
   }
   return buf;
 }
Пример #2
0
  private CharSequence printParent(CharSequence inner, String path) throws IOException {
    StringBuilder buf = new StringBuilder();
    Page page = pageStore.getPage(projectName, branchName, path, false);
    if (page.getParentPagePath() != null) {
      if (hasViewPermission(page.getParentPagePath())) {
        StringBuilder parentBuf = new StringBuilder();
        Page parentPage =
            pageStore.getPage(projectName, branchName, page.getParentPagePath(), false);
        String uri = htmlSerializerContext.getPageUri(page.getParentPagePath());
        parentBuf
            .append("<li><a href=\"")
            .append(uri)
            .append("\">") // $NON-NLS-1$ //$NON-NLS-2$
            .append(parentPage.getTitle())
            .append("</a>") // $NON-NLS-1$
            .append("<ul class=\"nav nav-list\">"); // $NON-NLS-1$

        if (path.equals(this.path)) {
          List<String> siblingPaths =
              pageStore.listChildPagePaths(projectName, branchName, page.getParentPagePath());
          for (String siblingPath : siblingPaths) {
            parentBuf.append(siblingPath.equals(path) ? inner : printLinkListItem(siblingPath));
          }
        } else {
          parentBuf.append(inner);
        }
        parentBuf
            .append("</ul>") // $NON-NLS-1$
            .append("</li>"); // $NON-NLS-1$

        buf.append(printParent(parentBuf, page.getParentPagePath()));
      }
    } else {
      buf.append(inner);
    }
    return buf;
  }