incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r803820 - in /sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet: ./ default/ default/explorer/ default/explorer/explorer.esp default/explorer/item.esp default/explorer/properties.esp
Date Thu, 13 Aug 2009 09:41:03 GMT
Author: bdelacretaz
Date: Thu Aug 13 09:41:02 2009
New Revision: 803820

URL: http://svn.apache.org/viewvc?rev=803820&view=rev
Log:
SLING-993 - experimental jQuery-based resource explorer

Added:
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
  (with props)
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/item.esp
  (with props)
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/properties.esp
  (with props)

Added: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp?rev=803820&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
(added)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
Thu Aug 13 09:41:02 2009
@@ -0,0 +1,60 @@
+<%--
+/*
+ * 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.
+ */
+--%>
+ 
+<html>
+<head><title>Sling || JCR Explorer</title>
+	<link rel="stylesheet" href="/libs/sling/explorer/css/explorer.css" type="text/css"/>
+	<script type="text/javascript" src="/system/sling.js"></script>
+	<script type="text/javascript" src="/libs/sling/explorer/js/jquery-1.3.2.js"></script>
+	<script type="text/javascript" src="/libs/sling/explorer/js/explorer.js"></script>

+</head>
+<body onload="init_load('<%= resource.path %>');">
+	<div id="expl_container">
+          <div id="expl_logo">
+            <a href="http://incubator.apache.org/sling">
+            <img border="0" align="right" 
+              width="51" height="30" src="http://incubator.apache.org/sling/site/media.data/logo.png"
alt="Apache Sling"/>
+            </a>
+          </div>
+	  <div id="expl_header">
+  		<!--<form>
+  			<input type="text">
+  			<input type="submit" value="search">
+  		</form>-->
+		</div>
+		
+		<div id="expl_sidebar">
+		</div>
+
+		<div id="expl_content">
+			content
+		</div>
+
+		<div id="expl_footer">
+          <a href="/?sling:authRequestLogin=1">Login</a>
+          <br/>
+		  Note that this explorer is still <b>experimental</b>
+		  - 
+		  <a href="http://svn.apache.org/repos/asf/sling/trunk/contrib/explorers/jquery" target="_new">patches</a>
are welcome!
+		</div>
+	</div>
+</body>
+</html>

Propchange: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
------------------------------------------------------------------------------
    svn:executable = *

