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

svn commit: r1085250 [2/2] - in /sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling: explorer/css/ explorer/js/ servlet/default/explorer/ servlet/default/explorer/edit/

Modified: sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit.esp
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit.esp?rev=1085250&r1=1085249&r2=1085250&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit.esp (original)
+++ sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit.esp Fri Mar 25 04:18:18 2011
@@ -29,475 +29,475 @@
     }
     
     var readonly = false; 
-	var dateFormatter = new Packages.java.text.SimpleDateFormat("dd.MM.yyyy HH:mm:ss");				
+    var dateFormatter = new Packages.java.text.SimpleDateFormat("dd.MM.yyyy HH:mm:ss");             
 
     var session = request.resourceResolver.adaptTo(Packages.javax.jcr.Session);
     if (session)
     {
-   		// var primaryNodeTypes = session.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
-   		var mixinNodeTypes = session.getWorkspace().getNodeTypeManager().getMixinNodeTypes();   		
+        // var primaryNodeTypes = session.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
+        var mixinNodeTypes = session.getWorkspace().getNodeTypeManager().getMixinNodeTypes();           
     }
     var privilegesInfo = new Packages.org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo();
-  	var canModifyProperties = false;
-	var isJcrNode = false;
-	try {
-		canModifyProperties = privilegesInfo.canModifyProperties( currentNode );
-		isJcrNode = true;
-	} catch (e) {}
+    var canModifyProperties = false;
+    var isJcrNode = false;
+    try {
+        canModifyProperties = privilegesInfo.canModifyProperties( currentNode );
+        isJcrNode = true;
+    } catch (e) {}
     var properties = resource.adaptTo(Packages.org.apache.sling.api.resource.ValueMap);
     if (!properties) {
         readonly = true;
         properties = Packages.org.apache.sling.api.resource.ResourceUtil.getValueMap(resource)
     }
