You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2018/01/29 18:56:47 UTC
[sling-whiteboard] branch master updated: Added the ability to
create and edit pages
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 62f0ba8 Added the ability to create and edit pages
62f0ba8 is described below
commit 62f0ba8f0a8735f4327055324ba7d3f7c0718800
Author: Dan Klco <da...@gmail.com>
AuthorDate: Mon Jan 29 13:56:39 2018 -0500
Added the ability to create and edit pages
---
cms/core/pom.xml | 6 +-
.../main/java/org/apache/sling/cms/CMSUtils.java | 24 ++++++
.../sling/cms/core/filters/EditIncludeFilter.java | 9 ++-
.../sling/cms/core/models/EditableResource.java | 12 ++-
.../org/apache/sling/cms/core/models/Page.java | 36 ++++-----
.../apache/sling/cms/core/models/PageManager.java | 3 +-
.../apache/sling/cms/core/models/PageTemplate.java | 77 ++++++++++++++++++--
.../sling/cms/core/models/PageTemplateManager.java | 64 ++++++++++++++++
.../org/apache/sling/cms/core/models/Site.java | 18 ++---
.../apache/sling/cms/core/models/SiteConfig.java | 41 +++++------
.../apache/sling/cms/core/models/SiteManager.java | 3 +-
cms/ui/pom.xml | 1 +
.../apps/reference/components/pages/base.json | 5 ++
.../reference/components/pages/base/base.jsp} | 6 +-
.../reference/components/pages/base/body.jsp} | 13 +++-
.../reference/components/pages/base/content.jsp} | 2 +-
.../reference}/components/pages/base/head.jsp | 13 ++--
.../reference}/components/pages/base/scripts.jsp | 7 +-
.../etc/clientlibs/sling-cms/css/editor.css | 23 +++++-
.../etc/clientlibs/sling-cms/css/styles.css | 4 +-
.../jcr_root/etc/clientlibs/sling-cms/js/editor.js | 11 ++-
.../etc/clientlibs/sling-cms/js/scripts.js | 37 +++++++++-
.../components/cms/contentnav/contentnav.jsp | 32 ++++++++
.../field.jsp => cms/pageeditbar/pageeditbar.jsp} | 8 +-
.../field.jsp => cms/pageeditor/pageeditor.jsp} | 4 +-
.../field.jsp => cms/pageproperties/include.jsp} | 9 ++-
.../pageproperties/pageproperties.jsp} | 9 ++-
.../components/cms/pagetemplate/edit.json | 1 +
.../components/cms/pagetemplate/pagetemplate.jsp | 3 +
.../field.jsp => cms/pagewrapper/pagewrapper.jsp} | 6 +-
.../components/cms/siteconfig/siteconfig.jsp | 2 +-
.../sling-cms/components/editor/fields/hidden.json | 5 ++
.../components/editor/fields/hidden/edit.json | 23 ++++++
.../editor/fields/{text.json => richtext.json} | 0
.../sling-cms/components/editor/fields/text.json | 4 +-
.../components/editor/fields/text/edit.json | 85 ++++++++++++++++++++++
.../components/editor/fields/text/field.jsp | 2 +-
.../components/editor/fields/textarea/field.jsp | 2 +-
.../field.jsp => scripts/pageTemplateOptions.jsp} | 13 +++-
.../editor/scripts/resourceTypeOptions.jsp | 2 +-
.../components/general/container/container.jsp | 2 +-
.../namedcontainer.jsp} | 2 +-
.../libs/sling-cms/components/pages/base.json | 1 -
.../libs/sling-cms/components/pages/base/head.jsp | 1 +
.../libs/sling-cms/components/pages/base/nav.jsp | 17 +----
.../sling-cms/components/pages/base/scripts.jsp | 3 +-
.../libs/sling-cms/content/config/create.json | 2 +-
.../libs/sling-cms/content/editor/add-named.json | 42 +++++++++++
.../libs/sling-cms/content/page/create.json | 29 ++------
.../jcr_root/libs/sling-cms/content/page/edit.json | 20 +++++
.../libs/sling-cms/content/page/pagewrapper.json | 4 +
.../libs/sling-cms/content/site/content.json | 8 ++
.../jcr_root/libs/sling-cms/content/start.json | 22 ++++++
.../resources/jcr_root/libs/sling-cms/global.jsp | 7 +-
54 files changed, 631 insertions(+), 154 deletions(-)
diff --git a/cms/core/pom.xml b/cms/core/pom.xml
index c7ec5ab..b8c4a49 100644
--- a/cms/core/pom.xml
+++ b/cms/core/pom.xml
@@ -119,7 +119,6 @@
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
- <version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -131,19 +130,16 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.5.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
<scope>test</scope>
</dependency>
@@ -180,7 +176,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.api</artifactId>
- <version>1.0.0</version>
+ <version>1.3.6</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/cms/core/src/main/java/org/apache/sling/cms/CMSUtils.java b/cms/core/src/main/java/org/apache/sling/cms/CMSUtils.java
index 8927620..dacce9e 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/CMSUtils.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/CMSUtils.java
@@ -16,6 +16,9 @@
*/
package org.apache.sling.cms;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.jackrabbit.JcrConstants;
import org.apache.sling.api.resource.Resource;
@@ -34,4 +37,25 @@ public class CMSUtils {
}
return null;
}
+
+ public static final <T> List<T> adaptResources(Resource[] resources, Class<T> type) {
+ List<T> values = new ArrayList<T>();
+ if (resources != null) {
+ for (Resource resource : resources) {
+ values.add(resource.adaptTo(type));
+ }
+ }
+ return values;
+ }
+
+
+ public static final <T> List<T> adaptResources(List<Resource> resources, Class<T> type) {
+ List<T> values = new ArrayList<T>();
+ if (resources != null) {
+ for (Resource resource : resources) {
+ values.add(resource.adaptTo(type));
+ }
+ }
+ return values;
+ }
}
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java b/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java
index 5975132..2eb1f1f 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/filters/EditIncludeFilter.java
@@ -33,6 +33,7 @@ import org.apache.felix.scr.annotations.sling.SlingFilterScope;
import org.apache.jackrabbit.JcrConstants;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
+import org.apache.sling.cms.CMSConstants;
import org.apache.sling.cms.core.models.EditableResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,7 +86,8 @@ public class EditIncludeFilter implements Filter {
writer.write("<div class=\"Sling-CMS__edit-bar\">");
writer.write(
"<button class=\"Sling-CMS__edit-button\" data-sling-cms-action=\"edit\" data-sling-cms-path=\""
- + resource.getPath() + "\" data-sling-cms-edit=\"" + editPath + "\" title=\"Edit\">✏</button>");
+ + resource.getPath() + "\" data-sling-cms-edit=\"" + editPath
+ + "\" title=\"Edit\">✏</button>");
if (!first) {
writer.write(
"<button class=\"Sling-CMS__edit-button\" data-sling-cms-action=\"moveup\" data-sling-cms-path=\""
@@ -101,6 +103,11 @@ public class EditIncludeFilter implements Filter {
"<button class=\"Sling-CMS__edit-button\" data-sling-cms-action=\"delete\" data-sling-cms-path=\""
+ resource.getPath() + "\" title=\"Delete\">×</button>");
}
+ Resource component = resource.adaptTo(EditableResource.class).getComponent();
+ if (component != null && component.getValueMap().containsKey(CMSConstants.PN_TITLE)) {
+ writer.write("<span class=\"Sling-CMS__component-title\">"
+ + component.getValueMap().get(CMSConstants.PN_TITLE, String.class) + "</span>");
+ }
writer.write("</div>");
}
chain.doFilter(request, response);
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/EditableResource.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/EditableResource.java
index 36e363b..d1b7e3a 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/EditableResource.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/EditableResource.java
@@ -31,6 +31,15 @@ public class EditableResource {
this.resource = resource;
}
+ /**
+ * Gets the component for the specified resource.
+ *
+ * @return the component for the specified resource
+ */
+ public Resource getComponent() {
+ return resource.getResourceResolver().getResource(resource.getResourceType());
+ }
+
private Resource getComponentEditPath(Resource component) {
if (component != null) {
if (component.getChild("edit") != null) {
@@ -62,8 +71,7 @@ public class EditableResource {
* @return the editor resource or null
*/
public Resource getEditResource() {
- Resource component = resource.getResourceResolver().getResource(resource.getResourceType());
- return getComponentEditPath(component);
+ return getComponentEditPath(getComponent());
}
/**
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/Page.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/Page.java
index 66b36d2..5ff42dd 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/Page.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/Page.java
@@ -16,16 +16,13 @@
*/
package org.apache.sling.cms.core.models;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.inject.Inject;
import javax.inject.Named;
-import org.apache.commons.lang.StringUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.cms.CMSConstants;
import org.apache.sling.cms.CMSUtils;
+import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
/**
@@ -45,29 +42,26 @@ public class Page extends AbstractContentModel {
@Inject
@Named("jcr:content/published")
- private Boolean published;
+ @Default(booleanValues = false)
+ private boolean published;
+
+ @Inject
+ @Named("jcr:content/sling:template")
+ private String template;
public Page(Resource resource) {
this.resource = resource;
}
- public String getAvailableComponents() {
- Resource config = resource.adaptTo(SiteManager.class).getSite().getConfig();
- List<String> types = new ArrayList<String>();
- if (config != null && config.getChild("content/pagetypes") != null) {
- for (Resource pageType : config.getChild("content/pagetypes").getChildren()) {
- if (getContentResource().getResourceType()
- .equals(pageType.getValueMap().get("resourceType", String.class))) {
- for (Resource type : pageType.getChild("availabletypes").getChildren()) {
- types.add(type.getValueMap().get("resourceType", String.class));
- }
- }
- }
- }
- return StringUtils.join(types, ",");
- }
-
public Boolean getPublished() {
return published;
}
+
+ public String getTemplatePath() {
+ return this.template;
+ }
+
+ public PageTemplate getTemplate() {
+ return this.resource.getResourceResolver().getResource(template).adaptTo(PageTemplate.class);
+ }
}
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/PageManager.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/PageManager.java
index f9ef68d..84bb9e7 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/PageManager.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/PageManager.java
@@ -17,7 +17,6 @@
package org.apache.sling.cms.core.models;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.cms.CMSConstants;
import org.apache.sling.cms.CMSUtils;
import org.apache.sling.models.annotations.Model;
@@ -25,7 +24,7 @@ import org.apache.sling.models.annotations.Model;
/**
* A model used to retrieve pages.
*/
-@Model(adaptables = ResourceResolver.class)
+@Model(adaptables = Resource.class)
public class PageManager {
private final Page page;
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/PageTemplate.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/PageTemplate.java
index 916a256..c621649 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/PageTemplate.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/PageTemplate.java
@@ -16,6 +16,9 @@
*/
package org.apache.sling.cms.core.models;
+import java.util.Arrays;
+import java.util.List;
+
import javax.inject.Inject;
import javax.inject.Named;
@@ -28,21 +31,85 @@ import org.apache.sling.models.annotations.Optional;
* A simple model for representing a page template
*/
@Model(adaptables = Resource.class)
-public interface PageTemplate {
+public class PageTemplate {
@Inject
@Optional
- String[] availableComponentTypes();
+ private String[] allowedPaths;
@Inject
@Optional
- String[] getAllowedPaths();
+ private String[] availableComponentTypes;
@Inject
- String getTemplate();
+ private List<Resource> fields;
+
+ private Resource resource;
+
+ @Inject
+ @Optional
+ private String template;
@Inject
@Named(CMSConstants.PN_TITLE)
- String getTitle();
+ private String title;
+
+ public PageTemplate(Resource resource) {
+ this.resource = resource;
+ }
+
+ /**
+ * @return the allowedPaths
+ */
+ public String[] getAllowedPaths() {
+ return allowedPaths;
+ }
+
+ /**
+ * @return the availableComponentTypes
+ */
+ public String[] getAvailableComponentTypes() {
+ return availableComponentTypes;
+ }
+
+ /**
+ * @return the fields
+ */
+ public List<Resource> getFields() {
+ return fields;
+ }
+
+ /**
+ * @return the resource
+ */
+ public Resource getResource() {
+ return resource;
+ }
+
+ /**
+ * @return the template
+ */
+ public String getTemplate() {
+ return template;
+ }
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "PageTemplate [allowedPaths=" + Arrays.toString(allowedPaths) + ", availableComponentTypes="
+ + Arrays.toString(availableComponentTypes) + ", fields=" + fields + ", resource=" + resource
+ + ", template=" + template + ", title=" + title + "]";
+ }
}
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/PageTemplateManager.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/PageTemplateManager.java
new file mode 100644
index 0000000..0839891
--- /dev/null
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/PageTemplateManager.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.cms.core.models;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Model;
+
+/**
+ * A model for retrieving the available templates to create a page under the
+ * specified resource.
+ */
+@Model(adaptables = Resource.class)
+public class PageTemplateManager {
+
+ private SiteConfig siteConfig;
+ private Resource resource;
+
+ public PageTemplateManager(Resource resource) {
+ Site site = resource.adaptTo(SiteManager.class).getSite();
+ this.siteConfig = site.getSiteConfig();
+ this.resource = resource;
+ }
+
+ public List<PageTemplate> getAvailableTemplates() {
+ String path = resource.getPath();
+ List<PageTemplate> availableTemplates = new ArrayList<PageTemplate>();
+ if (siteConfig != null && siteConfig.getPageTemplates() != null) {
+ for (PageTemplate template : siteConfig.getPageTemplates()) {
+ for (String allowedPath : template.getAllowedPaths()) {
+ if (path.matches(allowedPath)) {
+ availableTemplates.add(template);
+ break;
+ }
+ }
+ }
+ }
+ return availableTemplates;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "PageTemplateManager [siteConfig=" + siteConfig + ", resource=" + resource + "]";
+ }
+}
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java
index 3eab2dc..b3839bd 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/Site.java
@@ -19,8 +19,8 @@ package org.apache.sling.cms.core.models;
import javax.inject.Inject;
import javax.inject.Named;
+import org.apache.jackrabbit.JcrConstants;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.cms.CMSConstants;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Optional;
@@ -34,10 +34,10 @@ public class Site {
public static final String PN_CONFIG = CMSConstants.NAMESPACE + ":config";
private static Resource findSiteResource(Resource resource) {
- if (resource != null) {
- String[] pathSegments = resource.getPath().split("\\/");
- String sitePath = "/content/" + pathSegments[2];
- return resource.getResourceResolver().getResource(sitePath);
+ if (CMSConstants.NT_SITE.equals(resource.getValueMap().get(JcrConstants.JCR_PRIMARYTYPE, String.class))) {
+ return resource;
+ } else if (resource.getParent() != null) {
+ return findSiteResource(resource.getParent());
}
return null;
}
@@ -70,14 +70,6 @@ public class Site {
this.resource = resource;
}
- public Resource getConfig() {
- return resource.getResourceResolver().getResource(resource.getValueMap().get(PN_CONFIG, String.class));
- }
-
- public ValueMap getConfigProperties() {
- return getConfig().getValueMap();
- }
-
public String getDescription() {
return description;
}
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteConfig.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteConfig.java
index 39b2789..3d90717 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteConfig.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteConfig.java
@@ -21,8 +21,8 @@ import java.util.List;
import javax.inject.Inject;
import org.apache.sling.api.resource.Resource;
+import org.apache.sling.cms.CMSUtils;
import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.Optional;
/**
* A model representing a site configuration.
@@ -31,31 +31,35 @@ import org.apache.sling.models.annotations.Optional;
public class SiteConfig {
@Inject
- @Optional
- private List<Parameter> parameters;
+ private List<Resource> pageTemplates;
@Inject
- @Optional
- private List<PageTemplate> pageTemplates;
+ private List<Resource> parameters;
+
+ private Resource resource;
+
+ public SiteConfig(Resource resource) {
+ this.resource = resource;
+ }
/**
* @return the pageTemplates
*/
public List<PageTemplate> getPageTemplates() {
- return pageTemplates;
+ return CMSUtils.adaptResources(pageTemplates, PageTemplate.class);
}
/**
* @return the parameters
*/
public List<Parameter> getParameters() {
- return parameters;
+ return CMSUtils.adaptResources(parameters, Parameter.class);
}
public String getParameterValue(String key) {
String value = null;
if (parameters != null) {
- for (Parameter param : parameters) {
+ for (Parameter param : getParameters()) {
if (key.equals(param.getKey())) {
value = param.getValue();
break;
@@ -65,20 +69,15 @@ public class SiteConfig {
return value;
}
- /**
- * @param pageTemplates
- * the pageTemplates to set
- */
- public void setPageTemplates(List<PageTemplate> pageTemplates) {
- this.pageTemplates = pageTemplates;
- }
-
- /**
- * @param parameters
- * the parameters to set
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
*/
- public void setParameters(List<Parameter> parameters) {
- this.parameters = parameters;
+ @Override
+ public String toString() {
+ return "SiteConfig [parameters=" + parameters + ", pageTemplates=" + pageTemplates + ", resource=" + resource
+ + "]";
}
}
diff --git a/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteManager.java b/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteManager.java
index 46daede..6cfc6e0 100644
--- a/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteManager.java
+++ b/cms/core/src/main/java/org/apache/sling/cms/core/models/SiteManager.java
@@ -17,13 +17,12 @@
package org.apache.sling.cms.core.models;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.models.annotations.Model;
/**
* A model for retrieving sites.
*/
-@Model(adaptables = ResourceResolver.class)
+@Model(adaptables = Resource.class)
public class SiteManager {
private final Site site;
diff --git a/cms/ui/pom.xml b/cms/ui/pom.xml
index f163ee8..edb41f4 100644
--- a/cms/ui/pom.xml
+++ b/cms/ui/pom.xml
@@ -37,6 +37,7 @@
<instructions>
<Sling-Nodetypes>SLING-INF/nodetypes/nodetypes.cnd</Sling-Nodetypes>
<Sling-Initial-Content>
+ jcr_root/apps/reference;overwrite:=true;uninstall:=true;path:=/apps/reference,
jcr_root/libs/sling-cms;overwrite:=true;uninstall:=true;path:=/libs/sling-cms,
jcr_root/etc/clientlibs/sling-cms;overwrite:=true;uninstall:=true;path:=/etc/clientlibs/sling-cms
</Sling-Initial-Content>
diff --git a/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base.json b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base.json
new file mode 100644
index 0000000..a393610
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base.json
@@ -0,0 +1,5 @@
+{
+ "jcr:primaryType" : "sling:Component",
+ "jcr:title": "Reference - Base Page",
+ "componentType": "Page"
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/base.jsp
similarity index 88%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/base.jsp
index 408ce5c..38c2f6c 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/base.jsp
@@ -17,4 +17,8 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<!DOCTYPE html>
+<html lang="en">
+ <sling:call script="head.jsp" />
+ <sling:call script="body.jsp" />
+</html>
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/body.jsp
similarity index 71%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/body.jsp
index 408ce5c..06b5898 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/body.jsp
@@ -17,4 +17,15 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<body>
+ <sling:call script="/libs/sling-cms/components/editor/scripts/init.jsp" />
+ <div class="container">
+ <div class="row">
+ <div class="col-12">
+ <sling:call script="content.jsp" />
+ </div>
+ </div>
+ </div>
+ <sling:call script="scripts.jsp" />
+ <sling:call script="/libs/sling-cms/components/editor/scripts/finalize.jsp" />
+</body>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/content.jsp
similarity index 89%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/content.jsp
index 408ce5c..cf61b42 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/content.jsp
@@ -17,4 +17,4 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<sling:include path="container" resourceType="sling-cms/components/general/container" />
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/head.jsp
similarity index 59%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
copy to cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/head.jsp
index 05da97f..d0f02e4 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/head.jsp
@@ -19,9 +19,12 @@
<%@include file="/libs/sling-cms/global.jsp"%>
<head>
<meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>Apache Sling :: ${properties['jcr:title']}</title>
- <link href="/etc/clientlibs/launchpad/css/bundle.css" rel="stylesheet" />
- <link href="/etc/clientlibs/sling-cms/css/styles.css" rel="stylesheet" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>${properties['jcr:title']}</title>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+ <![endif]-->
</head>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/scripts.jsp
similarity index 59%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
copy to cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/scripts.jsp
index 688134b..fed0013 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
+++ b/cms/ui/src/main/resources/jcr_root/apps/reference/components/pages/base/scripts.jsp
@@ -17,7 +17,6 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.min.js"></script>
-<script src="/system/sling.js"></script>
-<script src="/etc/clientlibs/sling-cms/js/scripts.js"></script>
\ No newline at end of file
+<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/editor.css b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/editor.css
index c5a74f3..55851ba 100644
--- a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/editor.css
+++ b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/editor.css
@@ -20,9 +20,10 @@
.Sling-CMS__edit-bar {
width: 100%;
height: 38px;
- border-radius: 4px 4px 0 0;
padding: .2em;
background-color: silver;
+ line-height: 12px;
+ font-family: "Courier New", Courier, monospace;
}
.Sling-CMS__edit-button {
@@ -43,6 +44,10 @@
border: 1px dashed #adadad;
}
+.Sling-CMS__component-title {
+ padding: 0 10px;
+}
+
.Sling-CMS__modal-background {
display: none;
position: fixed;
@@ -83,4 +88,20 @@
.Sling-CMS__modal-close {
float:right;
+}
+
+.Sling-CMS__page-wrapper-frame {
+ position: fixed;
+ top: 30px;
+ left: 0px;
+ bottom: 0px;
+ right: 0px;
+ width: 100%;
+ height: 100%;
+ border: none;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ z-index: 998;
+ padding-top: 8px;
}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/styles.css b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/styles.css
index 9c26093..7be7622 100644
--- a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/styles.css
+++ b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/css/styles.css
@@ -71,7 +71,7 @@ input[type="checkbox"] {
.Modal {
display: none;
position: fixed;
- z-index: 1;
+ z-index: 1000;
left: 0;
top: 0;
width: 100%;
@@ -121,7 +121,7 @@ input[type="checkbox"] {
text-decoration: none;
}
-.Nav-Item:hover {
+.Nav-Item:hover, .Nav-Item.Active {
background-color: lightgray;
}
diff --git a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/editor.js b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/editor.js
index a69ebaa..74092b6 100644
--- a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/editor.js
+++ b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/editor.js
@@ -22,6 +22,9 @@ if(!window.CMSEditor){
$(".Sling-CMS__edit-button[data-sling-cms-action=add]").click(function(){
CMSEditor.ui.showModal('/cms/editor/add.html'+$(this).attr('data-sling-cms-path')+'?availableTypes='+$(this).data('sling-cms-available-types'));
});
+ $(".Sling-CMS__edit-button[data-sling-cms-action=add-named]").click(function(){
+ CMSEditor.ui.showModal('/cms/editor/add-named.html'+$(this).attr('data-sling-cms-path')+'?availableTypes='+$(this).data('sling-cms-available-types'));
+ });
$(".Sling-CMS__edit-button[data-sling-cms-action=delete]").click(function(){
CMSEditor.ui.showModal('/cms/editor/delete.html'+$(this).attr('data-sling-cms-path'));
});
@@ -55,8 +58,8 @@ if(!window.CMSEditor){
modalDisplayed: false,
hideModal: function() {
if(CMSEditor.ui.modalDisplayed) {
- $(".Sling-CMS__modal-background").fadeOut("slow");
- $(".Sling-CMS__modal-box").fadeOut("slow");
+ $(".Sling-CMS__modal-background").hide();
+ $(".Sling-CMS__modal-box").hide();
CMSEditor.ui.modalDisplayed = false;
}
},
@@ -66,8 +69,8 @@ if(!window.CMSEditor){
}
$(".Sling-CMS__modal-box iframe").attr('src',url);
- $(".Sling-CMS__modal-background").fadeIn("slow");
- $(".Sling-CMS__modal-box").fadeIn("slow");
+ $(".Sling-CMS__modal-background").show();
+ $(".Sling-CMS__modal-box").show();
CMSEditor.ui.modalDisplayed = true;
}
diff --git a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/scripts.js b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/scripts.js
index 856273c..9a90519 100644
--- a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/scripts.js
+++ b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms/js/scripts.js
@@ -83,7 +83,14 @@ Sling.CMS = {
return $modal;
}
},
- util: {
+ utils: {
+ form2Obj: function ($form){
+ var data = {};
+ $.map($form.serializeArray(), function(n, i){
+ data[n['name']] = n['value'];
+ });
+ return data;
+ }
}
}
@@ -167,6 +174,26 @@ Sling.CMS = {
});
}
}
+ Sling.CMS.ext['pageproperties'] = {
+ decorate: function($ctx){
+ $ctx.find('.Sling-CMS__page-properties').each(function(){
+ var $ctr = $(this);
+ $($ctr.data('source')).change(function(){
+ var config = $(this).val();
+ $ctr.load($ctr.data('path')+config, function(){
+ var source = $('#content-template').html();
+ var template = Handlebars.compile(source);
+ var updateContent = function(){
+ var data = Sling.CMS.utils.form2Obj($ctr.parents('form'));
+ $('input[name=":content"]').val(template(data));
+ }
+ $ctr.find('input,textarea,select').change(updateContent);
+ $ctr.parents('form').submit(updateContent);
+ });
+ });
+ });
+ }
+ }
Sling.CMS.ext['repeating'] = {
decorate: function($ctx){
@@ -194,6 +221,14 @@ Sling.CMS = {
});
}
}
+
+ Sling.CMS.ext['toggle-hidden'] = {
+ decorate: function($ctx){
+ $ctx.find('.Toggle-Hidden').click(function(){
+ $($(this).data('target')).toggleClass('Hide');
+ });
+ }
+ }
$(document).ready(function() {
Sling.CMS.init();
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentnav/contentnav.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentnav/contentnav.jsp
new file mode 100644
index 0000000..21688d5
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentnav/contentnav.jsp
@@ -0,0 +1,32 @@
+<%-- /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */ --%>
+ <%@include file="/libs/sling-cms/global.jsp"%>
+<sling:findResources var="content" query="${properties.query}" language="JCR-SQL2" />
+<h3 class="Nav-Header Toggle-Hidden" data-target="#Nav-${fn:replace(properties.title,' ','-')}">${properties.title}</h3>
+<ul class="Nav ${fn:startsWith(slingRequest.requestURI, properties.prefix) ? '' : 'Hide'}" id="Nav-${fn:replace(properties.title,' ','-')}">
+ <c:forEach var="item" items="${content}">
+ <c:set var="prefixPath" value="${item.path}/" />
+ <li class="Nav-Item ${(fn:startsWith(slingRequest.requestPathInfo.suffix, prefixPath) || slingRequest.requestPathInfo.suffix == item.path) ? 'Active' : ''}">
+ <a href="${properties.itemPrefix}${item.path}" title="View ${item.valueMap['jcr:title']}">
+ <sling:encode value="${item.valueMap['jcr:title']}" mode="HTML" />
+ </a>
+ </li>
+ </c:forEach>
+<li class="Nav-Item"><a href="${properties.createPath}" title="Create a new ${properties.title}" class="Fetch-Modal" data-title="Create ${properties.title}" data-path=".Main-Content form">+ ${properties.title}</a></li>
+</ul>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditbar/pageeditbar.jsp
similarity index 67%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditbar/pageeditbar.jsp
index 408ce5c..49e1ce0 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditbar/pageeditbar.jsp
@@ -16,5 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/ --%>
- <%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<%@include file="/libs/sling-cms/global.jsp"%>
+<link rel="stylesheet" href="/etc/clientlibs/sling-cms/css/editor.css" />
+<div class="Sling-CMS__edit-bar">
+ <a href="/cms" target="_blank" class="Sling-CMS__component-title">Sling CMS</a> >
+ <a href="/cms/site/content.html${slingRequest.requestPathInfo.suffix}" target="_blank" class="Sling-CMS__component-title">Open Page</a>
+</div>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditor/pageeditor.jsp
similarity index 82%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditor/pageeditor.jsp
index 408ce5c..bc914db 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageeditor/pageeditor.jsp
@@ -16,5 +16,5 @@
* specific language governing permissions and limitations
* under the License.
*/ --%>
- <%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<%@include file="/libs/sling-cms/global.jsp"%>
+<iframe class="Sling-CMS__page-wrapper-frame" src="/cms/page/pagewrapper.html${slingRequest.requestPathInfo.suffix}"></iframe>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageproperties/include.jsp
similarity index 68%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageproperties/include.jsp
index 408ce5c..a3fcf79 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageproperties/include.jsp
@@ -16,5 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/ --%>
- <%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<%@include file="/libs/sling-cms/global.jsp"%>
+<c:forEach var="field" items="${sling:listChildren(sling:getRelativeResource(slingRequest.requestPathInfo.suffixResource,'fields'))}">
+ <sling:include resource="${field}" />
+</c:forEach>
+<script id="content-template" type="text/x-handlebars-template">
+ ${slingRequest.requestPathInfo.suffixResource.valueMap.template}
+</script>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageproperties/pageproperties.jsp
similarity index 67%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageproperties/pageproperties.jsp
index 408ce5c..7e65828 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pageproperties/pageproperties.jsp
@@ -16,5 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/ --%>
- <%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<%@include file="/libs/sling-cms/global.jsp"%>
+<div class="Sling-CMS__page-properties" data-path="${resource.path}.include.html" data-source="select[name=pageTemplate]">
+</div>
+<input type="hidden" name=":operation" value="import" />
+<input type="hidden" name=":replaceProperties" value="true" />
+<input type="hidden" name=":contentType" value="json" />
+<input type="hidden" name=":content" value="" />
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/edit.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/edit.json
index 4978c26..8410523 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/edit.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/edit.json
@@ -27,6 +27,7 @@
"template": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/fields/textarea",
+ "defaultValue":"{\r\n \"jcr:primaryType\": \"sling:Page\",\r\n \"jcr:content\": {\r\n \"jcr:primaryType\": \"nt:unstructured\",\r\n \"jcr:title\": \"{{title}}\",\r\n \"sling:template\": \"{{template}}\",\r\n \"sling:resourceType\": \"sling-cms\/components\/page\/base\"\r\n }\r\n}",
"label": "Template",
"name": "template",
"required": true
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/pagetemplate.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/pagetemplate.jsp
index 242ae0c..fb8fd3b 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/pagetemplate.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagetemplate/pagetemplate.jsp
@@ -17,6 +17,9 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
+<div>
+ Template ${resource.path}
+</div>
<dl>
<dt>
Title
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagewrapper/pagewrapper.jsp
similarity index 75%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagewrapper/pagewrapper.jsp
index 408ce5c..313036c 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/pagewrapper/pagewrapper.jsp
@@ -16,5 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/ --%>
- <%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<%@include file="/libs/sling-cms/global.jsp"%>
+<c:set var="cmsEditEnabled" value="true" scope="request" />
+<sling:include resource="${sling:getResource(resourceResolver,slingRequest.requestPathInfo.suffix)}" />
+<c:set var="cmsEditEnabled" value="false" scope="request" />
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/siteconfig/siteconfig.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/siteconfig/siteconfig.jsp
index 86f5ef8..29d03a5 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/siteconfig/siteconfig.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/siteconfig/siteconfig.jsp
@@ -29,7 +29,7 @@
<h3>Page Templates</h3>
<c:set var="oldAvailableTypes" value="${availableTypes}" />
<c:set var="availableTypes" value="SlingCMS-PageTemplate" scope="request" />
-<sling:include path="${slingRequest.requestPathInfo.suffix}/pageTemplates" resourceType="sling-cms/components/general/container" />
+<sling:include path="${slingRequest.requestPathInfo.suffix}/pageTemplates" resourceType="sling-cms/components/general/namedcontainer" />
<c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
<c:set var="cmsEditEnabled" value="false" scope="request" />
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/hidden.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/hidden.json
new file mode 100644
index 0000000..b1869fb
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/hidden.json
@@ -0,0 +1,5 @@
+{
+ "jcr:primaryType": "sling:Component",
+ "componentType": "SlingCMS-FieldConfig",
+ "jcr:title": "Sling CMS - Hidden Field"
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/hidden/edit.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/hidden/edit.json
new file mode 100644
index 0000000..9593a05
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/hidden/edit.json
@@ -0,0 +1,23 @@
+ {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save Field",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "name": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Name",
+ "name": "name",
+ "required": true
+ },
+ "value": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Value",
+ "name": "value",
+ "required": true
+ }
+ }
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/richtext.json
similarity index 100%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text.json
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/richtext.json
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text.json
index b061241..a2f12ab 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text.json
@@ -1,4 +1,6 @@
{
"jcr:primaryType": "sling:Component",
- "sling:resourceSuperType" : "sling-cms/components/editor/fields/base"
+ "sling:resourceSuperType" : "sling-cms/components/editor/fields/base",
+ "componentType": "SlingCMS-FieldConfig",
+ "jcr:title": "Sling CMS - Input Field"
}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/edit.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/edit.json
new file mode 100644
index 0000000..7420e9d
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/edit.json
@@ -0,0 +1,85 @@
+ {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save Field",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "label": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Label",
+ "name": "label",
+ "required": true
+ },
+ "name": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Name",
+ "name": "name",
+ "required": true
+ },
+ "inputType": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Input Type",
+ "name": "type",
+ "options": {
+ "text": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Text",
+ "value": "text"
+ },
+ "color": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Color",
+ "value": "color"
+ },
+ "datetime": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Date/Time",
+ "value": "datetime-local"
+ },
+ "email": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Email",
+ "value": "email"
+ },
+ "number": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Number",
+ "value": "number"
+ },
+ "url": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "URL",
+ "value": "url"
+ }
+ }
+ },
+ "required": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Required",
+ "name": "required",
+ "options": {
+ "yes": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Yes",
+ "value": "true"
+ },
+ "no": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "No",
+ "value": "false"
+ }
+ }
+ },
+ "requiredTypeHint": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "required@TypeHint",
+ "value":"Boolean"
+ }
+ }
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/field.jsp
index 2944f7b..e922110 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/text/field.jsp
@@ -17,4 +17,4 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<input type="text" name="${properties.name}" value="${editProperties[properties.name]}" ${required} ${disabled} />
\ No newline at end of file
+<input type="${not empty properties.type ? properties.type : 'text'}" name="${properties.name}" value="${not empty editProperties[properties.name] ? editProperties[properties.name] : properties.defaultValue}" ${required} ${disabled} />
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
index 408ce5c..c0d2aef 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
@@ -17,4 +17,4 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<textarea name="${properties.name}" ${required} ${disabled}>${not empty editProperties[properties.name] ? editProperties[properties.name] : properties.defaultValue}</textarea>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/pageTemplateOptions.jsp
similarity index 54%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/pageTemplateOptions.jsp
index 408ce5c..6034a12 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/textarea/field.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/pageTemplateOptions.jsp
@@ -17,4 +17,15 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<textarea name="${properties.name}" ${required} ${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<option value="">Select Page Type</option>
+<sling:adaptTo var="pageTemplateManager" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.core.models.PageTemplateManager" />
+<sling:adaptTo var="siteManager" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.core.models.SiteManager" />
+Site=${siteManager.site}
+Site Config=${siteManager.site.siteConfig}
+Page Templates=${siteManager.site.siteConfig.pageTemplates}
+Page Template Manager=${pageTemplateManager}
+<c:forEach var="template" items="${pageTemplateManager.availableTemplates}">
+ <option value="${template.resource.path}">
+ <sling:encode value="${template.title}" mode="HTML" />
+ </option>
+</c:forEach>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/resourceTypeOptions.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/resourceTypeOptions.jsp
index 265eb92..290841f 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/resourceTypeOptions.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/scripts/resourceTypeOptions.jsp
@@ -17,7 +17,7 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<option>Select Component</option>
+<option value="">Select Component</option>
<c:forEach var="type" items="${fn:split(param.availableTypes,',')}">
<optgroup label="${sling:encode(type,'HTML_ATTR')}">
<c:set var="query" value="SELECT * FROM [sling:Component] WHERE [componentType]='${type}'" />
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
index 633775d..1cd3e07 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
@@ -23,7 +23,7 @@
</c:when>
<c:when test="${empty requestScope.availableTypes}">
<sling:adaptTo var="pageMgr" adaptable="${resource}" adaptTo="org.apache.sling.cms.core.models.PageManager" />
- <c:set var="availableTypes" value="${pageMgr.page.availableComponents}" />
+ <c:set var="availableTypes" value="${fn:join(pageMgr.page.template.availableComponentTypes,',')}" />
</c:when>
</c:choose>
<c:forEach var="child" items="${sling:listChildren(resource)}">
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/namedcontainer/namedcontainer.jsp
similarity index 92%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/namedcontainer/namedcontainer.jsp
index 633775d..92ad951 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/namedcontainer/namedcontainer.jsp
@@ -31,7 +31,7 @@
</c:forEach>
<c:if test="${cmsEditEnabled == 'true'}">
<div class="Sling-CMS__edit-bar">
- <button class="Sling-CMS__edit-button" data-sling-cms-action="add" data-sling-cms-path="${resource.path}" data-sling-cms-available-types="${availableTypes}" title="Add">
+ <button class="Sling-CMS__edit-button" data-sling-cms-action="add-named" data-sling-cms-path="${resource.path}" data-sling-cms-available-types="${availableTypes}" title="Add">
+
</button>
</div>
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base.json
index 619ff1f..e3a9405 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base.json
@@ -1,5 +1,4 @@
{
"jcr:primaryType" : "sling:Component",
- "componentType": "Page",
"jcr:title": "CMS - Base Page"
}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
index 05da97f..490c779 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
@@ -24,4 +24,5 @@
<title>Apache Sling :: ${properties['jcr:title']}</title>
<link href="/etc/clientlibs/launchpad/css/bundle.css" rel="stylesheet" />
<link href="/etc/clientlibs/sling-cms/css/styles.css" rel="stylesheet" />
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.css" rel="stylesheet" />
</head>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp
index 4a0b2a5..eff7db1 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/nav.jsp
@@ -25,25 +25,16 @@
CMS
</a>
</h1>
-<ul class="Nav">
- <li class="Nav-Header">Sites</li>
- <sling:include path="sitenav" resourceType="sling-cms/components/cms/sitenav" />
- <li class="Nav-Item"><a href="/cms/site/create.html/content" title="Create a new Site" class="Fetch-Modal" data-title="Create Site" data-path=".Main-Content form">+ Site</a></li>
-</ul>
-<ul class="Nav">
- <li class="Nav-Header">Config</li>
- <sling:include path="sitenav" resourceType="sling-cms/components/cms/confignav" />
- <li class="Nav-Item"><a href="/cms/config/create.html/etc/config" title="Create a new Config" class="Fetch-Modal" data-title="Create Site Config" data-path=".Main-Content form">+ Config</a></li>
-</ul>
-<ul>
- <li class="Nav-Header">Admin</li>
+<sling:include path="/mnt/overlay/sling-cms/content/start/jcr:content/nav" resourceType="sling-cms/components/general/container" />
+<h3 class="Nav-Header Toggle-Hidden" data-target="#Tools-Nav">Tools</h3>
+<ul id="Tools-Nav" class="Hide">
<li class="Nav-Item"><a href="/bin/browser.html" title="Browse the JCR content of this site">Node Browser</a></li>
<li class="Nav-Item"><a href="/bin/packages.html" title="Create content packages">Content Packages</a></li>
<li class="Nav-Item"><a href="/bin/users.html/" title="Manage Users and Groups">Users & Groups</a></li>
<li class="Nav-Item"><a href="/system/console/bundles" title="Edit the OSGi bundles of this site">System Console</a></li>
</ul>
<div>
-<strong>Session</strong>
+<h3 class="Nav-Header">Session</h3>
<div id="Login" style="display: block;"><a href="/system/sling/login.html" title="Login to Apache Sling">Login</a></div>
<div id="Logout" style="display: none;"><a href="/system/sling/logout" title="Logout of Apache Sling">Logout,</a> </div>
</div>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
index 688134b..19e7be8 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/scripts.jsp
@@ -18,6 +18,7 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote-lite.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.11/handlebars.min.js"></script>
<script src="/system/sling.js"></script>
<script src="/etc/clientlibs/sling-cms/js/scripts.js"></script>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json
index 1b5d5e5..82b4ace 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/create.json
@@ -63,7 +63,7 @@
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/fields/hidden",
"name": "parameters/sling:resourceType",
- "value": "sling-cms/components/general/container"
+ "value": "sling-cms/components/general/namedcontainer"
}
}
}
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/add-named.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/add-named.json
new file mode 100644
index 0000000..66ee093
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/editor/add-named.json
@@ -0,0 +1,42 @@
+{
+ "jcr:primaryType": "sling:Page",
+ "jcr:content": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "Edit",
+ "sling:resourceType": "sling-cms/components/pages/editor",
+ "container": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "add": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Add Component",
+ "actionSuffix": "/*",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "primaryType": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "sling-cms/components/editor/fields/hidden",
+ "name": "jcr:primaryType",
+ "value": "nt:unstructured"
+ },
+ "name": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "sling-cms/components/editor/fields/text",
+ "name": ":name",
+ "label": "Name",
+ "required": true
+ },
+ "type": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "name": "sling:resourceType",
+ "optionsScript": "/libs/sling-cms/components/editor/scripts/resourceTypeOptions.jsp",
+ "required": true
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json
index 02601bc..9abb30a 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/create.json
@@ -15,19 +15,11 @@
"slingform": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/slingform",
- "actionSuffix": "/*",
"button": "Create Page",
"successPrepend":"/libs/sling-cms/content/site/content.html",
"fields": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/general/container",
- "title": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Title",
- "name": "jcr:content/jcr:title",
- "required": true
- },
"name": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/fields/text",
@@ -35,23 +27,16 @@
"name": ":name",
"required": true
},
- "primaryType": {
+ "pageTemplate": {
"jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/hidden",
- "name": "jcr:primaryType",
- "value": "sling:Page"
- },
- "contentPrimaryType": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/hidden",
- "name": "jcr:content/jcr:primaryType",
- "value": "nt:unstructured"
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Page Template",
+ "name": "pageTemplate",
+ "optionsScript": "/libs/sling-cms/components/editor/scripts/pageTemplateOptions.jsp"
},
- "contentResourceType": {
+ "pageproperties": {
"jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "name": "jcr:content/sling:resourceType",
- "value": "nt:unstructured"
+ "sling:resourceType": "sling-cms/components/cms/pageproperties"
}
}
}
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/edit.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/edit.json
new file mode 100644
index 0000000..86ed6c2
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/edit.json
@@ -0,0 +1,20 @@
+{
+ "jcr:primaryType": "sling:Page",
+ "jcr:content": {
+ "jcr:primaryType": "nt:unstructured",
+ "jcr:title": "Edit",
+ "sling:resourceType": "sling-cms/components/pages/editor",
+ "container": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "pageeditbar": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/pageeditbar"
+ },
+ "pageeditor": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/pageeditor"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/pagewrapper.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/pagewrapper.json
new file mode 100644
index 0000000..b9c1469
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/page/pagewrapper.json
@@ -0,0 +1,4 @@
+{
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType" : "sling-cms/components/cms/pagewrapper"
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
index 4b38c28..8e9c79e 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
@@ -77,10 +77,18 @@
"type": "Actions",
"delete": {
"jcr:primaryType": "nt:unstructured",
+ "modal": true,
"title": "Delete the specified page",
"text": "×",
"prefix": "/cms/shared/delete.html"
},
+ "edit": {
+ "jcr:primaryType": "nt:unstructured",
+ "modal": false,
+ "title": "Edit Page",
+ "text": "✏",
+ "prefix": "/cms/page/edit.html"
+ },
"movecopy": {
"jcr:primaryType": "nt:unstructured",
"modal": true,
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
index 7a99e9d..fe50f14 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
@@ -14,6 +14,28 @@
"sling:resourceType": "sling-cms/components/general/richtext",
"text": "<h2>Welcome to the Apache Sling CMS!<\/h2><p>This is a full-featured Content Management System built using the Apache Sling Framework! To begin using this framework, select + Site on the left to add your first website.<\/p>"
}
+ },
+ "nav": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "sitenav": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentnav",
+ "createPath": "/cms/site/create.html/content",
+ "prefix":"/cms/site",
+ "itemPrefix": "/cms/site/content.html",
+ "query": "SELECT * FROM [sling:Site] AS s WHERE ISDESCENDANTNODE(s,'/content') ORDER BY NAME()",
+ "title": "Site"
+ },
+ "confignav": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentnav",
+ "createPath": "/cms/config/create.html/etc/config",
+ "prefix": "/cms/config",
+ "itemPrefix":"/cms/config/edit.html",
+ "query": "SELECT * FROM [sling:Config] AS s WHERE ISDESCENDANTNODE(s,'/etc/config') ORDER BY NAME()",
+ "title": "Site Config"
+ }
}
}
}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp
index 6691b79..5f0ea73 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/global.jsp
@@ -21,9 +21,4 @@
%><%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><%
%><%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><%
%><sling:defineObjects /><sling:adaptTo var="properties" adaptable="${resource}" adaptTo="org.apache.sling.api.resource.ValueMap" />
-<sling:adaptTo var="ra" adaptable="${slingRequest}" adaptTo="org.apache.sling.cms.core.models.RedirectAttribute" />
-<c:if test="${slingRequest.requestPathInfo.suffix != null}">
- <sling:getResource path="${slingRequest.requestPathInfo.suffix}" var="siteResource" />
- <sling:adaptTo var="siteMgr" adaptable="${siteResource}" adaptTo="org.apache.sling.cms.core.models.SiteManager" />
- <c:set var="site" value="${siteMgr.site}" />
-</c:if>
\ No newline at end of file
+<sling:adaptTo var="ra" adaptable="${slingRequest}" adaptTo="org.apache.sling.cms.core.models.RedirectAttribute" />
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
dklco@apache.org.