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-org-apache-sling-app-cms.git
The following commit(s) were added to refs/heads/master by this push:
new afeaf9c Fixing SLING-7945: adding the bulk replace tool into the
tools menu
new f7bf0ca Merge branch 'master' of
github.com:apache/sling-org-apache-sling-app-cms
afeaf9c is described below
commit afeaf9cbfc2b025363bdae8023931fa5cd291ddc
Author: Dan Klco <[email protected]>
AuthorDate: Mon Sep 24 13:13:31 2018 -0400
Fixing SLING-7945: adding the bulk replace tool into the tools menu
---
ui/src/main/frontend/src/js/cms.js | 11 ++
.../components/cms/suffixswitch/suffixswitch.jsp | 45 +++++++
.../libs/sling-cms/content/admin/bulkreplace.json | 139 +++++++++++----------
.../jcr_root/libs/sling-cms/content/start.json | 5 +
4 files changed, 136 insertions(+), 64 deletions(-)
diff --git a/ui/src/main/frontend/src/js/cms.js
b/ui/src/main/frontend/src/js/cms.js
index 97a9533..8684df8 100644
--- a/ui/src/main/frontend/src/js/cms.js
+++ b/ui/src/main/frontend/src/js/cms.js
@@ -412,6 +412,17 @@ Sling.CMS = {
});
}
}
+
+ Sling.CMS.ext['suffix-form'] = {
+ init: function() {
+ $('.suffix-form').submit(function(){
+ var suffix =
$(this).find('input[name=suffix]').val();
+ var path = $(this).attr('action');
+ window.location = path + suffix;
+ return false;
+ });
+ }
+ }
Sling.CMS.ext['table'] = {
decorate: function($ctx) {
diff --git
a/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/suffixswitch/suffixswitch.jsp
b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/suffixswitch/suffixswitch.jsp
new file mode 100644
index 0000000..7844b0b
--- /dev/null
+++
b/ui/src/main/resources/jcr_root/libs/sling-cms/components/cms/suffixswitch/suffixswitch.jsp
@@ -0,0 +1,45 @@
+<%-- /*
+ * 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"%>
+<c:choose>
+ <c:when test="${not empty slingRequest.requestPathInfo.suffix}">
+ <sling:include path="content"
resourceType="sling-cms/components/general/container" />
+ </c:when>
+ <c:otherwise>
+ <form method="get" action="${properties.target}" class="suffix-form">
+ <label class="label" for="suffix">
+ <sling:encode value="${properties.label}" mode="HTML" />
+ <span class="has-text-danger">*</span>
+ </label>
+ <div class="field has-addons">
+ <div class="control">
+ <input class="input pathfield" type="text" name="suffix"
required="required" data-type="${properties.type}"
data-base="${properties.base}" autocomplete="off" />
+ </div>
+ <div class="control">
+ <a href="/cms/shared/search.html" class="button
Fetch-Modal Search-Button" data-title="Search" data-path=".Main-Content > *">
+ <span class="jam jam-search"></span>
+ </a>
+ </div>
+ </div>
+ <div class="field">
+ <button type="submit" class="button
is-primary">${sling:encode(properties.button,'HTML')}</button>
+ </div>
+ </form>
+ </c:otherwise>
+</c:choose>
\ No newline at end of file
diff --git
a/ui/src/main/resources/jcr_root/libs/sling-cms/content/admin/bulkreplace.json
b/ui/src/main/resources/jcr_root/libs/sling-cms/content/admin/bulkreplace.json
index 83130bd..3d512b5 100644
---
a/ui/src/main/resources/jcr_root/libs/sling-cms/content/admin/bulkreplace.json
+++
b/ui/src/main/resources/jcr_root/libs/sling-cms/content/admin/bulkreplace.json
@@ -1,66 +1,77 @@
{
- "jcr:primaryType": "sling:Page",
- "jcr:content": {
- "sling:resourceType": "sling-cms/components/pages/base",
- "jcr:title": "Bulk Replace",
- "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>Bulk Replace</h3>"
- },
- "slingform": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"sling-cms/components/editor/slingform",
- "button": "Replace All",
- "fields": {
- "jcr:primaryType": "nt:unstructured",
- "sling:resourceType":
"sling-cms/components/general/container",
- "operation": {
- "jcr:primaryType":
"nt:unstructured",
- "sling:resourceType":
"sling-cms/components/editor/fields/hidden",
- "name": ":operation",
- "value": "bulkreplace"
- },
- "updateProperties": {
- "jcr:primaryType":
"nt:unstructured",
- "sling:resourceType":
"sling-cms/components/editor/fields/text",
- "label": "Update Properties",
- "name": "updateProperties"
- },
- "mode": {
- "jcr:primaryType":
"nt:unstructured",
- "sling:resourceType":
"sling-cms/components/editor/fields/select",
- "label": "Mode",
- "name": "mode",
- "options": {
- "exact": {
- "label": "Exact
Match",
- "value": "exact"
- },
- "regex": {
- "label":
"Regular Expression",
- "value": "regex"
- }
- }
- },
- "find": {
- "jcr:primaryType":
"nt:unstructured",
- "sling:resourceType":
"sling-cms/components/editor/fields/text",
- "label": "Find",
- "name": "find"
- },
- "replace": {
- "jcr:primaryType":
"nt:unstructured",
- "sling:resourceType":
"sling-cms/components/editor/fields/text",
- "label": "Replace",
- "name": "replace"
- }
- }
- }
- }
- }
+ "jcr:primaryType": "sling:Page",
+ "jcr:content": {
+ "sling:resourceType": "sling-cms/components/pages/base",
+ "jcr:title": "Bulk Replace",
+ "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>Bulk Replace</h3>"
+ },
+ "suffixswitch": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType": "sling-cms/components/cms/suffixswitch",
+ "base": "/content",
+ "button": "Go",
+ "label": "Path",
+ "target": "/cms/admin/bulkreplace.html",
+ "type": "nt:hierarchyNode",
+ "content": {
+ "slingform": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType":
"sling-cms/components/editor/slingform",
+ "button": "Replace All",
+ "fields": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType":
"sling-cms/components/general/container",
+ "operation": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType":
"sling-cms/components/editor/fields/hidden",
+ "name": ":operation",
+ "value": "bulkreplace"
+ },
+ "updateProperties": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType":
"sling-cms/components/editor/fields/text",
+ "label": "Update Properties",
+ "name": "updateProperties"
+ },
+ "mode": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType":
"sling-cms/components/editor/fields/select",
+ "label": "Mode",
+ "name": "mode",
+ "options": {
+ "exact": {
+ "label": "Exact Match",
+ "value": "exact"
+ },
+ "regex": {
+ "label": "Regular Expression",
+ "value": "regex"
+ }
+ }
+ },
+ "find": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType":
"sling-cms/components/editor/fields/text",
+ "label": "Find",
+ "name": "find"
+ },
+ "replace": {
+ "jcr:primaryType": "nt:unstructured",
+ "sling:resourceType":
"sling-cms/components/editor/fields/text",
+ "label": "Replace",
+ "name": "replace"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
b/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
index 2c061fa..1f95845 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/content/start.json
@@ -73,6 +73,11 @@
"title": "Tools",
"links": {
"jcr:primaryType": "nt:unstructured",
+ "bulkreplace": {
+ "jcr:primaryType":
"nt:unstructured",
+ "link":
"/cms/admin/bulkreplace.html",
+ "text": "Bulk Replace"
+ },
"contentpackages": {
"jcr:primaryType":
"nt:unstructured",
"link": "/bin/packages.html",