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 2020/08/29 02:06:34 UTC

[sling-org-apache-sling-app-cms] branch SLING-8913-multiple-instance-types updated (e21fe1d -> 59175fe)

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a change to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git.


    from e21fe1d  Merging
     new dbccacc  Fixing double click not firing
     new 4d99150  Adding a constant for the sling:Config node type
     new fe98d6a  Ensuring the path is set if a failure publishing occurs
     new 518f2b3  Adding the ability to re-publish
     new 7b252a7  Fixing an issue where the content distributor wasn't re-binding on start
     new 62ab937  Adding support for publishing configs
     new 59175fe  Starting on adding feature support for content distribution

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/sling/cms/CMSConstants.java    |   6 +-
 .../org/apache/sling/cms/PublishableResource.java  |   4 +
 .../sling/cms/publication/PublicationManager.java  |   2 +-
 .../internal/models/PublishableResourceImpl.java   |   6 +-
 .../ContentDistributionPublicationManager.java     |  23 ++-
 .../publication/PublicationManagerFactoryImpl.java |   3 +-
 .../cms/core/publication/PublishPostOperation.java |   2 +-
 .../core/publication/UnpublishPostOperation.java   |   3 +-
 feature/src/main/features/distribution.json        |  79 ++++++++-
 .../features/runmode-author/runmode-author.json    |  40 +++++
 .../runmode-renderer/runmode-renderer.json         |  13 ++
 .../runmode-standalone/runmode-standalone.json     |  17 ++
 .../resources/SLING-INF/nodetypes/nodetypes.cnd    |   2 +-
 .../components/cms/contentgrid/contentgrid.jsp     | 176 +++++++++++----------
 .../components/editor/fields/publication/field.jsp |   9 ++
 .../libs/sling-cms/content/config/bucket.json      |   8 +
 16 files changed, 287 insertions(+), 106 deletions(-)
 create mode 100644 feature/src/main/features/runmode-author/runmode-author.json
 create mode 100644 feature/src/main/features/runmode-renderer/runmode-renderer.json
 create mode 100644 feature/src/main/features/runmode-standalone/runmode-standalone.json


[sling-org-apache-sling-app-cms] 03/07: Ensuring the path is set if a failure publishing occurs

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit fe98d6a95774a8168019bd549ab62cd617044454
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Aug 28 22:03:48 2020 -0400

    Ensuring the path is set if a failure publishing occurs
---
 .../org/apache/sling/cms/core/publication/PublishPostOperation.java    | 2 +-
 .../org/apache/sling/cms/core/publication/UnpublishPostOperation.java  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/sling/cms/core/publication/PublishPostOperation.java b/core/src/main/java/org/apache/sling/cms/core/publication/PublishPostOperation.java