-	var primaryNodeTypeId = "jcr:primaryType";
-	var primaryNodeType = properties.get(primaryNodeTypeId, Packages.java.lang.String);
-	if ( primaryNodeType ) {
-	%>		
-	<div class="edit_properties_container">
-		<h3>general</h3>
-		<div id="property_element_<%= primaryNodeTypeId %>" class="property_element">
-		<fieldset>
-			<label for="<%= primaryNodeTypeId %>"><%= primaryNodeTypeId %></label>
-			<%  
-			var primaryNodeTypes = session.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
-			if ( primaryNodeTypes.hasNext() ) { %>
-			<select class="prop_value protected" name ="<%= primaryNodeTypeId %>" id="<%= primaryNodeTypeId %>">
-				<% while ( primaryNodeTypes.hasNext() ) {
-					var nodeType = primaryNodeTypes.nextNodeType();
-					%>
-					<option <% if ( nodeType.getName().equals( primaryNodeType ) ) { %> selected <%}%>><%= nodeType.getName() %></option>
-				<% } %>
-			</select>				
-			<% } %>
-			</fieldset>
-		</div>
-	<%
-	}
-	
-	// var mixinTypes = resource.getMixinTypes();
-	var mixinTypesId = "jcr:mixinTypes";
-	var mixinTypes = properties.get( mixinTypesId, Packages.javax.jcr.Property );
-	if ( mixinTypes || canModifyProperties ) { %>
-		<h3>mixin types</h3>
-		<div id="property_element_<%= mixinTypesId %>" class="multivalued property_element">
-			<form id="properties_form_<%= mixinTypesId %>" action="<%= path %>" method="post">
-				<fieldset>
-					<label for="<%= mixinTypesId %>"><%= mixinTypesId %></label>
-					<%	
-					create_multivalueinput_for_type( mixinTypesId, Packages.javax.jcr.PropertyType.NAME, mixinTypes, false );
-					%>
-					<% if (canModifyProperties) { %>
-						<select id="<%= mixinTypesId %>_new_entry" >
-						<%
-							var mixinNodeTypes = session.getWorkspace().getNodeTypeManager().getMixinNodeTypes();
-							while ( mixinNodeTypes.hasNext() ) {
-								var nodeType = mixinNodeTypes.nextNodeType();
-						%>
-							<option><%= nodeType.getName() %></option>
-						<% } %>
-						</select>
-						<a href="#" onclick="add_property_entry('<%= mixinTypesId %>')" class="button">add</a>
-					<% } %>
-				</fieldset>
-			</form>
-		</div>
-	<%  
-	}
-	// sort properties
-	var propKeys = Packages.java.util.Arrays.asList( properties.keySet().toArray() );
-	Packages.java.util.Collections.sort( propKeys );
-	propKeys = propKeys.toArray();
-	if ( (propKeys.length > 0) || canModifyProperties ) 
-	{ 
+    var primaryNodeTypeId = "jcr:primaryType";
+    var primaryNodeType = properties.get(primaryNodeTypeId, Packages.java.lang.String);
+    if ( primaryNodeType ) {
+    %>      
+    <div class="edit_properties_container">
+        <h3>general</h3>
+        <div id="property_element_<%= primaryNodeTypeId %>" class="property_element">
+        <fieldset>
+            <label for="<%= primaryNodeTypeId %>"><%= primaryNodeTypeId %></label>
+            <%  
+            var primaryNodeTypes = session.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
+            if ( primaryNodeTypes.hasNext() ) { %>
+            <select class="prop_value protected" name ="<%= primaryNodeTypeId %>" id="<%= primaryNodeTypeId %>">
+                <% while ( primaryNodeTypes.hasNext() ) {
+                    var nodeType = primaryNodeTypes.nextNodeType();
+                    %>
+                    <option <% if ( nodeType.getName().equals( primaryNodeType ) ) { %> selected <%}%>><%= nodeType.getName() %></option>
+                <% } %>
+            </select>               
+            <% } %>
+            </fieldset>
+        </div>
+    <%
+    }
+    
+    // var mixinTypes = resource.getMixinTypes();
+    var mixinTypesId = "jcr:mixinTypes";
+    var mixinTypes = properties.get( mixinTypesId, Packages.javax.jcr.Property );
+    if ( mixinTypes || canModifyProperties ) { %>
+        <h3>mixin types</h3>
+        <div id="property_element_<%= mixinTypesId %>" class="multivalued property_element">
+            <form id="properties_form_<%= mixinTypesId %>" action="<%= path %>" method="post">
+                <fieldset>
+                    <label for="<%= mixinTypesId %>"><%= mixinTypesId %></label>
+                    <%  
+                    create_multivalueinput_for_type( mixinTypesId, Packages.javax.jcr.PropertyType.NAME, mixinTypes, false );
+                    %>
+                    <% if (canModifyProperties) { %>
+                        <select id="<%= mixinTypesId %>_new_entry" >
+                        <%
+                            var mixinNodeTypes = session.getWorkspace().getNodeTypeManager().getMixinNodeTypes();
+                            while ( mixinNodeTypes.hasNext() ) {
+                                var nodeType = mixinNodeTypes.nextNodeType();
+                        %>
+                            <option><%= nodeType.getName() %></option>
+                        <% } %>
+                        </select>
+                        <a href="#" onclick="add_property_entry('<%= mixinTypesId %>')" class="button">add</a>
+                    <% } %>
+                </fieldset>
+            </form>
+        </div>
+    <%  
+    }
+    // sort properties
+    var propKeys = Packages.java.util.Arrays.asList( properties.keySet().toArray() );
+    Packages.java.util.Collections.sort( propKeys );
+    propKeys = propKeys.toArray();
+    if ( (propKeys.length > 0) || canModifyProperties ) 
+    { 
 %>
-		<h3>properties</h3>
+        <h3>properties</h3>
 <%
-		for ( var idx in propKeys ) {
-			var id = propKeys[idx];
-			var isProperty = false;
-			var isMultivalueProperty = false;
-			var val = properties.get( id, Packages.javax.jcr.Property );
-			var type;
-			if ( val ) 
-			{
-				isProperty = true;
-				type = Packages.javax.jcr.PropertyType.nameFromValue( val.type );
-				isMultivalueProperty = val.isMultiple();
-			} 
-			else 
-			{
-				val = properties.get( id );
-				type = "String";
-			} 
-			if ( !id.equals( primaryNodeTypeId ) && !id.equals( mixinTypesId ) ) { %>
-			<div id="property_element_<%= id %>" class="<% if ( isMultivalueProperty ) {%> multivalued <% } %> property_element">
-			<form id="properties_form_<%= id %>" action="<%=path%>" method="post">
-				<fieldset>
-					<label for="<%= id %>"><%= id %> 
-					<% if (isProperty) { %>
-					[ <%= type %> <% if ( isMultivalueProperty ) {%>MULTIVALUE<% } %>]
-					<% } else { %>
-					[not a property!]
-					<% } %>
-					</label>
-					<% 
-					if ( isProperty )
-					{
-						if ( isMultivalueProperty ) 
-						{					
-							create_multivalueinput_for_type( id, val.type, val, true );
-						} else { 
-							if ( isProperty )
-							{
-								create_input_for_type( id, val.getType(), val, ( canModifyProperties && !val.getDefinition().isProtected() ), false  );
-							}
-						}
-					}	
-					else {					
-						// used to output: <input class="prop_value text" id="<%= id %>" name="<%= id %>" value="<%= val %>" />					
-					}
-					 
-			%>
-				<input name=":redirect" type="hidden" value="<%=request.getContextPath()%><%=path%>.explorer.html">
-				</fieldset>
-			</form>       	
+        for ( var idx in propKeys ) {
+            var id = propKeys[idx];
+            var isProperty = false;
+            var isMultivalueProperty = false;
+            var val = properties.get( id, Packages.javax.jcr.Property );
+            var type;
+            if ( val ) 
+            {
+                isProperty = true;
+                type = Packages.javax.jcr.PropertyType.nameFromValue( val.type );
+                isMultivalueProperty = val.isMultiple();
+            } 
+            else 
+            {
+                val = properties.get( id );
+                type = "String";
+            } 
+            if ( !id.equals( primaryNodeTypeId ) && !id.equals( mixinTypesId ) ) { %>
+            <div id="property_element_<%= id %>" class="<% if ( isMultivalueProperty ) {%> multivalued <% } %> property_element">
+            <form id="properties_form_<%= id %>" action="<%=path%>" method="post">
+                <fieldset>
+                    <label for="<%= id %>"><%= id %> 
+                    <% if (isProperty) { %>
+                    [ <%= type %> <% if ( isMultivalueProperty ) {%>MULTIVALUE<% } %>]
+                    <% } else { %>
+                    [not a property!]
+                    <% } %>
+                    </label>
+                    <% 
+                    if ( isProperty )
+                    {
+                        if ( isMultivalueProperty ) 
+                        {                   
+                            create_multivalueinput_for_type( id, val.type, val, true );
+                        } else { 
+                            if ( isProperty )
+                            {
+                                create_input_for_type( id, val.getType(), val, ( canModifyProperties && !val.getDefinition().isProtected() ), false  );
+                            }
+                        }
+                    }   
+                    else {                  
+                        // used to output: <input class="prop_value text" id="<%= id %>" name="<%= id %>" value="<%= val %>" />                 
+                    }
+                     
+            %>
+                <input name=":redirect" type="hidden" value="<%=request.getContextPath()%><%=path%>.explorer.html">
+                </fieldset>
+            </form>         
 
-		
-			<% if ( canModifyProperties && isProperty && !val.getDefinition().isProtected() ) { %>
-				<div class="edit_properties">
-				<% if (!isMultivalueProperty) { %>
-					<button class="button_update_property" onclick="update_property('<%= id %>'); return false;">update property</button>
-				<% } %>
-					<button class="button_delete_property" onclick="delete_property('<%= id %>'); return false;">delete property</button>
-				</div>			
-			<% } %>
-		  </div>
-		  
-		<% }
-		} // for
-	}
-	%>
-	</div>
-	<%
+        
+            <% if ( canModifyProperties && isProperty && !val.getDefinition().isProtected() ) { %>
+                <div class="edit_properties">
+                <% if (!isMultivalueProperty) { %>
+                    <button class="button_update_property" onclick="update_property('<%= id %>'); return false;">update property</button>
+                <% } %>
+                    <button class="button_delete_property" onclick="delete_property('<%= id %>'); return false;">delete property</button>
+                </div>          
+            <% } %>
+          </div>
+          
+        <% }
+        } // for
+    }
+    %>
+    </div>
+    <%
     if (!readonly && canModifyProperties ) {
     %>
-		<div class="blubb">
-		  <h3>add property</h3>
-		  <div class="property_element">
-		  <table class="propoerty_table">
-		  <thead class="smallLabel">
-		  <tr>
-		  <td>Name</td>
-		  <td>Multi?</td>
-		  <td>Type</td>
-		  <td colspan="2">Value</td>
-		  </tr>
-		  </thead>
-		  <tbody>
-		  <tr>
-			  <td><input id="expl_add_prop_name" type="text" class="text"/></td>
-			  <td><input id="expl_add_prop_multi" class="checkbox" type="checkbox"></td>
-			  <td>
-				  <select id="expl_add_prop_type">
-					<option>Name</option>
-					<option>String</option>
-					<option>Boolean</option>
-					<option>Date</option>
-					<option>Double</option>
-					<option>Long</option>
-					<option>Path</option>
-					<option>Reference</option>
-					<option>WeakReference</option>
-				  </select>
-			  </td>
-			  <td><div id="prop_value_div"><input id="expl_add_prop_value" type="text" class="text"></div></td>
-			  <td><a class="button" href="#" onclick="add_prop('<%=path%>');">add property</a></td>
-			  </tr>
-		  </tbody>
-		  </table>
-		  </div>
-		</div>
+        <div class="blubb">
+          <h3>add property</h3>
+          <div class="property_element">
+          <table class="propoerty_table">
+          <thead class="smallLabel">
+          <tr>
+          <td>Name</td>
+          <td>Multi?</td>
+          <td>Type</td>
+          <td colspan="2">Value</td>
+          </tr>
+          </thead>
+          <tbody>
+          <tr>
+              <td><input id="expl_add_prop_name" type="text" class="text"/></td>
+              <td><input id="expl_add_prop_multi" class="checkbox" type="checkbox"></td>
+              <td>
+                  <select id="expl_add_prop_type">
+                    <option>Name</option>
+                    <option>String</option>
+                    <option>Boolean</option>
+                    <option>Date</option>
+                    <option>Double</option>
+                    <option>Long</option>
+                    <option>Path</option>
+                    <option>Reference</option>
+                    <option>WeakReference</option>
+                  </select>
+              </td>
+              <td><div id="prop_value_div"><input id="expl_add_prop_value" type="text" class="text"></div></td>
+              <td><a class="button" href="#" onclick="add_prop('<%=path%>');">add property</a></td>
+              </tr>
+          </tbody>
+          </table>
+          </div>
+        </div>
 
     <%
     }
     %>
 
 <script type="text/javascript">
