You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2014/11/24 15:29:17 UTC
svn commit: r1641400 - in /sling/trunk/contrib/explorers/resourceeditor: ./
src/main/java/org/apache/sling/reseditor/
src/main/resources/SLING-INF/libs/reseditor/
src/main/resources/SLING-INF/libs/sling/resource-editor/
src/main/resources/SLING-INF/lib...
Author: bdelacretaz
Date: Mon Nov 24 14:29:16 2014
New Revision: 1641400
URL: http://svn.apache.org/r1641400
Log:
SLING-4169 - restructure folders, patch contributed by Sandro Boehme, thanks!
Added:
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.jsp
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp
Removed:
sling/trunk/contrib/explorers/resourceeditor/layout.js
sling/trunk/contrib/explorers/resourceeditor/src/main/java/org/apache/sling/reseditor/ResEditorResourceProvider.java
sling/trunk/contrib/explorers/resourceeditor/src/main/java/org/apache/sling/reseditor/SelectorBasedResourceDecorator.java
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/reseditor/
sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/servlet/
Added: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp?rev=1641400&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp (added)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/html.jsp Mon Nov 24 14:29:16 2014
@@ -0,0 +1,277 @@
+<!DOCTYPE html>
+<%@ page session="false"%>
+<%@ page isELIgnored="false"%>
+<%@ page import="javax.jcr.*,org.apache.sling.api.resource.Resource, org.apache.sling.api.resource.ValueMap"%>
+<%@ page import="java.security.Principal"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
+
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+
+<sling:defineObjects />
+<html lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+<link href='<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/font.css' rel='stylesheet' type='text/css'>
+ <!--[if lt IE 9]>
+<link href='<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/font_ie.css' rel='stylesheet' type='text/css'>
+ <![endif]-->
+
+<!--
+original
+<link href='http://fonts.googleapis.com/css?family=Michroma' rel='stylesheet' type='text/css'>
+ -->
+
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/jsnodetypes/js/jsnodetypes.js"></script>
+
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/jquery.min.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/bootstrap.min.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/bootbox.min.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/jstree.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/select2.min.js"></script>
+
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/reseditor/tree/JSTreeAdapter.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/reseditor/tree/TreeController.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/reseditor/tree/AddNodeController.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/reseditor/LoginController.js"></script>
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/reseditor/MainController.js"></script>
+
+<!--
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/jquery.scrollTo-min.js"></script>
+ -->
+<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/js/urlEncode.js"></script>
+
+<link rel="stylesheet" type="text/css" media="all" href="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/style.css">
+<link rel="stylesheet" type="text/css" media="all" href="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/bootstrap.css">
+<link rel="stylesheet" type="text/css" media="all" href="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/bootbox.reseditor.css">
+<link rel="stylesheet" type="text/css" media="all" href="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/shake.css">
+<link rel="stylesheet" type="text/css" media="all" href="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/select2.css">
+<link rel="stylesheet" type="text/css" media="all" href="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/select2.reseditor.css">
+
+<!--[if IE]>
+ <link rel="stylesheet" type="text/css" media="all" href="<%= request.getContextPath() %>/libs/sling/resource-editor-static-content/css/browser_ie.css"/>
+<![endif]-->
+
+<%
+Principal userPrincipal = ((HttpServletRequest)pageContext.getRequest()).getUserPrincipal();
+%>
+<c:set var="authorized" value='<%=!"anonymous".equals(userPrincipal.getName()) %>'/>
+<c:set var="userPrincipal" value='<%=userPrincipal %>'/>
+
+<script type="text/javascript">
+var ntManager = new de.sandroboehme.NodeTypeManager();
+
+var mainControllerSettings = {
+ contextPath: "<%= request.getContextPath() %>",
+ nodeTypes: ntManager.getNodeTypeNames()
+};
+var mainController = new org.apache.sling.reseditor.MainController(mainControllerSettings, ntManager);
+
+var treeControllerSettings = {
+ contextPath: "<%= request.getContextPath() %>"
+};
+var treeController = new org.apache.sling.reseditor.TreeController(treeControllerSettings, mainController);
+
+var loginControllerSettings = {
+ authorized : ${authorized},
+ authorizedUser : '${userPrincipal.name}',
+ contextPath: "<%= request.getContextPath() %>"
+};
+var loginController = new org.apache.sling.reseditor.LoginController(loginControllerSettings, mainController);
+
+var jsTreeAdapterSettings = {
+ resourcePath : "${resource.path}",
+ requestURI: "${pageContext.request.requestURI}",
+ contextPath: "<%= request.getContextPath() %>",
+ resolutionPathInfo: "${resource.resourceMetadata['sling.resolutionPathInfo']}"
+};
+new org.apache.sling.reseditor.JSTreeAdapter(jsTreeAdapterSettings, treeController, mainController);
+
+</script>
+
+</head>
+<body>
+ <div id="container-fluid" class="container-fluid">
+ <div id="login" class="row">
+ <div class="col-sm-12">
+ <div class="logo">
+ Sling Resource Editor <span class="edition">node-edit version</span>
+ </div>
+ <div class="tabbable tabs-below">
+ <div id="login_tab_content" class="tab-content plate-background plate-box-shadow" style="display:none;">
+ <div class="tab-pane active">
+ <div>
+ <form id="login_form" class="form-horizontal" action="/j_security_check" method="post">
+ <div class="form-group">
+ <div class="controls">
+ <input class="form-control" type="hidden" value="${pageContext.request.requestURI}" name="resource" />
+ <input class="form-control" type="hidden" value="form" name="selectedAuthType" />
+ <input class="form-control" type="hidden" value="UTF-8" name="_charset_">
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label" for="j_username">Username:</label>
+ <div class="controls">
+ <input class="form-control" type="text" name="j_username" />
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="control-label" for="j_password">Password:</label>
+ <div class="controls">
+ <input class="form-control" type="password" name="j_password" />
+ </div>
+ </div>
+ <div class="form-group error">
+ <div class="controls">
+ <span id="login_error" class="help-block alert-warning"></span>
+ </div>
+ </div>
+ <div class="form-group" id="login_submit_control_group">
+ <div class="controls">
+ <input id="login_submit" type="button" class="btn btn-default form-control" value="Login" >
+ </div>
+ </div>
+ </form>
+ </div>
+ </div>
+ </div>
+ <ul class="nav nav-tabs">
+ <li class="active">
+ <a id="login_tab" href="#login_tab_content" data-toggle="tab">Login</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <div id="header" class="row">
+ <div class="col-sm-12" style="display:none;">
+ <div class="plate">
+ </div>
+ </div>
+ </div>
+ <div id="alerts" class="row">
+ <div id="alert" style="display:none;" class="col-sm-12">
+ <div id="alertMsg" class="alert alert-error alert-warning alert-dismissable">
+ <button id="alertClose" type="button" class="close">×</button>
+ <h4>Error</h4>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-4">
+ <div id="sidebar" class="plate">
+ <div id="tree" class="root" ></div>
+ </div>
+ </div>
+ <div class="col-sm-8">
+ <div id="outer_content" class="plate">
+ <div id="inner_content_margin">
+ <form action="not_configured_yet.change.properties" method="post">
+ <c:set var="resourceIsNode" scope="request" value="<%=resource.adaptTo(Node.class) !=null %>"/>
+ <c:choose>
+ <c:when test="${resourceIsNode}" >
+ <%--
+ For some reason I get the following exception when using the JSTL expression '${currentNode.properties}'
+ instead of the scriptlet code 'currentNode.getProperties()':
+ org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP:
+ org.apache.sling.scripting.jsp.jasper.el.JspValueExpression cannot be resolved to a type
+ see https://issues.apache.org/jira/browse/SLING-2455
+ --%>
+ <c:forEach var="property" items="<%=currentNode.getProperties()%>">
+ <% Property property = (Property) pageContext.getAttribute("property");%>
+ <fieldset>
+ <label class="proplabel" for='${property.name}'>${property.name} [<%=PropertyType.nameFromValue(property.getType())%>${property.multiple ? ' multiple' : ''}]</label>
+ <c:choose>
+ <c:when test="${property.multiple}" >
+ <fieldset class="propmultival_fieldset">
+ <div> </div>
+ <c:forEach var="value" items="<%=property.getValues()%>">
+ <c:choose>
+ <c:when test="${property.type == PropertyType.BINARY}" >
+ <p>I'm a binary property</p>
+ </c:when>
+ <c:otherwise>
+ <input class="propinputmultival form-control" value="${value.string}"/>
+ </c:otherwise>
+ </c:choose>
+ </c:forEach>
+ </fieldset>
+ </c:when>
+ <c:when test="${false}" >
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <c:when test="<%=property.getType() == PropertyType.BINARY%>" >
+ <c:choose>
+ <c:when test='<%=currentNode.getParent().isNodeType("nt:file") %>'>
+ <a class="propinput" href="<%= request.getContextPath() %>${resource.parent.path}">Download</a>
+ </c:when>
+ <c:otherwise>
+ <a class="propinput" href="<%= request.getContextPath() %>${resource.path}.property.download?property=${property.name}">View (choose "Save as..." to download)</a>
+ </c:otherwise>
+ </c:choose>
+ </c:when>
+ <c:otherwise>
+ <input class="propinput form-control" id="${property.name}" name="${property.name}" value="${property.string}"/>
+ </c:otherwise>
+ </c:choose>
+ </c:otherwise>
+ </c:choose>
+ </fieldset>
+ </c:forEach>
+ </c:when>
+ <c:otherwise>
+ <c:forEach var="property" items="<%=resource.adaptTo(ValueMap.class)%>">
+ <fieldset>
+ <label class="proplabel" for='${property.key}'>${property.key}</label>
+ <input class="propinput form-control" id="${property.key}" name="${property.key}" value="${property.value}"/>
+ </fieldset>
+ </c:forEach>
+ </c:otherwise>
+ </c:choose>
+ </form>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="row" style="visibility:hidden; display:none;">
+ <div class="col-sm-12">
+ <div id="footer" class="plate">
+ <p>I'm looking forward to be filled with useful content</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 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">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="addNodeDialogLabel">Add Node</h4>
+ </div>
+ <div class="modal-body">
+ <div class="form-group">
+ <label for="nodeName">Node Name</label>
+ <input name="nodeName" type="text" class="form-control" id="nodeName" placeholder="Node Name">
+ </div>
+ <div class="form-group">
+ <label for="nodeType">Node Type</label>
+ <input name="jcr:primaryType" type="hidden" id="nodeType">
+ </div>
+ <div class="form-group">
+ <label for="resourceType">Sling Resource Type</label>
+ <input name="sling:resourceType" type="hidden" id="resourceType">
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+ <button type="button" class="btn btn-primary submit">Save changes</button>
+ </div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
Added: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp?rev=1641400&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp (added)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.incl.jsp Mon Nov 24 14:29:16 2014
@@ -0,0 +1,15 @@
+
+[
+ <c:forEach var="theResource" items="<%=resource.listChildren()%>" varStatus="status">
+ <%--Hiding the resource provider root. --%>
+ <c:if test="${theResource.path != '/reseditor'}">
+ <% Resource theResource = (Resource) pageContext.getAttribute("theResource");%>
+ {
+ "text": "<i class=\"jstree-icon node-icon open-icon\"></i><i class=\"jstree-icon node-icon remove-icon\"></i><i class=\"jstree-icon node-icon add-icon\"></i>${fn:escapeXml(theResource.name)} [<span class=\"node-type\">${theResource.resourceType}</span>]",
+ "li_attr": { "nodename" : "${fn:escapeXml(theResource.name)}" },
+ "a_attr": { "href" : "/reseditor${fn:escapeXml(theResource.path)}.html" },
+ "children" : <%= theResource.listChildren().hasNext() %> <%--${theResource.listChildren().hasNext()} will work in Servlet 3.0 --%>
+ }${!status.last ? ',': ''}
+ </c:if>
+ </c:forEach>
+]
Added: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.jsp?rev=1641400&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.jsp (added)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/nodes.json.jsp Mon Nov 24 14:29:16 2014
@@ -0,0 +1,15 @@
+<%@ page session="false"%>
+<%@ page isELIgnored="false"%>
+<%@ page import="javax.jcr.*,org.apache.sling.api.resource.Resource"%>
+<%@ page import="java.util.Iterator"%>
+<%@ page import="java.util.LinkedList, java.util.List"%>
+
+<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8"%>
+
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
+<sling:defineObjects />
+<% response.setContentType("application/json"); %>
+
+<%@ include file="nodes.json.incl.jsp" %>
Added: sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp?rev=1641400&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp (added)
+++ sling/trunk/contrib/explorers/resourceeditor/src/main/resources/SLING-INF/libs/sling/resource-editor/rootnodes.json.jsp Mon Nov 24 14:29:16 2014
@@ -0,0 +1,22 @@
+<%@ page session="false"%>
+<%@ page isELIgnored="false"%>
+<%@ page import="javax.jcr.*,org.apache.sling.api.resource.Resource"%>
+<%@ page import="java.util.Iterator"%>
+<%@ page import="java.util.LinkedList, java.util.List"%>
+
+<%@ page language="java" contentType="application/json; charset=UTF-8" pageEncoding="UTF-8"%>
+
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
+<sling:defineObjects />
+<% response.setContentType("application/json"); %>
+[{
+ "id" : "/",
+ "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" : "${theResource.name}" },
+ "a_attr" :{ "href" : "<%= request.getContextPath() %>/reseditor/.html" },
+ "children" :
+ <%@ include file="nodes.json.incl.jsp" %>
+}]
\ No newline at end of file