Beispiel #1
0
 protected String title() throws Exception {
   WikiPagePath fullPath = getPageCrawler().getFullPath(page);
   TagGroup group = new TagGroup();
   group.add(HtmlUtil.makeLink(PathParser.render(fullPath), page.getName()));
   group.add(HtmlUtil.makeItalic(pageType()));
   return group.html();
 }
Beispiel #2
0
  private HtmlTag makeEditForm(
      String resource, boolean firstTimeForNewPage, String defaultNewPageContent) throws Exception {
    HtmlTag form = new HtmlTag("form");
    form.addAttribute("name", "f");
    form.addAttribute("action", resource);
    form.addAttribute("method", "post");
    form.add(HtmlUtil.makeInputTag("hidden", "responder", "saveData"));
    form.add(HtmlUtil.makeInputTag("hidden", SAVE_ID, String.valueOf(SaveRecorder.newIdNumber())));
    form.add(
        HtmlUtil.makeInputTag("hidden", TICKET_ID, String.valueOf((SaveRecorder.newTicket()))));
    if (request.hasInput("redirectToReferer") && request.hasHeader("Referer")) {
      String redirectUrl = request.getHeader("Referer").toString();
      int questionMarkIndex = redirectUrl.indexOf("?");
      if (questionMarkIndex > 0) redirectUrl = redirectUrl.substring(0, questionMarkIndex);
      redirectUrl += "?" + request.getInput("redirectAction").toString();
      form.add(HtmlUtil.makeInputTag("hidden", "redirect", redirectUrl));
    }

    form.add(createTextarea(firstTimeForNewPage, defaultNewPageContent));
    form.add(createButtons());
    form.add(
        "<br/>Hints:\n<ul>"
            + "<li>Use alt+s (Windows) or control+s (Mac OS X) to save your changes. Or, tab from the text area to the \"Save\" button!</li>\n"
            + "<li>Grab the lower-right corner of the text area to increase its size (works with some browsers).</li>\n"
            + "</ul>");

    TagGroup group = new TagGroup();
    group.add(form);

    return group;
  }
Beispiel #3
0
 private void includeJavaScriptFile(String jsFile, TagGroup scripts) {
   HtmlTag scriptTag = HtmlUtil.makeJavascriptLink(jsFile);
   scripts.add(scriptTag);
 }