Added: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/item.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/item.esp?rev=803820&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/item.esp
(added)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/item.esp
Thu Aug 13 09:41:02 2009
@@ -0,0 +1,53 @@
+<%--
+/*
+ * 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.
+ */
+--%>
+ 
+<%
+var nodes = request.resourceResolver.listChildren(resource);
+
+if (nodes.hasNext()) {
+
+    %>
+    <ul>
+    <%
+
+    while (nodes.hasNext()) {
+      var child = nodes.next();
+      var name = Packages.org.apache.sling.api.resource.ResourceUtil.getName(child);
+      var path = child.path.substr(1);
+      var id = path.replace(/\//g, "_");
+      
+      %>
+      <li>
+        <p id="<%= id %>">
+            <a href="#" onclick="explorer_toggle('<%= path %>')" ><%= name
%></a>
+        </p>
+      </li>
+      <%
+    }
+
+    %>
+    </ul>
+    <%
+
+}
+
+
+%>
\ No newline at end of file

Propchange: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/item.esp
------------------------------------------------------------------------------
    svn:executable = *

Added: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/properties.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/properties.esp?rev=803820&view=auto
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/properties.esp
(added)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/properties.esp
Thu Aug 13 09:41:02 2009
@@ -0,0 +1,173 @@
+<%--
+/*
+ * 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.
+ */
+--%>
+ 
+<%
+    var path = resource.path;
+    var readonly = false;
+%>
+
+<h2><%= Packages.org.apache.sling.api.resource.ResourceUtil.getName(resource) %></h2>
+<p><a href="<%= path %>.explorer.html"><%=path%></a></p>
+
+<div>
+  <h3>properties</h3>
+  
+  <%
+  
+    var props = resource.adaptTo(Packages.org.apache.sling.api.resource.PersistableValueMap);
+    if (!props) {
+        readonly = true;
+        props = Packages.org.apache.sling.api.resource.ResourceUtil.getValueMap(resource)
+    }
+  
+    var propKeys = props.keySet().toArray();
+    for (var idx in propKeys) {
+        var id = propKeys[idx];
+        var val = props.get(id, Packages.javax.jcr.Property);
+        var type;
+        if (val) {
+            type = Packages.javax.jcr.PropertyType.nameFromValue(val.type);
+        } else {
+            val = props.get(id);
+            type = "String";
+        }
+
+        %>
+        <form style="display:inline;margin:0px;" action="<%=path%>" method="post">
+            <label><%= id %> [<%= type %>]</label>
+            <input class="prop_value" name ="<%= id %>" value="<%= val %>"
/>
+            <input name=":redirect" type="hidden" value="<%=path%>.explorer.html">
+            <input type="submit" value="update">
+        </form>
+        
+        <form style="display:inline;margin:0px;" action="<%=path%>" method="post">
+            <input type="submit" value="delete">
+            <input type="hidden" name ="<%= id %>@Delete" value="a" />
+            <input name=":redirect" type="hidden" value="<%=path%>.explorer.html">
+        </form>
+        
+        <br/>
+        <%
+    }
+    %>
+</div>
+
+    <%
+    if (!readonly) {
+        %>
+<div>
+  <h3>add property</h3>
+  <table>
+  <thead class="smallLabel">
+  <tr>
+  <td>Name</td>
+  <td>Type</td>
+  <td colspan="2">Value</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+  <td>
+  <input id="expl_add_prop_name" type="text"/>
+  </td><td>
+  <select id="expl_add_prop_type">
+    <option>String</option>
+    <option>Boolean</option>
+    <option>Date</option>
+    <option>Double</option>
+    <option>Long</option>
+  </select>
+  </td><td>
+  <input id="expl_add_prop_value" type="text">
+  </td><td>
+  <a class="button" href="#" onclick="add_prop('<%=path%>');">add property</a>
+  </td>
+  </tr>
+  </tbody>
+  </table>
+</div>
+
+        <%
+    }
+    %>
+   
+    <%
+    var session = request.resourceResolver.adaptTo(Packages.javax.jcr.Session);
+    if (session) {
+        try {
+            session.checkPermission(path, "add_node");
+            %>   
+<div>
+  <h3>add new node</h3>
+  <form action="<%=path%>/*" method="post">
+  <table>
+  <thead class="smallLabel">
+  <tr>
+  <td>Name hint</td>
+  <td>sling:resourceType</td>
+  <td colspan="2">jcr:primaryType</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+    <td>
+    <input name=":nameHint" type="text">
+    </td><td>
+    <input name="sling:resourceType" type="text">
+    </td><td>
+    <input name="jcr:primaryType" type="text">
+    </td><td>
+    <input name=":redirect" type="hidden" value="<%=path%>/*.explorer.html">
+    <input type="submit" value="new node">
+    </td>
+  </tr>
+  </tbody>
+  </table>
+  </form>
+</div>
+
+            <%
+        } catch (e) {
+            // don't care
+        }
+    }
+    %>
+
+    <%
+    try {
+        if (currentNode && session) {
+            session.checkPermission(path, "remove");
+            %>
+<div>
+  <h3>delete node</h3>
+  <form action="<%=path%>" method="post">
+  <input name=":operation" type="hidden" value="delete">
+  <input name=":redirect" type="hidden" value="<%= Packages.org.apache.sling.api.resource.ResourceUtil.getParent(resource)
%>.explorer.html">
+  <input type="submit" value="delete this node">
+  </form>
+</div>
+
+            <%
+        }
+    } catch (e) {
+        // don't care
+    }
+    %>

Propchange: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/properties.esp
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message