You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by my...@apache.org on 2010/09/19 15:24:08 UTC
svn commit: r998655 [3/3] - in
/sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling:
explorer/css/ explorer/css/images/ explorer/js/ servlet/default/explorer/
Modified: sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp?rev=998655&r1=998654&r2=998655&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp (original)
+++ sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp Sun Sep 19 13:24:07 2010
@@ -1,246 +1,242 @@
-<%--
-/*
- * 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.
- */
---%>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-
-<title>Sling || JCR Explorer</title>
-
+<%--
+/*
+ * 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.
+ */
+--%>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+
+<title>Sling || JCR Explorer</title>
+
<link rel="stylesheet" href="<%= request.getContextPath() %>/libs/sling/explorer/css/explorer.css" type="text/css"/>
- <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/base/jquery-ui.css" type="text/css" media="all" />
- <link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
-
- <script type="text/javascript" src="<%= request.getContextPath() %>/system/sling.js"></script>
-
- <!-- <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/explorer/js/jquery-1.4.2.min.js"></script> -->
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
-
+ <link rel="stylesheet" href="<%= request.getContextPath() %>/libs/sling/explorer/css/jquery-ui.css" type="text/css" media="all" />
+ <link rel="stylesheet" href="<%= request.getContextPath() %>/libs/sling/explorer/css/ui.theme.css" type="text/css" media="all" />
+
+ <script type="text/javascript" src="<%= request.getContextPath() %>/system/sling.js"></script>
+ <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/explorer/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/explorer/js/jquery-ui.min.js"></script>
- <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/explorer/js/ui.datetimebox.js"></script>
-
- <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/explorer/js/explorer.js"></script>
-
-</head>
-
-<%
-var resourceType = '';
-
-try
-{
-if ( currentNode && currentNode.hasProperty( 'sling:resourceType' ) ) {
- resourceType = currentNode.getProperty('sling:resourceType');
-}
-}
-catch (ex) { }
-%>
-
-<body>
+ <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/explorer/js/ui.datetimebox.js"></script>
+ <script type="text/javascript" src="<%= request.getContextPath() %>/libs/sling/explorer/js/explorer.js"></script>
+</head>
+
+<body>
<div id="error_dialog" title="Error output" style="display:none;">
<p>Some text that you want to display to the user.</p>
</div>
- <div id="login-dialog" style="display:none;">
- <form accept-charset="UTF-8" enctype="multipart/form-data" action="#" method="post" id="login-form">
- <fieldset>
- <input type="hidden" value="UTF-8" name="_charset_" />
- <input type="hidden" value="/" name="resource" />
- <input type="hidden" value="form" name="selectedAuthType" />
- </fieldset>
-
- <fieldset>
- <p>
- <label for="j_username">Username:</label> <input type="text" class="" accesskey="u" name="j_username" id="j_username" />
- <label for="j_password">Password:</label> <input type="password" accesskey="p" name="j_password" id="j_password" />
- <button class="form-button" accesskey="l" id="do_login">Login</button>
- </p>
- </fieldset>
-
- </form>
- </div>
-
- <div class="menu">
- <div id="menu_login" style="display:none">
- <a href="#" onclick="" id="show_login_dialog">Login</a>
- </div>
- <div id="menu_logout" style="display:none">
- <strong id="menu_username"> ??? </strong> | <a href="#" id="do_logout">Logout</a>
- </div>
- </div>
-
- <div id="expl_container">
- <div id="expl_logo">
- <a href="http://incubator.apache.org/sling">
- <img width="51" height="30" src="http://incubator.apache.org/sling/site/media.data/logo.png" alt="Apache Sling"/>
- </a><!-- <span id="height"></span> -->
- </div>
-
- <div id="query_container">
- <button id="show_query_dialog">Query</button> <span class="foundQueries"></span>
- <div class="clear"></div>
- <div id="expl_search" style="display:none;">
- <form action="#">
- <p>
- <label>
- Query Language:
- </label>
- <select name="query_language" id="query_language">
- <%
- var session = request.resourceResolver.adaptTo(Packages.javax.jcr.Session);
- if (session)
- {
- var queryManager = session.getWorkspace().getQueryManager();
- var supportedQueryLanguages = queryManager.getSupportedQueryLanguages();
- for (idx in supportedQueryLanguages) {
- %>
- <option><%=supportedQueryLanguages[idx]%></option>
- <%
- } // for
- } // if
- %>
- </select>
- <br class="clear" />
- </p>
- <p>
- <label>
- Query expression:
- </label>
- <input type="text" class="text" name="search_expression" id="search_expression" ></input>
- <br class="clear" />
- </p>
- <p>
- <input class="button" type="submit" value="Execute!" onclick="search($('#query_language').val(), $('#search_expression').val(), 1 ); return false;" />
- <br class="clear" />
- </p>
- </form>
- <div id="sql_search_result"></div>
- </div>
- </div>
-
- <div id="expl_header">
-
- </div>
-
- <div id="expl_content_container">
-
- <div id="expl_sidebar">
- </div>
-
- <div id="expl_content">
- content
- </div>
- <div class="clear"></div>
-
- </div>
-
- <div id="expl_footer">
- <p id="logout" style="display:none">
- You are currently logged in as user <b id="username">????</b> to
- workspace <b id="workspace">????</b>.
- </p>
-
- <p id="login" style="display:none">
- You are not currently logged in. To login (use <em>admin/admin</em>
- to be allowed to write to the repository), follow
+ <div id="login-dialog" style="display:none;">
+ <form accept-charset="UTF-8" enctype="multipart/form-data" action="#" method="post" id="login-form">
+ <fieldset>
+ <input type="hidden" value="UTF-8" name="_charset_" />
+ <input type="hidden" value="/" name="resource" />
+ <input type="hidden" value="form" name="selectedAuthType" />
+ </fieldset>
+
+ <fieldset>
+ <p>
+ <label for="j_username">Username:</label> <input type="text" class="" accesskey="u" name="j_username" id="j_username" />
+ <label for="j_password">Password:</label> <input type="password" accesskey="p" name="j_password" id="j_password" />
+ <button class="form-button" accesskey="l" id="do_login">Login</button>
+ </p>
+ </fieldset>
+
+ </form>
+ </div>
+
+ <div class="menu">
+ <div id="menu_login" style="display:none">
+ <a href="#" onclick="" id="show_login_dialog">Login</a>
+ </div>
+ <div id="menu_logout" style="display:none">
+ <strong id="menu_username"> ??? </strong> | <a href="#" id="do_logout">Logout</a>
+ </div>
+ </div>
+
+ <div id="expl_container">
+ <div id="expl_logo">
+ <a href="http://sling.apache.org">
+ <img width="51" height="30" src="http://sling.apache.org/site/media.data/logo.png" alt="Apache Sling"/>
+ </a><!-- <span id="height"></span> -->
+ </div>
+
+ <div id="query_container">
+ <button id="show_query_dialog">Query</button> <span class="foundQueries"></span>
+ <div class="clear"></div>
+ <div id="expl_search" style="display:none;">
+ <form action="#">
+ <p>
+ <label>
+ Query Language:
+ </label>
+ <select name="query_language" id="query_language">
+ <%
+ var session = request.resourceResolver.adaptTo(Packages.javax.jcr.Session);
+ if (session)
+ {
+ var queryManager = session.getWorkspace().getQueryManager();
+ var supportedQueryLanguages = queryManager.getSupportedQueryLanguages();
+ for (idx in supportedQueryLanguages) {
+ %>
+ <option><%=supportedQueryLanguages[idx]%></option>
+ <%
+ } // for
+ } // if
+ %>
+ </select>
+ <br class="clear" />
+ </p>
+ <p>
+ <label>
+ Query expression:
+ </label>
+ <input type="text" class="text" name="search_expression" id="search_expression" ></input>
+ <br class="clear" />
+ </p>
+ <p>
+ <input class="button" type="submit" value="Execute!" onclick="search($('#query_language').val(), $('#search_expression').val(), 1 ); return false;" />
+ <br class="clear" />
+ </p>
+ </form>
+ <div id="sql_search_result"></div>
+ </div>
+ </div>
+
+ <div id="expl_header">
+
+ </div>
+
+ <div id="expl_content_container">
+
+ <div id="expl_sidebar">
+ <ul>
+ <li>
+ <p id="_" class="selected">
+ <a href="#" onclick="explorer_toggle('/', '')" >/</a>
+ </p>
+ </li>
+ </ul>
+ </div>
+
+ <div id="expl_content">
+ content
+ </div>
+ <div class="clear"></div>
+ </div>
+
+ <div id="expl_footer">
+ <p id="logout" style="display:none">
+ You are currently logged in as user <b id="username">????</b> to
+ workspace <b id="workspace">????</b>.
+ </p>
+
+ <p id="login" style="display:none">
+ You are not currently logged in. To login (use <em>admin/admin</em>
+ to be allowed to write to the repository), follow
<a href="<%= request.getContextPath() %>/system/sling/login" title="Click to Login">this link</a>.
- </p>
-<!--
-Resource resolver user ID: <%= request.resourceResolver.getUserID() %>(<%=request.getAuthType() %>)<br/>
-Session user ID: <span id="sessionuserid"></span>
--->
- </div>
- </div>
-
- <script type="text/javascript">
- // <![CDATA[
- $( function() {
- jQuery("#error_dialog").dialog({
- bgiframe: true,
- autoOpen: false,
- height: 400,
- width: 400,
- modal: true
- });
-
- // window resizing -> adjust sidebar and content height
- $(window).resize( function() {
- adjust_height();
- });
-
- // query - sliding window
- $("button#show_query_dialog").click(function () {
- $('button#show_query_dialog').toggleClass('query_open');
- $("#expl_search").slideToggle( "slow", adjust_height );
- });
-
-
- // login - sliding window
- $("a#show_login_dialog").click(function () {
- $('a#show_login_dialog').toggleClass('login_open');
- $("#login-dialog").slideToggle("slow", adjust_height );
- });
-
- $('button#do_login').click( function(e) {
- var userId = $("input#j_username").val();
- // ajax login
- $.post('/j_security_check',
- $("#login-form").serialize(),
- function(data) {
- if ( userId == Sling.getSessionInfo().userID )
- {
- $("#login-dialog").slideToggle("slow", adjust_height );
- update_credentials();
- load_props( currentPath, currentResourceType );
- }
- else
- {
- // failed to login!
- }
- });
- return false;
- });
-
- $('a#do_logout').click( function(e) {
- // ajax logout
- $.get( '/system/sling/logout.html', function(data) {
- update_credentials();
- load_props( currentPath, currentResourceType );
- } );
- });
-
- update_credentials();
- init_load('<%= resource.path %>', '<%= resourceType %>');
- adjust_height();
- });
-
- function adjust_height() {
- var newHeight = $(window).height() - $("#expl_logo").outerHeight(true) - $("#query_container").outerHeight(true) - $("#expl_footer").outerHeight(true);
- var offset_top = $("#expl_content_container").offset().top;
- var newHeight2 = $(window).height() - offset_top - $("#expl_footer").outerHeight(true);
- // $("#height").html(" window height " + $(window).height() + " height1 " + newHeight + " offset top " + offset_top + " height2 " + newHeight2 );
- $("#expl_sidebar").height(newHeight2 - 25);
- $("#expl_content").height(newHeight2 - 45);
- }
-
- // ]]>
- </script>
-</body>
+ </p>
+<!--
+Resource resolver user ID: <%= request.resourceResolver.getUserID() %>(<%=request.getAuthType() %>)<br/>
+Session user ID: <span id="sessionuserid"></span>
+-->
+ </div>
+ </div>
+
+ <script type="text/javascript">
+ // <![CDATA[
+ $( function() {
+ jQuery("#error_dialog").dialog({
+ bgiframe: true,
+ autoOpen: false,
+ height: 400,
+ width: 400,
+ modal: true
+ });
+
+ // window resizing -> adjust sidebar and content height
+ $(window).resize( function() {
+ adjust_height();
+ });
+
+ // query - sliding window
+ $("button#show_query_dialog").click(function () {
+ $('button#show_query_dialog').toggleClass('query_open');
+ $("#expl_search").slideToggle( "slow", adjust_height );
+ });
+
+
+ // login - sliding window
+ $("a#show_login_dialog").click(function () {
+ $('a#show_login_dialog').toggleClass('login_open');
+ $("#login-dialog").slideToggle("slow", adjust_height );
+ });
+
+ $('button#do_login').click( function(e) {
+ var userId = $("input#j_username").val();
+ $.ajax({
+ url: '/j_security_check',
+ type: 'POST',
+ data: $("#login-form").serialize(),
+ success: function( data, textStatus, xmlHttpRequest ) {
+ // show_error(data);
+ var sessionInfo = Sling.getSessionInfo();
+ if ( userId == sessionInfo.userID )
+ {
+ $("#login-dialog").slideToggle("slow", adjust_height );
+ update_credentials();
+ load_props( currentPath );
+ }
+ else
+ {
+ show_error( data );
+ }
+ },
+ error: function( xmlHttpRequest, textStatus, errorThrown ) {
+ show_error( xmlHttpRequest.responseText );
+ }
+ });
+ return false;
+ });
+
+ $('a#do_logout').click( function(e) {
+ // ajax logout
+ $.get( '/system/sling/logout.html', function(data) {
+ update_credentials();
+ load_props( currentPath );
+ } );
+ });
+
+ update_credentials();
+ init_load( '<%= resource.path %>' );
+ adjust_height();
+ });
+
+ function adjust_height() {
+ var newHeight = $(window).height() - $("#expl_logo").outerHeight(true) - $("#query_container").outerHeight(true) - $("#expl_footer").outerHeight(true);
+ var offset_top = $("#expl_content_container").offset().top;
+ var newHeight2 = $(window).height() - offset_top - $("#expl_footer").outerHeight(true);
+ // $("#height").html(" window height " + $(window).height() + " height1 " + newHeight + " offset top " + offset_top + " height2 " + newHeight2 );
+ $("#expl_sidebar").height(newHeight2 - 25);
+ $("#expl_content").height(newHeight2 - 45);
+ }
+
+ // ]]>
+ </script>
+</body>
</html>
\ No newline at end of file
Modified: sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/item.esp
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/item.esp?rev=998655&r1=998654&r2=998655&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/item.esp (original)
+++ sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/item.esp Sun Sep 19 13:24:07 2010
@@ -38,7 +38,10 @@ if (nodes.hasNext()) {
path = path.substr(1);
// WARNING: have a look at explorer.js - duplicate code!
var id = path.replace(/\//g, "_");
- id = id.replace(/^_/, ""); // remove trailing _
+ if ( path.length > 1 )
+ {
+ id = id.replace(/^_/, ""); // remove trailing _
+ }
id = id.replace(/\./g, '_');// due to the css selectors
id = id.replace(/:/g, '_');// due to the css selectors
id = id.replace(/\[/g, '_');// due to the css selectors
Added: sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/node.esp
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/node.esp?rev=998655&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/node.esp (added)
+++ sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/node.esp Sun Sep 19 13:24:07 2010
@@ -0,0 +1,315 @@
+<%--
+/*
+ * 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.
+ */
+--%>
+<%
+ response.setContentType("text/html; charset=UTF-8");
+
+ var path = resource.path;
+ var wsSepPos = path.indexOf(":/", 0);
+ if (wsSepPos != -1) {
+ path = path.substring(wsSepPos + 1);
+ }
+
+ var readonly = false;
+
+ var session = request.resourceResolver.adaptTo(Packages.javax.jcr.Session);
+
+ var privilegesInfo = new Packages.org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo();
+ var canModifyProperties = false;
+ var isJcrNode = false;
+ var resourceType;
+ try {
+ canModifyProperties = privilegesInfo.canModifyProperties( currentNode );
+ isJcrNode = true;
+ if ( currentNode && currentNode.hasProperty( 'sling:resourceType' ) )
+ {
+ resourceType = currentNode.getProperty('sling:resourceType').getString();
+ }
+ } catch (e) {}
+%>
+ <div id="expl_content_header">
+ <div>
+ <h2> <% if (path == '/') { %> <Root> <% } else { %> <%= Packages.org.apache.sling.api.resource.ResourceUtil.getName( resource ) %><% } %></h2>
+<%
+ try {
+ if ( session ) {
+ session.checkPermission(path, "remove");
+ %>
+ <form class="deleteNote" action="%3C%=path%%3E" method="post">
+ <input name=":operation" type="hidden" value="delete">
+ <input name=":redirect" type="hidden" value="<%=request.getContextPath()%><%= Packages.org.apache.sling.api.resource.ResourceUtil.getParent(resource) %>.explorer.html">
+ <input type="submit" class="button" value="delete this node">
+ </form>
+ <div class="clear"></div>
+ </div>
+<%
+ }
+ } catch ( e ) {
+ // don't care
+ }%>
+ <p>
+ <a href="<%= request.getContextPath() %><%= path %>.explorer.html"><%=path%></a>
+ <% if(isJcrNode){ %>
+ (JCR identifier: <%= currentNode.getIdentifier() %>)
+ <% } %>
+ </p>
+
+<% if (session) {
+ try {
+ session.checkPermission(path, "add_node");
+%>
+ <div>
+ <h3>
+ add new child node
+ </h3>
+ <form id="new_child_node_form" method="post" name="new_child_node_form">
+ <div class="property_element">
+ <table class="propoerty_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" class="text">
+ </td>
+ <td>
+ <input name="sling:resourceType" id="new_node_sling_resource_type" type="text" class="text">
+ </td>
+ <td>
+<%
+ var primaryNodeTypes = session.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
+ if ( primaryNodeTypes.hasNext() ) {
+%>
+ <select name="jcr:primaryType" id="jcr:primaryType">
+<% while (primaryNodeTypes.hasNext()) {
+ var primaryNodeType = primaryNodeTypes.nextNodeType();
+%>
+ <option>
+ <%=primaryNodeType.getName()%>
+ </option>
+<% } %>
+ </select>
+<% } %>
+ </td>
+ <td>
+ <input type="submit" class="button" value="new child node" onclick="add_new_child_node(); return false;">
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </form>
+ </div><%
+ } catch (e) {
+ // don't care
+ }
+ }
+ %>
+ <div class="clear"></div>
+ </div>
+ <div>
+ <%
+ sling.include( path + ".explorer.edit."+ (resourceType == null ? '' : (resourceType.replace(':', '_') + '.') ) + "html" );
+ %>
+ </div>
+<script type="text/javascript">
+ $(function() {
+ $.datetimebox.setDefaults({
+ showOn: 'both',
+ buttonImageOnly: true,
+ buttonImage: 'calendar.gif',
+ buttonText: 'Calendar',
+ dateFormat: 'dd/mm/yy hh:ii',
+ changeYear: true,
+ changeMonth: true,
+ closeText: 'Confirm',
+ closeImage: 'calendar_close.gif',
+ timeText: 'Time (hh:mm): ',
+ prevText: 'Previous',
+ nextText: 'Next',
+ currentText: 'Today',
+ monthNames: ['January', 'February', 'March', 'April', 'May', 'June','July', 'August', 'September', 'October', 'November', 'December'],
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ weekHeader: 'Week',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: '',
+ constrainInput: true,
+ onSelect: function (dateText) {
+ document.all ?
+ $(this).get(0).fireEvent("onchange")
+ : $(this).change();
+ }
+ });
+ decorate_datepicker();
+ });
+
+ function add_new_child_node()
+ {
+ $.ajax({
+ url: '<%=path%>/*',
+ type: 'POST',
+ data: $("form[id='new_child_node_form']" ).serialize(),
+ success: function( data, textStatus, xmlHttpRequest )
+ {
+ var child_node_location = xmlHttpRequest.getResponseHeader('Location');
+ if ( child_node_location )
+ {
+ load_branch(
+ '<%=path%>',
+ function() { skip_to( child_node_location );},
+ true
+ );
+ }
+ else
+ {
+ show_error( xmlHttpRequest.responseText );
+ }
+ },
+ error: function( xmlHttpRequest, textStatus, errorThrown )
+ {
+ show_error( xmlHttpRequest.responseText );
+ }
+ });
+ return false;
+ };
+
+ function create_edit_field_for_type(field_name, field_type)
+ {
+ var prop_val_input = '';
+ switch ( field_type ) {
+ case 'Boolean' :
+ prop_val_input = '<input type="hidden" name="'
+ + field_name + '" id="'
+ + field_name + '" value="false"><input class="checkbox" type="checkbox" onchange="$(\'#'
+ + field_name + '\').val(this.checked ? \'true\' : \'false\');">';
+ break;
+ case 'Date' :
+ prop_val_input = '<input id="'
+ + field_name + '" class="datepicker" type="text" class="text"><' + 'script>decorate_datepicker()<' + '/script>';
+ break;
+ default:
+ prop_val_input = '<input id="'
+ + field_name + '" type="text" class="text">';
+ } // switch
+ return prop_val_input;
+ };
+
+ function decorate_datepicker() {
+ $(".datepicker:not(.protected)").datetimebox({
+ showOn: 'both',
+ buttonImageOnly: true,
+ buttonImage: '/libs/sling/explorer/img/calendar.gif',
+ buttonText: 'Calendar',
+ // dateFormat: 'yy-mm-dd hh:ii',
+ dateFormat: 'dd.mm.yy hh:ii:00',
+ changeYear: true,
+ changeMonth: true,
+ closeText: 'Confirm',
+ closeImage: '/libs/sling/explorer/img/calendar.gif',
+ timeText: 'Time (hh:mm): ',
+ prevText: 'Previous',
+ nextText: 'Next',
+ currentText: 'Today',
+ monthNames: ['January', 'February', 'March', 'April', 'May', 'June','July', 'August', 'September', 'October', 'November', 'December'],
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
+ weekHeader: 'Week',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: '',
+ constrainInput: true,
+ onSelect: function (dateText) {
+ document.all ?
+ $(this).get(0).fireEvent("onchange")
+ : $(this).change();
+ }
+ });
+ }
+</script>
+<%
+ function create_input_for_type( id, type, val, editable, omitName ) {
+ switch ( type ) {
+ case Packages.javax.jcr.PropertyType.DATE :
+ %>
+ <form>
+ <input class="prop_value text datepicker<% if(!editable) { %> protected<%}%>" <% if (!omitName) { %> name="<%= id %>" <% } %> id="<%= id %>" value="<%= dateFormatter.format( val.getDate().getTime() ) %>"> <%
+ break;
+ case Packages.javax.jcr.PropertyType.BOOLEAN : %> <input type="hidden" name="<%= id %>" id="<%= id %>_cb" value="<%= val %>"> <input type="checkbox" id="<%= id %>" <% if(!editable) { %> class="protected" <%}%> <% if ( val.getBoolean() ) { %> checked <% } %> onchange="$('[id=<%= id %>_cb]').val( this.checked ? 'true' : 'false' );"> <%
+ break;
+ case Packages.javax.jcr.PropertyType.REFERENCE :
+ case Packages.javax.jcr.PropertyType.WEAKREFERENCE :
+ case Packages.javax.jcr.PropertyType.PATH :
+ try {
+ var refNode = val.getNode();
+ %> -> <a href="#" onclick="skip_to('<%= refNode.getPath() %>')"><%= refNode.getPath() %> (<%= refNode.getIdentifier() %>)</a> <input class="prop_value text <% if(!editable) { %> protected <%}%>" id="<%= id %>" <% if (!omitName) { %> name="<%= id %>" <% } %> value="<%= val %>"> <%
+ } catch ( ex ) {}
+ break;
+ case Packages.javax.jcr.PropertyType.BINARY :
+ %> <a class="saveAs" href="%3C%=%20path%20%%3E" target="_blank">Download content (use "Save as...")</a> <%
+ break;
+ default: %> <input class="prop_value text <% if(!editable) { %> protected <%}%>" id="<%= id %>" <% if (!omitName) { %> name="<%= id %>" <% } %> value="<%= val %>"> <%
+ break;
+ } // switch
+ } %> <% function create_multivalueinput_for_type( id, type, multivalue_property, include_add_field ) {
+ %> <input type="hidden" name="<%= id %>@TypeHint" value="<%= type %>[]">
+ </form>
+ <ul id="<%= id %>_entries">
+ <%
+ if ( multivalue_property ) {
+ for ( var idx in multivalue_property.getValues() )
+ {
+ var entry = multivalue_property.getValues()[idx]; %>
+ <li>
+ <input type="hidden" name="<%= id %>" value="<%= entry.getString() %>"> <%= entry.getString() %> <% if ( canModifyProperties && !multivalue_property.getDefinition().isProtected() ) { %> <a href="#" class="button" onclick="$(this).parent().remove();update_property('<%= id %>');">delete</a> <% } %>
+ </li><%
+ } // for
+ } // if
+ %>
+ </ul>
+ <div class="addMultivalueproperty">
+ <% if ( include_add_field && canModifyProperties && !multivalue_property.getDefinition().isProtected() ) {
+ create_input_for_type( id+"_new_entry", type, '', true, true );
+ %>
+ <a href="#" onclick="add_property_entry('<%= id %>')" class="button">add</a>
+ <div class="clear"></div>
+ </div>
+ <%
+ }
+ }
+ %>