-	$(function() {
-		/* we are lacking the id, which is required to update_property
-		$("button.button_update_property").click( function(e) {
-			update_property();
-			return false;
-		});
-		*/
-		
-		$("#expl_add_prop_type").change( function (e) {
-			$("#prop_value_div").html( create_edit_field_for_type( 'expl_add_prop_value', $("#expl_add_prop_type").val() ) );
-		});
-		
-		// disable protected fields
-		$(".protected").attr("disabled", "disabled");
-	
-		$.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, $("#new_node_sling_resource_type").val() );},
-								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() {
+        /* we are lacking the id, which is required to update_property
+        $("button.button_update_property").click( function(e) {
+            update_property();
+            return false;
+        });
+        */
+        
+        $("#expl_add_prop_type").change( function (e) {
+            $("#prop_value_div").html( create_edit_field_for_type( 'expl_add_prop_value', $("#expl_add_prop_type").val() ) );
+        });
+        
+        // disable protected fields
+        $(".protected").attr("disabled", "disabled");
+    
+        $.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, $("#new_node_sling_resource_type").val() );},
+                                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;
+    };
 
-	// adding click handlers for "delete property" links (x)
-	function add_property_entry( id )
-	{				
-		var value = $("[id="+ id +"_new_entry]").val();
-		var li_html = '<li><input type="hidden" name="' 
-					+ id + '" value="' 
-					+ value + '" />'
-					+ value + ' <a href="#" class="button" onclick="$(this).parent().remove();update_property(\'' + id + '\');">delete</a></li>';
-		$("ul[id='" + id + "_entries']").append(li_html);
-		update_property( id );
-	}
+    // adding click handlers for "delete property" links (x)
+    function add_property_entry( id )
+    {               
+        var value = $("[id="+ id +"_new_entry]").val();
+        var li_html = '<li><input type="hidden" name="' 
+                    + id + '" value="' 
+                    + value + '" />'
+                    + value + ' <a href="#" class="button" onclick="$(this).parent().remove();update_property(\'' + id + '\');">delete</a></li>';
+        $("ul[id='" + id + "_entries']").append(li_html);
+        update_property( id );
+    }
 
