This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resource-editor.git
commit 0b7573da2dbe3654728a068a64b9444e0df2e95a Author: Sandro Boehme <[email protected]> AuthorDate: Sat Nov 5 23:32:32 2016 +0000 SLING-6248 Resource Editor :: Create a simple Resource Type Editor git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1768284 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/less/reseditor.less | 19 ++- .../js/MainController.js | 8 +- .../js/scriptpathchooser/scriptfilechooser.js | 48 ++++++++ .../js/tree/JSTreeAdapter.js | 31 +++-- .../js/tree/TreeController.js | 71 ++++++----- .../SLING-INF/libs/sling/resource-editor/html.jsp | 14 ++- .../libs/sling/resource-editor/node-content.jsp | 130 ++++++++++++++++++++- .../libs/sling/resource-editor/rootnodes.json.jsp | 2 +- 8 files changed, 264 insertions(+), 59 deletions(-) diff --git a/src/main/less/reseditor.less b/src/main/less/reseditor.less index 05239c7..7f66e5c 100755 --- a/src/main/less/reseditor.less +++ b/src/main/less/reseditor.less @@ -160,7 +160,7 @@ body width: 200px; } -#tree +.tree-and-props { overflow: auto; height: 100%; @@ -204,14 +204,14 @@ body clear: both } -#tree a, #tree :visited, #tree :link { +.tree-and-props a, .tree-and-props :visited, .tree-and-props :link { border:1px solid transparent; padding:0px 1px; font-family: arial, helvetica, sans-serif, times; color: @textColor } -#tree .jstree-hovered, #tree .jstree-hovered.jstree-clicked { +.tree-and-props .jstree-hovered, .tree-and-props .jstree-hovered.jstree-clicked{ .plate-selected-text-shadow; color: #FFF; background: transparent; @@ -291,8 +291,9 @@ body box-shadow: none; } -#tree .jstree-clicked +.tree-and-props .jstree-clicked, #page-script-chooser-row .files>tr:hover { + .rounded; background: @selectedBackground; border:1px solid black; padding:0px 1px; @@ -373,4 +374,14 @@ input.jstree-rename-input{ #properties-info-icon { margin-top: 5px; +} + +#page-script-chooser-row { + .rounded; + border: 1px solid @textColor; + margin: 10px; +} + +#page-script-chooser-row .table > tbody > tr > td { + border-top: 0; } \ No newline at end of file diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js index 447abd7..53128cc 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/MainController.js @@ -157,13 +157,13 @@ org.apache.sling.reseditor.MainController = (function() { var alert_height = $("#alerts").outerHeight(true); var content_tab_height = $("#content-tabs").outerHeight(true); var footer_height = $("#footer").outerHeight(true); - var sidebar_margin = $("#sidebar").outerHeight(true)-$("#sidebar").outerHeight(false); + var tree_margin = $("#tree").outerHeight(true)-$("#tree").outerHeight(false); var mainrow_margin = $("#main-row").outerHeight(true)-$("#main-row").outerHeight(false); - var usable_height = $(window).height() - login_height - header_height - alert_height - sidebar_margin - mainrow_margin - 15; + var usable_height = $(window).height() - login_height - header_height - alert_height - tree_margin - mainrow_margin - 15; // activate again if the footer is needed -// var usable_height = $(window).height() - header_height - footer_height - sidebar_margin - 1; - $("#sidebar").height( usable_height ); +// var usable_height = $(window).height() - header_height - footer_height - tree_margin - 1; + $("#tree").height( usable_height ); $("#outer_content").height( usable_height-content_tab_height ); } diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/scriptpathchooser/scriptfilechooser.js b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/scriptpathchooser/scriptfilechooser.js new file mode 100644 index 0000000..d2acbf3 --- /dev/null +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/scriptpathchooser/scriptfilechooser.js @@ -0,0 +1,48 @@ +/* + * 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. + */ + +/* + * Represents the functionality for the file chooser within the script path chooser. + */ + +// creating the namespace +var org = org || {}; +org.apache = org.apache || {}; +org.apache.sling = org.apache.sling || {}; +org.apache.sling.sitebuilder = org.apache.sling.sitebuilder || {}; + +//defining the module +org.apache.sling.sitebuilder.Scriptfilechooser = (function() { + + function Scriptfilechooser(){ + this.selectedScriptResourcePath = ""; + var thisScriptfilechooser = this; + $('#page-script-chooser-row .files').on("click", "td", function(e) { + thisScriptfilechooser.selectedPageScriptPath = $(this).text(); + var selectedPageScriptFilePath = thisScriptfilechooser.selectedScriptResourcePath+"/"+$(this).text() + $('#selected-script-path-row input[name="selectedScriptFilePath"]').val(selectedPageScriptFilePath); + $('#selected-script-path-row input[name="resourceSuperType"]').val(thisScriptfilechooser.selectedScriptResourcePath); + }); + } + Scriptfilechooser.prototype.setSelectedScriptResourcePath = function(selectedScriptResourcePath) { + this.selectedScriptResourcePath = selectedScriptResourcePath; + } + + return Scriptfilechooser; +}()); \ No newline at end of file diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/JSTreeAdapter.js b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/JSTreeAdapter.js index 90df484..c1ea2b4 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/JSTreeAdapter.js +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/JSTreeAdapter.js @@ -52,30 +52,34 @@ $(document).ready(function() { // TO CREATE AN INSTANCE // select the tree container using jQuery - $("#tree") + $(thisJSTreeAdapter.treeController.settings.treeAndPropsSelector) .bind("loaded.jstree", function (event, data) { - var pathElements = treeController.getPathElements(settings.resourcePath); - - if (pathElements.length >= 1 && pathElements[0] != "") { - treeController.openElement($("#tree > ul > li[nodename=''] > ul"), pathElements); + if (thisJSTreeAdapter.treeController.settings.rootPath == null) { + var pathElements = treeController.getPathElements(settings.resourcePath); + if (pathElements.length >= 1 && pathElements[0] != "") { + treeController.openElement($(thisJSTreeAdapter.treeController.settings.treeAndPropsSelector+" > ul > li[nodename=''] > ul"), pathElements); + } } // position the info-icon - $('#tree-info-icon').show(); - $('#root i:first').before($('#tree-info-icon')); + if (thisJSTreeAdapter.treeController.settings.treeSelector != null) { + $(thisJSTreeAdapter.treeController.settings.treeRootElementSelector+' i:first').before($('.tree-info-icon:last').clone().show()); + thisJSTreeAdapter.treeController.initTreeEvents(); + } }) // call `.jstree` with the options object .jstree({ "core" : { "check_callback" : true, - multiple: true, + multiple: thisJSTreeAdapter.treeController.settings.multipleSelection == null ? true : thisJSTreeAdapter.treeController.settings.multipleSelection, animation: 600, 'dblclick_toggle': false, 'data' : { 'url' : function (liJson) { // initial call for the root element if (liJson.id === '#'){ - return settings.contextPath+"/reseditor/.rootnodes.json"; + var rootPath = thisJSTreeAdapter.treeController.settings.rootPath == null ? "/" : thisJSTreeAdapter.treeController.settings.rootPath; + return settings.contextPath+"/reseditor"+rootPath+".rootnodes.json"; } else { // the li the user clicked on. var li = $('#'+liJson.id); @@ -159,12 +163,17 @@ $(document).ready(function() { }).on('keydown.jstree', 'a.jstree-anchor', function (e) { treeController.configureKeyListeners(e); }).on('select_node.jstree', function (e, data) { - //noop - ; + if (thisJSTreeAdapter.treeController.settings.selectCallback != null) { + thisJSTreeAdapter.treeController.settings.selectCallback(e, data); + } }).on('after_open.jstree', function(e, data){ treeController.afterOpen(data.node); }).on('close_node.jstree', function(e, data){ treeController.beforeClose(data.node); + }).on('ready.jstree', function(e, data){ + if (thisJSTreeAdapter.treeController.settings.readyCallback != null) { + thisJSTreeAdapter.treeController.settings.readyCallback(e, data); + } }); }); diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js index 42733a2..d4144b0 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor-static-content/js/tree/TreeController.js @@ -40,32 +40,38 @@ org.apache.sling.reseditor.TreeController = (function() { var addNodeControllerSettings = {}; this.addNodeController = new org.apache.sling.reseditor.AddNodeController(addNodeControllerSettings, mainController); - $(document).ready(function() { - $("#tree").on("click", "#root",function(e) { - var target = $(e.target); - if (target.hasClass("open-icon")){ - thatTreeController.openNodeTarget(e); - } else if (target.hasClass("add-icon")){ - thatTreeController.openAddNodeDialog(target.parents("li")); - }else if (target.hasClass("remove-icon")){ - thatTreeController.deleteSingleNode(target.parents("li")); - } - }); - $("#tree").on("dblclick", "#root",function(e) { - var target = $(e.target); - if (target.hasClass("jstree-anchor") || target.hasClass("node-type")){ - var id = target.parents("li:first").attr("id"); - thatTreeController.openRenameNodeDialog(id); - } - }); - $("#tree-info-icon").on("click", function(e, data) { - $('#sidebar .info-content-container').slideToggle(); + }; + + TreeController.prototype.initTreeEvents = function(root, paths) { + var thatTreeController = this; + $(thatTreeController.settings.treeAndPropsSelector).on("click", function(e) { + var target = $(e.target); + if (target.hasClass("open-icon")){ + thatTreeController.openNodeTarget(e); + } else if (target.hasClass("add-icon")){ + thatTreeController.openAddNodeDialog(target.parents("li")); + }else if (target.hasClass("remove-icon")){ + thatTreeController.deleteSingleNode(target.parents("li")); + } + }); + $(thatTreeController.settings.treeAndPropsSelector).on("dblclick", thatTreeController.settings.treeRootElementSelector,function(e) { + var target = $(e.target); + if (target.hasClass("jstree-anchor") || target.hasClass("node-type")){ + var id = target.parents("li:first").attr("id"); + thatTreeController.openRenameNodeDialog(id); + } + }); + if (thatTreeController.settings.treeSelector != null) { + $(thatTreeController.settings.treeSelector+" .tree-info-icon").on("click", function(e, data) { + console.log($(thatTreeController.settings.treeSelector+' .info-content-container').parentsUntil("body")); + $(thatTreeController.settings.treeSelector+' .info-content-container').slideToggle(); }); - $("#sidebar .info-content-container .close").on("click", function(e, data) { - $('#sidebar .info-content-container').slideToggle(); + $(thatTreeController.settings.treeSelector+" .info-content-container .close").on("click", function(e, data) { + console.log($(thatTreeController.settings.treeSelector+' .info-content-container').parentsUntil("body")); + $(thatTreeController.settings.treeSelector+' .info-content-container').slideToggle(); }); - }); - }; + } + } TreeController.prototype.configureKeyListeners = function(e) { // see http://www.javascripter.net/faq/keycodes.htm @@ -129,7 +135,7 @@ org.apache.sling.reseditor.TreeController = (function() { TreeController.prototype.openRenameNodeDialog = function(id) { var liElement = $('#'+id); - $("#tree").jstree("edit", $('#'+id), this.mainController.decodeFromHTML(liElement.attr("nodename"))); + $(this.settings.treeAndPropsSelector).jstree("edit", $('#'+id), this.mainController.decodeFromHTML(liElement.attr("nodename"))); } TreeController.prototype.renameNode = function(e, data) { @@ -176,7 +182,7 @@ org.apache.sling.reseditor.TreeController = (function() { } TreeController.prototype.getPathFromLi = function(li){ - var path = $(li).parentsUntil(".root").andSelf().map( + var path = $(li).parentsUntil(this.settings.treeAndPropsSelector).andSelf().map( function() { return this.tagName == "LI" ? $(this).attr("nodename") @@ -199,12 +205,12 @@ org.apache.sling.reseditor.TreeController = (function() { if (pathElementLi.length === 0){ alert("Couldn't find "+pathElementName+" under the path "+this.getPathFromLi(root.parent())); } else { - $('#tree').jstree('open_node', pathElementLi, + $(this.settings.treeAndPropsSelector).jstree('open_node', pathElementLi, function(){ if (paths.length>0){ thisTreeController.openElement($("#"+pathElementLi.attr('id')).children("ul"), paths); } else { - $('#tree').jstree('select_node', pathElementLi.attr('id'), 'true'); + $(thisTreeController.settings.treeAndPropsSelector).jstree('select_node', pathElementLi.attr('id'), 'true'); var target = $('#'+pathElementLi.attr('id')+' a:first'); target.focus(); } @@ -217,13 +223,14 @@ org.apache.sling.reseditor.TreeController = (function() { var path = this.getPathFromLi(li); path = this.mainController.decodeFromHTML(path); path = this.mainController.encodeURL(path); - return this.settings.contextPath+"/reseditor"+path+extension; + var rootPath = this.settings.rootPath == null ? "" : this.settings.rootPath ; + return this.settings.contextPath+"/reseditor"+rootPath+path+extension; } TreeController.prototype.deleteNodes = function() { var thatTreeController = this; var lastDeletedLI; - var selectedIds = $("#tree").jstree('get_selected'); + var selectedIds = $(this.settings.treeAndPropsSelector).jstree('get_selected'); var firstId = selectedIds[0]; var parentLi = $('#'+firstId).parents('li'); var parentPath = this.getURLEncodedPathFromLi(parentLi); @@ -245,7 +252,7 @@ org.apache.sling.reseditor.TreeController = (function() { type: 'POST', url: parentPath, success: function(server_data) { - var tree = $('#tree').jstree(true); + var tree = $(thatTreeController.settings.treeAndPropsSelector).jstree(true); for (var i=0; i<selectedIds.length; i++){ var id = selectedIds[i]; tree.delete_node(id); @@ -280,7 +287,7 @@ org.apache.sling.reseditor.TreeController = (function() { url: encodedResourcePathToDelete, success: function(server_data) { var id = li.attr("id"); - var tree = $('#tree').jstree(true); + var tree = $(thatTreeController.settings.treeAndPropsSelector).jstree(true); tree.delete_node(id); }, error: function(errorJson) { diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp index 89ea81c..67ff501 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp @@ -64,6 +64,9 @@ original <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/LoginController.js"></script> <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/MainController.js"></script> + +<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/scriptpathchooser/scriptfilechooser.js"></script> + <!-- <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/generated/3rd_party/js/jquery.scrollTo-min.js"></script> <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/generated/3rd_party/js/urlEncode.js"></script> @@ -99,7 +102,10 @@ var mainControllerSettings = { var mainController = new org.apache.sling.reseditor.MainController(mainControllerSettings, ntManager); var treeControllerSettings = { - contextPath: "<%= request.getContextPath() %>" + contextPath: "<%= request.getContextPath() %>", + treeAndPropsSelector: "#tree-and-props", + treeSelector: "#tree", + treeRootElementSelector: "#tree-and-props .root-element" }; var treeController = new org.apache.sling.reseditor.TreeController(treeControllerSettings, mainController); @@ -193,7 +199,7 @@ new org.apache.sling.reseditor.PropertyController({}, mainController); </div> <div id="main-row" class="row"> <div id="sidebar-col" class="col-sm-4"> - <div id="sidebar" class="plate"> + <div id="tree" class="plate"> <div class="ie9filter-plate-div"> <div style="display:none;" class="info-content-container" > <div class="well well-sm info-content"> @@ -212,7 +218,7 @@ new org.apache.sling.reseditor.PropertyController({}, mainController); </ul> </div> </div> - <div id="tree" class="root" ></div> + <div id="tree-and-props" class="root tree-and-props" ></div> </div> </div> </div> @@ -226,7 +232,7 @@ new org.apache.sling.reseditor.PropertyController({}, mainController); </div> </div> </div> - <span id="tree-info-icon" class="info-icon info-icon-lightgray pull-right clearfix" style="display:none;"></span> + <span class="tree-info-icon info-icon info-icon-lightgray pull-right clearfix" style="display:none;"></span> <!-- Add node dialog --> <div class="modal fade" id="addNodeDialog" tabindex="-1" role="dialog" aria-labelledby="addNodeDialogLabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp index 40bc624..5b53126 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/node-content.jsp @@ -8,21 +8,145 @@ <sling:defineObjects /> <div id="node-content" class="col-sm-8"> <c:set var="scriptResource" scope="request" value="${sling:getResource(resourceResolver,sling:getResource(resourceResolver,resource.path).resourceType)}"/> - <% Resource theResource = (Resource) request.getAttribute("scriptResource");%> - <c:set var="isWebPage" value="<%=theResource != null ? theResource.isResourceType("sling/web-page") : false %>"/> + <% + Resource scriptResourceReqAttr = (Resource) request.getAttribute("scriptResource"); + boolean hasScriptResource = scriptResourceReqAttr != null; + %> + <%-- + Has to inherit from sling/resource-editor/node-content and has to have a "name" string property + When should it be displayed as active? + --%> + <c:set var="isWebPage" value="<%=hasScriptResource ? scriptResourceReqAttr.isResourceType("sling/web-page") : false %>"/> <c:if test="${isWebPage}"> <ul id="content-tabs" class="nav nav-pills" role="tablist"> <li role="presentation" class="active"><a href="#page-editor" aria-controls="page-editor" role="tab" data-toggle="pill">Web Page Editor</a></li> <li role="presentation"><a href="#page-preview" aria-controls="page-preview" role="tab" data-toggle="pill">Page Preview</a></li> + <li role="presentation"><a href="#resource-type-editor" aria-controls="resource-type-editor" role="tab" data-toggle="pill">Resource Type Editor</a></li> <li role="presentation"><a href="#properties" aria-controls="properties" role="tab" data-toggle="pill">Properties</a></li> </ul> </c:if> + <c:if test="${!isWebPage}"> + <ul id="content-tabs" class="nav nav-pills" role="tablist"> + <li role="presentation" class="active"><a href="#properties" aria-controls="properties" role="tab" data-toggle="pill">Properties</a></li> + <li role="presentation"><a href="#resource-type-editor" aria-controls="resource-type-editor" role="tab" data-toggle="pill">Resource Type Editor</a></li> + </ul> + </c:if> <div id="outer_content" class="plate"> <div class="ie9filter-plate-div"> <div id="inner_content_margin" class="full-height"> <div class="row full-height" > <div class="col-sm-12 full-height" > <div class="tab-content full-height" > + <%-- TODO: move the resource-type-editor to the Sitebuilder project --%> + <div style="color: #c0c0c0;" role="tabpanel" class="tab-pane" id="resource-type-editor"> + <script type="text/javascript"> + var superTypeTreeController = null; + var selectedScriptResourcePath = ""; + var scriptFileChooser = null; + function selectCallback(e, data) { + // https://www.jstree.com/api/#/?q=.jstree%20Event&f=select_node.jstree + var id = data.selected[0]; + var li = $('#'+id); + var selectedPath = superTypeTreeController.get_uri_from_li(li,".json"); + + scriptFileChooser.setSelectedScriptResourcePath($('#'+id+" .node-type:first").text()); + + $.getJSON(selectedPath).done(function(propertyJson) { + $('#page-script-chooser-row .files').empty(); + for (var key in propertyJson) { + $('#page-script-chooser-row .files').append("<tr><td>"+key+"</td></tr>"); + } + }).fail(function(data) { + superTypeTreeController.mainController.displayAlertHtml(data.responseText); + }); + }; + var superTypeTreeControllerSettings = { + contextPath : "<%= request.getContextPath() %>", + treeAndPropsSelector: "#resource-super-type-tree-and-props", + treeSelector: null, + treeRootElementSelector: "#resource-super-type-tree-and-props .root-element", + rootPath:"/apps/inheritedresources", + multipleSelection: false, + selectCallback: selectCallback, + readyCallback: pageScriptChooserReady + }; + superTypeTreeController = new org.apache.sling.reseditor.TreeController(superTypeTreeControllerSettings, mainController); + + function pageScriptChooserReady(){ + scriptFileChooser = new org.apache.sling.sitebuilder.Scriptfilechooser(selectedScriptResourcePath); + + // TODO: Use this page as an editor for the resource type. +// var pathElements = superTypeTreeController.getPathElements("/com/lux-car-rental"); +// if (pathElements.length >= 1 && pathElements[0] != "") { +// superTypeTreeController.openElement($(superTypeTreeControllerSettings.treeAndPropsSelector+" .root-element > ul"), pathElements); +// } + }; + + var superTypesTreeAdapterSettings = { + resourcePath : "${resource.path}", + requestURI: "${pageContext.request.requestURI}", + contextPath: "<%= request.getContextPath() %>", + resolutionPathInfo: "${resource.resourceMetadata['sling.resolutionPathInfo']}" + }; + new org.apache.sling.reseditor.JSTreeAdapter(superTypesTreeAdapterSettings, superTypeTreeController, mainController); + + </script> + <div class="row"> + <div id="sidebar-col" class="col-sm-12"> + <h5>Script to copy and overwrite</h5> + </div> + </div> + <div id="page-script-chooser-row" class="row"> + <div id="sidebar-col" class="col-sm-8"> + <div id="resource-super-type-tree" class=""> + <div class="ie9filter-plate-div"> + <div id="resource-super-type-tree-and-props" class="root tree-and-props" ></div> + </div> + </div> + </div> + <div class="col-sm-4"> + <div class="file-props-container"> + <table class="table table-hover"> + <thead> + <tr> + <th>Filename:</th> + </tr> + </thead> + <tbody class="files"> + </tbody> + </table> + </div> + </div> + </div> + <div id="selected-script-path-row" class="row"> + <form method="post" action="<%= request.getRequestURL() %>" enctype="multipart/form-data"> + <div class="col-sm-12"> + <div class="form-group"> + <label for="resourceSuperType">Resource super type:</label> + <input type="text" class="form-control" id="resourceSuperType" name="resourceSuperType" readonly> + </div> + <div class="form-group"> + <label for="resourceType">Resource Type:</label> + <input type="text" class="form-control" id="resourceType" name="resourceType" > + </div> + <div class="form-group"> + <label for="selectedScriptFilePath">Resource super type script to overwrite:</label> + <input type="text" class="form-control" id="selectedScriptFilePath" name="selectedScriptFilePath" readonly> + </div> + <div>'Create new script' does the following: + <ol> + <li>Creates the specified resource type</li> + <li>Assigns the specified resource super type to the resource type</li> + <li>Copies the specified script to the resource type to overwrite it from the resource super type</li> + </ol> + </div> + <input type="hidden" name=":operation" value="edit-resource-type"> + <input type="hidden" name="_charset_" value="utf-8"> + <button type="submit" class="btn btn-default">Create new script</button> + </div> + </form> + </div> + </div> <div role="tabpanel" class="tab-pane ${isWebPage ? 'active' : ''} full-height" id="page-editor"> <a href="/pageeditor${resource.path}.main.html" target="_blank"> <span id="open-new-window" class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> @@ -39,7 +163,7 @@ </a> <iframe id="iframe" src="${resource.path}.html" allowtransparency="true" frameborder="0" height="100%" width="100%" style="height: 500px;background:none transparent;-webkit-border-radius:7px;-moz-border-radius: 7px;border-radius: 7px; border: 3px solid black"></iframe> </div> - <div role="tabpanel" class="tab-pane ${!isWebPage ? 'active' : ''}" id="properties"> + <div role="tabpanel" class="tab-pane ${!isWebPage && !showPageChooser ? 'active' : ''}" id="properties"> <div style="display: none;" class="info-content-container" > <div class="well well-sm info-content"> <button type="button" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> diff --git a/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp b/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp index b2821b7..68c7414 100644 --- a/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp +++ b/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp @@ -34,7 +34,7 @@ "id" : "root", "state" : {"opened":true, "disabled": false, "selected": false}, "text" : "<i class=\"jstree-icon node-icon open-icon\"></i><i class=\"jstree-icon node-icon add-icon\"></i> /", - "li_attr" :{ "nodename" : "${currentNode.name}", "nodetype" :"${currentNode.primaryNodeType.name}" }, + "li_attr" :{ "nodename" : "${currentNode.name}", "nodetype" :"${currentNode.primaryNodeType.name}", "class": "root-element"}, "a_attr" :{ "href" : "<%= request.getContextPath() %>/reseditor/.html" }, "children" : <%@ include file="nodes.json.incl.jsp" %> -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
