Package com.psddev.cms.db

Examples of com.psddev.cms.db.Template


        if (object != null) {
            State.getInstance(object).setResolveInvisible(true);
        }

        Template template = Query.from(Template.class).where("_id = ?", param(UUID.class, "templateId")).first();

        if (template != null) {
            if (object == null) {
                Set<ObjectType> contentTypes = template.getContentTypes();

                if (!contentTypes.isEmpty()) {
                    object = contentTypes.iterator().next().createObject(objectId);
                    State.getInstance(object).as(Site.ObjectModification.class).setOwner(getSite());
                }
View Full Code Here


                    page.writeStart("h2").writeHtml("Create New").writeEnd();

                    page.writeStart("ul", "class", "links pageThumbnails");
                        for (TypeTemplate typeTemplate : favorites) {
                            ObjectType type = typeTemplate.type;
                            Template template = typeTemplate.template;
                            State state = State.getInstance(Query.fromType(type).where("cms.template.default = ?", template).first());
                            String permalink = null;

                            if (state != null) {
                                permalink = state.as(Directory.ObjectModification.class).getPermalink();
                            }

                            page.writeStart("li", "data-preview-url", permalink);
                                page.writeStart("a",
                                        "target", "_top",
                                        "href", page.url("/content/edit.jsp",
                                                "typeId", type.getId(),
                                                "templateId", template != null ? template.getId() : null));
                                    page.writeHtml(getTypeTemplateLabel(typeCounts, typeTemplate));
                                page.writeEnd();
                            page.writeEnd();
                        }
                    page.writeEnd();
View Full Code Here

        page.writeEnd();
    }

    private String getTypeTemplateLabel(Map<ObjectType, Integer> typeCounts, TypeTemplate typeTemplate) {
        ObjectType type = typeTemplate.type;
        Template template = typeTemplate.template;
        StringBuilder label = new StringBuilder();

        label.append(ToolPageContext.Static.getObjectLabel(type));

        if (template != null && typeCounts.get(type) > 1) {
View Full Code Here

TOP

Related Classes of com.psddev.cms.db.Template

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.