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 2019/06/24 21:30:53 UTC
[sling-org-apache-sling-app-cms] 02/02: Completely re-vamped the CA
Configuration structure to be more consistent
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch dklco/conf-cleanup
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
commit 892d7fa5820ea9851d842d8f68078b57483fd479
Author: Dan Klco <dk...@apache.org>
AuthorDate: Mon Jun 24 17:30:01 2019 -0400
Completely re-vamped the CA Configuration structure to be more consistent
---
...ageManager.java => ComponentConfiguration.java} | 23 ++--
.../{PageTemplate.java => ComponentPolicy.java} | 45 ++------
...ageManager.java => ComponentPolicyManager.java} | 15 ++-
.../java/org/apache/sling/cms/PageManager.java | 5 +-
.../java/org/apache/sling/cms/PageTemplate.java | 16 +--
.../org/apache/sling/cms/PageTemplateManager.java | 4 +-
.../java/org/apache/sling/cms/package-info.java | 2 +-
.../core/internal/filters/EditIncludeFilter.java | 2 +-
.../models/ComponentConfigurationImpl.java | 55 ++++++++++
.../core/internal/models/ComponentPolicyImpl.java | 94 ++++++++++++++++
.../models/ComponentPolicyManagerImpl.java | 49 +++++++++
.../cms/core/internal/models/PageTemplateImpl.java | 40 ++-----
.../internal/ResourceEditorAssociationTest.java | 3 +-
pom.xml | 1 +
.../components/general/codeblock/edit.json | 28 ++---
.../general/columncontrol/columncontrol.jsp | 49 ++++-----
.../components/general/columncontrol/config.json | 40 ++++---
.../components/general/columncontrol/edit.json | 74 ++++++-------
.../components/general/columncontrol/options.jsp | 5 +-
.../reference/components/general/cta/config.json | 26 +++--
.../apps/reference/components/general/cta/cta.jsp | 6 +-
.../reference/components/general/cta/edit.json | 96 ++++++++--------
.../reference/components/general/cta/options.jsp | 11 +-
.../components/general/iframe/config.json | 40 ++++---
.../reference/components/general/iframe/edit.json | 84 +++++++-------
.../reference/components/general/iframe/iframe.jsp | 5 +-
.../components/general/iframe/options.jsp | 11 +-
.../reference/components/general/image/config.json | 26 +++--
.../reference/components/general/image/edit.json | 64 +++++------
.../reference/components/general/image/image.jsp | 2 +-
.../reference/components/general/image/options.jsp | 11 +-
.../reference/components/general/list/config.json | 46 ++++----
.../reference/components/general/list/edit.json | 122 ++++++++++-----------
.../reference/components/general/list/init.jsp | 2 +-
.../reference/components/general/list/item.jsp | 22 ++--
.../reference/components/general/list/list.jsp | 18 +--
.../components/general/list/pagination.jsp | 74 ++++++-------
.../components/general/search/config.json | 88 +++++++--------
.../reference/components/general/search/edit.json | 44 ++++----
.../components/general/search/pagination.jsp | 74 ++++++-------
.../reference/components/general/search/result.jsp | 24 ++--
.../reference/components/general/search/search.jsp | 38 +++----
.../components/general/searchform/config.json | 46 ++++----
.../components/general/searchform/edit.json | 14 +--
.../components/general/searchform/searchform.jsp | 8 +-
.../components/general/stylewrapper/config.json | 20 ++--
.../components/general/stylewrapper/edit.json | 30 ++---
.../components/general/stylewrapper/options.jsp | 4 +-
.../general/stylewrapper/stylewrapper.jsp | 2 +-
.../components/general/suffixheader/edit.json | 106 +++++++++---------
.../general/suffixheader/suffixheader.jsp | 14 +--
.../reference/components/general/tags/config.json | 66 +++++------
.../reference/components/general/tags/edit.json | 14 +--
.../reference/components/general/tags/tags.jsp | 19 ++--
ui/src/main/resources/jcr_root/conf/global.json | 18 +--
.../components/caconfig/component/component.jsp | 44 ++++----
.../components/caconfig/component/edit.json | 38 +++----
.../components/caconfig/fileeditor/config.json | 3 +-
.../components/caconfig/fileeditor/fileeditor.jsp | 2 +-
.../sling-cms/components/caconfig/policies.json | 6 +
.../components/caconfig/policies/include.jsp | 5 +-
.../libs/sling-cms/components/caconfig/policy.json | 5 +
.../components/caconfig/policy/config.json | 4 +
.../policy}/config/config.jsp | 28 -----
.../components/caconfig/policy/config/edit.json | 20 ++++
.../components/caconfig/policy/policy.jsp | 6 +-
.../components/caconfig/policymapping.json | 6 +
.../components/caconfig/policymapping/edit.json | 24 ++++
.../caconfig/policymapping/policymapping.jsp | 17 ++-
.../components/caconfig/scripts/policyOptions.jsp | 11 +-
.../template}/config.json | 0
.../template}/config/config.jsp | 25 +----
.../template}/config/edit.json | 6 +-
.../fileeditor.jsp => template/template.jsp} | 11 +-
.../cms/templateeditor/templateeditor.jsp | 45 --------
.../{cms/templateeditor => }/config/config.jsp | 25 +----
.../{cms/templateeditor => }/config/edit.json | 0
.../components/general/container/container.jsp | 7 +-
.../libs/sling-cms/content/config/edit.json | 6 +
.../libs/sling-cms/content/template/edit.json | 15 ++-
...ernal.ResourceEditorAssociation-confedit.config | 20 ++++
81 files changed, 1196 insertions(+), 1028 deletions(-)
diff --git a/api/src/main/java/org/apache/sling/cms/PageManager.java b/api/src/main/java/org/apache/sling/cms/ComponentConfiguration.java
similarity index 62%
copy from api/src/main/java/org/apache/sling/cms/PageManager.java
copy to api/src/main/java/org/apache/sling/cms/ComponentConfiguration.java
index 98a821f..114ca11 100644
--- a/api/src/main/java/org/apache/sling/cms/PageManager.java
+++ b/api/src/main/java/org/apache/sling/cms/ComponentConfiguration.java
@@ -16,19 +16,26 @@
*/
package org.apache.sling.cms;
-import org.osgi.annotation.versioning.ProviderType;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ValueMap;
/**
- * A interface used to retrieve sling:Page Resources. Adaptable from a child
- * Resource of a sling:Page.
+ * A class to retrieve the configuration for a Resource's component.
*/
-@ProviderType
-public interface PageManager {
+public interface ComponentConfiguration {
/**
- * Get the page containing the adapted resource
+ * Get the ValueMap for the resource's component configuration.
*
- * @return the page
+ * @return the configuration properties
*/
- Page getPage();
+ ValueMap getProperties();
+
+ /**
+ * Get the Resource backing for the resource's component configuration.
+ *
+ * @return the configuration resource
+ */
+ Resource getResource();
+
}
diff --git a/api/src/main/java/org/apache/sling/cms/PageTemplate.java b/api/src/main/java/org/apache/sling/cms/ComponentPolicy.java
similarity index 57%
copy from api/src/main/java/org/apache/sling/cms/PageTemplate.java
copy to api/src/main/java/org/apache/sling/cms/ComponentPolicy.java
index 66a9cb0..857c473 100644
--- a/api/src/main/java/org/apache/sling/cms/PageTemplate.java
+++ b/api/src/main/java/org/apache/sling/cms/ComponentPolicy.java
@@ -19,56 +19,35 @@ package org.apache.sling.cms;
import java.util.Map;
import org.apache.sling.api.resource.Resource;
-import org.osgi.annotation.versioning.ProviderType;
/**
- * An interface for representing a page template. Adaptable from a
- * sling:Template Resource.
+ * A class to represent a component policy, e.g. the definition of what
+ * components are available for a particular container and their shared
+ * configurations.
*/
-@ProviderType
-public interface PageTemplate {
+public interface ComponentPolicy {
/**
- * Gets the paths under which pages for this template can be created.
+ * Returns true if the ComponentPolicy applies to the specified resource
*
- * @return the allowedPaths
+ * @param resource the resource to check
+ * @return true if this policy should be enabled for the resource, false if not
*/
- String[] getAllowedPaths();
+ boolean applies(Resource resource);
/**
- * Gets the list of Component Types which will be available for pages created
- * with this template
+ * Gets the list of Component Types which will be available when using this
+ * component policy
*
- * @return the availableComponentTypes
+ * @return the available ComponentTypes
*/
String[] getAvailableComponentTypes();
/**
- * Gets the Component Configurations for this template
+ * Gets the Component Configurations when using this component policy
*
* @return the componentConfigs
*/
Map<String, Resource> getComponentConfigs();
- /**
- * Gets the Resource backing this template
- *
- * @return the resource
- */
- Resource getResource();
-
- /**
- * Gets the Handlebars template to use for creating the content of the page
- *
- * @return the template
- */
- String getTemplate();
-
- /**
- * Gets the title of the template
- *
- * @return the title
- */
- String getTitle();
-
}
diff --git a/api/src/main/java/org/apache/sling/cms/PageManager.java b/api/src/main/java/org/apache/sling/cms/ComponentPolicyManager.java
similarity index 67%
copy from api/src/main/java/org/apache/sling/cms/PageManager.java
copy to api/src/main/java/org/apache/sling/cms/ComponentPolicyManager.java
index 98a821f..c8bf831 100644
--- a/api/src/main/java/org/apache/sling/cms/PageManager.java
+++ b/api/src/main/java/org/apache/sling/cms/ComponentPolicyManager.java
@@ -16,19 +16,22 @@
*/
package org.apache.sling.cms;
+import org.jetbrains.annotations.Nullable;
import org.osgi.annotation.versioning.ProviderType;
/**
- * A interface used to retrieve sling:Page Resources. Adaptable from a child
- * Resource of a sling:Page.
+ * An interface for retrieving the applicable component policy for a given
+ * resource.
*/
@ProviderType
-public interface PageManager {
+public interface ComponentPolicyManager {
/**
- * Get the page containing the adapted resource
+ * Gets the applicable component policy based on the containing page's template
+ * and the path of the content resource
*
- * @return the page
+ * @return the componentPolicy or null if the no component policy is applicable
*/
- Page getPage();
+ @Nullable
+ ComponentPolicy getComponentPolicy();
}
diff --git a/api/src/main/java/org/apache/sling/cms/PageManager.java b/api/src/main/java/org/apache/sling/cms/PageManager.java
index 98a821f..1a1996a 100644
--- a/api/src/main/java/org/apache/sling/cms/PageManager.java
+++ b/api/src/main/java/org/apache/sling/cms/PageManager.java
@@ -16,6 +16,7 @@
*/
package org.apache.sling.cms;
+import org.jetbrains.annotations.Nullable;
import org.osgi.annotation.versioning.ProviderType;
/**
@@ -28,7 +29,9 @@ public interface PageManager {
/**
* Get the page containing the adapted resource
*
- * @return the page
+ * @return the page containing the adapted resource or null if the resource is
+ * not a child of a page
*/
+ @Nullable
Page getPage();
}
diff --git a/api/src/main/java/org/apache/sling/cms/PageTemplate.java b/api/src/main/java/org/apache/sling/cms/PageTemplate.java
index 66a9cb0..dc6d35e 100644
--- a/api/src/main/java/org/apache/sling/cms/PageTemplate.java
+++ b/api/src/main/java/org/apache/sling/cms/PageTemplate.java
@@ -16,7 +16,7 @@
*/
package org.apache.sling.cms;
-import java.util.Map;
+import java.util.List;
import org.apache.sling.api.resource.Resource;
import org.osgi.annotation.versioning.ProviderType;
@@ -36,19 +36,11 @@ public interface PageTemplate {
String[] getAllowedPaths();
/**
- * Gets the list of Component Types which will be available for pages created
- * with this template
+ * Gets the list of Component Policies for pages created with this template
*
- * @return the availableComponentTypes
+ * @return the component policies
*/
- String[] getAvailableComponentTypes();
-
- /**
- * Gets the Component Configurations for this template
- *
- * @return the componentConfigs
- */
- Map<String, Resource> getComponentConfigs();
+ List<ComponentPolicy> getComponentPolicies();
/**
* Gets the Resource backing this template
diff --git a/api/src/main/java/org/apache/sling/cms/PageTemplateManager.java b/api/src/main/java/org/apache/sling/cms/PageTemplateManager.java
index f841540..dda00be 100644
--- a/api/src/main/java/org/apache/sling/cms/PageTemplateManager.java
+++ b/api/src/main/java/org/apache/sling/cms/PageTemplateManager.java
@@ -18,6 +18,7 @@ package org.apache.sling.cms;
import java.util.List;
+import org.jetbrains.annotations.NotNull;
import org.osgi.annotation.versioning.ProviderType;
/**
@@ -29,9 +30,10 @@ public interface PageTemplateManager {
/**
* Gets the available templates for the current resource based on the templates
- * in the repository and then limiting the templates by their allowed pathF
+ * in the repository and then limiting the templates by their allowed path
*
* @return the list of available templates
*/
+ @NotNull
List<PageTemplate> getAvailableTemplates();
}
diff --git a/api/src/main/java/org/apache/sling/cms/package-info.java b/api/src/main/java/org/apache/sling/cms/package-info.java
index ed902f1..e0a8f8f 100644
--- a/api/src/main/java/org/apache/sling/cms/package-info.java
+++ b/api/src/main/java/org/apache/sling/cms/package-info.java
@@ -23,5 +23,5 @@
*
* @since 0.10.0
*/
-@org.osgi.annotation.versioning.Version("0.12.0")
+@org.osgi.annotation.versioning.Version("1.0.0")
package org.apache.sling.cms;
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/filters/EditIncludeFilter.java b/core/src/main/java/org/apache/sling/cms/core/internal/filters/EditIncludeFilter.java
index b6c4256..b8e9993 100644
--- a/core/src/main/java/org/apache/sling/cms/core/internal/filters/EditIncludeFilter.java
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/filters/EditIncludeFilter.java
@@ -123,7 +123,7 @@ public class EditIncludeFilter implements Filter {
}
String title = component != null ? component.getTitle()
: StringUtils.substringAfterLast(resource.getResourceType(), "/");
- writer.write("<div class=\"sling-cms-component\" data-component=\"" + component + "\" data-sling-cms-title=\""
+ writer.write("<div class=\"sling-cms-component\" data-component=\"" + component.getResource().getPath() + "\" data-sling-cms-title=\""
+ title + "\" data-sling-cms-resource-path=\"" + resource.getPath()
+ "\" data-sling-cms-resource-type=\"" + resource.getResourceType() + "\" data-sling-cms-edit=\""
+ editPath + "\"><div class=\"sling-cms-editor\">");
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentConfigurationImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentConfigurationImpl.java
new file mode 100644
index 0000000..7455ab6
--- /dev/null
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentConfigurationImpl.java
@@ -0,0 +1,55 @@
+/*
+ * 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.internal.models;
+
+import java.util.Collections;
+import java.util.Optional;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ValueMap;
+import org.apache.sling.api.wrappers.ValueMapDecorator;
+import org.apache.sling.cms.ComponentConfiguration;
+import org.apache.sling.cms.ComponentPolicyManager;
+import org.apache.sling.models.annotations.Model;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Model(adaptables = Resource.class, adapters = ComponentConfiguration.class)
+public class ComponentConfigurationImpl implements ComponentConfiguration {
+
+ private static final Logger log = LoggerFactory.getLogger(ComponentConfigurationImpl.class);
+
+ private Optional<Resource> configRsrc;
+
+ public ComponentConfigurationImpl(Resource resource) {
+ configRsrc = Optional.ofNullable(resource.adaptTo(ComponentPolicyManager.class))
+ .map(ComponentPolicyManager::getComponentPolicy)
+ .map(p -> p.getComponentConfigs().get(resource.getResourceType()));
+ log.debug("Loaded configuration resource: {}", configRsrc);
+ }
+
+ @Override
+ public ValueMap getProperties() {
+ return configRsrc.map(Resource::getValueMap).orElse(new ValueMapDecorator(Collections.emptyMap()));
+ }
+
+ @Override
+ public Resource getResource() {
+ return configRsrc.orElse(null);
+ }
+
+}
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentPolicyImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentPolicyImpl.java
new file mode 100644
index 0000000..9922672
--- /dev/null
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentPolicyImpl.java
@@ -0,0 +1,94 @@
+/*
+ * 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.internal.models;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.cms.ComponentPolicy;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Model(adaptables = Resource.class, adapters = ComponentPolicy.class)
+public class ComponentPolicyImpl implements ComponentPolicy {
+
+ private static final Logger log = LoggerFactory.getLogger(ComponentPolicyImpl.class);
+
+ @ValueMapValue
+ private String pathPattern;
+
+ @ValueMapValue
+ private String policyPath;
+
+ private Optional<Resource> policyResource;
+
+ private final ResourceResolver resolver;
+
+ public ComponentPolicyImpl(Resource resource) {
+ resolver = resource.getResourceResolver();
+
+ log.debug("Initialized policy {} with pattern {} and path {}", resolver, pathPattern, policyPath);
+ }
+
+ @Override
+ public boolean applies(Resource resource) {
+ return Optional.ofNullable(new PageManagerImpl(resource).getPage())
+ .map(p -> StringUtils.removeStart(resource.getPath(), p.getPath())).map(p -> p.matches(pathPattern))
+ .orElse(false);
+ }
+
+ @Override
+ public String[] getAvailableComponentTypes() {
+ return policyResource.map(pr -> pr.getValueMap().get("availableComponentTypes", new String[0]))
+ .orElse(new String[0]);
+ }
+
+ @Override
+ public Map<String, Resource> getComponentConfigs() {
+ Map<String, Resource> configs = new HashMap<>();
+ Resource container = policyResource.map(pr -> pr.getChild("componentConfigurations")).orElse(null);
+ if (container != null) {
+ container.getChildren().forEach(c -> configs.put(c.getValueMap().get("type", String.class), c));
+ }
+ log.debug("Loaded configurations for components: {}", configs.keySet());
+
+ return configs;
+ }
+
+ @PostConstruct
+ public void init() {
+ policyResource = Optional.ofNullable(resolver.getResource(policyPath));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "ComponentPolicyImpl [pathPattern=" + pathPattern + ", policyPath=" + policyPath + ", resolver="
+ + resolver + ", policyResource=" + policyResource + "]";
+ }
+
+}
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentPolicyManagerImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentPolicyManagerImpl.java
new file mode 100644
index 0000000..d6c7e49
--- /dev/null
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/ComponentPolicyManagerImpl.java
@@ -0,0 +1,49 @@
+/*
+ * 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.internal.models;
+
+import java.util.Optional;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.cms.ComponentPolicy;
+import org.apache.sling.cms.ComponentPolicyManager;
+import org.apache.sling.cms.Page;
+import org.apache.sling.models.annotations.Model;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Model(adaptables = Resource.class, adapters = ComponentPolicyManager.class)
+public class ComponentPolicyManagerImpl implements ComponentPolicyManager {
+
+ private static final Logger log = LoggerFactory.getLogger(ComponentPolicyManagerImpl.class);
+
+ private final ComponentPolicy componentPolicy;
+
+ public ComponentPolicyManagerImpl(Resource resource) {
+ componentPolicy = Optional.ofNullable(new PageManagerImpl(resource).getPage()).map(Page::getTemplate).map(t -> {
+ log.debug("Loading policies for template: {}", t);
+ return t.getComponentPolicies().stream().filter(cp -> cp.applies(resource)).findFirst().orElse(null);
+ }).orElse(null);
+ log.debug("Loaded component policy: {}", componentPolicy);
+ }
+
+ @Override
+ public ComponentPolicy getComponentPolicy() {
+ return componentPolicy;
+ }
+
+}
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/PageTemplateImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/PageTemplateImpl.java
index 9e121b4..5459f01 100644
--- a/core/src/main/java/org/apache/sling/cms/core/internal/models/PageTemplateImpl.java
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/PageTemplateImpl.java
@@ -17,15 +17,15 @@
package org.apache.sling.cms.core.internal.models;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
+import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.cms.CMSConstants;
+import org.apache.sling.cms.ComponentPolicy;
import org.apache.sling.cms.PageTemplate;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.Optional;
@@ -41,15 +41,10 @@ public class PageTemplateImpl implements PageTemplate {
private String[] allowedPaths;
@Inject
- @Optional
- private String[] availableComponentTypes;
-
- @Inject
- @Optional
- private List<Resource> componentConfigurations;
+ private List<Resource> fields;
@Inject
- private List<Resource> fields;
+ private List<Resource> policies;
private Resource resource;
@@ -76,26 +71,9 @@ public class PageTemplateImpl implements PageTemplate {
return allowedPaths;
}
- /**
- * @return the availableComponentTypes
- */
- @Override
- public String[] getAvailableComponentTypes() {
- return availableComponentTypes;
- }
-
- /**
- * @return the componentConfigs
- */
@Override
- public Map<String, Resource> getComponentConfigs() {
- Map<String, Resource> configs = new HashMap<>();
- if (componentConfigurations != null) {
- for (Resource cfg : componentConfigurations) {
- configs.put(cfg.getValueMap().get("type", String.class), cfg);
- }
- }
- return configs;
+ public List<ComponentPolicy> getComponentPolicies() {
+ return policies.stream().map(p -> p.adaptTo(ComponentPolicy.class)).collect(Collectors.toList());
}
/**
@@ -136,9 +114,9 @@ public class PageTemplateImpl implements PageTemplate {
*/
@Override
public String toString() {
- return "PageTemplate [allowedPaths=" + Arrays.toString(allowedPaths) + ", availableComponentTypes="
- + Arrays.toString(availableComponentTypes) + ", fields=" + fields + ", resource=" + resource
- + ", template=" + template + ", title=" + title + "]";
+ return "PageTemplateImpl [allowedPaths=" + Arrays.toString(allowedPaths) + ", fields=" + fields + ", policies="
+ + getComponentPolicies() + ", resource=" + resource + ", template=" + template + ", title=" + title
+ + "]";
}
}
diff --git a/core/src/test/java/org/apache/sling/cms/core/internal/ResourceEditorAssociationTest.java b/core/src/test/java/org/apache/sling/cms/core/internal/ResourceEditorAssociationTest.java
index 2410942..95c40c9 100644
--- a/core/src/test/java/org/apache/sling/cms/core/internal/ResourceEditorAssociationTest.java
+++ b/core/src/test/java/org/apache/sling/cms/core/internal/ResourceEditorAssociationTest.java
@@ -34,7 +34,8 @@ public class ResourceEditorAssociationTest {
@Before
public void init() {
- rea = new ResourceEditorAssociation(new ResourceEditorAssociationConfig() {
+ rea = new ResourceEditorAssociation();
+ rea.activate(new ResourceEditorAssociationConfig() {
@Override
public Class<? extends Annotation> annotationType() {
diff --git a/pom.xml b/pom.xml
index 4f2bab5..445bf98 100644
--- a/pom.xml
+++ b/pom.xml
@@ -304,6 +304,7 @@
<!-- Fixing issues with deleted modules -->
<exclude>**/target/*</exclude>
<exclude>**/target/**/*</exclude>
+ <exclude>vagrant/**/*</exclude>
</excludes>
</configuration>
<executions>
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/codeblock/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/codeblock/edit.json
index d3ff62f..5cfb83f 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/codeblock/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/codeblock/edit.json
@@ -1,16 +1,16 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save Code Block",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "code": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/textarea",
- "label": "Code",
- "name": "code",
- "required": true
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save Code Block",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "code": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/textarea",
+ "label": "Code",
+ "name": "code",
+ "required": true
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/columncontrol.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/columncontrol.jsp
index 5920d3a..a673a3e 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/columncontrol.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/columncontrol.jsp
@@ -17,28 +17,27 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
- <c:choose>
- <c:when test="${properties.container == true}">
- <sling:adaptTo var="pageMgr" adaptable="${resource}" adaptTo="org.apache.sling.cms.PageManager" />
- <c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/columncontrol']}" />
- <div class="${configRsrc.valueMap.containerclass}">
- <div class="row">
- <c:forEach var="col" items="${fn:split(properties.layout,',')}" varStatus="status">
- <div class="${sling:encode(col,'HTML_ATTR')}">
- <sling:include path="col-${status.index}" resourceType="sling-cms/components/general/container" />
- </div>
- </c:forEach>
- </div>
- </div>
- </c:when>
- <c:otherwise>
- <div class="row">
- <c:forEach var="col" items="${fn:split(properties.layout,',')}" varStatus="status">
- <div class="${sling:encode(col,'HTML_ATTR')}">
- <sling:include path="col-${status.index}" resourceType="sling-cms/components/general/container" />
- </div>
- </c:forEach>
- </div>
- </c:otherwise>
- </c:choose>
-
+<c:choose>
+ <c:when test="${properties.container == true}">
+ <sling:adaptTo adaptable="${resource}" adaptTo="org.apache.sling.cms.ComponentPolicyManager" var="componentPolicyMgr" />
+ <c:set var="configRsrc" value="${componentPolicyMgr.componentPolicy.componentConfigs['reference/components/general/columncontrol']}" />
+ <div class="${configRsrc.valueMap.containerclass}">
+ <div class="row">
+ <c:forEach var="col" items="${fn:split(properties.layout,',')}" varStatus="status">
+ <div class="${sling:encode(col,'HTML_ATTR')}">
+ <sling:include path="col-${status.index}" resourceType="sling-cms/components/general/container" />
+ </div>
+ </c:forEach>
+ </div>
+ </div>
+ </c:when>
+ <c:otherwise>
+ <div class="row">
+ <c:forEach var="col" items="${fn:split(properties.layout,',')}" varStatus="status">
+ <div class="${sling:encode(col,'HTML_ATTR')}">
+ <sling:include path="col-${status.index}" resourceType="sling-cms/components/general/container" />
+ </div>
+ </c:forEach>
+ </div>
+ </c:otherwise>
+</c:choose>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/config.json
index 3032090..0fc0f9c 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/config.json
@@ -1,19 +1,25 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "columns": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/repeating",
- "label": "Columns",
- "name": "columns",
- "type": "text",
- "required": true
- },
- "containerclass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Container Class",
- "name": "containerclass",
- "required": true
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "columns": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/repeating",
+ "label": "Columns",
+ "name": "columns",
+ "type": "text",
+ "required": true
+ },
+ "columnsTypeHint": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "columns@TypeHint",
+ "value": "String[]"
+ },
+ "containerclass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Container Class",
+ "name": "containerclass",
+ "required": true
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/edit.json
index 8fb7aa3..db69071 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/edit.json
@@ -1,39 +1,39 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "layout": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Layout",
- "name": "layout",
- "required": true,
- "optionsScript": "/apps/reference/components/general/columncontrol/options.jsp"
- },
- "container": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Wrap In Container?",
- "name": "container",
- "required": true,
- "options": {
- "no": {
- "label": "No",
- "value": false
- },
- "yes": {
- "label": "Yes",
- "value": true
- }
- }
- },
- "containerTypeHint": {
- "sling:resourceType": "sling-cms/components/editor/fields/hidden",
- "name": "container@TypeHint",
- "value": "Boolean"
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "layout": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Layout",
+ "name": "layout",
+ "required": true,
+ "optionsScript": "/apps/reference/components/general/columncontrol/options.jsp"
+ },
+ "container": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Wrap In Container?",
+ "name": "container",
+ "required": true,
+ "options": {
+ "no": {
+ "label": "No",
+ "value": false
+ },
+ "yes": {
+ "label": "Yes",
+ "value": true
+ }
+ }
+ },
+ "containerTypeHint": {
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "container@TypeHint",
+ "value": "Boolean"
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/options.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/options.jsp
index 53b08bb..7962cbb 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/options.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/options.jsp
@@ -17,9 +17,8 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<sling:adaptTo var="pageMgr" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/columncontrol']}" />
-<c:forEach var="layout" items="${configRsrc.valueMap.columns}">
+<sling:adaptTo adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.ComponentConfiguration" var="cmpCfg" />
+<c:forEach var="layout" items="${cmpCfg.properties.columns}">
<option ${slingRequest.requestPathInfo.suffixResource.valueMap.layout == fn:split(layout,'=')[1] ? 'selected' : ''} value="${sling:encode(fn:split(layout,'=')[1],'HTML_ATTR')}">
${sling:encode(fn:split(layout,'=')[0],'HTML')}
</option>
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/config.json
index f4a138e..60d348f 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/config.json
@@ -1,12 +1,18 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "ctaClasses": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/repeating",
- "label": "CTA Classes",
- "name": "ctaClasses",
- "type": "text",
- "required": true
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "ctaClasses": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/repeating",
+ "label": "CTA Classes",
+ "name": "ctaClasses",
+ "type": "text",
+ "required": true
+ },
+ "ctaClassesTypeHint": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "ctaClasses@TypeHint",
+ "value": "String[]"
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/cta.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/cta.jsp
index 25f57b6..cad7ef8 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/cta.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/cta.jsp
@@ -18,7 +18,7 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<c:if test="${not empty properties.href}">
- <a href="${properties.href }" class="${properties.ctaClass}" ${target}>
- <sling:encode value="${properties.text}" mode="HTML" />
- </a>
+ <a href="${properties.href}" class="${properties.ctaClass}" ${target}>
+ <sling:encode value="${properties.text}" mode="HTML" />
+ </a>
</c:if>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/edit.json
index a06a441..4b07360 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/edit.json
@@ -1,50 +1,50 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save CTA",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "ctaClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "CTA Class",
- "name": "ctaClass",
- "required": true,
- "optionsScript": "/apps/reference/components/general/cta/options.jsp"
- },
- "text": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Text",
- "name": "text",
- "required": true
- },
- "href": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/path",
- "basePath": "/content",
- "type": "page",
- "label": "CTA Link",
- "name": "href",
- "titleProperty": "jcr:content/jcr:title"
- },
- "target": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Open In New Window?",
- "name": "target",
- "options": {
- "jcr:primaryType": "nt:unstructured",
- "yes": {
- "label": "Yes",
- "value": " target=\"_blank\""
- },
- "no": {
- "label": "No",
- "value": ""
- }
- }
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save CTA",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "ctaClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "CTA Class",
+ "name": "ctaClass",
+ "required": true,
+ "optionsScript": "/apps/reference/components/general/cta/options.jsp"
+ },
+ "text": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Text",
+ "name": "text",
+ "required": true
+ },
+ "href": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/path",
+ "basePath": "/content",
+ "type": "page",
+ "label": "CTA Link",
+ "name": "href",
+ "titleProperty": "jcr:content/jcr:title"
+ },
+ "target": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Open In New Window?",
+ "name": "target",
+ "options": {
+ "jcr:primaryType": "nt:unstructured",
+ "yes": {
+ "label": "Yes",
+ "value": " target=\"_blank\""
+ },
+ "no": {
+ "label": "No",
+ "value": ""
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/options.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/options.jsp
index 1d6436c..e414d9f 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/options.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/options.jsp
@@ -17,10 +17,9 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<sling:adaptTo var="pageMgr" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/cta']}" />
-<c:forEach var="ctaClass" items="${configRsrc.valueMap.ctaClasses}">
- <option ${slingRequest.requestPathInfo.suffixResource.valueMap.ctaClass == sling:encode(fn:split(ctaClass,'=')[1],'HTML_ATTR') ? 'selected' : ''} value="${sling:encode(fn:split(ctaClass,'=')[1],'HTML_ATTR')}">
- ${sling:encode(fn:split(ctaClass,'=')[0],'HTML')}
- </option>
+<sling:adaptTo adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.ComponentConfiguration" var="cmpCfg" />
+<c:forEach var="ctaClass" items="${cmpCfg.properties.ctaClasses}">
+ <option ${slingRequest.requestPathInfo.suffixResource.valueMap.ctaClass == sling:encode(fn:split(ctaClass,'=')[1],'HTML_ATTR') ? 'selected' : ''} value="${sling:encode(fn:split(ctaClass,'=')[1],'HTML_ATTR')}">
+ ${sling:encode(fn:split(ctaClass,'=')[0],'HTML')}
+ </option>
</c:forEach>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/config.json
index c1bc419..f1afea8 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/config.json
@@ -1,19 +1,25 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "wrapperClasses": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/repeating",
- "label": "Wrapper Classes",
- "name": "wrapperClasses",
- "type": "text",
- "required": true
- },
- "iframeClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "IFrame Class",
- "name": "iframeClass",
- "required": true
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "wrapperClasses": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/repeating",
+ "label": "Wrapper Classes",
+ "name": "wrapperClasses",
+ "type": "text",
+ "required": true
+ },
+ "wrapperClassesTypeHint": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "wrapperClasses@TypeHint",
+ "value": "String[]"
+ },
+ "iframeClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "IFrame Class",
+ "name": "iframeClass",
+ "required": true
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/edit.json
index 4cc817a..a9c903d 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/edit.json
@@ -1,44 +1,44 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save IFrame",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "src": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/path",
- "basePath": "/content",
- "type": "page",
- "label": "Frame Source",
- "name": "src",
- "titleProperty": "jcr:content/jcr:title",
- "required": true
- },
- "layout": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Wrapper Class",
- "name": "wrapperClass",
- "required": true,
- "optionsScript": "/apps/reference/components/general/iframe/options.jsp"
- },
- "allowFullscreen": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Allow Fullscreen",
- "name": "allowFullscreen",
- "options": {
- "jcr:primaryType": "nt:unstructured",
- "yes": {
- "label": "Yes",
- "value": " allowfullscreen=\"allowfullscreen\""
- },
- "no": {
- "label": "No",
- "value": " allowfullscreen=\"allowfullscreen\""
- }
- }
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save IFrame",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "src": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/path",
+ "basePath": "/content",
+ "type": "page",
+ "label": "Frame Source",
+ "name": "src",
+ "titleProperty": "jcr:content/jcr:title",
+ "required": true
+ },
+ "layout": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Wrapper Class",
+ "name": "wrapperClass",
+ "required": true,
+ "optionsScript": "/apps/reference/components/general/iframe/options.jsp"
+ },
+ "allowFullscreen": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Allow Fullscreen",
+ "name": "allowFullscreen",
+ "options": {
+ "jcr:primaryType": "nt:unstructured",
+ "yes": {
+ "label": "Yes",
+ "value": " allowfullscreen=\"allowfullscreen\""
+ },
+ "no": {
+ "label": "No",
+ "value": " allowfullscreen=\"allowfullscreen\""
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/iframe.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/iframe.jsp
index abc081b..1c903e0 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/iframe.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/iframe.jsp
@@ -18,9 +18,8 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<c:if test="${not empty properties.src}">
- <sling:adaptTo var="pageMgr" adaptable="${resource}" adaptTo="org.apache.sling.cms.PageManager" />
- <c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/iframe']}" />
+ <sling:adaptTo adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.ComponentConfiguration" var="cmpCfg" />
<div class="${properties.wrapperClass}">
- <iframe src="${properties.src}" class="${configRsrc.valueMap.iframeClass}" ${properties.allowFullscreen}></iframe>
+ <iframe src="${properties.src}" class="${cmpCfg.properties.iframeClass}" ${properties.allowFullscreen}></iframe>
</div>
</c:if>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/options.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/options.jsp
index eeeb013..7688ffa 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/options.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/iframe/options.jsp
@@ -17,10 +17,9 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<sling:adaptTo var="pageMgr" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/iframe']}" />
-<c:forEach var="wrapperClass" items="${configRsrc.valueMap.wrapperClasses}">
- <option ${slingRequest.requestPathInfo.suffixResource.valueMap.wrapperClass == sling:encode(fn:split(wrapperClass,'=')[1],'HTML_ATTR') ? 'selected' : ''} value="${sling:encode(fn:split(wrapperClass,'=')[1],'HTML_ATTR')}">
- ${sling:encode(fn:split(wrapperClass,'=')[0],'HTML')}
- </option>
+<sling:adaptTo adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.ComponentConfiguration" var="cmpCfg" />
+<c:forEach var="wrapperClass" items="${cmpCfg.properties.wrapperClasses}">
+ <option ${slingRequest.requestPathInfo.suffixResource.valueMap.wrapperClass == sling:encode(fn:split(wrapperClass,'=')[1],'HTML_ATTR') ? 'selected' : ''} value="${sling:encode(fn:split(wrapperClass,'=')[1],'HTML_ATTR')}">
+ ${sling:encode(fn:split(wrapperClass,'=')[0],'HTML')}
+ </option>
</c:forEach>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/config.json
index 186deb4..2c0691f 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/config.json
@@ -1,12 +1,18 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "imageClasses": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/repeating",
- "label": "Image Classes",
- "name": "imageClasses",
- "type": "text",
- "required": true
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "imageClasses": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/repeating",
+ "label": "Image Classes",
+ "name": "imageClasses",
+ "type": "text",
+ "required": true
+ },
+ "imageClassesTypeHint": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "imageClasses@TypeHint",
+ "value": "String[]"
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/edit.json
index 6e4b0d7..f123dd8 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/edit.json
@@ -1,34 +1,34 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save Image",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "src": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/path",
- "basePath": "/content",
- "type": "file",
- "label": "Image Source",
- "name": "src",
- "titleProperty": "jcr:content/jcr:title",
- "required": true
- },
- "alt": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Alt Text",
- "name": "alt",
- "required": true
- },
- "imageClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Image Class",
- "name": "imageClass",
- "required": true,
- "optionsScript": "/apps/reference/components/general/image/options.jsp"
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save Image",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "src": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/path",
+ "basePath": "/content",
+ "type": "file",
+ "label": "Image Source",
+ "name": "src",
+ "titleProperty": "jcr:content/jcr:title",
+ "required": true
+ },
+ "alt": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Alt Text",
+ "name": "alt",
+ "required": true
+ },
+ "imageClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Image Class",
+ "name": "imageClass",
+ "required": true,
+ "optionsScript": "/apps/reference/components/general/image/options.jsp"
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/image.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/image.jsp
index 363ad86..49658b3 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/image.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/image.jsp
@@ -18,5 +18,5 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<c:if test="${not empty properties.src}">
- <img src="${properties.src}" alt="${properties.alt}" class="${properties.imageClass}" />
+ <img src="${properties.src}" alt="${properties.alt}" class="${properties.imageClass}" />
</c:if>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/options.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/options.jsp
index f702354..af6f30d 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/image/options.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/image/options.jsp
@@ -17,10 +17,9 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<sling:adaptTo var="pageMgr" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/image']}" />
-<c:forEach var="imageClass" items="${configRsrc.valueMap.imageClasses}">
- <option ${slingRequest.requestPathInfo.suffixResource.valueMap.imageClass == sling:encode(fn:split(imageClass,'=')[1],'HTML_ATTR') ? 'selected' : ''} value="${sling:encode(fn:split(imageClass,'=')[1],'HTML_ATTR')}">
- ${sling:encode(fn:split(imageClass,'=')[0],'HTML')}
- </option>
+<sling:adaptTo adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.ComponentConfiguration" var="cmpCfg" />
+<c:forEach var="imageClass" items="${cmpCfg.properties.imageClasses}">
+ <option ${slingRequest.requestPathInfo.suffixResource.valueMap.imageClass == sling:encode(fn:split(imageClass,'=')[1],'HTML_ATTR') ? 'selected' : ''} value="${sling:encode(fn:split(imageClass,'=')[1],'HTML_ATTR')}">
+ ${sling:encode(fn:split(imageClass,'=')[0],'HTML')}
+ </option>
</c:forEach>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/config.json
index 696f63e..e7daa2e 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/config.json
@@ -1,25 +1,25 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "paginationClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Pagination Class",
- "name": "paginationClass",
- "required": true
- },
- "pageItemClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Page Item Class",
- "name": "pageItemClass",
- "required": true
- },
- "pageLinkClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "PageLink Class",
- "name": "pageLinkClass",
- "required": true
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "paginationClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Pagination Class",
+ "name": "paginationClass",
+ "required": true
+ },
+ "pageItemClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Page Item Class",
+ "name": "pageItemClass",
+ "required": true
+ },
+ "pageLinkClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "PageLink Class",
+ "name": "pageLinkClass",
+ "required": true
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/edit.json
index 607c520..acccc51 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/edit.json
@@ -1,63 +1,63 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "query": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/textarea",
- "label": "Query",
- "name": "query",
- "required": true
- },
- "limit": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Limit",
- "name": "limit",
- "required": true,
- "type": "number"
- },
- "includePagination": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Include Pagination",
- "name": "includePagination",
- "required": true,
- "options": {
- "yes": {
- "jcr:primaryType": "nt:unstructured",
- "label": "Yes",
- "value": "true"
- },
- "no": {
- "jcr:primaryType": "nt:unstructured",
- "label": "No",
- "value": "false"
- }
- }
- },
- "includePaginationTypeHint": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/hidden",
- "name": "includePagination@TypeHint",
- "value": "Boolean"
- },
- "tag": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "List Tag",
- "name": "tag",
- "required": false
- },
- "class": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "List Class",
- "name": "class",
- "required": false
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "query": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/textarea",
+ "label": "Query",
+ "name": "query",
+ "required": true
+ },
+ "limit": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Limit",
+ "name": "limit",
+ "required": true,
+ "type": "number"
+ },
+ "includePagination": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Include Pagination",
+ "name": "includePagination",
+ "required": true,
+ "options": {
+ "yes": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Yes",
+ "value": "true"
+ },
+ "no": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "No",
+ "value": "false"
+ }
+ }
+ },
+ "includePaginationTypeHint": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "includePagination@TypeHint",
+ "value": "Boolean"
+ },
+ "tag": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "List Tag",
+ "name": "tag",
+ "required": false
+ },
+ "class": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "List Class",
+ "name": "class",
+ "required": false
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/init.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/init.jsp
index 7a3cc93..2935fd8 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/init.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/init.jsp
@@ -23,7 +23,7 @@
<c:set var="includePagination" value="${properties.includePagination}" scope="request" />
<c:set var="tag" value="${not empty properties.tag ? properties.tag : 'ul'}" scope="request" />
<c:set var="clazz" value="${not empty properties.class ? properties.class : ''}" scope="request" />
-<c:set var="listConfig" value="${pageMgr.page.template.componentConfigs['reference/components/general/list']}" scope="request" />
+<c:set var="listConfig" value="${sling:adaptTo(resource,'org.apache.sling.cms.ComponentConfiguration').resource}" scope="request" />
<c:if test="${not empty query}">
<c:set var="list" value="${sling:adaptTo(slingRequest, 'org.apache.sling.cms.reference.models.ItemList')}" scope="request" />
</c:if>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/item.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/item.jsp
index 0f39089..27ad99c 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/item.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/item.jsp
@@ -18,15 +18,15 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<li>
- <c:choose>
- <c:when test="${item.resourceType == 'sling:File' || item.resourceType == 'nt:file'}">
- <c:set var="url" value="${item.path }" />
- </c:when>
- <c:otherwise>
- <c:set var="url" value="${item.path}.html" />
- </c:otherwise>
- </c:choose>
- <a href="${url}">
- <sling:encode value="${item.valueMap['jcr:content/jcr:title']}" default="${item.name}" mode="HTML" />
- </a>
+ <c:choose>
+ <c:when test="${item.resourceType == 'sling:File' || item.resourceType == 'nt:file'}">
+ <c:set var="url" value="${item.path }" />
+ </c:when>
+ <c:otherwise>
+ <c:set var="url" value="${item.path}.html" />
+ </c:otherwise>
+ </c:choose>
+ <a href="${url}">
+ <sling:encode value="${item.valueMap['jcr:content/jcr:title']}" default="${item.name}" mode="HTML" />
+ </a>
</li>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/list.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/list.jsp
index 3c165e2..71a24f3 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/list.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/list.jsp
@@ -19,13 +19,13 @@
<%@include file="/libs/sling-cms/global.jsp"%>
<sling:call script="init.jsp" />
<c:if test="${list != null}">
- <${tag} class="list ${clazz}">
- <c:forEach var="it" items="${list.items}">
- <c:set var="item" value="${it}" scope="request" />
- <sling:call script="item.jsp" />
- </c:forEach>
- <c:if test="${includePagination}">
- <sling:call script="pagination.jsp" />
- </c:if>
- </${tag}>
+ <${tag} class="list ${clazz}">
+ <c:forEach var="it" items="${list.items}">
+ <c:set var="item" value="${it}" scope="request" />
+ <sling:call script="item.jsp" />
+ </c:forEach>
+ <c:if test="${includePagination}">
+ <sling:call script="pagination.jsp" />
+ </c:if>
+ </${tag}>
</c:if>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/pagination.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/pagination.jsp
index cd8277d..1081d59 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/list/pagination.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/list/pagination.jsp
@@ -18,41 +18,41 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<nav>
- <ul class="${listConfig.valueMap.paginationClass}">
- <c:choose>
- <c:when test="${list.first == true}">
- <li class="${listConfig.valueMap.pageItemClass} disabled">
- <span class="${listConfig.valueMap.pageLinkClass}">
- <
- </span>
- </li>
- </c:when>
- <c:otherwise>
- <li class="${listConfig.valueMap.pageItemClass}">
- <a class="${listConfig.valueMap.pageLinkClass}" href="?page=${list.currentPage - 1}"><</a>
- </li>
- </c:otherwise>
- </c:choose>
- <c:forEach var="page" items="${list.pages}">
- <li class="${listConfig.valueMap.pageItemClass} ${page == list.currentPage ? 'active' : ''}">
- <a href="?page=${page}" class="${listConfig.valueMap.pageLinkClass}">
- ${page}
- </a>
- </li>
- </c:forEach>
- <c:choose>
- <c:when test="${list.last}">
- <li class="${listConfig.valueMap.pageItemClass} disabled">
- <span class="${listConfig.valueMap.pageLinkClass}">
- >
- </span>
- </li>
- </c:when>
- <c:otherwise>
- <li class="${listConfig.valueMap.pageItemClass}">
- <a class="${listConfig.valueMap.pageLinkClass}" href="?page=${list.currentPage + 1}">></a>
- </li>
- </c:otherwise>
- </c:choose>
- </ul>
+ <ul class="${listConfig.valueMap.paginationClass}">
+ <c:choose>
+ <c:when test="${list.first == true}">
+ <li class="${listConfig.valueMap.pageItemClass} disabled">
+ <span class="${listConfig.valueMap.pageLinkClass}">
+ <
+ </span>
+ </li>
+ </c:when>
+ <c:otherwise>
+ <li class="${listConfig.valueMap.pageItemClass}">
+ <a class="${listConfig.valueMap.pageLinkClass}" href="?page=${list.currentPage - 1}"><</a>
+ </li>
+ </c:otherwise>
+ </c:choose>
+ <c:forEach var="page" items="${list.pages}">
+ <li class="${listConfig.valueMap.pageItemClass} ${page == list.currentPage ? 'active' : ''}">
+ <a href="?page=${page}" class="${listConfig.valueMap.pageLinkClass}">
+ ${page}
+ </a>
+ </li>
+ </c:forEach>
+ <c:choose>
+ <c:when test="${list.last}">
+ <li class="${listConfig.valueMap.pageItemClass} disabled">
+ <span class="${listConfig.valueMap.pageLinkClass}">
+ >
+ </span>
+ </li>
+ </c:when>
+ <c:otherwise>
+ <li class="${listConfig.valueMap.pageItemClass}">
+ <a class="${listConfig.valueMap.pageLinkClass}" href="?page=${list.currentPage + 1}">></a>
+ </li>
+ </c:otherwise>
+ </c:choose>
+ </ul>
</nav>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/config.json
index ee549b1..572506f 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/config.json
@@ -1,46 +1,46 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "searchClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Search Class",
- "name": "searchClass",
- "type": "text"
- },
- "resultClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Result Class",
- "name": "resultClass",
- "type": "text"
- },
- "resultHeaderClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Result Header Class",
- "name": "resultHeaderClass",
- "type": "text"
- },
- "paginationClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Pagination Class",
- "name": "paginationClass",
- "required": true
- },
- "pageItemClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Page Item Class",
- "name": "pageItemClass",
- "required": true
- },
- "pageLinkClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "PageLink Class",
- "name": "pageLinkClass",
- "required": true
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "searchClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Search Class",
+ "name": "searchClass",
+ "type": "text"
+ },
+ "resultClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Result Class",
+ "name": "resultClass",
+ "type": "text"
+ },
+ "resultHeaderClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Result Header Class",
+ "name": "resultHeaderClass",
+ "type": "text"
+ },
+ "paginationClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Pagination Class",
+ "name": "paginationClass",
+ "required": true
+ },
+ "pageItemClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Page Item Class",
+ "name": "pageItemClass",
+ "required": true
+ },
+ "pageLinkClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "PageLink Class",
+ "name": "pageLinkClass",
+ "required": true
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/edit.json
index c77aaaf..57c2f8c 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/edit.json
@@ -1,24 +1,24 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "limit": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Limit",
- "name": "limit",
- "required": true,
- "type": "number"
- },
- "basePath": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Base Path",
- "name": "basePath",
- "required": true
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "limit": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Limit",
+ "name": "limit",
+ "required": true,
+ "type": "number"
+ },
+ "basePath": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Base Path",
+ "name": "basePath",
+ "required": true
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp
index f7bf5fb..d74ebfd 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/pagination.jsp
@@ -19,41 +19,41 @@
<%@include file="/libs/sling-cms/global.jsp"%>
<c:set var="pageParam" value="${not empty param.q ? param.q : '1'}" />
<nav>
- <ul class="${searchConfig.valueMap.paginationClass}">
- <c:choose>
- <c:when test="${search.first == true}">
- <li class="${searchConfig.valueMap.pageItemClass} disabled">
- <span class="${searchConfig.valueMap.pageLinkClass}">
- <
- </span>
- </li>
- </c:when>
- <c:otherwise>
- <li class="${searchConfig.valueMap.pageItemClass}">
- <a class="${searchConfig.valueMap.pageLinkClass}" href="?q=${sling:encode(search.term,'HTML_ATTR')}"><</a>
- </li>
- </c:otherwise>
- </c:choose>
- <c:forEach var="page" items="${search.pages}">
- <li class="${searchConfig.valueMap.pageItemClass}${page == pageParam ? ' active' : ''}">
- <a href="?q=${sling:encode(search.term,'HTML_ATTR')}&page=${page}" class="${searchConfig.valueMap.pageLinkClass}${page == param.page ? ' active' : ''}">
- ${page}
- </a>
- </li>
- </c:forEach>
- <c:choose>
- <c:when test="${search.last}">
- <li class="${searchConfig.valueMap.pageItemClass} disabled">
- <span class="${searchConfig.valueMap.pageLinkClass}">
- >
- </span>
- </li>
- </c:when>
- <c:otherwise>
- <li class="${searchConfig.valueMap.pageItemClass}">
- <a class="${searchConfig.valueMap.pageLinkClass}" href="?q=${sling:encode(search.term,'HTML_ATTR')}&page=${search.currentPage + 1}">></a>
- </li>
- </c:otherwise>
- </c:choose>
- </ul>
+ <ul class="${searchConfig.paginationClass}">
+ <c:choose>
+ <c:when test="${search.first == true}">
+ <li class="${searchConfig.pageItemClass} disabled">
+ <span class="${searchConfig.pageLinkClass}">
+ <
+ </span>
+ </li>
+ </c:when>
+ <c:otherwise>
+ <li class="${searchConfig.pageItemClass}">
+ <a class="${searchConfig.pageLinkClass}" href="?q=${sling:encode(search.term,'HTML_ATTR')}"><</a>
+ </li>
+ </c:otherwise>
+ </c:choose>
+ <c:forEach var="page" items="${search.pages}">
+ <li class="${searchConfig.pageItemClass}${page == pageParam ? ' active' : ''}">
+ <a href="?q=${sling:encode(search.term,'HTML_ATTR')}&page=${page}" class="${searchConfig.pageLinkClass}${page == param.page ? ' active' : ''}">
+ ${page}
+ </a>
+ </li>
+ </c:forEach>
+ <c:choose>
+ <c:when test="${search.last}">
+ <li class="${searchConfig.pageItemClass} disabled">
+ <span class="${searchConfig.pageLinkClass}">
+ >
+ </span>
+ </li>
+ </c:when>
+ <c:otherwise>
+ <li class="${searchConfig.pageItemClass}">
+ <a class="${searchConfig.pageLinkClass}" href="?q=${sling:encode(search.term,'HTML_ATTR')}&page=${search.currentPage + 1}">></a>
+ </li>
+ </c:otherwise>
+ </c:choose>
+ </ul>
</nav>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp
index 0d86a95..6b4176c 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/result.jsp
@@ -17,16 +17,16 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<div class="searchresult ${searchConfig.valueMap.resultClass}">
- <div class="searchresult__header ${searchConfig.valueMap.resultHeaderClass}">
- <a href="${result.path}.html" class="searchresult__link">
- <sling:encode value="${result.valueMap['jcr:content/jcr:title']}" mode="HTML" />
- </a>
- </div>
- <p class="searchresult__body">
- <sling:encode value="${result.valueMap['jcr:content/jcr:description']}" mode="HTML" />
- </p>
- <a href="${result.path}.html" class="searchresult__link">
- ${fn:replace(result.path,sling:getAbsoluteParent(result,3).path,'')}.html
- </a>
+<div class="searchresult ${searchConfig.resultClass}">
+ <div class="searchresult__header ${searchConfig.resultHeaderClass}">
+ <a href="${result.path}.html" class="searchresult__link">
+ <sling:encode value="${result.valueMap['jcr:content/jcr:title']}" mode="HTML" />
+ </a>
+ </div>
+ <p class="searchresult__body">
+ <sling:encode value="${result.valueMap['jcr:content/jcr:description']}" mode="HTML" />
+ </p>
+ <a href="${result.path}.html" class="searchresult__link">
+ ${fn:replace(result.path,sling:getAbsoluteParent(result,3).path,'')}.html
+ </a>
</div>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp
index 498f969..f9f42d1 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/search/search.jsp
@@ -18,24 +18,24 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<sling:adaptTo var="pageMgr" adaptable="${resource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="searchConfig" value="${pageMgr.page.template.componentConfigs['reference/components/general/search']}" scope="request" />
+<c:set var="searchConfig" value="${sling:adaptTo(resource,'org.apache.sling.cms.ComponentConfiguration').properties}" scope="request" />
<c:if test="${not empty properties.limit && not empty param.q}">
- <c:set var="search" value="${sling:adaptTo(slingRequest, 'org.apache.sling.cms.reference.models.Search')}" scope="request" />
- <div class="search ${searchConfig.valueMap.searchClass}">
- <div class="search__header">
- <fmt:message key="slingcms.search.header">
- <fmt:param value="${sling:encode(search.term,'HTML')}" />
- <fmt:param value="${search.start + 1}" />
- <fmt:param value="${search.end}" />
- <fmt:param value="${search.count}" />
- </fmt:message>
- </div>
- <div class="search__results">
- <c:forEach var="result" items="${search.results}">
- <c:set var="result" value="${result}" scope="request" />
- <sling:call script="result.jsp" />
- </c:forEach>
- </div>
- <sling:call script="pagination.jsp" />
- </div>
+ <c:set var="search" value="${sling:adaptTo(slingRequest, 'org.apache.sling.cms.reference.models.Search')}" scope="request" />
+ <div class="search ${searchConfig.searchClass}">
+ <div class="search__header">
+ <fmt:message key="slingcms.search.header">
+ <fmt:param value="${sling:encode(search.term,'HTML')}" />
+ <fmt:param value="${search.start + 1}" />
+ <fmt:param value="${search.end}" />
+ <fmt:param value="${search.count}" />
+ </fmt:message>
+ </div>
+ <div class="search__results">
+ <c:forEach var="result" items="${search.results}">
+ <c:set var="result" value="${result}" scope="request" />
+ <sling:call script="result.jsp" />
+ </c:forEach>
+ </div>
+ <sling:call script="pagination.jsp" />
+ </div>
</c:if>${search.finalize}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/config.json
index 29143ec..f223e16 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/config.json
@@ -1,25 +1,25 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "formClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Form Class",
- "name": "formClass",
- "type": "text"
- },
- "buttonClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Button Class",
- "name": "buttonClass",
- "type": "text"
- },
- "inputClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/text",
- "label": "Input Class",
- "name": "inputClass",
- "type": "text"
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "formClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Form Class",
+ "name": "formClass",
+ "type": "text"
+ },
+ "buttonClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Button Class",
+ "name": "buttonClass",
+ "type": "text"
+ },
+ "inputClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Input Class",
+ "name": "inputClass",
+ "type": "text"
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/edit.json
index b956aab..631afb2 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/edit.json
@@ -1,9 +1,9 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "No Edit Needed",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container"
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "No Edit Needed",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container"
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/searchform.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/searchform.jsp
index 671640c..3b9171d 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/searchform.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/searchform/searchform.jsp
@@ -18,8 +18,8 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<sling:adaptTo var="pageMgr" adaptable="${resource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="searchConfig" value="${pageMgr.page.template.componentConfigs['reference/components/general/searchform']}" scope="request" />
-<form action="${pageMgr.page.path}.html" method="GET" class="${searchConfig.valueMap.formClass}">
- <input type="text" name="q" class="${searchConfig.valueMap.inputClass}" placeholder="<fmt:message key="slingcms.search"/>" />
- <input type="submit" class="${searchConfig.valueMap.buttonClass}" value="<fmt:message key="slingcms.search"/>" />
+<c:set var="searchConfig" value="${sling:adaptTo(resource,'org.apache.sling.cms.ComponentConfiguration').properties}" scope="request" />
+<form action="${pageMgr.page.path}.html" method="GET" class="${searchConfig.formClass}">
+ <input type="text" name="q" class="${searchConfig.inputClass}" placeholder="<fmt:message key="slingcms.search"/>" />
+ <input type="submit" class="${searchConfig.buttonClass}" value="<fmt:message key="slingcms.search"/>" />
</form>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/config.json
index 7910776..f79cb44 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/config.json
@@ -1,12 +1,12 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/general/container",
- "styles": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType" : "sling-cms/components/editor/fields/repeating",
- "label": "Style Options",
- "name": "styles",
- "type": "text",
- "required": true
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "styles": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/repeating",
+ "label": "Style Options",
+ "name": "styles",
+ "type": "text",
+ "required": true
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/edit.json
index cfec221..e577436 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/edit.json
@@ -1,17 +1,17 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "style": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Style Option",
- "name": "style",
- "required": true,
- "optionsScript": "/apps/reference/components/general/stylewrapper/options.jsp"
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "style": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Style Option",
+ "name": "style",
+ "required": true,
+ "optionsScript": "/apps/reference/components/general/stylewrapper/options.jsp"
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/options.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/options.jsp
index 0fe314e..1a87293 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/options.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/options.jsp
@@ -17,9 +17,7 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<sling:adaptTo var="pageMgr" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/stylewrapper']}" />
-<c:forEach var="style" items="${configRsrc.valueMap.styles}">
+<c:forEach var="style" items="${sling:adaptTo(slingRequest.requestPathInfo.suffixResource,'org.apache.sling.cms.ComponentConfiguration').properties.styles}">
<option ${slingRequest.requestPathInfo.suffixResource.valueMap.style == fn:split(style,'=')[1] ? 'selected' : ''} value="${sling:encode(fn:split(style,'=')[1],'HTML_ATTR')}">
${sling:encode(fn:split(style,'=')[0],'HTML')}
</option>
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp
index 84e2083..8aecba7 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp
@@ -18,5 +18,5 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<div class="${properties.style}">
- <sling:include path="container" resourceType="sling-cms/components/general/container" />
+ <sling:include path="container" resourceType="sling-cms/components/general/container" />
</div>
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/edit.json
index d6cad4f..789bc11 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/edit.json
@@ -1,55 +1,55 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "subString": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Subsitution String",
- "name": "subString",
- "required": true
- },
- "property": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Suffix Resource Property",
- "name": "property"
- },
- "tag": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Tag",
- "name": "tag",
- "required": true,
- "options": {
- "h1": {
- "label": "Header 1",
- "value": "h1"
- },
- "h2": {
- "label": "Header 2",
- "value": "h2"
- },
- "h3": {
- "label": "Header 3",
- "value": "h3"
- },
- "h4": {
- "label": "Header 4",
- "value": "h4"
- },
- "h5": {
- "label": "Header 5",
- "value": "h5"
- },
- "p": {
- "label": "Paragraph",
- "value": "p"
- }
- }
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "subString": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Subsitution String",
+ "name": "subString",
+ "required": true
+ },
+ "property": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Suffix Resource Property",
+ "name": "property"
+ },
+ "tag": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Tag",
+ "name": "tag",
+ "required": true,
+ "options": {
+ "h1": {
+ "label": "Header 1",
+ "value": "h1"
+ },
+ "h2": {
+ "label": "Header 2",
+ "value": "h2"
+ },
+ "h3": {
+ "label": "Header 3",
+ "value": "h3"
+ },
+ "h4": {
+ "label": "Header 4",
+ "value": "h4"
+ },
+ "h5": {
+ "label": "Header 5",
+ "value": "h5"
+ },
+ "p": {
+ "label": "Paragraph",
+ "value": "p"
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/suffixheader.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/suffixheader.jsp
index d5285ce..5bbdade 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/suffixheader.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/suffixheader/suffixheader.jsp
@@ -18,13 +18,13 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<c:choose>
- <c:when test="${not empty properties.property}">
- <c:set var="value" value="${slingRequest.requestPathInfo.suffixResource.valueMap[properties.property]}" />
- </c:when>
- <c:otherwise>
- <c:set var="value" value="${slingRequest.requestPathInfo.suffixResource.name}" />
- </c:otherwise>
+ <c:when test="${not empty properties.property}">
+ <c:set var="value" value="${slingRequest.requestPathInfo.suffixResource.valueMap[properties.property]}" />
+ </c:when>
+ <c:otherwise>
+ <c:set var="value" value="${slingRequest.requestPathInfo.suffixResource.name}" />
+ </c:otherwise>
</c:choose>
<${properties.tag}>
- <sling:encode value="${fn:replace(properties.subString,'{SUFFIX}',value)}" mode="HTML" />
+ <sling:encode value="${fn:replace(properties.subString,'{SUFFIX}',value)}" mode="HTML" />
</${properties.tag}>
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/config.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/config.json
index b11b927..d946173 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/config.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/config.json
@@ -1,35 +1,35 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "tagPage": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/path",
- "label": "Tag Page",
- "name": "tagPage",
- "type": "page"
- },
- "listTag": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "List Tag",
- "name": "listTag"
- },
- "listClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "List Class",
- "name": "listClass"
- },
- "itemTag": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Item Tag",
- "name": "itemTag"
- },
- "itemClass": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/text",
- "label": "Item Class",
- "name": "itemClass"
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "tagPage": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/path",
+ "label": "Tag Page",
+ "name": "tagPage",
+ "type": "page"
+ },
+ "listTag": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "List Tag",
+ "name": "listTag"
+ },
+ "listClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "List Class",
+ "name": "listClass"
+ },
+ "itemTag": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Item Tag",
+ "name": "itemTag"
+ },
+ "itemClass": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Item Class",
+ "name": "itemClass"
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/edit.json b/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/edit.json
index 67a9d32..a254ed4 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/edit.json
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/edit.json
@@ -1,9 +1,9 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "No Need to Edit",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container"
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "No Need to Edit",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container"
+ }
}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/tags.jsp b/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/tags.jsp
index 7161621..622fb6b 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/tags.jsp
+++ b/reference/src/main/resources/jcr_root/apps/reference/components/general/tags/tags.jsp
@@ -17,18 +17,19 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
+<sling:adaptTo adaptable="${resource}" adaptTo="org.apache.sling.cms.ComponentConfiguration" var="cmpCfg" />
<sling:adaptTo adaptable="${resource}" adaptTo="org.apache.sling.cms.PageManager" var="pageMgr" />
-<c:set var="config" value="${sling:adaptTo(pageMgr.page.template.componentConfigs['reference/components/general/tags'],'org.apache.sling.api.resource.ValueMap')}" scope="request" />
+<c:set var="config" value="${cmpCfg.properties}" />
<c:set var="contentResource" value="${sling:getRelativeResource(pageMgr.page.resource,'jcr:content')}" />
<c:set var="listTag" value="${empty config.listTag ? 'div' : config.listTag}" />
<c:set var="itemTag" value="${empty config.listTag ? 'span' : config.itemTag}" />
<${listTag} class="${config.listClass}">
- <c:forEach var="tagPath" items="${contentResource.valueMap['sling:taxonomy']}">
- <c:set var="tag" value="${sling:getResource(resourceResolver,tagPath)}" />
- <${itemTag} class="${config.itemClass}">
- <a href="${config.tagPage}.html${tag.path}.html">
- <sling:encode value="${tag.valueMap['jcr:title']}" default="${tag.name}" mode="HTML" />
- </a>
- </${itemTag}>
- </c:forEach>
+ <c:forEach var="tagPath" items="${contentResource.valueMap['sling:taxonomy']}">
+ <c:set var="tag" value="${sling:getResource(resourceResolver,tagPath)}" />
+ <${itemTag} class="${config.itemClass}">
+ <a href="${config.tagPage}.html${tag.path}.html">
+ <sling:encode value="${tag.valueMap['jcr:title']}" default="${tag.name}" mode="HTML" />
+ </a>
+ </${itemTag}>
+ </c:forEach>
</${listTag}>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/conf/global.json b/ui/src/main/resources/jcr_root/conf/global.json
index 11c4fd0..0225cac 100644
--- a/ui/src/main/resources/jcr_root/conf/global.json
+++ b/ui/src/main/resources/jcr_root/conf/global.json
@@ -109,13 +109,10 @@
"jcr:primaryType": "nt:unstructured",
"jcr:title": "Base Page",
"template": "{\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\": \"/conf/global/site/templates/base-page\",\r\n \"sling:resourceType\": \"reference/components/pages/base\",\r\n \"published\": false\r\n }\r\n}",
- "availableComponentTypes": [
- "General"
- ],
"allowedPaths": [
"/content/apache/sling-apache-org.*"
],
- "sling:resourceType": "sling-cms/components/cms/pagetemplate",
+ "sling:resourceType": "sling-cms/components/caconfig/template",
"fields": {
"jcr:primaryType": "nt:unstructured",
"text": {
@@ -134,19 +131,6 @@
"label": "Name",
"sling:resourceType": "sling-cms/components/editor/fields/text"
}
- },
- "componentConfigurations": {
- "jcr:primaryType": "nt:unstructured",
- "componentconfig": {
- "jcr:primaryType": "nt:unstructured",
- "type": "reference/components/general/columncontrol",
- "containerclass": "container",
- "columns": [
- "50-50=col-md-6 col-md-6",
- "100=col-md-12"
- ],
- "sling:resourceType": "sling-cms/components/caconfig/component"
- }
}
}
}
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/component.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/component.jsp
index c1bc911..9b34ddb 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/component.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/component.jsp
@@ -18,26 +18,26 @@
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
<c:if test="${not empty properties.type}">
- <h4>
- <sling:encode value="${properties.type}" mode="HTML" />
- </h4>
- <dl>
- <c:forEach var="val" items="${properties}">
- <c:if test="${not fn:contains(val.key,':') and val.key != 'type'}">
- <dt>
- <sling:encode value="${val.key}" mode="HTML" />
- </dt>
- <dd>
- <c:catch var="ex">
- <c:forEach var="item" items="${val.value}">
- <sling:encode value="${item}" mode="HTML" />
- </c:forEach>
- </c:catch>
- <c:if test="${ex != null}">
- <sling:encode value="${val.value}" mode="HTML" />
- </c:if>
- </dd>
- </c:if>
- </c:forEach>
- </dl>
+ <h4>
+ <sling:encode value="${properties.type}" mode="HTML" />
+ </h4>
+ <dl>
+ <c:forEach var="val" items="${properties}">
+ <c:if test="${not fn:contains(val.key,':') and val.key != 'type'}">
+ <dt>
+ <sling:encode value="${val.key}" mode="HTML" />
+ </dt>
+ <dd>
+ <c:catch var="ex">
+ <c:forEach var="item" items="${val.value}">
+ <sling:encode value="${item}" mode="HTML" />
+ </c:forEach>
+ </c:catch>
+ <c:if test="${ex != null}">
+ <sling:encode value="${val.value}" mode="HTML" />
+ </c:if>
+ </dd>
+ </c:if>
+ </c:forEach>
+ </dl>
</c:if>
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/edit.json
index 649b7ae..198683c 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/edit.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/component/edit.json
@@ -1,21 +1,21 @@
{
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save Component Config",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/general/container",
- "type": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/editor/fields/select",
- "label": "Component",
- "name": "type",
- "optionsScript": "/libs/sling-cms/components/editor/scripts/componentConfigOptions.jsp",
- "required": true
- },
- "includeconfig": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/cms/includeconfig"
- }
- }
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save Component Config",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "type": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Component",
+ "name": "type",
+ "optionsScript": "/libs/sling-cms/components/editor/scripts/componentConfigOptions.jsp",
+ "required": true
+ },
+ "includeconfig": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/includeconfig"
+ }
+ }
}
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/config.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/config.json
index 67035e4..c3e3fae 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/config.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/config.json
@@ -1,4 +1,5 @@
{
"jcr:primaryType": "sling:Component",
- "jcr:title": "Sling CMS - File Editor"
+ "jcr:title": "Sling CMS - File Editor",
+ "componentType": "SlingCMS-FileEditor"
}
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/fileeditor.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/fileeditor.jsp
index 9fe38da..b2c1bee 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/fileeditor.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/fileeditor.jsp
@@ -22,7 +22,7 @@
<c:set var="oldAvailableTypes" value="${availableTypes}" />
<c:set var="availableTypes" value="SlingCMS-FileEditor" scope="request" />
-<sling:include path="${slingRequest.requestPathInfo.suffix}" resourceType="sling-cms/components/caconfig/fileeditor/config" />
+<sling:include path="${slingRequest.requestPathInfo.suffix}" resourceType="sling-cms/components/general/container" />
<c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
<sling:call script="/libs/sling-cms/components/editor/scripts/finalize.jsp" />
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policies.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policies.json
new file mode 100644
index 0000000..6cba73c
--- /dev/null
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policies.json
@@ -0,0 +1,6 @@
+{
+ "jcr:primaryType": "sling:Component",
+ "jcr:title": "Sling CMS - Component Policies",
+ "sling:resourceSuperType": "sling-cms/components/caconfig/base",
+ "componentType": "SlingCMS-Config"
+}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policies/include.jsp
similarity index 81%
copy from reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policies/include.jsp
index 84e2083..8575917 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policies/include.jsp
@@ -17,6 +17,5 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<div class="${properties.style}">
- <sling:include path="container" resourceType="sling-cms/components/general/container" />
-</div>
+ <c:set var="availableTypes" value="SlingCMS-PolicyConfig" scope="request" />
+<sling:include path="${slingRequest.requestPathInfo.suffix}" resourceType="sling-cms/components/general/container" />
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy.json
new file mode 100644
index 0000000..8257ab5
--- /dev/null
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy.json
@@ -0,0 +1,5 @@
+{
+ "jcr:primaryType": "sling:Component",
+ "jcr:title": "Sling CMS - Component Policy",
+ "componentType": "SlingCMS-PolicyConfig"
+}
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config.json
new file mode 100644
index 0000000..1ba4a95
--- /dev/null
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config.json
@@ -0,0 +1,4 @@
+{
+ "jcr:primaryType": "sling:Component",
+ "jcr:title": "Sling CMS - Policy Configuration"
+}
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/config.jsp
similarity index 68%
copy from ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/config.jsp
index c1d48ef..a06ea08 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/config.jsp
@@ -19,17 +19,6 @@
<%@include file="/libs/sling-cms/global.jsp"%>
<br/>
<h3><sling:encode value="${properties['jcr:title']}" mode="HTML" /> (${resource.path})</h3>
-<br/>
-<div>
- <h4>Allowed Paths</h4>
- <ul>
- <c:forEach var="allowedPath" items="${properties.allowedPaths}">
- <li>
- <pre><sling:encode value="${allowedPath}" mode="HTML" /></pre>
- </li>
- </c:forEach>
- </ul>
-</div>
<hr/>
<div>
<h4>
@@ -46,23 +35,6 @@
<hr/>
<div>
<h4>
- Template Content
- </h4>
- <pre><sling:encode value="${properties.template}" mode="HTML" /></pre>
-</div>
-<hr/>
-<div>
- <h4>
- Configuration Fields
- </h4>
- <c:set var="oldAvailableTypes" value="${availableTypes}" />
- <c:set var="availableTypes" value="SlingCMS-FieldConfig" scope="request" />
- <sling:include path="fields" resourceType="sling-cms/components/general/container" />
- <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
-</div>
-<hr/>
-<div>
- <h4>
Component Configurations
</h4>
<c:set var="oldAvailableTypes" value="${availableTypes}" />
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/edit.json
new file mode 100644
index 0000000..d1f581c
--- /dev/null
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/config/edit.json
@@ -0,0 +1,20 @@
+ {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save Page Type",
+ "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:title",
+ "required": true
+ },
+ "availableComponentTypes": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/availablecomponenttypes"
+ }
+ }
+}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/policy.jsp
similarity index 78%
copy from reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/policy.jsp
index 84e2083..ba8476b 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/stylewrapper/stylewrapper.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policy/policy.jsp
@@ -17,6 +17,6 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<div class="${properties.style}">
- <sling:include path="container" resourceType="sling-cms/components/general/container" />
-</div>
+<c:set var="oldAvailableTypes" value="${availableTypes}" />
+<sling:include path="${resource.path}" resourceType="sling-cms/components/caconfig/policy/config" />
+<c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping.json
new file mode 100644
index 0000000..ceddd9b
--- /dev/null
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping.json
@@ -0,0 +1,6 @@
+{
+ "jcr:primaryType": "sling:Component",
+ "jcr:title": "Sling CMS - Component Policies",
+ "sling:resourceSuperType": "sling-cms/components/caconfig/base",
+ "componentType": "SlingCMS-PolicyMappingConfig"
+}
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping/edit.json
new file mode 100644
index 0000000..a007f12
--- /dev/null
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping/edit.json
@@ -0,0 +1,24 @@
+ {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Save Policy Mapping",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "pathPattern": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Path Pattern",
+ "name": "pathPattern",
+ "required": true
+ },
+ "policyPath": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/select",
+ "label": "Policy Path",
+ "name": "policyPath",
+ "optionsScript": "/libs/sling-cms/components/caconfig/scripts/policyOptions.jsp",
+ "required": true
+ }
+ }
+}
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/cta.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping/policymapping.jsp
similarity index 68%
copy from reference/src/main/resources/jcr_root/apps/reference/components/general/cta/cta.jsp
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping/policymapping.jsp
index 25f57b6..6f660ca 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/cta/cta.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/policymapping/policymapping.jsp
@@ -17,8 +17,15 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<c:if test="${not empty properties.href}">
- <a href="${properties.href }" class="${properties.ctaClass}" ${target}>
- <sling:encode value="${properties.text}" mode="HTML" />
- </a>
-</c:if>
\ No newline at end of file
+<dl>
+ <dt>Path Pattern</dt>
+ <dd><sling:encode value="${properties.pathPattern}" mode="HTML" /></dd>
+
+ <dt>Policy</dt>
+ <dd>
+ <c:if test="${not empty properties.policyPath}">
+ <sling:getResource var="policy" path="${properties.policyPath}" />
+ <sling:encode value="${policy.valueMap['jcr:title']}" mode="HTML" />
+ </c:if>
+ </dd>
+</dl>
\ No newline at end of file
diff --git a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/options.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/scripts/policyOptions.jsp
similarity index 58%
copy from reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/options.jsp
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/scripts/policyOptions.jsp
index 53b08bb..83d995c 100644
--- a/reference/src/main/resources/jcr_root/apps/reference/components/general/columncontrol/options.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/scripts/policyOptions.jsp
@@ -17,10 +17,9 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
-<sling:adaptTo var="pageMgr" adaptable="${slingRequest.requestPathInfo.suffixResource}" adaptTo="org.apache.sling.cms.PageManager" />
-<c:set var="configRsrc" value="${pageMgr.page.template.componentConfigs['reference/components/general/columncontrol']}" />
-<c:forEach var="layout" items="${configRsrc.valueMap.columns}">
- <option ${slingRequest.requestPathInfo.suffixResource.valueMap.layout == fn:split(layout,'=')[1] ? 'selected' : ''} value="${sling:encode(fn:split(layout,'=')[1],'HTML_ATTR')}">
- ${sling:encode(fn:split(layout,'=')[0],'HTML')}
- </option>
+<option value="">Select Policy</option>
+<sling:getParent var="parent" resource="${slingRequest.requestPathInfo.suffixResource}" level="4" />
+<c:set var="query" value="SELECT * FROM [nt:unstructured] WHERE [sling:resourceType] = 'sling-cms/components/caconfig/policy' AND ISDESCENDANTNODE([${parent.path}]) ORDER BY [jcr:title]" />
+<c:forEach var="policy" items="${sling:findResources(resourceResolver,query,'JCR-SQL2')}">
+ <option value="${policy.path}" ${policy.path == editProperties.policyPath ? 'selected' : ''}><sling:encode value="${policy.valueMap['jcr:title']}" mode="HTML" /></option>
</c:forEach>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config.json
similarity index 100%
rename from ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config.json
rename to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config.json
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/config.jsp
similarity index 77%
copy from ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/config.jsp
index c1d48ef..0a97fe2 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/config.jsp
@@ -33,15 +33,12 @@
<hr/>
<div>
<h4>
- Available Component Types
+ Component Policies
</h4>
- <ul>
- <c:forEach var="availableComponentType" items="${properties.availableComponentTypes}">
- <li>
- <sling:encode value="${availableComponentType}" mode="HTML" />
- </li>
- </c:forEach>
- </ul>
+ <c:set var="oldAvailableTypes" value="${availableTypes}" />
+ <c:set var="availableTypes" value="SlingCMS-PolicyMappingConfig" scope="request" />
+ <sling:include path="policies" resourceType="sling-cms/components/general/container" />
+ <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
</div>
<hr/>
<div>
@@ -59,14 +56,4 @@
<c:set var="availableTypes" value="SlingCMS-FieldConfig" scope="request" />
<sling:include path="fields" resourceType="sling-cms/components/general/container" />
<c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
-</div>
-<hr/>
-<div>
- <h4>
- Component Configurations
- </h4>
- <c:set var="oldAvailableTypes" value="${availableTypes}" />
- <c:set var="availableTypes" value="SlingCMS-ComponentConfig" scope="request" />
- <sling:include path="componentConfigurations" resourceType="sling-cms/components/general/container" />
- <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
-</div>
+</div>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/edit.json
similarity index 90%
copy from ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/edit.json
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/edit.json
index 37c1e23..cba3207 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/edit.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/config/edit.json
@@ -1,7 +1,7 @@
{
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/slingform",
- "button": "Save Page Type",
+ "button": "Save Page Template",
"fields": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/general/container",
@@ -26,10 +26,6 @@
"name": "allowedPaths@TypeHint",
"value": "String[]"
},
- "availableComponentTypes": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/cms/availablecomponenttypes"
- },
"template": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/editor/fields/textarea",
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/fileeditor.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/template.jsp
similarity index 70%
copy from ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/fileeditor.jsp
copy to ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/template.jsp
index 9fe38da..f90e8b8 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/fileeditor/fileeditor.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/caconfig/template/template.jsp
@@ -16,14 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/ --%>
- <%@include file="/libs/sling-cms/global.jsp"%>
-<c:set var="cmsEditEnabled" value="true" scope="request" />
+<%@include file="/libs/sling-cms/global.jsp"%>
+ <c:set var="cmsEditEnabled" value="true" scope="request" />
<sling:call script="/libs/sling-cms/components/editor/scripts/init.jsp" />
-
-<c:set var="oldAvailableTypes" value="${availableTypes}" />
-<c:set var="availableTypes" value="SlingCMS-FileEditor" scope="request" />
-<sling:include path="${slingRequest.requestPathInfo.suffix}" resourceType="sling-cms/components/caconfig/fileeditor/config" />
-<c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
-
+<sling:include path="${slingRequest.requestPathInfo.suffix}" resourceType="sling-cms/components/caconfig/template/config" />
<sling:call script="/libs/sling-cms/components/editor/scripts/finalize.jsp" />
<c:set var="cmsEditEnabled" value="false" scope="request" />
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/templateeditor.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/templateeditor.jsp
deleted file mode 100644
index bdb76b1..0000000
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/templateeditor.jsp
+++ /dev/null
@@ -1,45 +0,0 @@
-<%-- /*
- * 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"%>
-<nav class="breadcrumb" aria-label="breadcrumbs">
- <c:set var="siteCfgResource" value="${slingRequest.requestPathInfo.suffixResource.parent.parent}" />
- <c:set var="cfgResource" value="${siteCfgResource.parent}" />
- <ul>
- <li>
- <a href="/cms/config/list.html${cfgResource.path}">
- <sling:encode value="${cfgResource.valueMap['jcr:content/jcr:title']}" mode="HTML" default="${cfgResource.name}" />
- </a>
- </li>
- <li>
- <a href="/cms/config/edit.html${siteCfgResource.path}">
- <sling:encode value="${siteCfgResource.valueMap['jcr:title']}" mode="HTML" default="${siteCfgResource.name}" />
- </a>
- </li>
- <li class="is-active">
- <a href="#">
- <sling:encode value="${resource.valueMap['jcr:title']}" mode="HTML" />
- </a>
- </li>
- </ul>
-</nav>
- <c:set var="cmsEditEnabled" value="true" scope="request" />
-<sling:call script="/libs/sling-cms/components/editor/scripts/init.jsp" />
-<sling:include path="${slingRequest.requestPathInfo.suffix}" resourceType="sling-cms/components/cms/templateeditor/config" />
-<sling:call script="/libs/sling-cms/components/editor/scripts/finalize.jsp" />
-<c:set var="cmsEditEnabled" value="false" scope="request" />
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/config/config.jsp
similarity index 77%
rename from ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp
rename to ui/src/main/resources/jcr_root/libs/sling-cms/components/config/config.jsp
index c1d48ef..0a97fe2 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/config.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/config/config.jsp
@@ -33,15 +33,12 @@
<hr/>
<div>
<h4>
- Available Component Types
+ Component Policies
</h4>
- <ul>
- <c:forEach var="availableComponentType" items="${properties.availableComponentTypes}">
- <li>
- <sling:encode value="${availableComponentType}" mode="HTML" />
- </li>
- </c:forEach>
- </ul>
+ <c:set var="oldAvailableTypes" value="${availableTypes}" />
+ <c:set var="availableTypes" value="SlingCMS-PolicyMappingConfig" scope="request" />
+ <sling:include path="policies" resourceType="sling-cms/components/general/container" />
+ <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
</div>
<hr/>
<div>
@@ -59,14 +56,4 @@
<c:set var="availableTypes" value="SlingCMS-FieldConfig" scope="request" />
<sling:include path="fields" resourceType="sling-cms/components/general/container" />
<c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
-</div>
-<hr/>
-<div>
- <h4>
- Component Configurations
- </h4>
- <c:set var="oldAvailableTypes" value="${availableTypes}" />
- <c:set var="availableTypes" value="SlingCMS-ComponentConfig" scope="request" />
- <sling:include path="componentConfigurations" resourceType="sling-cms/components/general/container" />
- <c:set var="availableTypes" value="${oldAvailableTypes}" scope="request" />
-</div>
+</div>
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/components/config/edit.json
similarity index 100%
rename from ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/templateeditor/config/edit.json
rename to ui/src/main/resources/jcr_root/libs/sling-cms/components/config/edit.json
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
index b6b41c8..5f031d7 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/general/container/container.jsp
@@ -22,8 +22,11 @@
<c:set var="availableTypes" value="${requestScope.availableTypes}" />
</c:when>
<c:when test="${empty requestScope.availableTypes}">
- <sling:adaptTo var="pageMgr" adaptable="${resource}" adaptTo="org.apache.sling.cms.PageManager" />
- <c:set var="availableTypes" value="${fn:join(pageMgr.page.template.availableComponentTypes,',')}" />
+ <sling:adaptTo var="policyMgr" adaptable="${resource}" adaptTo="org.apache.sling.cms.ComponentPolicyManager" />
+ <c:set var="policy" value="${policyMgr.componentPolicy}" />
+ <c:if test="${policy != null && not empty policy.availableComponentTypes}">
+ <c:set var="availableTypes" value="${fn:join(policy.availableComponentTypes,',')}" />
+ </c:if>
</c:when>
</c:choose>
<c:forEach var="child" items="${sling:listChildren(resource)}">
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/edit.json
index 59be611..e1bf644 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/edit.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/edit.json
@@ -12,6 +12,12 @@
"sling:resourceType": "sling-cms/components/general/richtext",
"text": "<h2>Edit Configuration</h2>"
},
+ "contentbreadcrumb": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentbreadcrumb",
+ "depth": 1,
+ "rootTitle": "Configuration"
+ },
"editconfig": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/caconfig/edit"
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/edit.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/edit.json
index f895837..d8674db 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/edit.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/template/edit.json
@@ -7,9 +7,20 @@
"container": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/general/container",
- "siteconfig": {
+ "richtext": {
"jcr:primaryType": "nt:unstructured",
- "sling:resourceType": "sling-cms/components/cms/templateeditor"
+ "sling:resourceType": "sling-cms/components/general/richtext",
+ "text": "<h2>Edit Template</h2>"
+ },
+ "contentbreadcrumb": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentbreadcrumb",
+ "depth": 1,
+ "rootTitle": "Configuration"
+ },
+ "templateeditor": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/caconfig/template"
}
}
}
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/install/org.apache.sling.cms.core.internal.ResourceEditorAssociation-confedit.config b/ui/src/main/resources/jcr_root/libs/sling-cms/install/org.apache.sling.cms.core.internal.ResourceEditorAssociation-confedit.config
new file mode 100644
index 0000000..9269f4e
--- /dev/null
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/install/org.apache.sling.cms.core.internal.ResourceEditorAssociation-confedit.config
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+pathPattern="\\/conf\\/[\\w\\d\\-_]+\\/[\\w\\d\\-_]+\\/.+"
+editor="/cms/config/edit.html"