use of org.structr.api.util.html.Tag in project structr by structr.
the class TextSetting method render.
@Override
public void render(final Tag parent) {
final Tag group = parent.block("div").css("form-group");
group.block("label").text(getKey());
group.block("textarea").attr(new Attr("name", getKey())).text(getValue(""));
renderResetButton(group);
}
use of org.structr.api.util.html.Tag in project structr by structr.
the class StructrConfigHtmlWriter method beginDocument.
@Override
public RestWriter beginDocument(final String baseUrl, final String propertyView) throws IOException {
String currentType = baseUrl.replace(restPath + "/", "").replace("/" + propertyView, "");
if (!propertyView.equals("public")) {
this.propertyView = "/" + propertyView;
}
Tag head = doc.block("head");
// head.empty("link").attr(new Rel("stylesheet"), new Type("text/css"), new Href("/structr/css/rest.css"));
// head.inline("script").attr(new Type("text/javascript"), new Src("/structr/js/CollapsibleLists.js"));
head.inline("style").attr(new Type("text/css")).text("body,html{font-family:\"Liberation Mono\",\"DejaVu Sans Mono\",Consolas,Monaco,\"Vera Sans Mono\",\"Lucida Console\",\"Courier New\",monospace!important;font-size:9pt;padding:0;margin:0}div#top{border-bottom:1px solid #a5a5a5;line-height:2em;background:#363636;background:-webkit-gradient(linear,left bottom,left top,from(#363636),to(#666)) no-repeat;background:-moz-linear-gradient(90deg,#363636,#666) no-repeat;filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#666666', EndColorStr='#363636', GradientType=0);padding:20px;font-family:Arial,Helvetica,Sans-serif}div#top a{color:#fff;text-decoration:none;font-weight:700;margin-right:1em}div#left{background-color:#eee;padding:10px 20px}div#left a{color:#666;text-decoration:none;font-weight:700;margin-right:1em}div#right{clear:both;padding-left:20px}ul{list-style-type:none}b{font-weight:700;color:#444}a.id,a.id:visited{color:#00a}span.type{font-weight:400;color:#080}span.id{font-weight:400;color:#999}span.name{font-weight:700;color:#666}span.string{color:#c60}span.boolean,span.number{color:#00a}span.null{color:#999}.collapsibleListOpen{list-style-image:url(data:image/gif;base64,R0lGODlhBwAHAOcYAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCww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AHAAcAAAgXAP8JHEgwE0GBBgdmWriw4MF/CR8KDAgAOw==);cursor:pointer}.collapsibleList{cursor:default}button.collapse,button.expand{font-family:\"Liberation Mono\",\"DejaVu Sans Mono\",Consolas,Monaco,\"Vera Sans Mono\",\"Lucida Console\",\"Courier New\",monospace!important;float:right;margin:-.3em 1em 0 0}");
head.inline("script").attr(new Type("text/javascript")).text("var CollapsibleLists=new function(){function g(b){return function(a){a||(a=window.event);for(a=a.target?a.target:a.srcElement;\"LI\"!=a.nodeName;)a=a.parentNode;a==b&&f(b)}}function f(b){for(var a=b.className.match(/(^| )collapsibleListClosed( |$)/),c=b.getElementsByTagName(\"ul\"),d=0;d<c.length;d++){for(var e=c[d];\"LI\"!=e.nodeName;)e=e.parentNode;e==b&&(c[d].style.display=a?\"block\":\"none\")}b.className=b.className.replace(/(^| )collapsibleList(Open|Closed)( |$)/,\"\");0<c.length&&(b.className+=\" collapsibleList\"+\n" + "(a?\"Open\":\"Closed\"))}this.apply=function(b){for(var a=document.getElementsByTagName(\"ul\"),c=0;c<a.length;c++)if(a[c].className.match(/(^| )collapsibleList( |$)/)&&(this.applyTo(a[c],!0),!b))for(var d=a[c].getElementsByTagName(\"ul\"),e=0;e<d.length;e++)d[e].className+=\" collapsibleList\"};this.applyTo=function(b,a){for(var c=b.getElementsByTagName(\"li\"),d=0;d<c.length;d++)a&&b!=c[d].parentNode||(c[d].addEventListener?c[d].addEventListener(\"click\",g(c[d]),!1):c[d].attachEvent(\"onclick\",g(c[d])),f(c[d]))};\n" + "this.openAll=function(){var b = [].slice.call(document.getElementsByClassName(\"collapsibleListClosed\")); [].forEach.call(b, function (el) { f(el); });};this.closeAll=function(){var b = [].slice.call(document.getElementsByClassName(\"collapsibleListOpen\")); [].forEach.call(b, function (el) { f(el); });}};");
head.inline("title").text(baseUrl);
Tag body = doc.block("body").attr(new Onload("if (document.querySelectorAll('#right > ul > li > ul > li > ul.collapsibleList > li').length > 5) { CollapsibleLists.apply(true); }"));
Tag top = body.block("div").id("top");
final App app = StructrApp.getInstance(securityContext);
final Tag left = body.block("div").id("left");
left.inline("button").attr(new Css("collapse right")).attr(new Attr("onclick", "CollapsibleLists.closeAll()")).text(" - ");
left.inline("button").attr(new Css("expand right")).attr(new Attr("onclick", "CollapsibleLists.openAll()")).text(" + ");
try (final Tx tx = app.tx()) {
final List<SchemaNode> schemaNodes = app.nodeQuery(SchemaNode.class).getAsList();
Collections.sort(schemaNodes);
for (SchemaNode node : schemaNodes) {
final String rawType = node.getName();
top.inline("a").attr(new Href(restPath + "/" + rawType), new If(rawType.equals(currentType), new Css("active"))).text(rawType);
}
} catch (Throwable t) {
logger.warn("", t);
}
for (String view : StructrApp.getConfiguration().getPropertyViews()) {
if (!hiddenViews.contains(view)) {
left.inline("a").attr(new Href(restPath + "/" + currentType + "/" + view), new If(view.equals(propertyView), new Css("active"))).text(view);
}
}
// main div
currentElement = body.block("div").id("right");
// h1 title
currentElement.block("h1").text(baseUrl);
// begin ul
currentElement = currentElement.block("ul");
return this;
}
use of org.structr.api.util.html.Tag in project structr by structr.
the class StructrJsonHtmlWriter method beginDocument.
@Override
public RestWriter beginDocument(final String baseUrl, final String propertyView) throws IOException {
String currentType = baseUrl.replace(restPath + "/", "").replace("/" + propertyView, "");
if (!propertyView.equals("public")) {
this.propertyView = "/" + propertyView;
}
Tag head = doc.block("head");
// head.empty("link").attr(new Rel("stylesheet"), new Type("text/css"), new Href("/structr/css/rest.css"));
// head.inline("script").attr(new Type("text/javascript"), new Src("/structr/js/CollapsibleLists.js"));
head.inline("style").attr(new Type("text/css")).text("body,html{font-family:\"Liberation Mono\",\"DejaVu Sans Mono\",Consolas,Monaco,\"Vera Sans Mono\",\"Lucida Console\",\"Courier New\",monospace!important;font-size:9pt;padding:0;margin:0}div#top{border-bottom:1px solid #a5a5a5;line-height:2em;background:#363636;background:-webkit-gradient(linear,left bottom,left top,from(#363636),to(#666)) no-repeat;background:-moz-linear-gradient(90deg,#363636,#666) no-repeat;filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#666666', EndColorStr='#363636', GradientType=0);padding:20px;font-family:Arial,Helvetica,Sans-serif}div#top a{color:#fff;text-decoration:none;font-weight:700;margin-right:1em}div#left{background-color:#eee;padding:10px 20px}div#left a{color:#666;text-decoration:none;font-weight:700;margin-right:1em}div#right{clear:both;padding-left:20px}ul{list-style-type:none}b{font-weight:700;color:#444}a.id,a.id:visited{color:#00a}span.type{font-weight:400;color:#080}span.id{font-weight:400;color:#999}span.name{font-weight:700;color:#666}span.string{color:#c60}span.boolean,span.number{color:#00a}span.null{color:#999}span.comma{color:#000}.collapsibleListOpen{list-style-image:url(data:image/gif;base64,R0lGODlhBwAHAOcYAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVVVVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2RkZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKCgoODg4SEhIWFhYaGhoeHh4iIiImJiYqKiouLi4yMjI2NjY6Ojo+Pj5CQkJGRkZKSkpOTk5SUlJWVlZaWlpeXl5iYmJmZmZqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq6ys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ZmZqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq6ysrK2tra6urq+vr7CwsLGxsbKysrOzs7S0tLW1tba2tre3t7i4uLm5ubq6uru7u7y8vL29vb6+vr+/v8DAwMHBwcLCwsPDw8TExMXFxcbGxsfHx8jIyMnJycrKysvLy8zMzM3Nzc7Ozs/Pz9DQ0NHR0dLS0tPT09TU1NXV1dbW1tfX19jY2NnZ2dra2tvb29zc3N3d3d7e3t/f3+Dg4OHh4eLi4uPj4+Tk5OXl5ebm5ufn5+jo6Onp6erq6uvr6+zs7O3t7e7u7u/v7/Dw8PHx8fLy8vPz8/T09PX19fb29vf39/j4+Pn5+fr6+vv7+/z8/P39/f7+/v///yH5BAEKAP8ALAAAAAAHAAcAAAgXAP8JHEgwE0GBBgdmWriw4MF/CR8KDAgAOw==);cursor:pointer}.collapsibleList{cursor:default}button.collapse,button.expand{font-family:\"Liberation Mono\",\"DejaVu Sans Mono\",Consolas,Monaco,\"Vera Sans Mono\",\"Lucida Console\",\"Courier New\",monospace!important;float:right;margin:-.3em 1em 0 0}li.collapsibleListClosed>ul.collapsibleList>li{display:none}li.collapsibleListClosed>ul.collapsibleList::before{content:\"…\"}li.collapsibleListClosed>ul.collapsibleList:empty{display:none}li.collapsibleListClosed>ul.collapsibleList{line-height:11px;display:inline-block;border:1px solid #aaa;border-radius:6px;padding-left:2px;cursor:pointer;background-color:#ddd;padding-right:3px;margin-left:-5px;margin-right:-5px;font-family:initial}");
head.inline("script").attr(new Type("text/javascript")).text("var CollapsibleLists=new function(){function g(b){return function(a){a||(a=window.event);for(a=a.target?a.target:a.srcElement;\"LI\"!=a.nodeName;)a=a.parentNode;a==b&&f(b)}}function f(b){for(var a=b.className.match(/(^| )collapsibleListClosed( |$)/),c=b.getElementsByTagName(\"ul\"),d=0;d<c.length;d++){for(var e=c[d];\"LI\"!=e.nodeName;)e=e.parentNode}b.className=b.className.replace(/(^| )collapsibleList(Open|Closed)( |$)/,\"\");0<c.length&&(b.className+=\" collapsibleList\"+\n" + "(a?\"Open\":\"Closed\"))}this.apply=function(b){for(var a=document.getElementsByTagName(\"ul\"),c=0;c<a.length;c++)if(a[c].className.match(/(^| )collapsibleList( |$)/)&&(this.applyTo(a[c],!0),!b))for(var d=a[c].getElementsByTagName(\"ul\"),e=0;e<d.length;e++)d[e].className+=\" collapsibleList\"};this.applyTo=function(b,a){for(var c=b.getElementsByTagName(\"li\"),d=0;d<c.length;d++)a&&b!=c[d].parentNode||(c[d].addEventListener?c[d].addEventListener(\"click\",g(c[d]),!1):c[d].attachEvent(\"onclick\",g(c[d])),f(c[d]))};\n" + "this.openAll=function(){var b = [].slice.call(document.getElementsByClassName(\"collapsibleListClosed\")); [].forEach.call(b, function (el) { f(el); });};this.closeAll=function(){var b = [].slice.call(document.getElementsByClassName(\"collapsibleListOpen\")); [].forEach.call(b, function (el) { f(el); });}};");
head.inline("title").text(baseUrl);
Tag body = doc.block("body").attr(new Onload("if (document.querySelectorAll('#right > ul > li > ul > li > ul.collapsibleList > li').length > 5) { CollapsibleLists.apply(true); }"));
Tag top = body.block("div").id("top");
final App app = StructrApp.getInstance(securityContext);
final Tag left = body.block("div").id("left");
left.inline("button").attr(new Css("collapse right")).attr(new Attr("onclick", "CollapsibleLists.closeAll()")).text(" - ");
left.inline("button").attr(new Css("expand right")).attr(new Attr("onclick", "CollapsibleLists.openAll()")).text(" + ");
try (final Tx tx = app.tx()) {
final List<SchemaNode> schemaNodes = app.nodeQuery(SchemaNode.class).getAsList();
Collections.sort(schemaNodes);
for (SchemaNode node : schemaNodes) {
final String rawType = node.getName();
top.inline("a").attr(new Href(restPath + "/" + rawType), new If(rawType.equals(currentType), new Css("active"))).text(rawType);
}
} catch (Throwable t) {
logger.warn("", t);
}
for (String view : StructrApp.getConfiguration().getPropertyViews()) {
if (!hiddenViews.contains(view)) {
left.inline("a").attr(new Href(restPath + "/" + currentType + "/" + view), new If(view.equals(propertyView), new Css("active"))).text(view);
}
}
// main div
currentElement = body.block("div").id("right");
// h1 title
currentElement.block("h1").text(baseUrl);
// begin ul
currentElement = currentElement.block("ul");
return this;
}
use of org.structr.api.util.html.Tag in project structr by structr.
the class ConfigServlet method createConfigDocument.
// ----- private methods -----
private Document createConfigDocument(final HttpServletRequest request, final PrintWriter writer) {
final Document doc = new Document(writer);
final Tag body = setupDocument(request, doc);
final Tag form = body.block("form").css("config-form");
final Tag main = form.block("div").id("main");
final Tag tabs = main.block("div").id("configTabs");
final Tag menu = tabs.block("ul").id("configTabsMenu");
// configure form
form.attr(new Attr("action", ConfigUrl), new Attr("method", "post"));
for (final SettingsGroup group : Settings.getGroups()) {
final String key = group.getKey();
final String name = group.getName();
menu.block("li").block("a").id(key + "Menu").attr(new Attr("href", "#" + key)).block("span").text(name);
final Tag container = tabs.block("div").css("tab-content").id(key);
// let settings group render itself
group.render(container);
// stop floating
container.block("div").attr(new Style("clear: both;"));
}
// add services tab
menu.block("li").block("a").id("servicesMenu").attr(new Attr("href", "#services")).block("span").text("Services");
final Services services = Services.getInstance();
final Tag container = tabs.block("div").css("tab-content").id("services");
final Tag table = container.block("table").id("services-table");
final Tag header = table.block("tr");
header.block("th").text("Service Name");
header.block("th").attr(new Attr("colspan", "2"));
for (final String serviceClassName : services.getServices()) {
final Class<Service> serviceClass = services.getServiceClassForName(serviceClassName);
final boolean running = serviceClass != null ? services.isReady(serviceClass) : false;
final Tag row = table.block("tr");
row.block("td").text(serviceClassName);
if (running) {
row.block("td").block("button").attr(new Type("button"), new OnClick("window.location.href='" + ConfigUrl + "?restart=" + serviceClassName + "';")).text("Restart");
if ("HttpService".equals(serviceClassName)) {
row.block("td");
} else {
row.block("td").block("button").attr(new Type("button"), new OnClick("window.location.href='" + ConfigUrl + "?stop=" + serviceClassName + "';")).text("Stop");
}
row.block("td");
} else {
row.block("td");
row.block("td");
row.block("td").block("button").attr(new Type("button"), new OnClick("window.location.href='" + ConfigUrl + "?start=" + serviceClassName + "';")).text("Start");
}
}
// update active section so we can restore it when redirecting
container.empty("input").attr(new Type("hidden"), new Name("active_section")).id("active_section");
// stop floating
container.block("div").attr(new Style("clear: both;"));
// buttons
final Tag buttons = form.block("div").css("buttons");
buttons.block("button").attr(new Type("button")).id("new-entry-button").text("Add entry");
buttons.block("button").attr(new Type("button"), new OnClick("window.location.href='" + ConfigUrl + "?reload';")).text("Reload configuration file");
buttons.empty("input").attr(new Type("submit"), new Value("Save to structr.conf"));
body.block("script").text("$('#new-entry-button').on('click', createNewEntry);");
return doc;
}
use of org.structr.api.util.html.Tag in project structr by structr.
the class ConfigServlet method createLoginDocument.
private Document createLoginDocument(final HttpServletRequest request, final PrintWriter writer) {
final Document doc = new Document(writer);
final Tag body = setupDocument(request, doc).css("login");
final Tag loginBox = body.block("div").id("login").css("dialog").attr(new Style("display: block; margin: auto; margin-top: 200px;"));
loginBox.block("i").attr(new Attr("title", "Structr Logo")).css("logo-login sprite sprite-structr_gray_100x27");
loginBox.block("p").text("Welcome to the " + TITLE + ". Please log in with the <b>super- user</b> password which can be found in your structr.conf.");
final Tag form = loginBox.block("form").attr(new Attr("action", ConfigUrl), new Attr("method", "post"));
final Tag table = form.block("table");
final Tag row1 = table.block("tr");
row1.block("td").block("label").attr(new Attr("for", "passwordField")).text("Password:");
row1.block("td").empty("input").id("passwordField").attr(new Type("password"), new Name("password"));
final Tag row2 = table.block("tr");
final Tag cell13 = row2.block("td").attr(new Attr("colspan", "2")).css("btn");
final Tag button = cell13.block("button").id("loginButton").attr(new Name("login"));
button.block("i").css("sprite sprite-key");
button.block("span").text(" Login");
cell13.empty("input").attr(new Type("hidden"), new Name("action"), new Value("login"));
return doc;
}
Aggregations