index ad1672b..e9dbf51 100644
--- a/core/src/main/java/org/apache/sling/cms/core/publication/PublishPostOperation.java
+++ b/core/src/main/java/org/apache/sling/cms/core/publication/PublishPostOperation.java
@@ -47,6 +47,7 @@ public class PublishPostOperation implements PostOperation {
     public void run(SlingHttpServletRequest request, PostResponse response, SlingPostProcessor[] processors) {
         final List<Modification> changes = new ArrayList<>();
         try {
+            response.setPath(request.getResource().getPath());
             publicationManagerFactory.getPublicationManager()
                     .publish(request.getResource().adaptTo(PublishableResource.class));
 
@@ -58,7 +59,6 @@ public class PublishPostOperation implements PostOperation {
 
             request.getResourceResolver().commit();
 
-            response.setPath(request.getResource().getPath());
             response.onModified(request.getResource().getPath());
         } catch (Exception e) {
             log.error("Failed to publish", e);
diff --git a/core/src/main/java/org/apache/sling/cms/core/publication/UnpublishPostOperation.java b/core/src/main/java/org/apache/sling/cms/core/publication/UnpublishPostOperation.java
index 1dff941..56313c4 100644
--- a/core/src/main/java/org/apache/sling/cms/core/publication/UnpublishPostOperation.java
+++ b/core/src/main/java/org/apache/sling/cms/core/publication/UnpublishPostOperation.java
@@ -47,6 +47,8 @@ public class UnpublishPostOperation implements PostOperation {
     public void run(SlingHttpServletRequest request, PostResponse response, SlingPostProcessor[] processors) {
         final List<Modification> changes = new ArrayList<>();
         try {
+
+            response.setPath(request.getResource().getPath());
             publicationManagerFactory.getPublicationManager()
                     .unpublish(request.getResource().adaptTo(PublishableResource.class));
 
@@ -58,7 +60,6 @@ public class UnpublishPostOperation implements PostOperation {
 
             request.getResourceResolver().commit();
 
-            response.setPath(request.getResource().getPath());
             response.onModified(request.getResource().getPath());
         } catch (Exception e) {
             log.error("Failed to publish", e);


[sling-org-apache-sling-app-cms] 05/07: Fixing an issue where the content distributor wasn't re-binding on start

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 7b252a7bab180e5a72723b4c90d4ca1140b35432
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Aug 28 22:05:07 2020 -0400

    Fixing an issue where the content distributor wasn't re-binding on start
---
 .../sling/cms/core/publication/PublicationManagerFactoryImpl.java      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java b/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java
index 44eedda..50e4268 100644
--- a/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java
+++ b/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java
@@ -26,6 +26,7 @@ import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Reference;
 import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.service.metatype.annotations.Designate;
 
@@ -39,7 +40,7 @@ public class PublicationManagerFactoryImpl implements PublicationManagerFactory,
     @Reference
     private EventAdmin eventAdmin;
 
-    @Reference(cardinality = ReferenceCardinality.OPTIONAL)
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
     private Distributor distributor;
 
     private PUBLICATION_MODE publicationMode;


[sling-org-apache-sling-app-cms] 07/07: Starting on adding feature support for content distribution

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 59175fe0a7de4db15779800ec1dd59efeeb3aa9f
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Aug 28 22:06:20 2020 -0400

    Starting on adding feature support for content distribution
---
 feature/src/main/features/distribution.json        | 79 ++++++++++++++++++++--
 .../features/runmode-author/runmode-author.json    | 40 +++++++++++
 .../runmode-renderer/runmode-renderer.json         | 13 ++++
 .../runmode-standalone/runmode-standalone.json     | 17 +++++
 4 files changed, 142 insertions(+), 7 deletions(-)

diff --git a/feature/src/main/features/distribution.json b/feature/src/main/features/distribution.json
index 0de723a..52d467f 100644
--- a/feature/src/main/features/distribution.json
+++ b/feature/src/main/features/distribution.json
@@ -1,14 +1,79 @@
-
 {
-    "id":"org.apache.sling:org.apache.sling.cms.feature:slingfeature:distribution:${cms.version}",
-    "bundles":[
+    "id": "org.apache.sling:org.apache.sling.cms.feature:slingfeature:distribution:${cms.version}",
+    "bundles": [
         {
-            "id":"org.apache.sling:org.apache.sling.distribution.api:0.4.0",
-            "start-order":"20"
+            "id": "org.apache.sling:org.apache.sling.distribution.api:0.4.0",
+            "start-order": "20"
         },
         {
-            "id":"org.apache.sling:org.apache.sling.distribution.core:0.4.2",
-            "start-order":"20"
+            "id": "org.apache.sling:org.apache.sling.distribution.core:0.4.2",
+            "start-order": "20"
         }
+    ],
+    "configurations": {
+        "org.apache.sling.distribution.resources.impl.DistributionConfigurationResourceProviderFactory~agent": {
+            "provider.roots": "/libs/sling-cms/content/distribution/services/agents",
+            "kind": "agent"
+        },
+        "org.apache.sling.distribution.resources.impl.DistributionConfigurationResourceProviderFactory~exporter": {
+            "provider.roots": "/libs/sling-cms/content/distribution/services/exporters",
+            "kind": "exporter"
+        },
+        "org.apache.sling.distribution.resources.impl.DistributionConfigurationResourceProviderFactory~importer": {
+            "provider.roots": "/libs/sling-cms/content/distribution/services/importers",
+            "kind": "importer"
+        },
+        "org.apache.sling.distribution.resources.impl.DistributionServiceResourceProviderFactory~agent": {
+            "provider.roots": "/libs/sling-cms/content/distribution/services/agents",
+            "kind": "agent"
+        },
+        "org.apache.sling.distribution.resources.impl.DistributionServiceResourceProviderFactory~exporter": {
+            "provider.roots": "/libs/sling-cms/content/distribution/services/exporter",
+            "kind": "exporter"
+        },
+        "org.apache.sling.distribution.resources.impl.DistributionServiceResourceProviderFactory~importer": {
+            "provider.roots": "/libs/sling-cms/content/distribution/services/importer",
+            "kind": "importer"
+        },
+        "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~distribution": {
+            "user.mapping": [
+                "org.apache.sling.distribution.core=sling-package-install"
+            ]
+        },
+        "org.apache.sling.distribution.agent.impl.PrivilegeDistributionRequestAuthorizationStrategyFactory~default": {
+            "name": "default",
+            "jcrPrivilege": "sling:publish"
+        },
+        "org.apache.sling.distribution.serialization.impl.vlt.VaultDistributionPackageBuilderFactory~default": {
+            "fileThreshold": 1,
+            "cleanupDelay": 60,
+            "autoSaveThreshold": -1,
+            "package.roots": "",
+            "type": "jcrvlt",
+            "MEGA_BYTES": "MEGA_BYTES",
+            "property.filters": [
+                ""
+            ],
+            "pathsMapping": [
+                ""
+            ],
+            "strictImport": true,
+            "aclHandling": "IGNORE",
+            "importMode": "",
+            "digestAlgorithm": "MD5",
+            "tempFsFolder": "",
+            "monitoringQueueSize": 0,
+            "useOffHeapMemory": false,
+            "cugHandling": "",
+            "useBinaryReferences": false,
+            "package.filters": [
+                "/home/users|-.*/.tokens",
+                "/home/users|-.*/.rep:cache"
+            ],
+            "name": "default"
+        }
+    },
+    "repoinit:TEXT|true": [
+        "register privilege sling:publish"
     ]
 }
\ No newline at end of file
diff --git a/feature/src/main/features/runmode-author/runmode-author.json b/feature/src/main/features/runmode-author/runmode-author.json
new file mode 100644
index 0000000..31bb8f6
--- /dev/null
+++ b/feature/src/main/features/runmode-author/runmode-author.json
@@ -0,0 +1,40 @@
+{
+    "id": "org.apache.sling:org.apache.sling.cms.feature:slingfeature:runmode-author:${cms.version}",
+    "configurations": {
+        "org.apache.sling.cms.core.publication.PublicationManagerFactoryImpl": {
+            "publicationMode": "CONTENT_DISTRIBUTION",
+            "agents": []
+        },
+        "org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporterFactory~default": {
+            "packageBuilder.target": "(name=default)",
+            "name": "default"
+        },
+        "org.apache.sling.distribution.serialization.impl.vlt.VaultDistributionPackageBuilderFactory~default": {
+            "fileThreshold": 1,
+            "cleanupDelay": 60,
+            "autoSaveThreshold": -1,
+            "package.roots": "",
+            "type": "jcrvlt",
+            "MEGA_BYTES": "MEGA_BYTES",
+            "property.filters": [
+                ""
+            ],
+            "pathsMapping": [
+                ""
+            ],
+            "strictImport": true,
+            "aclHandling": "",
+            "importMode": "REPLACE",
+            "digestAlgorithm": "NONE",
+            "tempFsFolder": "",
+            "monitoringQueueSize": 0,
+            "useOffHeapMemory": false,
+            "cugHandling": "",
+            "useBinaryReferences": false,
+            "package.filters": [
+                ""
+            ],
+            "name": "default"
+        }
+    }
+}
\ No newline at end of file
diff --git a/feature/src/main/features/runmode-renderer/runmode-renderer.json b/feature/src/main/features/runmode-renderer/runmode-renderer.json
new file mode 100644
index 0000000..ac2bcd0
--- /dev/null
+++ b/feature/src/main/features/runmode-renderer/runmode-renderer.json
@@ -0,0 +1,13 @@
+{
+    "id": "org.apache.sling:org.apache.sling.cms.feature:slingfeature:runmode-author:${cms.version}",
+    "configurations": {
+        "org.apache.sling.cms.core.publication.PublicationManagerFactoryImpl": {
+            "publicationMode": "CONTENT_DISTRIBUTION",
+            "agents": []
+        },
+        "org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporterFactory~default": {
+            "packageBuilder.target": "(name=default)",
+            "name": "default"
+        }
+    }
+}
\ No newline at end of file
diff --git a/feature/src/main/features/runmode-standalone/runmode-standalone.json b/feature/src/main/features/runmode-standalone/runmode-standalone.json
new file mode 100644
index 0000000..0b3834b
--- /dev/null
+++ b/feature/src/main/features/runmode-standalone/runmode-standalone.json
@@ -0,0 +1,17 @@
+{
+    "id": "org.apache.sling:org.apache.sling.cms.feature:slingfeature:runmode-standalone:${cms.version}",
+    "configurations": {
+        "org.apache.sling.cms.core.publication.PublicationManagerFactoryImpl": {
+            "publicationMode": "STANDALONE",
+            "agents": []
+        },
+        "org.apache.sling.cms.core.internal.filters.CMSSecurityConfigInstance": {
+            "hostDomains": [],
+            "allowedPatterns": [
+                "^\/content\/starter/.*$",
+                "^\/static/.*$",
+                "^\/system\/sling\/form\/login$"
+            ]
+        }
+    }
+}
\ No newline at end of file


[sling-org-apache-sling-app-cms] 04/07: Adding the ability to re-publish

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 518f2b3baaf0fc6e58af3c20fd5e15ee48ccefc5
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Aug 28 22:04:37 2020 -0400

    Adding the ability to re-publish
---
 .../libs/sling-cms/components/cms/contentgrid/contentgrid.jsp    | 9 +++++++++
 .../sling-cms/components/editor/fields/publication/field.jsp     | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp
index f0d3fe7..b122bab 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp
@@ -89,9 +89,18 @@
                                 </div>
                             </footer>
                             <footer class="card-footer">
+                                <sling:adaptTo adaptable="${resourceResolver}" adaptTo="org.apache.sling.cms.publication.PublicationManager" var="publicationManager" />
                                 <sling:adaptTo adaptable="${child}" adaptTo="org.apache.sling.cms.PublishableResource" var="publishableResource" />
                                 <c:if test="${child.resourceType == 'sling:Page' || child.resourceType == 'sling:File' || child.resourceType == 'nt:file'}">
                                     <c:choose>
+                                        <c:when test="${publishableResource.published && publicationManager.publicationMode == 'CONTENT_DISTRIBUTION'}">
+                                            <a class="Fetch-Modal card-footer-item" href="/cms/shared/publish.html${child.path}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
+                                                Republish
+                                            </a>
+                                            <a class="Fetch-Modal card-footer-item" href="/cms/shared/unpublish.html${child.path}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
+                                                Unpublish
+                                            </a>
+                                        </c:when>
                                         <c:when test="${publishableResource.published}">
                                             <a class="Fetch-Modal card-footer-item" href="/cms/shared/unpublish.html${child.path}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
                                                 Unpublish
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/publication/field.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/publication/field.jsp
index c267eb3..191713d 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/publication/field.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/publication/field.jsp
@@ -55,7 +55,16 @@
         </dl>
     </div>
     <div class="column">
+        <sling:adaptTo adaptable="${resourceResolver}" adaptTo="org.apache.sling.cms.publication.PublicationManager" var="publicationManager" />
         <c:choose>
+            <c:when test="${publishableResource.published && publicationManager.publicationMode == 'CONTENT_DISTRIBUTION'}">
+                <a class="Fetch-Modal button is-success is-outlined" href="/cms/shared/publish.html${sling:encode(slingRequest.requestPathInfo.suffixResource.parent.path,'HTML_ATTR')}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
+                    Republish
+                </a>
+                <a class="Fetch-Modal button is-success is-outlined" href="/cms/shared/unpublish.html${sling:encode(slingRequest.requestPathInfo.suffixResource.parent.path,'HTML_ATTR')}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
+                    Unpublish
+                </a>
+            </c:when>
             <c:when test="${publishableResource.published}">
                 <a class="Fetch-Modal button is-success is-outlined" href="/cms/shared/unpublish.html${sling:encode(slingRequest.requestPathInfo.suffixResource.parent.path,'HTML_ATTR')}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
                     Unpublish


[sling-org-apache-sling-app-cms] 02/07: Adding a constant for the sling:Config node type

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 4d9915030dc437ddda7a25d11e1a70b841c62c25
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Aug 28 22:03:04 2020 -0400

    Adding a constant for the sling:Config node type
---
 api/src/main/java/org/apache/sling/cms/CMSConstants.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/api/src/main/java/org/apache/sling/cms/CMSConstants.java b/api/src/main/java/org/apache/sling/cms/CMSConstants.java
index 68eb3db..c698e35 100644
--- a/api/src/main/java/org/apache/sling/cms/CMSConstants.java
+++ b/api/src/main/java/org/apache/sling/cms/CMSConstants.java
@@ -65,6 +65,11 @@ public class CMSConstants {
     public static final String NN_METADATA = "metadata";
 
     /**
+     * Config node type.
+     */
+    public static final String NT_CONFIG = NAMESPACE + ":Config";
+
+    /**
      * Component node type.
      */
     public static final String NT_COMPONENT = NAMESPACE + ":Component";
@@ -138,7 +143,6 @@ public class CMSConstants {
      */
     public static final String PN_TAXONOMY = NAMESPACE + ":taxonomy";
 
-
     /**
      * Template attribute name
      */


[sling-org-apache-sling-app-cms] 06/07: Adding support for publishing configs

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 62ab9376e938e78817dd91139b40c1ef0651a91f
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Aug 28 22:05:54 2020 -0400

    Adding support for publishing configs
---
 .../org/apache/sling/cms/PublishableResource.java  |  4 ++++
 .../sling/cms/publication/PublicationManager.java  |  2 +-
 .../internal/models/PublishableResourceImpl.java   |  6 +++++-
 .../ContentDistributionPublicationManager.java     | 23 +++++++++++++++++-----
 .../resources/SLING-INF/nodetypes/nodetypes.cnd    |  2 +-
 .../libs/sling-cms/content/config/bucket.json      |  8 ++++++++
 6 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/api/src/main/java/org/apache/sling/cms/PublishableResource.java b/api/src/main/java/org/apache/sling/cms/PublishableResource.java
index 068618d..e15ed54 100644
--- a/api/src/main/java/org/apache/sling/cms/PublishableResource.java
+++ b/api/src/main/java/org/apache/sling/cms/PublishableResource.java
@@ -22,6 +22,10 @@ import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.cms.publication.PublicationType;
 
+/**
+ * A Model interface for adapting sling:File, sling:Page and sling:Config
+ * resources.
+ */
 public interface PublishableResource {
 
     /**
diff --git a/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java b/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java
index 02057c6..bf9e316 100644
--- a/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java
+++ b/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java
@@ -43,7 +43,7 @@ public interface PublicationManager {
      * @param resource the resource to publish
      * @throws PublicationException an exception occurs publishing the resource
      */
-    void unpublish(PublishableResource resource) throws PublicationException;
+    void unpublish(@NotNull PublishableResource resource) throws PublicationException;
 
     /**
      * The publication mode for the instance
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/PublishableResourceImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/PublishableResourceImpl.java
index 043646e..7386eeb 100644
--- a/core/src/main/java/org/apache/sling/cms/core/internal/models/PublishableResourceImpl.java
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/PublishableResourceImpl.java
@@ -70,7 +70,11 @@ public class PublishableResourceImpl implements PublishableResource {
         this.resource = resource;
         this.created = resource.getValueMap().get(JcrConstants.JCR_CREATED, Calendar.class);
         this.createdBy = resource.getValueMap().get(NodeTypeConstants.JCR_CREATEDBY, String.class);
-        this.contentResource = resource.getChild(JcrConstants.JCR_CONTENT);
+        if (CMSConstants.NT_CONFIG.equals(resource.getValueMap().get(JcrConstants.JCR_PRIMARYTYPE, String.class))) {
+            this.contentResource = resource;
+        } else {
+            this.contentResource = resource.getChild(JcrConstants.JCR_CONTENT);
+        }
         if (this.contentResource != null) {
             ValueMap properties = contentResource.getValueMap();
             this.lastModified = properties.get(JcrConstants.JCR_LASTMODIFIED, Calendar.class);
diff --git a/core/src/main/java/org/apache/sling/cms/core/publication/ContentDistributionPublicationManager.java b/core/src/main/java/org/apache/sling/cms/core/publication/ContentDistributionPublicationManager.java
index 2934232..98464da 100644
--- a/core/src/main/java/org/apache/sling/cms/core/publication/ContentDistributionPublicationManager.java
+++ b/core/src/main/java/org/apache/sling/cms/core/publication/ContentDistributionPublicationManager.java
@@ -31,6 +31,8 @@ import org.apache.sling.distribution.DistributionResponse;
 import org.apache.sling.distribution.Distributor;
 import org.apache.sling.distribution.SimpleDistributionRequest;
 import org.osgi.service.event.EventAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Implementation of the PublicationManager interface using Sling Content
@@ -38,6 +40,8 @@ import org.osgi.service.event.EventAdmin;
  */
 public class ContentDistributionPublicationManager extends StandalonePublicationManager {
 
+    private static final Logger log = LoggerFactory.getLogger(ContentDistributionPublicationManager.class);
+
     private final Distributor distributor;
     private final String[] agents;
 
@@ -45,18 +49,21 @@ public class ContentDistributionPublicationManager extends StandalonePublication
         super(eventAdmin);
         this.distributor = distributor;
         this.agents = agents;
-        
+
     }
 
     @Override
     public void publish(PublishableResource resource) throws PublicationException {
+        log.info("Publishing: {}", resource.getPath());
         DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD,
-                new String[] { resource.getPath() }, Collections.singleton(resource.getContentResource().getPath()));
+                new String[] { resource.getPath(), resource.getContentResource().getPath() },
+                Collections.singleton(resource.getContentResource().getPath()));
         List<DistributionResponse> failedResponses = this
                 .distributeRequest(resource.getResource().getResourceResolver(), request);
         if (!failedResponses.isEmpty()) {
             throw new PublicationException("Failed to publish: " + collectFailures(failedResponses));
         } else {
+            log.debug("Content Distribution successful, updating publication information");
             super.publish(resource);
         }
     }
@@ -67,14 +74,20 @@ public class ContentDistributionPublicationManager extends StandalonePublication
     }
 
     private List<DistributionResponse> distributeRequest(ResourceResolver resolver, DistributionRequest request) {
-        return Arrays.stream(agents).map(a -> distributor.distribute(a, resolver, request))
-                .filter(res -> !res.isSuccessful()).collect(Collectors.toList());
+        return Arrays.stream(agents).map(a -> {
+            log.info("Sending to agent: {}", a);
+            DistributionResponse response = distributor.distribute(a, resolver, request);
+            log.debug("Retrieved response [{}]: {}", response.getState(), response.getMessage());
+            return response;
+        }).filter(res -> !res.isSuccessful()).collect(Collectors.toList());
     }
 
     @Override
     public void unpublish(PublishableResource resource) throws PublicationException {
+        log.info("Unpublish: {}", resource.getPath());
         DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE,
-                new String[] { resource.getPath() }, Collections.singleton(resource.getContentResource().getPath()));
+                new String[] { resource.getPath(), resource.getContentResource().getPath() },
+                Collections.singleton(resource.getContentResource().getPath()));
         List<DistributionResponse> failedResponses = this
                 .distributeRequest(resource.getResource().getResourceResolver(), request);
         if (!failedResponses.isEmpty()) {
diff --git a/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd b/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
index 1d85577..43edb8f 100644
--- a/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
+++ b/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
@@ -36,7 +36,7 @@
     - componentType (string)
     - jcr:title (string)
     
-[sling:Config] > nt:hierarchyNode, mix:lastModified
+[sling:Config] > nt:hierarchyNode, mix:lastModified, mix:publishable
     orderable
     - sling:resourceType (string)
     - jcr:title (string)
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/bucket.json b/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/bucket.json
index dbeda1f..c8d5461 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/bucket.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/config/bucket.json
@@ -37,6 +37,10 @@
                         "jcr:primaryType": "nt:unstructured",
                         "title": "Title"
                     },
+                    "published": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "title": "Published"
+                    },
                     "lastModified": {
                         "jcr:primaryType": "nt:unstructured",
                         "title": "Last Modified"
@@ -63,6 +67,10 @@
                                 "sling:resourceType": "sling-cms/components/cms/columns/text",
                                 "property": "jcr:title"
                             },
+                            "publish": {
+                                "jcr:primaryType": "nt:unstructured",
+                                "sling:resourceType": "sling-cms/components/cms/columns/publish"
+                            },
                             "lastModified": {
                                 "jcr:primaryType": "nt:unstructured",
                                 "sling:resourceType": "sling-cms/components/cms/columns/lastmodified",


[sling-org-apache-sling-app-cms] 01/07: Fixing double click not firing

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit dbccacc4a0fb25dc8eacb00aff64c506fcf3b75b
Author: Dan Klco <dk...@apache.org>
AuthorDate: Fri Aug 28 08:35:30 2020 -0400

    Fixing double click not firing
---
 .../components/cms/contentgrid/contentgrid.jsp     | 167 ++++++++++-----------
 1 file changed, 80 insertions(+), 87 deletions(-)

diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp
index 8b2d6a8..f0d3fe7 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/contentgrid/contentgrid.jsp
@@ -28,97 +28,90 @@
             </c:forEach>
             <c:if test="${showCard}">
                 <div class="tile is-parent is-3 contentnav__item">
-                        <sling:getResource base="${resource}" path="types/${child.valueMap['jcr:primaryType']}/columns/name" var="nameConfig" />
-                        <c:choose>
-                            <c:when test="${not empty child.valueMap['jcr:content/jcr:title']}">
-                                <c:set var="title" value="${child.valueMap['jcr:content/jcr:title']}" />
-                            </c:when>
-                            <c:when test="${not empty child.valueMap['jcr:title']}">
-                                <c:set var="title" value="${child.valueMap['jcr:title']}" />
-                            </c:when>
-                            <c:otherwise>
-                                <c:set var="title" value="${child.name}" />
-                            </c:otherwise>
-                        </c:choose>
-                        <div class="tile is-child">
-                            <div class="card is-linked" title="${sling:encode(child.name,'HTML_ATTR')}" data-value="${child.path}">
-                                <div class="card-image">
-                                    <figure class="image is-5by4">
-                                        <c:choose>
-                                            <c:when test="${child.resourceType == 'sling:File' || child.resourceType == 'nt:file'}">
-                                                <img src="${child.path}.transform/sling-cms-thumbnail.png" loading="lazy" alt="${child.name}">
-                                            </c:when>
-                                            <c:when test="${child.resourceType == 'sling:Site'}">
-                                                <img src="/static/sling-cms/thumbnails/site.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${sling:encode(child.name, 'HTML_ATTR')}">
-                                            </c:when>
-                                            <c:when test="${child.resourceType == 'sling:OrderedFolder' || child.resourceType == 'sling:Folder' || child.resourceType == 'nt:folder'}">
-                                                <img src="/static/sling-cms/thumbnails/folder.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${sling:encode(child.name, 'HTML_ATTR')}">
-                                            </c:when>
-                                            <c:when test="${child.resourceType == 'sling:Page'}">
-                                                <c:set var="templateThumbnail" value="${child.valueMap['jcr:content/sling:template']}/thumbnail"/>
-                                                <c:choose>
-                                                    <c:when test="${sling:getResource(resourceResolver, templateThumbnail) != null}">
-                                                        <img src="${templateThumbnail}.transform/sling-cms-thumbnail.png" loading="lazy" alt="${sling:encode(child.name, 'HTML_ATTR')}">
-                                                    </c:when>
-                                                    <c:otherwise>
-                                                        <img src="/static/sling-cms/thumbnails/page.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${child.name}">
-                                                    </c:otherwise>
-                                                </c:choose>
-                                            </c:when>
-                                            <c:otherwise>
-                                                <img src="/static/sling-cms/thumbnails/file.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${child.name}">
-                                            </c:otherwise>
-                                        </c:choose>
-                                    </figure>
-                                    <div class="is-vhidden cell-actions">
-                                        <sling:getResource base="${resource}" path="types/${child.valueMap['jcr:primaryType']}/columns/actions" var="colConfig" />
-                                        <c:forEach var="ac" items="${sling:listChildren(colConfig)}">
-                                            <c:set var="actionConfig" value="${ac}" scope="request" />
-                                            <sling:include path="${child.path}" resourceType="${actionConfig.resourceType}" />
-                                        </c:forEach>
-                                    </div>
+                    <sling:getResource base="${resource}" path="types/${child.valueMap['jcr:primaryType']}/columns/name" var="nameConfig" />
+                    <c:choose>
+                        <c:when test="${not empty child.valueMap['jcr:content/jcr:title']}">
+                            <c:set var="title" value="${child.valueMap['jcr:content/jcr:title']}" />
+                        </c:when>
+                        <c:when test="${not empty child.valueMap['jcr:title']}">
+                            <c:set var="title" value="${child.valueMap['jcr:title']}" />
+                        </c:when>
+                        <c:otherwise>
+                            <c:set var="title" value="${child.name}" />
+                        </c:otherwise>
+                    </c:choose>
+                    <div class="tile is-child">
+                        <div class="card is-linked" title="${sling:encode(child.name,'HTML_ATTR')}" data-value="${child.path}">
+                            <div class="card-image">
+                                <figure class="image is-5by4">
+                                    <c:choose>
+                                        <c:when test="${child.resourceType == 'sling:File' || child.resourceType == 'nt:file'}">
+                                            <img src="${child.path}.transform/sling-cms-thumbnail.png" loading="lazy" alt="${child.name}">
+                                        </c:when>
+                                        <c:when test="${child.resourceType == 'sling:Site'}">
+                                            <img src="/static/sling-cms/thumbnails/site.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${sling:encode(child.name, 'HTML_ATTR')}">
+                                        </c:when>
+                                        <c:when test="${child.resourceType == 'sling:OrderedFolder' || child.resourceType == 'sling:Folder' || child.resourceType == 'nt:folder'}">
+                                            <img src="/static/sling-cms/thumbnails/folder.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${sling:encode(child.name, 'HTML_ATTR')}">
+                                        </c:when>
+                                        <c:when test="${child.resourceType == 'sling:Page'}">
+                                            <c:set var="templateThumbnail" value="${child.valueMap['jcr:content/sling:template']}/thumbnail"/>
+                                            <c:choose>
+                                                <c:when test="${sling:getResource(resourceResolver, templateThumbnail) != null}">
+                                                    <img src="${templateThumbnail}.transform/sling-cms-thumbnail.png" loading="lazy" alt="${sling:encode(child.name, 'HTML_ATTR')}">
+                                                </c:when>
+                                                <c:otherwise>
+                                                    <img src="/static/sling-cms/thumbnails/page.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${child.name}">
+                                                </c:otherwise>
+                                            </c:choose>
+                                        </c:when>
+                                        <c:otherwise>
+                                            <img src="/static/sling-cms/thumbnails/file.png.transform/sling-cms-thumbnail.png" loading="lazy" alt="${child.name}">
+                                        </c:otherwise>
+                                    </c:choose>
+                                </figure>
+                                <div class="is-vhidden cell-actions">
+                                    <sling:getResource base="${resource}" path="types/${child.valueMap['jcr:primaryType']}/columns/actions" var="colConfig" />
+                                    <c:forEach var="ac" items="${sling:listChildren(colConfig)}">
+                                        <c:set var="actionConfig" value="${ac}" scope="request" />
+                                        <sling:include path="${child.path}" resourceType="${actionConfig.resourceType}" />
+                                    </c:forEach>
                                 </div>
-                                <footer class="card-footer">
-                                    <div class="card-footer-item card-footer-group">
-                                        <c:choose>
-                                            <c:when test="${child.resourceType == 'sling:Site' || child.resourceType == 'sling:OrderedFolder' || child.resourceType == 'sling:Folder' || child.resourceType == 'nt:folder' || child.resourceType == 'sling:Page'}">
-                                                <a href="${nameConfig.valueMap.prefix}${child.path}" class="item-link">${sling:encode(title,'HTML')}</a>
-                                            </c:when>
-                                            <c:otherwise>
-                                                <span>${sling:encode(title,'HTML')}</span>
-                                            </c:otherwise>
-                                        </c:choose>
-                                        <c:catch var="ex">
-                                            <small>
-                                                <fmt:formatDate type="both" dateStyle="long" timeStyle="long" value = "${child.valueMap['jcr:content/jcr:lastModified'].time}" />
-                                            </small>
-                                        </c:catch>
-                                    </div>
-                                </footer>
-                                <footer class="card-footer">
-                                    <sling:adaptTo adaptable="${child}" adaptTo="org.apache.sling.cms.PublishableResource" var="publishableResource" />
-                                    <c:if test="${child.resourceType == 'sling:Page' || child.resourceType == 'sling:File' || child.resourceType == 'nt:file'}">
-                                        <c:choose>
-                                            <c:when test="${publishableResource.published}">
-                                                <a class="Fetch-Modal card-footer-item" href="/cms/shared/unpublish.html${child.path}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
-                                                    Unpublish
-                                                </a>
-                                            </c:when>
-                                            <c:otherwise>
-                                                <a class="Fetch-Modal card-footer-item" href="/cms/shared/publish.html${child.path}" title="Content Not Published" data-title="Publish" data-path=".Main-Content form">
-                                                    Publish
-                                                </a>
-                                            </c:otherwise>
-                                        </c:choose>
-                                    </c:if>
-                                     <c:if test="${child.resourceType == 'sling:Site' || child.resourceType == 'sling:OrderedFolder' || child.resourceType == 'sling:Folder' || child.resourceType == 'nt:folder' || child.resourceType == 'sling:Page'}">
-                                        <a href="${nameConfig.valueMap.prefix}${child.path}" class="card-footer-item">Open</a>
-                                    </c:if>
-                                </footer>
                             </div>
+                            <footer class="card-footer">
+                                <div class="card-footer-item card-footer-group">
+                                    <span>${sling:encode(title,'HTML')}</span>
+                                    <c:catch var="ex">
+                                        <small>
+                                            <fmt:formatDate type="both" dateStyle="long" timeStyle="long" value = "${child.valueMap['jcr:content/jcr:lastModified'].time}" />
+                                        </small>
+                                    </c:catch>
+                                </div>
+                            </footer>
+                            <footer class="card-footer">
+                                <sling:adaptTo adaptable="${child}" adaptTo="org.apache.sling.cms.PublishableResource" var="publishableResource" />
+                                <c:if test="${child.resourceType == 'sling:Page' || child.resourceType == 'sling:File' || child.resourceType == 'nt:file'}">
+                                    <c:choose>
+                                        <c:when test="${publishableResource.published}">
+                                            <a class="Fetch-Modal card-footer-item" href="/cms/shared/unpublish.html${child.path}" title="Content Published" data-title="Unpublish" data-path=".Main-Content form">
+                                                Unpublish
+                                            </a>
+                                        </c:when>
+                                        <c:otherwise>
+                                            <a class="Fetch-Modal card-footer-item" href="/cms/shared/publish.html${child.path}" title="Content Not Published" data-title="Publish" data-path=".Main-Content form">
+                                                Publish
+                                            </a>
+                                        </c:otherwise>
+                                    </c:choose>
+                                </c:if>
+                                    <c:if test="${child.resourceType == 'sling:Site' || child.resourceType == 'sling:OrderedFolder' || child.resourceType == 'sling:Folder' || child.resourceType == 'nt:folder' || child.resourceType == 'sling:Page'}">
+                                    <a href="${nameConfig.valueMap.prefix}${child.path}" class="card-footer-item item-link">Open</a>
+                                </c:if>
+                            </footer>
                         </div>
                     </div>
-                </c:if>
+                </div> 
+            </c:if>
         </c:forEach>
     </div>
 </div>