You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2018/01/30 05:21:56 UTC
[sling-whiteboard] branch master updated: Making the content stuff
more flexible and adding a taxonomy concept
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 8b2dd6a Making the content stuff more flexible and adding a taxonomy concept
8b2dd6a is described below
commit 8b2dd6a4343a1b3be2b454f631232520218bd4c0
Author: Dan Klco <da...@gmail.com>
AuthorDate: Tue Jan 30 00:21:46 2018 -0500
Making the content stuff more flexible and adding a taxonomy concept
---
.../resources/SLING-INF/nodetypes/nodetypes.cnd | 18 +++-
.../availablecomponenttypes.jsp | 20 +++-
.../contentactions.jsp} | 14 +--
.../cms/contentbreadcrumb/contentbreadcrumb.jsp | 41 ++++++++
.../components/cms/contenttable/contenttable.jsp | 27 +----
.../libs/sling-cms/content/site/content.json | 31 ++++++
.../jcr_root/libs/sling-cms/content/start.json | 13 ++-
.../libs/sling-cms/content/taxonomy/create.json | 47 +++++++++
.../libs/sling-cms/content/taxonomy/edit.json | 33 ++++++
.../libs/sling-cms/content/taxonomy/list.json | 112 +++++++++++++++++++++
10 files changed, 312 insertions(+), 44 deletions(-)
diff --git a/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd b/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
index 5455fe0..3de2f55 100644
--- a/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
+++ b/cms/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
@@ -42,14 +42,24 @@
- jcr:lastModified (date)
- jcr:lastModifiedBy (string)
- jcr:title (string)
- + * (nt:base) = nt:base version
+ + * (nt:unstructured) = nt:unstructured version
[sling:Page] > nt:hierarchyNode
orderable
- published (boolean)
- + jcr:content (nt:base) = nt:unstructured copy primary
+ + jcr:content (nt:unstructured) = nt:unstructured copy primary
+ * (nt:base) = nt:base version
[sling:Component] > nt:unstructured
- - componentType (boolean)
- - jcr:title (boolean)
+ - componentType (string)
+ - jcr:title (string)
+
+[sling:Taxonomy] > nt:hierarchyNode
+ orderable
+ - sling:related (string)
+ - sling:created (date)
+ - sling:createdBy (string)
+ - jcr:lastModified (date)
+ - jcr:lastModifiedBy (string)
+ - jcr:title (string)
+ + * (sling:Taxonomy) = sling:Taxonomy version
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/availablecomponenttypes/availablecomponenttypes.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/availablecomponenttypes/availablecomponenttypes.jsp
index 9ae305f..c5c71b3 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/availablecomponenttypes/availablecomponenttypes.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/availablecomponenttypes/availablecomponenttypes.jsp
@@ -19,10 +19,26 @@
<%@include file="/libs/sling-cms/global.jsp"%>
<div class="Field-Group">
<label for="availableComponentTypes">
- Component Types
+ Available Component Types
</label>
<div class="Field-Input">
- <select
+ <c:set var="currentTypes" value="|${fn:join(slingRequest.requestPathInfo.suffixResource.valueMap.availableComponentTypes, '|')}|"/>
+ <sling:adaptTo var="componentManager" adaptable="${resourceResolver}" adaptTo="org.apache.sling.cms.core.models.ComponentManager" />
+ <c:forEach var="type" items="${componentManager.componentTypes}">
+ <label class="Checkbox-Label">
+ <c:set var="search" value="|${type}|" />
+ <c:choose>
+ <c:when test="${fn:contains(currentTypes,search)}">
+ <c:set var="checked">checked="checked"</c:set>
+ </c:when>
+ <c:otherwise>
+ <c:set var="checked" value="" />
+ </c:otherwise>
+ </c:choose>
+ <input name="availableComponentTypes" type="checkbox" ${checked} value="${sling:encode(type,'HTML_ATTR')}">
+ <sling:encode value="${type}" mode="HTML" />
+ </label>
+ </c:forEach>
</div>
<input type="hidden" name="availableComponentTypes@TypeHint" value="String[]" />
</div>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/availablecomponenttypes/availablecomponenttypes.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentactions/contentactions.jsp
similarity index 65%
copy from cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/availablecomponenttypes/availablecomponenttypes.jsp
copy to cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentactions/contentactions.jsp
index 9ae305f..bf384ce 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/availablecomponenttypes/availablecomponenttypes.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentactions/contentactions.jsp
@@ -16,13 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/ --%>
-<%@include file="/libs/sling-cms/global.jsp"%>
-<div class="Field-Group">
- <label for="availableComponentTypes">
- Component Types
- </label>
- <div class="Field-Input">
- <select
- </div>
- <input type="hidden" name="availableComponentTypes@TypeHint" value="String[]" />
-</div>
\ No newline at end of file
+ <%@include file="/libs/sling-cms/global.jsp"%>
+ <c:forEach var="action" items="${sling:listChildren(sling:getRelativeResource(resource,'actions'))}" varStatus="status">
+ <c:if test="${!status.first}"> | </c:if><a class="Button Fetch-Modal" data-title="Add ${action.valueMap.label}" data-path=".Main-Content form" href="${action.valueMap.prefix}${slingRequest.requestPathInfo.suffix}">+ ${action.valueMap.label}</a>
+ </c:forEach>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp
new file mode 100644
index 0000000..2080bd2
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentbreadcrumb/contentbreadcrumb.jsp
@@ -0,0 +1,41 @@
+<%-- /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */ --%>
+ <%@include file="/libs/sling-cms/global.jsp"%>
+<sling:getParent resource="${slingRequest.requestPathInfo.suffixResource}" var="site" level="${resource.valueMap.depth}" />
+<ul class="Breadcrumb">
+ <li class="Breadcrumb-Item">
+ <a href="${resource.valueMap.prefix}${site.path}">
+ <sling:encode value="${site.valueMap['jcr:title']}" mode="HTML" />
+ </a>
+ </li>
+ <c:if test="${site.path != slingRequest.requestPathInfo.suffix && site.path != slingRequest.requestPathInfo.suffixResource.parent.path}">
+ <c:forEach var="parent" items="${sling:getParents(slingRequest.requestPathInfo.suffixResource,(resource.valueMap.depth + 1))}">
+ <li class="Breadcrumb-Item">
+ <a href="${resource.valueMap.prefix}${parent.path}">
+ <sling:encode value="${parent.valueMap[resource.valueMap.titleProp]}" default="${parent.name}" mode="HTML" />
+ </a>
+ </li>
+ </c:forEach>
+ </c:if>
+ <c:if test="${site.path != slingRequest.requestPathInfo.suffix}">
+ <li class="Breadcrumb-Item">
+ <sling:encode value="${slingRequest.requestPathInfo.suffixResource.valueMap[resource.valueMap.titleProp]}" default="${slingRequest.requestPathInfo.suffix}" mode="HTML" />
+ </li>
+ </c:if>
+</ul>
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp
index b519469..6b34121 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contenttable/contenttable.jsp
@@ -17,31 +17,6 @@
* under the License.
*/ --%>
<%@include file="/libs/sling-cms/global.jsp"%>
- <a class="Button Fetch-Modal" data-title="Add Page" data-path=".Main-Content form" href="/cms/page/create.html${slingRequest.requestPathInfo.suffix}">+ Page</a>
- | <a class="Button Fetch-Modal" data-title="Add File" data-path=".Main-Content form" href="/cms/file/upload.html${slingRequest.requestPathInfo.suffix}">+ File</a>
- | <a class="Button Fetch-Modal" data-title="Add Folder" data-path=".Main-Content form" href="/cms/folder/create.html${slingRequest.requestPathInfo.suffix}">+ Folder</a>
-<sling:getParent resource="${slingRequest.requestPathInfo.suffixResource}" var="site" level="2" />
-<ul class="Breadcrumb">
- <li class="Breadcrumb-Item">
- <a href="/cms/site/content.html${site.path}">
- <sling:encode value="${site.valueMap['jcr:title']}" mode="HTML" />
- </a>
- </li>
- <c:if test="${site.path != slingRequest.requestPathInfo.suffix && site.path != slingRequest.requestPathInfo.suffixResource.parent.path}">
- <c:forEach var="parent" items="${sling:getParents(slingRequest.requestPathInfo.suffixResource,3)}">
- <li class="Breadcrumb-Item">
- <a href="/cms/site/content.html${parent.path}">
- <sling:encode value="${parent.valueMap['jcr:content/jcr:title']}" default="${parent.name}" mode="HTML" />
- </a>
- </li>
- </c:forEach>
- </c:if>
- <c:if test="${site.path != slingRequest.requestPathInfo.suffix}">
- <li class="Breadcrumb-Item">
- <sling:encode value="${slingRequest.requestPathInfo.suffixResource.valueMap['jcr:content/jcr:title']}" default="${slingRequest.requestPathInfo.suffix}" mode="HTML" />
- </li>
- </c:if>
-</ul>
<table>
<thead>
<tr>
@@ -113,7 +88,7 @@
<td class="Cell-${colConfig.valueMap.type}" title="${sling:encode(colValue,'HTML_ATTR')}">
<c:choose>
<c:when test="${colConfig.valueMap.link}">
- <a href="/cms/site/content.html${child.path}">
+ <a href="${colConfig.valueMap.prefix}${child.path}">
<sling:encode value="${colValue}" mode="HTML" />
</a>
</c:when>
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
index 87ca62c..d4f0b21 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/site/content.json
@@ -11,6 +11,34 @@
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/cms/siteheader"
},
+ "contentactions": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentactions",
+ "actions": {
+ "page": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Page",
+ "prefix": "/cms/page/create.html"
+ },
+ "file": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "File",
+ "prefix": "/cms/file/upload.html"
+ },
+ "folder": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Folder",
+ "prefix": "/cms/folder/create.html"
+ }
+ }
+ },
+ "contentbreadcrumb": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentbreadcrumb",
+ "depth": 2,
+ "prefix": "/cms/site/content.html",
+ "titleProp": "jcr:content/jcr:title"
+ },
"contenttable": {
"jcr:primaryType": "nt:unstructured",
"sling:resourceType": "sling-cms/components/cms/contenttable",
@@ -54,6 +82,7 @@
"name": {
"jcr:primaryType": "nt:unstructured",
"link": true,
+ "prefix": "/cms/site/content.html",
"type": "Name"
},
"title": {
@@ -173,6 +202,7 @@
"name": {
"jcr:primaryType": "nt:unstructured",
"link": true,
+ "prefix": "/cms/site/content.html",
"type": "Name"
},
"title": {
@@ -233,6 +263,7 @@
"name": {
"jcr:primaryType": "nt:unstructured",
"link": true,
+ "prefix": "/cms/site/content.html",
"type": "Name"
},
"title": {
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
index fe50f14..752003f 100644
--- a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
@@ -24,7 +24,7 @@
"createPath": "/cms/site/create.html/content",
"prefix":"/cms/site",
"itemPrefix": "/cms/site/content.html",
- "query": "SELECT * FROM [sling:Site] AS s WHERE ISDESCENDANTNODE(s,'/content') ORDER BY NAME()",
+ "query": "SELECT * FROM [sling:Site] AS s WHERE ISCHILDNODE(s,'/content') ORDER BY NAME()",
"title": "Site"
},
"confignav": {
@@ -33,8 +33,17 @@
"createPath": "/cms/config/create.html/etc/config",
"prefix": "/cms/config",
"itemPrefix":"/cms/config/edit.html",
- "query": "SELECT * FROM [sling:Config] AS s WHERE ISDESCENDANTNODE(s,'/etc/config') ORDER BY NAME()",
+ "query": "SELECT * FROM [sling:Config] AS s WHERE ISCHILDNODE(s,'/etc/config') ORDER BY NAME()",
"title": "Site Config"
+ },
+ "taxonomynav": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentnav",
+ "createPath": "/cms/taxonomy/create.html/etc/taxonomy",
+ "prefix": "/cms/taxonomy",
+ "itemPrefix":"/cms/taxonomy/list.html",
+ "query": "SELECT * FROM [sling:Taxonomy] AS s WHERE ISCHILDNODE(s,'/etc/taxonomy') ORDER BY NAME()",
+ "title": "Taxonomy"
}
}
}
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/create.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/create.json
new file mode 100644
index 0000000..98c5e25
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/create.json
@@ -0,0 +1,47 @@
+{
+ "jcr:primaryType": "sling:Page",
+ "jcr:content": {
+ "sling:resourceType": "sling-cms/components/pages/base",
+ "jcr:title": "Create Taxonomy",
+ "jcr:primaryType": "nt:unstructured",
+ "container": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "richtext": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/richtext",
+ "text": "<h3>Create Taxonomy</h3>"
+ },
+ "slingform": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "actionSuffix": "/*",
+ "button": "Create Taxonomy",
+ "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
+ },
+ "name": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/text",
+ "label": "Name",
+ "name": ":name",
+ "required": true
+ },
+ "primaryType": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/fields/hidden",
+ "name": "jcr:primaryType",
+ "value": "sling:Taxonomy"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json
new file mode 100644
index 0000000..3da06ed
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/edit.json
@@ -0,0 +1,33 @@
+{
+ "jcr:primaryType": "sling:Page",
+ "jcr:content": {
+ "sling:resourceType": "sling-cms/components/pages/base",
+ "jcr:title": "Edit Taxonomy Item",
+ "jcr:primaryType": "nt:unstructured",
+ "container": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "richtext": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/richtext",
+ "text": "<h3>Edit Taxonomy Item</h3>"
+ },
+ "slingform": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/editor/slingform",
+ "button": "Update Taxonomy",
+ "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
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json
new file mode 100644
index 0000000..0e4589f
--- /dev/null
+++ b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/content/taxonomy/list.json
@@ -0,0 +1,112 @@
+{
+ "jcr:primaryType": "sling:Page",
+ "jcr:content": {
+ "sling:resourceType": "sling-cms/components/pages/base",
+ "jcr:title": "Taxonomy",
+ "jcr:primaryType": "nt:unstructured",
+ "container": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/general/container",
+ "contentactions": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentactions",
+ "actions": {
+ "taxonomy": {
+ "jcr:primaryType": "nt:unstructured",
+ "label": "Taxonomy Item",
+ "prefix": "/cms/taxonomy/create.html"
+ }
+ }
+ },
+ "contentbreadcrumb": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contentbreadcrumb",
+ "depth": 3,
+ "prefix": "/cms/taxonomy/list.html",
+ "titleProp": "jcr:title"
+ },
+ "contenttable": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/contenttable",
+ "columns": {
+ "jcr:primaryType": "nt:unstructured",
+ "name": {
+ "jcr:primaryType": "nt:unstructured",
+ "title": "Name"
+ },
+ "title": {
+ "jcr:primaryType": "nt:unstructured",
+ "title": "Title"
+ },
+ "lastModified": {
+ "jcr:primaryType": "nt:unstructured",
+ "title": "Last Modified"
+ },
+ "lastModifiedBy": {
+ "jcr:primaryType": "nt:unstructured",
+ "title": "Last Modified By"
+ },
+ "actions": {
+ "jcr:primaryType": "nt:unstructured",
+ "title": "Actions"
+ }
+ },
+ "types": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:Taxonomy":{
+ "jcr:primaryType": "nt:unstructured",
+ "columns": {
+ "jcr:primaryType": "nt:unstructured",
+ "name": {
+ "jcr:primaryType": "nt:unstructured",
+ "link": true,
+ "prefix": "/cms/taxonomy/list.html",
+ "type": "Name"
+ },
+ "title": {
+ "jcr:primaryType": "nt:unstructured",
+ "property": "jcr:title",
+ "type": "String"
+ },
+ "lastModified": {
+ "jcr:primaryType": "nt:unstructured",
+ "property": "jcr:content/jcr:lastModified",
+ "type": "Date"
+ },
+ "lastModifiedBy": {
+ "jcr:primaryType": "nt:unstructured",
+ "property": "jcr:content/jcr:lastModifiedBy",
+ "type": "String"
+ },
+ "actions": {
+ "jcr:primaryType": "nt:unstructured",
+ "type": "Actions",
+ "edit": {
+ "jcr:primaryType": "nt:unstructured",
+ "modal": true,
+ "title": "Edit Taxonomy Item",
+ "text": "✏",
+ "prefix": "/cms/taxonomy/edit.html"
+ },
+ "movecopy": {
+ "jcr:primaryType": "nt:unstructured",
+ "modal": true,
+ "title": "Move / Copy Taxonomy Item",
+ "text": "⇆",
+ "prefix": "/cms/shared/movecopy.html"
+ },
+ "delete": {
+ "jcr:primaryType": "nt:unstructured",
+ "modal": true,
+ "title": "Delete the specified taxonomy item",
+ "text": "×",
+ "prefix": "/cms/shared/delete.html"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
dklco@apache.org.