You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2007/11/28 20:31:07 UTC

svn commit: r599106 - in /incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content: sample/components/ sample/content/ sling/ sling/scripts/ sling/scripts/sling/ sling/scripts/sling/SampleContent/ sling/scripts/sling/SamplePage/

Author: fmeschbe
Date: Wed Nov 28 11:31:06 2007
New Revision: 599106

URL: http://svn.apache.org/viewvc?rev=599106&view=rev
Log:
SLING-98 Adapt to Sling API and microsling:
   - Organize Scripts by resource type and request extension
   - Remove unused sling:componentId properties

Added:
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp
Removed:
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/components/
Modified:
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json

Modified: incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json?rev=599106&r1=599105&r2=599106&view=diff
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json (original)
+++ incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json Wed Nov 28 11:31:06 2007
@@ -1,7 +1,6 @@
 {
 	"primaryNodeType": "sling:SamplePage",
 	"properties": {
-		"sling:componentId": "/sample/components/page",
 		"title": "This is a Sample Page"
 	},
 	
@@ -10,7 +9,6 @@
 	        "name": "content",
 			"primaryNodeType": "sling:SampleContent",
 			"properties": {
-				"sling:componentId": "/sample/components/content",
 				"title": "Welcome to the Sample Component",
 				"text": "The Sample Component is a simple component showing nested content"
 			}
@@ -20,7 +18,6 @@
 	        "name": "moreinfo",
 			"primaryNodeType": "sling:SamplePage",
 			"properties": {
-				"sling:componentId": "/sample/components/page",
 				"title": "More Information"
 			},
 			
@@ -29,7 +26,6 @@
 			        "name": "content",
 					"primaryNodeType": "sling:SampleContent",
 					"properties": {
-						"sling:componentId": "/sample/components/content",
 						"title": "Page Providing More Information",
 						"text": "This page provides more information on this tool, yet it seems empty."
 					}
@@ -41,7 +37,6 @@
 	        "name": "moreinfojsp",
 			"primaryNodeType": "sling:SamplePage",
 			"properties": {
-				"sling:componentId": "/sample/components/page",
 				"title": "Bundle-JSP Page"
 			},
 			
@@ -50,7 +45,6 @@
 			        "name": "content",
 					"primaryNodeType": "sling:SampleContent",
 					"properties": {
-						"sling:componentId": "/org/apache/sling/sample/jsp/component.jsp",
 						"title": "JSP Rendered Content",
 						"text": "This Content is rendered by a JSP script embeded in the Bundle."
 					}

Added: incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp?rev=599106&view=auto
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp (added)
+++ incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp Wed Nov 28 11:31:06 2007
@@ -0,0 +1,42 @@
+<%--
+    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.
+--%>
+<%@page session="false" %>
+<%@page import="org.apache.sling.sample.*" %>
+<%@page import="org.apache.sling.api.*" %>
+<%@page import="org.apache.sling.api.resource.Resource"%>
+<%@page import="java.util.Iterator"%>
+<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %>
+
+<%-- Ensure the presence of the ComponentAPI objects --%>
+<sling:defineObjects />
+<%
+    SampleContent content = (SampleContent) slingRequest.getResource().getObject();
+%>
+
+<h1><%= content.getTitle() %></h1>
+<p><%= content.getText() %></p>
+<table border="1" cellpadding="3" cellspacing="0">
+<%
+	Iterator<Resource> ci = resourceManager.listChildren(slingRequest.getResource());
+	while (ci.hasNext()) {
+		Resource child = ci.next();
+		%><tr><td><sling:include resource="<%= child %>" /></td></tr><%
+	}
+%>
+</table>
\ No newline at end of file

Added: incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp?rev=599106&view=auto
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp (added)
+++ incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp Wed Nov 28 11:31:06 2007
@@ -0,0 +1,59 @@
+<%--
+    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.
+--%>
+<%@page session="false"%>
+<%@page import="org.apache.sling.sample.*"%>
+<%@page import="org.apache.sling.api.*"%>
+<%@page import="org.apache.sling.api.resource.Resource"%>
+<%@page import="org.apache.sling.jcr.resource.SyntheticResource"%>
+<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
+
+<%-- Ensure the presence of the ComponentAPI objects --%>
+<sling:defineObjects />
+<%
+    SamplePage content = (SamplePage) slingRequest.getResource().getObject();
+%>
+<%-- This is a top level component, so we have to draw the html and head tags --%>
+<html>
+<head>
+<title><%=content.getTitle()%></title>
+</head>
+<body>
+<h1><%=content.getTitle()%></h1>
+
+<table style="border: none; height: 90%;">
+	<tr valign="top">
+		<td
+			style="padding-top: 20px; padding-right: 20px; background-color: cornsilk">
+		<%
+		    final String naviRootPath = "/sample/content";
+		    Resource naviRoot = new SyntheticResource(naviRootPath,
+		        Navigation.RESOURCE_TYPE);
+		%> <sling:include resource="<%= naviRoot %>" /></td>
+		<td>
+		<table>
+			<tr>
+				<td><sling:include path="content" /></td>
+			</tr>
+		</table>
+		</td>
+	</tr>
+</table>
+
+</body>
+</html>
\ No newline at end of file