Search in sources :

Example 21 with Body

use of org.structr.web.entity.html.Body in project structr by structr.

the class DeploymentTest method test06SimpleTemplateInSharedComponents.

@Test
public void test06SimpleTemplateInSharedComponents() {
    // setup
    try (final Tx tx = app.tx()) {
        final Page page = Page.createNewPage(securityContext, "test06");
        final Html html = createElement(page, page, "html");
        final Head head = createElement(page, html, "head");
        createElement(page, head, "title", "test06");
        final Body body = createElement(page, html, "body");
        createElement(page, body, "div");
        final ShadowDocument shadowDocument = CreateComponentCommand.getOrCreateHiddenDocument();
        createTemplate(shadowDocument, null, "template source - öäüÖÄÜß'\"'`");
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    // test
    compare(calculateHash(), true);
}
Also used : Head(org.structr.web.entity.html.Head) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) ShadowDocument(org.structr.web.entity.dom.ShadowDocument) Body(org.structr.web.entity.html.Body) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Example 22 with Body

use of org.structr.web.entity.html.Body in project structr by structr.

the class DeploymentTest method test16SharedTemplateWithChildren.

@Test
public void test16SharedTemplateWithChildren() {
    // setup
    try (final Tx tx = app.tx()) {
        final Page page = Page.createNewPage(securityContext, "test16");
        final Html html = createElement(page, page, "html");
        final Head head = createElement(page, html, "head");
        createElement(page, head, "title", "test16");
        final Body body = createElement(page, html, "body");
        final Div div1 = createElement(page, body, "div");
        final Template template = createTemplate(page, div1, "template source - öäüÖÄÜß'\"'`");
        createElement(page, template, "div");
        final DOMNode table = createElement(page, template, "table");
        final DOMNode tr = createElement(page, table, "tr");
        createElement(page, tr, "td");
        createElement(page, tr, "td");
        createComponent(template);
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    // test
    compare(calculateHash(), true, false);
}
Also used : Div(org.structr.web.entity.html.Div) Head(org.structr.web.entity.html.Head) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) DOMNode(org.structr.web.entity.dom.DOMNode) Body(org.structr.web.entity.html.Body) Template(org.structr.web.entity.dom.Template) MailTemplate(org.structr.core.entity.MailTemplate) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Example 23 with Body

use of org.structr.web.entity.html.Body in project structr by structr.

the class DeploymentTest method test05SimpleTemplateInPage.

@Test
public void test05SimpleTemplateInPage() {
    // setup
    try (final Tx tx = app.tx()) {
        final Page page = Page.createNewPage(securityContext, "test05");
        final Html html = createElement(page, page, "html");
        final Head head = createElement(page, html, "head");
        createElement(page, head, "title", "test05");
        final Body body = createElement(page, html, "body");
        final Div div1 = createElement(page, body, "div");
        final Template template = createTemplate(page, div1, "template source - öäüÖÄÜß'\"'`");
        final PropertyMap templateProperties = new PropertyMap();
        templateProperties.put(StructrApp.key(Template.class, "functionQuery"), "find('User')");
        templateProperties.put(StructrApp.key(Template.class, "dataKey"), "user");
        template.setProperties(template.getSecurityContext(), templateProperties);
        // append children to template object
        createElement(page, template, "div");
        createElement(page, template, "div");
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    // test
    compare(calculateHash(), true);
}
Also used : Div(org.structr.web.entity.html.Div) Head(org.structr.web.entity.html.Head) PropertyMap(org.structr.core.property.PropertyMap) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) Body(org.structr.web.entity.html.Body) Template(org.structr.web.entity.dom.Template) MailTemplate(org.structr.core.entity.MailTemplate) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Example 24 with Body

use of org.structr.web.entity.html.Body in project structr by structr.

the class DeploymentTest method test24ContentShowConditions.

