private HtmlTag makeMergeNewDivTag() { HtmlTag mergeNew = HtmlUtil.makeDivTag("merge_new"); mergeNew.add("Your Changes"); mergeNew.add(HtmlUtil.BR); mergeNew.add(makeContentTextArea()); mergeNew.add(makeInputTagWithAccessKey()); return mergeNew; }
private HtmlTag makeMergeOldDivTag() { HtmlTag mergeOld = HtmlUtil.makeDivTag("merge_old"); mergeOld.add("Existing Content (read only)"); mergeOld.add(HtmlUtil.BR); mergeOld.add(makeOldContentTextArea()); return mergeOld; }
public HtmlTag makeTagsHtml(PageData pageData) throws Exception { HtmlTag div = new HtmlTag("div"); div.addAttribute("style", "float: left; padding-right: 5px"); div.add(makeInputField("Tags:", PropertySUITES, PropertySUITES, 40, pageData)); return div; }
private HtmlTag makeContentTextArea() { HtmlTag contentTextArea = new HtmlTag("textarea"); contentTextArea.addAttribute("name", EditResponder.CONTENT_INPUT_NAME); contentTextArea.addAttribute("rows", "25"); contentTextArea.addAttribute("cols", "50"); contentTextArea.add(newContent); return contentTextArea; }
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; }
private HtmlTag makeOldContentTextArea() { HtmlTag oldContentTextArea = new HtmlTag("textarea"); oldContentTextArea.addAttribute("class", OLD_CONTENT_INPUT_NAME); oldContentTextArea.addAttribute("name", OLD_CONTENT_INPUT_NAME); oldContentTextArea.addAttribute("rows", "25"); oldContentTextArea.addAttribute("cols", "50"); oldContentTextArea.addAttribute("readonly", "readonly"); oldContentTextArea.add(Utils.escapeHTML(existingContent)); return oldContentTextArea; }
private HtmlTag createTextarea(boolean firstTimeForNewPage, String defaultNewPageContent) { HtmlTag textarea = new HtmlTag("textarea"); textarea.addAttribute("class", CONTENT_INPUT_NAME); textarea.addAttribute("name", CONTENT_INPUT_NAME); textarea.addAttribute("rows", "30"); textarea.addAttribute("cols", "70"); textarea.addAttribute("tabindex", "1"); textarea.add(Utils.escapeHTML(firstTimeForNewPage ? defaultNewPageContent : content)); return textarea; }
public HtmlTag makeInputField( String label, String propertyName, String fieldId, int size, PageData pageData) throws Exception { HtmlTag div = new HtmlTag("div"); div.addAttribute("style", "float: left;"); div.add(label); String textValue = ""; WikiPageProperty theProp = pageData.getProperties().getProperty(propertyName); if (theProp != null) { String propValue = theProp.getValue(); if (propValue != null) textValue = propValue; } div.add(HtmlUtil.BR); HtmlTag input = HtmlUtil.makeInputTag("text", fieldId, textValue); input.addAttribute("size", Integer.toString(size)); div.add(input); return div; }
private HtmlTag makeRenameFormHTML(String filename) throws Exception { HtmlTag form = HtmlUtil.makeFormTag("get", "/" + resource); form.add(HtmlUtil.makeInputTag("hidden", "responder", "renameFile")); form.add("Rename " + HtmlUtil.makeBold(filename).html() + " to "); form.add(HtmlUtil.BR); form.add(HtmlUtil.BR); form.add(HtmlUtil.BR); form.add(HtmlUtil.makeInputTag("text", "newName", filename)); form.add(HtmlUtil.makeInputTag("submit", "renameFile", "Rename")); form.add(HtmlUtil.makeInputTag("hidden", "filename", filename)); return form; }
private String makeRightColumn() throws Exception { HtmlTag form = HtmlUtil.makeFormTag("post", resource); form.add(HtmlUtil.makeInputTag("hidden", "responder", "saveData")); form.add( HtmlUtil.makeInputTag( "hidden", EditResponder.TIME_STAMP, String.valueOf(clock.currentClockTimeInMillis()))); form.add( HtmlUtil.makeInputTag( "hidden", EditResponder.TICKET_ID, String.valueOf(SaveRecorder.newTicket()))); HtmlTag title = HtmlUtil.makeDivTag("centered"); title.use( "This page has been recently modified. You may want to merge existing page content into your changes."); form.add(title); form.add(makeMergeNewDivTag()); form.add(makeMergeOldDivTag()); form.add(addHiddenAttributes()); return form.html(); }
public HtmlTag makeCollapsableSection(HtmlElement title, HtmlElement content) { String id = random.nextLong() + ""; // invisible: < recognition HtmlTag outerDiv; if (invisible) { outerDiv = HtmlUtil.makeDivTag(collapsableInvisibleCss); outerDiv.add(content); return outerDiv; } outerDiv = HtmlUtil.makeDivTag(cssClass); HtmlTag image = new HtmlTag("img"); image.addAttribute("src", imageSrc()); image.addAttribute("class", "left"); image.addAttribute("id", "img" + id); HtmlTag anchor = new HtmlTag("a", image); anchor.addAttribute("href", "javascript:toggleCollapsable('" + id + "');"); HtmlTag links = new HtmlTag("div"); links.addAttribute("style", "float: right;"); links.addAttribute("class", "meta"); links.add(expandAllLink + " | " + collapseAllLink); outerDiv.add(links); outerDiv.add(anchor); outerDiv.add(title); HtmlTag collapsablediv = makeCollapsableDiv(); collapsablediv.addAttribute("id", id); collapsablediv.add(content); outerDiv.add(collapsablediv); return outerDiv; }
private HtmlTag createButtons() throws Exception { HtmlTag buttons = HtmlUtil.makeDivTag("edit_buttons"); buttons.add(makeSaveButton()); buttons.add(makeScriptButtons()); return buttons; }