You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2011/11/11 05:19:50 UTC

svn commit: r1200732 - in /sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot: Album/trail.html.jsp Album/treeentry.html.jsp Photo/edit.html.jsp Photo/html.jsp Photo/main.html.jsp

Author: cziegeler
Date: Fri Nov 11 04:19:49 2011
New Revision: 1200732

URL: http://svn.apache.org/viewvc?rev=1200732&view=rev
Log:
Correct links (remove obsolete selector)
Add edit page for a photo
Always encode title when writing out

Added:
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp   (with props)
Modified:
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp
    sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp?rev=1200732&r1=1200731&r2=1200732&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/trail.html.jsp Fri Nov 11 04:19:49 2011
@@ -46,7 +46,7 @@
         } while ( continueProcessing);
     }  
     for(int k=parents.size()-1;k>=0;k--) {
-      %><div class="trailpart" style="padding:3px;"><a href="<%=parents.get(k)[0] %>.slingshot.html"><%=parents.get(k)[1] %></a></div><%
+      %><div class="trailpart" style="padding:3px;"><a href="<%=parents.get(k)[0] %>.html"><%=parents.get(k)[1] %></a></div><%
     }
   %>
 </div>

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp?rev=1200732&r1=1200731&r2=1200732&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Album/treeentry.html.jsp Fri Nov 11 04:19:49 2011
@@ -25,4 +25,4 @@
   ValueMap attributes = ResourceUtil.getValueMap(resource);
   Resource parent = resource.getParent();
   String name = resource.getName();
-%>- <a href="<%=parent.getName() %>/<%=name %>.slingshot.html"><%=ResponseUtil.escapeXml(attributes.get("jcr:title", name)) %></a><br/>
\ No newline at end of file
+%>- <a href="<%=parent.getName() %>/<%=name %>.html"><%=ResponseUtil.escapeXml(attributes.get("jcr:title", name)) %></a><br/>
\ No newline at end of file

Added: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp?rev=1200732&view=auto
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp (added)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp Fri Nov 11 04:19:49 2011
@@ -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.api.resource.ResourceUtil,
+                  org.apache.sling.api.resource.ValueMap,
+                  org.apache.sling.api.request.ResponseUtil"%><%
+%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
+%><sling:defineObjects/><%
+    final ValueMap attributes = ResourceUtil.getValueMap(resource);
+    final String photoName = ResponseUtil.escapeXml(attributes.get("jcr:title", resource.getName()));
+%><html>
+  <head>
+    <title><%= photoName %></title>
+  </head>
+  <body>
+    <h1><%= photoName %></h1>
+    <img src="<%=resource.getName() %>"/>
+    <form method="POST" action="<%=resource.getName() %>">
+      <input type="hidden" name=":redirect" value="<%=resource.getName() %>.html"/>
+      <p>Title: <input name="jcr:title" value="<%=photoName%>"/></p>
+      <p>Description: <input name="jcr:description" value="<%=ResponseUtil.escapeXml(attributes.get("jcr:description", ""))%>"/></p>
+      <p>Location: <input name="slingshot:location" value="<%=ResponseUtil.escapeXml(attributes.get("slingshot:location", ""))%>"/></p>
+      <button name="save">Save</button>
+      <p><a href="<%=resource.getName() %>.html">Cancel</a></p>
+    </form>
+  </body>
+</html>
\ No newline at end of file

Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/edit.html.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp?rev=1200732&r1=1200731&r2=1200732&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/html.jsp Fri Nov 11 04:19:49 2011
@@ -22,7 +22,8 @@
 %><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %><%
 %><sling:defineObjects/><%
     final ValueMap attributes = ResourceUtil.getValueMap(resource);
-    final String photoName = attributes.get("jcr:title", resource.getName());
+    final String photoName = ResponseUtil.escapeXml(attributes.get("jcr:title", resource.getName()));
+    final String albumName = ResponseUtil.escapeXml(ResourceUtil.getValueMap(resource.getParent()).get("jcr:title", resource.getParent().getName()));
 %><html>
   <head>
     <title><%= photoName %></title>
@@ -44,5 +45,7 @@
     }
 %>
     </p>
+    <p><a href="<%=resource.getName() %>.edit.html">Edit</a></p>
+    <p>Album: <a href="../<%=resource.getParent().getName() %>.html"><%= albumName %></a></p>
   </body>
 </html>
\ No newline at end of file

Modified: sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp?rev=1200732&r1=1200731&r2=1200732&view=diff
==============================================================================
--- sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp (original)
+++ sling/trunk/samples/slingshot/src/main/resources/SLING-INF/content/libs/slingshot/Photo/main.html.jsp Fri Nov 11 04:19:49 2011
@@ -26,7 +26,6 @@
 %><div class="photo">
 <%
     final ValueMap attr = ResourceUtil.getValueMap(resource);
-    final String albumName = resource.getParent().getName();
     final String photoName = attr.get("jcr:title", resource.getName());
     final String relPath = resource.getPath();
     String imagePath = relPath;
@@ -35,8 +34,8 @@
         imagePath = previewPath;
     }
 %>
-    <a href="<%= request.getContextPath() %><%=relPath%>.slingshot.html"><img src="<%=imagePath%>" width="100" height="100"/></a><br/>
-    <p><a href="<%= request.getContextPath() %><%=relPath%>.slingshot.html"><%= ResponseUtil.escapeXml(photoName) %></a></p>
+    <a href="<%= request.getContextPath() %><%=relPath%>.html"><img src="<%=imagePath%>" width="100" height="100"/></a><br/>
+    <p><a href="<%= request.getContextPath() %><%=relPath%>.html"><%= ResponseUtil.escapeXml(photoName) %></a></p>
     <p>Tags:&nbsp;
 <%
     String[] values = attr.get("slingshot:tags", String[].class);