use of org.structr.api.util.html.Attr in project structr by structr.
the class ConfigServlet method setupDocument.
// ----- private methods -----
private Tag setupDocument(final HttpServletRequest request, final Document doc) {
final Tag head = doc.block("head");
head.block("title").text(TITLE);
head.empty("meta").attr(new Attr("http-equiv", "Content-Type"), new Attr("content", "text/html;charset=utf-8"));
head.empty("meta").attr(new Name("viewport"), new Attr("content", "width=1024, user-scalable=yes"));
head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/lib/jquery-ui-1.10.3.custom.min.css"));
head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/main.css"));
head.empty("link").attr(new Rel("stylesheet"), new Href("/structr/css/config.css"));
head.empty("link").attr(new Rel("icon"), new Href("favicon.ico"), new Type("image/x-icon"));
head.block("script").attr(new Src("/structr/js/lib/jquery-1.11.1.min.js"));
head.block("script").attr(new Src("/structr/js/lib/jquery-ui-1.11.0.custom.min.js"));
head.block("script").attr(new Src("/structr/js/icons.js"));
head.block("script").attr(new Src("/structr/js/config.js"));
final Tag body = doc.block("body");
final Tag header = body.block("div").id("header");
header.block("i").css("logo sprite sprite-structr-logo");
final Tag links = header.block("div").id("menu").css("menu").block("ul");
if (isAuthenticated(request)) {
final Tag form = links.block("li").block("form").attr(new Attr("action", ConfigUrl), new Attr("method", "post"), new Style("display: none")).id("logout-form");
form.empty("input").attr(new Type("hidden"), new Name("action"), new Value("logout"));
links.block("a").text("Logout").attr(new Style("cursor: pointer"), new OnClick("$('#logout-form').submit();"));
}
return body;
}
use of org.structr.api.util.html.Attr in project structr by structr.
the class StringSetting method render.
@Override
public void render(final Tag parent) {
final Tag group = parent.block("div").css("form-group");
final Tag label = group.block("label").text(getKey());
if (getComment() != null) {
label.attr(new Attr("class", "has-comment"));
label.attr(new Attr("data-comment", getComment()));
}
final Tag input = group.empty("input").attr(new Attr("type", "text"), new Attr("name", getKey()));
final String value = getValue();
// display value if non-empty
if (value != null) {
input.attr(new Attr("value", value));
}
renderResetButton(group);
}
use of org.structr.api.util.html.Attr in project structr by structr.
the class BooleanSetting method render.
@Override
public void render(final Tag parent) {
final Tag group = parent.block("div").css("form-group");
final Tag label = group.block("label").text(getKey());
if (getComment() != null) {
label.attr(new Attr("class", "has-comment"));
label.attr(new Attr("data-comment", getComment()));
}
final Tag trueInput = group.empty("input").attr(new Attr("type", "radio"), new Attr("name", getKey()), new Attr("value", "true"));
group.block("span").text("Enabled");
final Tag falseInput = group.empty("input").attr(new Attr("type", "radio"), new Attr("name", getKey()), new Attr("value", "false"));
group.block("span").text("Disabled");
if (getValue()) {
trueInput.attr(new Attr("checked", "checked"));
} else {
falseInput.attr(new Attr("checked", "checked"));
}
renderResetButton(group);
}
use of org.structr.api.util.html.Attr in project structr by structr.
the class ChoiceSetting method render.
@Override
public void render(final Tag parent) {
final Tag group = parent.block("div").css("form-group");
group.block("label").text(getKey());
final Tag select = group.block("select").attr(new Attr("name", getKey()));
for (final String choice : choices) {
final Tag option = select.block("option").text(choice);
// selected?
if (choice.equals(getValue())) {
option.attr(new Attr("selected", "selected"));
}
}
}
use of org.structr.api.util.html.Attr in project structr by structr.
the class IntegerSetting method render.
@Override
public void render(final Tag parent) {
final Tag group = parent.block("div").css("form-group");
group.block("label").text(getKey());
final Tag input = group.empty("input").attr(new Attr("type", "text"), new Attr("name", getKey()));
final Integer value = getValue();
// display value if non-empty
if (value != null) {
input.attr(new Attr("value", value));
}
renderResetButton(group);
}
Aggregations