@Test
public void test24ContentShowConditions() {
    // setup
    try (final Tx tx = app.tx()) {
        final Page page = Page.createNewPage(securityContext, "test24");
        final Html html = createElement(page, page, "html");
        final Head head = createElement(page, html, "head");
        createElement(page, head, "title", "test24");
        final Body body = createElement(page, html, "body");
        final Div div1 = createElement(page, body, "div");
        final Content content1 = createContent(page, div1, "${current.type}");
        final Content content2 = createContent(page, div1, "${find('User', 'name', '@structr')[0].id}");
        final Content content3 = createContent(page, div1, "${find('User', 'name', '@structr')[0].id}");
        content1.setProperty(StructrApp.key(DOMNode.class, "showConditions"), "eq(current.type, 'MyTestFolder')");
        content2.setProperty(StructrApp.key(DOMNode.class, "showConditions"), "if(equal(extract(first(find('User', 'name' 'structr')), 'name'), '@structr'), true, false)");
        // for testing only
        content3.setProperty(StructrApp.key(DOMNode.class, "showConditions"), "(((((([]))))))");
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    // test
    compare(calculateHash(), true);
}
Also used : Div(org.structr.web.entity.html.Div) Head(org.structr.web.entity.html.Head) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Content(org.structr.web.entity.dom.Content) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) DOMNode(org.structr.web.entity.dom.DOMNode) Body(org.structr.web.entity.html.Body) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Example 25 with Body

use of org.structr.web.entity.html.Body in project structr by structr.

the class DeploymentTest method test09SharedTemplatesWithChildren.

@Test
public void test09SharedTemplatesWithChildren() {
    // setup
    try (final Tx tx = app.tx()) {
        // create first page
        final Page page1 = Page.createNewPage(securityContext, "test09_1");
        final Html html1 = createElement(page1, page1, "html");
        final Head head1 = createElement(page1, html1, "head");
        createElement(page1, head1, "title", "test09_1");
        final Body body1 = createElement(page1, html1, "body");
        final Div div1 = createElement(page1, body1, "div");
        final Template template1 = createTemplate(page1, div1, "template source - öäüÖÄÜß'\"'`");
        createElement(page1, template1, "div", "test1");
        createElement(page1, template1, "div", "test1");
        final Template component = createComponent(template1);
        // create second page
        final Page page2 = Page.createNewPage(securityContext, "test09_2");
        final Html html2 = createElement(page2, page2, "html");
        final Head head2 = createElement(page2, html2, "head");
        createElement(page2, head2, "title", "test09_2");
        final Body body2 = createElement(page2, html2, "body");
        final Div div2 = createElement(page2, body2, "div");
        // re-use template from above
        cloneComponent(component, div2);
        tx.success();
    } catch (FrameworkException fex) {
        fail("Unexpected exception.");
    }
    // test
    compare(calculateHash(), true);
}
Also used : Div(org.structr.web.entity.html.Div) Head(org.structr.web.entity.html.Head) Tx(org.structr.core.graph.Tx) FrameworkException(org.structr.common.error.FrameworkException) Html(org.structr.web.entity.html.Html) Page(org.structr.web.entity.dom.Page) Body(org.structr.web.entity.html.Body) Template(org.structr.web.entity.dom.Template) MailTemplate(org.structr.core.entity.MailTemplate) Test(org.junit.Test) StructrUiTest(org.structr.web.StructrUiTest)

Aggregations

Body (org.structr.web.entity.html.Body)29 Head (org.structr.web.entity.html.Head)29 Test (org.junit.Test)28 FrameworkException (org.structr.common.error.FrameworkException)28 Tx (org.structr.core.graph.Tx)28 StructrUiTest (org.structr.web.StructrUiTest)28 Page (org.structr.web.entity.dom.Page)28 Html (org.structr.web.entity.html.Html)28 Div (org.structr.web.entity.html.Div)22 MailTemplate (org.structr.core.entity.MailTemplate)10 Template (org.structr.web.entity.dom.Template)10 Content (org.structr.web.entity.dom.Content)8 PropertyMap (org.structr.core.property.PropertyMap)6 DOMNode (org.structr.web.entity.dom.DOMNode)6 GraphObject (org.structr.core.GraphObject)4 NodeAttribute (org.structr.core.graph.NodeAttribute)4 Principal (org.structr.core.entity.Principal)3 StringProperty (org.structr.core.property.StringProperty)3 User (org.structr.web.entity.User)3 Script (org.structr.web.entity.html.Script)3