-	// submit property
-	function update_property( id )
-	{
-		$.ajax({
-			url: '<%= path %>',
-			type: 'POST',
-			data: $("form[id='properties_form_"+id+"']" ).serialize(),
-			success: function( data, textStatus, xmlHttpRequest ) 
-					{
-						reload_properties();
-					},
-			error: function( xmlHttpRequest, textStatus, errorThrown ) 
-					{
-						show_error( xmlHttpRequest.responseText );
-					}
-		});
-	}
-	
-	function delete_property( id )
-	{
-		var params = {};
-		params[id + "@Delete"] = "delete";
-		$.ajax({
-			url: '<%= path %>',
-			type: 'POST',
-			data: params,
-			success: function( data, textStatus, xmlHttpRequest ) 
-					{
-						$("[id=property_element_" + id+"]").remove();
-						// todo: animate "Deleted"
-					},
-			error: function( xmlHttpRequest, textStatus, errorThrown ) 
-					{
-						show_error( xmlHttpRequest.responseText );
-					}
-		});
-	}
-			
-	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();
-		}
-		});
+    // submit property
+    function update_property( id )
+    {
+        $.ajax({
+            url: '<%= path %>',
+            type: 'POST',
+            data: $("form[id='properties_form_"+id+"']" ).serialize(),
+            success: function( data, textStatus, xmlHttpRequest ) 
+                    {
+                        reload_properties();
+                    },
+            error: function( xmlHttpRequest, textStatus, errorThrown ) 
+                    {
+                        show_error( xmlHttpRequest.responseText );
+                    }
+        });
+    }
+    
+    function delete_property( id )
+    {
+        var params = {};
+        params[id + "@Delete"] = "delete";
+        $.ajax({
+            url: '<%= path %>',
+            type: 'POST',
+            data: params,
+            success: function( data, textStatus, xmlHttpRequest ) 
+                    {
+                        $("[id=property_element_" + id+"]").remove();
+                        // todo: animate "Deleted"
+                    },
+            error: function( xmlHttpRequest, textStatus, errorThrown ) 
+                    {
+                        show_error( xmlHttpRequest.responseText );
+                    }
+        });
+    }
+            
+    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 : 			
-			%>
-			<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" class="checkbox" id="<%= id %>" <% if ( val.getBoolean() ) { %>checked<% } %> onchange="$('[id=<%= id %>_cb]').val( this.checked ? 'true' : 'false' );" <% if(!editable) { %> class="protected" disabled<%}%>>
-		<% 
-			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="<%= path %>" 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 
+    switch ( type ) { 
+        case Packages.javax.jcr.PropertyType.DATE :             
+            %>
+            <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" class="checkbox" id="<%= id %>" <% if ( val.getBoolean() ) { %>checked<% } %> onchange="$('[id=<%= id %>_cb]').val( this.checked ? 'true' : 'false' );" <% if(!editable) { %> class="protected" disabled<%}%>>
+        <% 
+            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="<%= path %>" 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 ) {
-	var typeStr = Packages.javax.jcr.PropertyType.nameFromValue( type );
+    var typeStr = Packages.javax.jcr.PropertyType.nameFromValue( type );
 %>
-	<input type="hidden" name="<%= id %>@TypeHint" value="<%= typeStr %>[]" /> 
-	<ul id="<%= id %>_entries">
-	<% 
-	if ( multivalue_property ) {
-		var editable = canModifyProperties && !multivalue_property.getDefinition().isProtected()
-		for ( var idx in multivalue_property.getValues() )
-		{ 
-			var entry = multivalue_property.getValues()[idx];	%>
-			<li>
-				<input type="hidden" name="<%= id %>" value="<%= entry.getString() %>" />
-				<%
-				switch (type)
-				{
-					case Packages.javax.jcr.PropertyType.REFERENCE :
-					case Packages.javax.jcr.PropertyType.WEAKREFERENCE :
-					case Packages.javax.jcr.PropertyType.PATH :
-						try {
-							var refNode = session.getNodeByIdentifier(entry.getQValue().getString());
-							%>
-				-&gt; <a href="#" onclick="skip_to('<%= refNode.getPath() %>');"><%= refNode.getPath() %> (<%= refNode.getIdentifier() %>)</a> 
+    <input type="hidden" name="<%= id %>@TypeHint" value="<%= typeStr %>[]" /> 
+    <ul id="<%= id %>_entries">
+    <% 
+    if ( multivalue_property ) {
+        var editable = canModifyProperties && !multivalue_property.getDefinition().isProtected()
+        for ( var idx in multivalue_property.getValues() )
+        { 
+            var entry = multivalue_property.getValues()[idx];   %>
+            <li>
+                <input type="hidden" name="<%= id %>" value="<%= entry.getString() %>" />
+                <%
+                switch (type)
+                {
+                    case Packages.javax.jcr.PropertyType.REFERENCE :
+                    case Packages.javax.jcr.PropertyType.WEAKREFERENCE :
+                    case Packages.javax.jcr.PropertyType.PATH :
+                        try {
+                            var refNode = session.getNodeByIdentifier(entry.getQValue().getString());
+                            %>
+                -&gt; <a href="#" onclick="skip_to('<%= refNode.getPath() %>');"><%= refNode.getPath() %> (<%= refNode.getIdentifier() %>)</a> 
  
-							<% 
-						} catch ( ex ) {
-						}
-						break;
-					default:
-				%>
-				<%= entry.getString() %> 
-				<% 
-				} // switch
-				%>
-				<% if ( editable ) { %>
-					<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", typeStr, '', true, true );
-			%>
-			<a href="#" onclick="add_property_entry('<%= id %>')" class="button">add</a>
-			<div class="clear"></div>
-	</div>	
-		<% 
+                            <% 
+                        } catch ( ex ) {
+                        }
+                        break;
+                    default:
+                %>
+                <%= entry.getString() %> 
+                <% 
+                } // switch
+                %>
+                <% if ( editable ) { %>
+                    <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", typeStr, '', true, true );
+            %>
+            <a href="#" onclick="add_property_entry('<%= id %>')" class="button">add</a>
+            <div class="clear"></div>
+    </div>  
+        <% 
 
-	}
+    }
 
 }
 %>
\ No newline at end of file

Modified: sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit/sling_redirect.esp
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit/sling_redirect.esp?rev=1085250&r1=1085249&r2=1085250&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit/sling_redirect.esp (original)
+++ sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/edit/sling_redirect.esp Fri Mar 25 04:18:18 2011
@@ -3,7 +3,7 @@ You are about to redirect to
 var target = '!! sling:target property missing !!';
 if ( currentNode.hasProperty('sling:target') )
 {
-	target = currentNode.getProperty('sling:target'); 
+    target = currentNode.getProperty('sling:target'); 
 }
 %>
 <%= target %>
\ No newline at end of file

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=1085250&r1=1085249&r2=1085250&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 Fri Mar 25 04:18:18 2011
@@ -25,106 +25,107 @@
 
 <title>Sling || JCR Explorer 1.0.0</title>
 
-	<link rel="stylesheet" href="<%= request.getContextPath() %>/libs/sling/explorer/css/explorer.css" type="text/css"/>
-	<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> 
+    <link rel="stylesheet" href="<%= request.getContextPath() %>/libs/sling/explorer/css/explorer.css" type="text/css"/>
+    <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>
 
 <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>&nbsp;<input type="text" class="" accesskey="u" name="j_username" id="j_username" />&nbsp;
-					<label for="j_password">Password:</label>&nbsp;<input type="password" accesskey="p" name="j_password" id="j_password" />&nbsp;
-				 	<button class="form-button" accesskey="l" id="do_login">Login</button>
-				</p>     
-			</fieldset>	
-			
-		</form>
-	</div>
-	
+    <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>&nbsp;<input type="text" class="" accesskey="u" name="j_username" id="j_username" />&nbsp;
+                    <label for="j_password">Password:</label>&nbsp;<input type="password" accesskey="p" name="j_password" id="j_password" />&nbsp;
+                    <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">
+        </div>
+        <div id="menu_logout" style="display:none">
           <strong id="menu_username"> ??? </strong> | <a href="#" id="do_logout">Logout</a>
-		</div>
+        </div>
     </div>          
 
-	<div id="expl_container">
+    <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"/>
+                <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" id="searchButton" 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 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" id="searchButton" 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">
@@ -132,16 +133,16 @@
                     </p>
                 </li>
             </ul>
-		</div>
+        </div>
 
-		<div id="expl_content">
-			content
+        <div id="expl_content">
+            content
         </div>
         <div class="clear"></div>
-	</div>
+    </div>
 
-		<div id="expl_footer">
-		<p id="logout" style="display:none">
+        <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>
@@ -151,44 +152,44 @@
            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();
+        </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',
@@ -197,46 +198,46 @@ Session user ID: <span id="sessionuserid
                             // 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 );
-							}
+                            {                            
+                                $("#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>	
+                    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=1085250&r1=1085249&r2=1085250&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 Fri Mar 25 04:18:18 2011
@@ -21,57 +21,57 @@
 <%
 if ( resource )
 {
-	var nodes = request.resourceResolver.listChildren( resource );
-	if ( nodes && 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;
+    var nodes = request.resourceResolver.listChildren( resource );
+    if ( nodes && 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;
 
-			var wsSepPos = path.indexOf(":/", 0);
-			if (wsSepPos != -1) {
-				path = path.substring(wsSepPos + 1);
-			}
+            var wsSepPos = path.indexOf(":/", 0);
+            if (wsSepPos != -1) {
+                path = path.substring(wsSepPos + 1);
+            }
 
-			path = path.substr(1);
-			// WARNING: have a look at explorer.js - duplicate code!
-			var id = path.replace(/\//g, "_");
-			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
-			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
-			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
-			id = id.replace(/\s/g, '_');// due to the css selectors
-			%>
-			<li>
-				<p id="<%= id %>">
-					<%
-						var resourceType = '';
-						var node = child.adaptTo(Packages.javax.jcr.Node);
-						if ( node && node.hasProperty( 'sling:resourceType' ) ) {
-							resourceType = node.getProperty('sling:resourceType');
-						}
-					%>
-					<a href="#" onclick="explorer_toggle('<%= path %>', '<%= resourceType %>')" ><%= name %></a>
-				</p>
-			  </li>
-			<%
-		} // while
-	%>
-	</ul>
-	<%
-	} // if (nodes.hasNext())
+            path = path.substr(1);
+            // WARNING: have a look at explorer.js - duplicate code!
+            var id = path.replace(/\//g, "_");
+            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
+            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
+            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
+            id = id.replace(/\s/g, '_');// due to the css selectors
+            %>
+            <li>
+                <p id="<%= id %>">
+                    <%
+                        var resourceType = '';
+                        var node = child.adaptTo(Packages.javax.jcr.Node);
+                        if ( node && node.hasProperty( 'sling:resourceType' ) ) {
+                            resourceType = node.getProperty('sling:resourceType');
+                        }
+                    %>
+                    <a href="#" onclick="explorer_toggle('<%= path %>', '<%= resourceType %>')" ><%= name %></a>
+                </p>
+              </li>
+            <%
+        } // while
+    %>
+    </ul>
+    <%
+    } // if (nodes.hasNext())
 } // if (resource)
 %>
\ No newline at end of file

Modified: 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=1085250&r1=1085249&r2=1085250&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/node.esp (original)
+++ sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/node.esp Fri Mar 25 04:18:18 2011
@@ -61,11 +61,11 @@
             </form>
         </div>
 <%
-	  }
-	  %>
-	  <div class="clear"></div>
+      }
+      %>
+      <div class="clear"></div>
 
-	  <%
+      <%
           }
       } catch ( e ) {
           // don't care
@@ -270,72 +270,72 @@
 </script>
 <% 
 function create_input_for_type( id, type, val, editable, omitName ) { 
-	switch ( type ) { 
-		case Packages.javax.jcr.PropertyType.DATE :                     
+    switch ( type ) { 
+        case Packages.javax.jcr.PropertyType.DATE :                     
 %>
     <form>
       <input class="prop_value text datepicker&lt;% if(!editable) { %&gt; protected&lt;%}%&gt;" <% if (!omitName) { %> name="<%= id %>" <% } %> id="<%= id %>" value="<%= dateFormatter.format( val.getDate().getTime() ) %>"> <%
                       break; 
-		case Packages.javax.jcr.PropertyType.BOOLEAN : 
+        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=&lt;%= id %&gt;_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();
+            break;
+        case Packages.javax.jcr.PropertyType.REFERENCE :
+        case Packages.javax.jcr.PropertyType.WEAKREFERENCE :
+        case Packages.javax.jcr.PropertyType.PATH :
+            try {
+                var refNode = val.getNode();
 %> -&gt; <a href="#" onclick="skip_to('&lt;%= refNode.getPath() %&gt;')"><%= refNode.getPath() %> (<%= refNode.getIdentifier() %>)</a> <input class="prop_value text &lt;% if(!editable) { %&gt; protected &lt;%}%&gt;" id="<%= id %>" <% if (!omitName) { %> name="<%= id %>" <% } %> value="<%= val %>"> <% 
-			} catch ( ex ) {}
-			break;
-		case Packages.javax.jcr.PropertyType.BINARY :
+            } 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 &lt;% if(!editable) { %&gt; protected &lt;%}%&gt;" id="<%= id %>" <% if (!omitName) { %> name="<%= id %>" <% } %> value="<%= val %>"> <% 
-				  break; 
-	} // switch 
+            break;
+        default: %> <input class="prop_value text &lt;% if(!editable) { %&gt; protected &lt;%}%&gt;" 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>
+    <input type="hidden" name="<%= id %>@TypeHint" value="<%= type %>[]">
+    </form>
     <ul id="<%= id %>_entries">
 <% 
-	if ( multivalue_property )
-	{
-		var editable = canModifyProperties && !multivalue_property.getDefinition().isProtected()
-		for ( var idx in multivalue_property.getValues() )
-		{ 
-			var entry = multivalue_property.getValues()[idx];
+    if ( multivalue_property )
+    {
+        var editable = canModifyProperties && !multivalue_property.getDefinition().isProtected()
+        for ( var idx in multivalue_property.getValues() )
+        { 
+            var entry = multivalue_property.getValues()[idx];
 %>
 <li><input type="hidden" name="<%= id %>" value="<%= entry.getString() %>">
-<%			
-			switch (type)
-			{
-				case Packages.javax.jcr.PropertyType.REFERENCE :
-				case Packages.javax.jcr.PropertyType.WEAKREFERENCE :
-				case Packages.javax.jcr.PropertyType.PATH :
-					try {
-						var refNode = entry.getNode();
+<%          
+            switch (type)
+            {
+                case Packages.javax.jcr.PropertyType.REFERENCE :
+                case Packages.javax.jcr.PropertyType.WEAKREFERENCE :
+                case Packages.javax.jcr.PropertyType.PATH :
+                    try {
+                        var refNode = entry.getNode();
 %> -&gt; <a href="#" onclick="skip_to('&lt;%= refNode.getPath() %&gt;')"><%= refNode.getPath() %> (<%= refNode.getIdentifier() %>)</a> <input class="prop_value text &lt;% if(!editable) { %&gt; protected &lt;%}%&gt;" id="<%= id %>" <% if (!include_add_field) { %> name="<%= id %>" <% } %> value="<%= entry %>"> <% 
-					} catch ( ex ) {}
-					break;
-				default:
+                    } catch ( ex ) {}
+                    break;
+                default:
 %>
-					<%= entry.getString() %> 
+                    <%= entry.getString() %> 
 <% 
-			} // switch
-			if ( editable ) 
-			{ 
+            } // switch
+            if ( editable ) 
+            { 
 %>
 <a href="#" class="button" onclick="$(this).parent().remove();update_property('&lt;%= id %&gt;');">delete</a> 
-<% 			
-			} // if 
+<%          
+            } // if 
 %></li>
 <% 
-		} // for
-	} // if ( multivalue_property ) 
+        } // for
+    } // if ( multivalue_property ) 
 %>
     </ul>
     <div class="addMultivalueproperty">

Modified: sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/search.esp
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/search.esp?rev=1085250&r1=1085249&r2=1085250&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/search.esp (original)
+++ sling/trunk/bundles/extensions/explorer/src/main/resources/libs/sling/servlet/default/explorer/search.esp Fri Mar 25 04:18:18 2011
@@ -27,144 +27,144 @@ var maxEntries = 100;
 var session = request.resourceResolver.adaptTo(Packages.javax.jcr.Session);
 if ( session )
 {
-	var expression = unescape(request.getParameter("expression"));
-	var language = request.getParameter("language");
-	var page = parseInt(request.getParameter("page") || 1);
-	var queryManager = session.getWorkspace().getQueryManager();
+    var expression = unescape(request.getParameter("expression"));
+    var language = request.getParameter("language");
+    var page = parseInt(request.getParameter("page") || 1);
+    var queryManager = session.getWorkspace().getQueryManager();
 %>
 <h3>Query results:</h3>
 <ul>
-<%	
-	var countExpression = expression; // must contain an 'order by' clause
-	var knownNumberOfHits = false;
-	if ( !countExpression.toLowerCase().match(/order\s*by/) )
-	{	
-		if ( language == 'JCR-SQL2' ) { 
-			countExpression += ' order by [jcr:score] desc'; 
-		}
-		if ( language == 'xpath' ) { 
-			countExpression += ' order by @jcr:score descending';
-		}
-	}
-	var overallEntryCount = 'unknown ';
-	var durationInMs = 'unknown ';
-	var results = null;
-	var start = new Date();
-	if ( countExpression.toLowerCase().match(/order\s*by/) )
-	{
-		var countQuery = queryManager.createQuery( countExpression , language );
-		results = countQuery.execute();
-		overallEntryCount = results.getRows().getSize();
-		knownNumberOfHits = (overallEntryCount != -1);
-		overallEntryCount = knownNumberOfHits ? overallEntryCount.toString() : 'unknown';
-	}
-	else
-	{
-		var query = queryManager.createQuery( expression , language );
-		results = query.execute();
-	}
+<%  
+    var countExpression = expression; // must contain an 'order by' clause
+    var knownNumberOfHits = false;
+    if ( !countExpression.toLowerCase().match(/order\s*by/) )
+    {   
+        if ( language == 'JCR-SQL2' ) { 
+            countExpression += ' order by [jcr:score] desc'; 
+        }
+        if ( language == 'xpath' ) { 
+            countExpression += ' order by @jcr:score descending';
+        }
+    }
+    var overallEntryCount = 'unknown ';
+    var durationInMs = 'unknown ';
+    var results = null;
+    var start = new Date();
+    if ( countExpression.toLowerCase().match(/order\s*by/) )
+    {
+        var countQuery = queryManager.createQuery( countExpression , language );
+        results = countQuery.execute();
+        overallEntryCount = results.getRows().getSize();
+        knownNumberOfHits = (overallEntryCount != -1);
+        overallEntryCount = knownNumberOfHits ? overallEntryCount.toString() : 'unknown';
+    }
+    else
+    {
+        var query = queryManager.createQuery( expression , language );
+        results = query.execute();
+    }
 
-	/* WE DON'T REPERFORM THE QUERY ANYMORE!
-	var query = queryManager.createQuery( expression, language );
-	if ( overallEntryCount != 'unknown')
-	{
-		query.setOffset( (page - 1) * entriesPerPage );
-		query.setLimit( entriesPerPage );
-	}
-	else
-	{
-		query.setLimit( maxEntries );
-	}
-	results = query.execute();
-	*/
-	
-	var count = 0;
-	var ri = results.getRows(); // RowIterator
-	try
-	{
-		ri.skip((page - 1) * entriesPerPage);
-		var end = new Date();
-		durationInMs = end.getTime() - start.getTime();
-	%>
-	<h4>Hits: <%= overallEntryCount %> (took <%= durationInMs %>ms)</h4>	
-	<%		
-		while ( ri.hasNext() && count < entriesPerPage ) {
-			var row = ri.nextRow(); // row
-			var score = row.getScore(); // double
-			var resourceType = '';
-			var node = row.getNode();
-			if ( node && node.hasProperty( 'sling:resourceType' ) ) {
-				resourceType = node.getProperty('sling:resourceType');
-			}
+    /* WE DON'T REPERFORM THE QUERY ANYMORE!
+    var query = queryManager.createQuery( expression, language );
+    if ( overallEntryCount != 'unknown')
+    {
+        query.setOffset( (page - 1) * entriesPerPage );
+        query.setLimit( entriesPerPage );
+    }
+    else
+    {
+        query.setLimit( maxEntries );
+    }
+    results = query.execute();
+    */
+    
+    var count = 0;
+    var ri = results.getRows(); // RowIterator
+    try
+    {
+        ri.skip((page - 1) * entriesPerPage);
+        var end = new Date();
+        durationInMs = end.getTime() - start.getTime();
+    %>
+    <h4>Hits: <%= overallEntryCount %> (took <%= durationInMs %>ms)</h4>    
+    <%      
+        while ( ri.hasNext() && count < entriesPerPage ) {
+            var row = ri.nextRow(); // row
+            var score = row.getScore(); // double
+            var resourceType = '';
+            var node = row.getNode();
+            if ( node && node.hasProperty( 'sling:resourceType' ) ) {
+                resourceType = node.getProperty('sling:resourceType');
+            }
 %>
 <li>
 <a href="#" onclick="skip_to('<%= row.getPath() %>', '<%= resourceType %>')"><%= row.getPath() %></a> (score: <%= score %>)
 </li>
-<%	    
-			count++;
-		} // while		
-	}
-	catch( noSuchElementException )
-	{
-	}
+<%      
+            count++;
+        } // while      
+    }
+    catch( noSuchElementException )
+    {
+    }
 
-	var moreToCome = (count == entriesPerPage);
-	var lastPage = 0;
-	if ( knownNumberOfHits )
-	{
-		lastPage = Math.round(overallEntryCount / entriesPerPage) + (((overallEntryCount % 10) < 5 && (overallEntryCount % 10) > 0)  ? 1 : 0);
-		moreToCome = ((lastPage > 0) && lastPage != page);
-	}
+    var moreToCome = (count == entriesPerPage);
+    var lastPage = 0;
+    if ( knownNumberOfHits )
+    {
+        lastPage = Math.round(overallEntryCount / entriesPerPage) + (((overallEntryCount % 10) < 5 && (overallEntryCount % 10) > 0)  ? 1 : 0);
+        moreToCome = ((lastPage > 0) && lastPage != page);
+    }
 
 %>
 </ul>
 <div id="page_navigation">
 <% 
-	if (page > 1) { 
+    if (page > 1) { 
 %>
-	<a href="#" class="button" id="first_page" title="first page">|&lt;</a> 
-	<a href="#" class="button" id="previous_page" title="previous page">
-	<%= ((page - 2) * entriesPerPage) + 1 %>..<%= ((page - 1) * entriesPerPage) %>
-	</a> 
+    <a href="#" class="button" id="first_page" title="first page">|&lt;</a> 
+    <a href="#" class="button" id="previous_page" title="previous page">
+    <%= ((page - 2) * entriesPerPage) + 1 %>..<%= ((page - 1) * entriesPerPage) %>
+    </a> 
 <script>
 $('#previous_page').click( function(e) {
-	search('<%= language %>', '<%= escape(expression) %>', <%= page - 1 %> );
+    search('<%= language %>', '<%= escape(expression) %>', <%= page - 1 %> );
 });
 $('#first_page').click( function(e) {
-	search('<%= language %>', '<%= escape(expression) %>', 1 );
+    search('<%= language %>', '<%= escape(expression) %>', 1 );
 });
-</script>	
+</script>   
 <% 
-	} // if (page > 1)
+    } // if (page > 1)
 %>
 
 <%= ((page - 1) * entriesPerPage) + 1 %>..<%= ((page - 1) * entriesPerPage) + count %>
 <% 
-	if ( moreToCome ) 
-	{		
+    if ( moreToCome ) 
+    {       
 %>
 <a href="#" class="button" id="next_page" title="next page">
 <%= (page * entriesPerPage) + 1 %>..<%= ((page + 1) * entriesPerPage) %>
 </a>
 <% 
-		if (lastPage > 0) { 
+        if (lastPage > 0) { 
 %>
 <a href="#" class="button" id="last_page">&gt;|</a>
 <% 
-		} 
+        } 
 %>
 </div>
 <script>
-	$('#next_page').click( function(e) {
-		search('<%= language %>', '<%= escape(expression) %>', <%= page + 1 %> );
-	});
-<% if (lastPage > 0) { %>	
-	$('#last_page').click( function(e) {
-		search('<%= language %>', '<%= escape(expression) %>', <%= lastPage %> );
-	});
+    $('#next_page').click( function(e) {
+        search('<%= language %>', '<%= escape(expression) %>', <%= page + 1 %> );
+    });
+<% if (lastPage > 0) { %>   
+    $('#last_page').click( function(e) {
+        search('<%= language %>', '<%= escape(expression) %>', <%= lastPage %> );
+    });
 <% } %>
 </script>
 <% 
-	} // if (moreToCome)
-} // if	
+    } // if (moreToCome)
+} // if 
 %>