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/02 14:42:45 UTC

svn commit: r991918 - in /sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling: explorer/css/explorer.css explorer/js/explorer.js servlet/default/explorer/edit.esp servlet/default/explorer/explorer.esp servlet/default/explorer/search.esp

Author: mykee
Date: Thu Sep  2 12:42:45 2010
New Revision: 991918

URL: http://svn.apache.org/viewvc?rev=991918&view=rev
Log:
SLING-1713 jQuery JCR Explorer - step 1 - improvements

Modified:
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit.esp
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
    sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/search.esp

Modified: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css?rev=991918&r1=991917&r2=991918&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css (original)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/css/explorer.css Thu Sep  2 12:42:45 2010
@@ -42,7 +42,7 @@ html, body 
 
 html /* shows always scrollbar in Firefox*/
 {
-	overflow-y: scroll;
+	overflow: visible;
 }	
 	
 body
@@ -50,9 +50,10 @@ body
 	font-size: 13px;
 	color: #545D66;
 	margin: 0;
-	padding: 0 0 20px 0;
+	padding: 0;
 	text-align: center;
 	font-family: Verdana, Arial, Helvetica, sans-serif;
+	overflow: hidden;
 }
 
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
@@ -81,14 +82,24 @@ h2
 
 h3
 {
-	font-size: 16px;
-	line-height: /**/;
+	font-size: 14px;
+	background-color: #527EA3;
+	color: #F6FBFE;
+	padding: 5px 10px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
+	margin: 0 0 10px 0;
 }
 
 h4, h5, h6
 {
-	font-size: 13px;
-	line-height: /**/;
+	font-size: 12px;
+	background-color: #a4bcd0;
+	color: #FFFFFF;
+	padding: 5px 10px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
+	margin: 0 0 10px 0;
 }
 
 b, strong, b *, strong *
@@ -103,7 +114,8 @@ i, em, i *, em *
 
 ul, ol
 {
-	margin: 10px 0 10px 35px;
+	clear: both;
+/*	margin: 10px 0 10px 35px; */
 }
 
 ul
@@ -116,7 +128,7 @@ ol
 
 li
 {
-	margin: 3px 0;
+	margin: 5px 0;
 }
 
 p
@@ -150,7 +162,7 @@ a:hover
 	text-decoration: underline;
 }
 
-a:focus, input:focus, button:focus
+a:focus, input:focus, button:focus, :focus
 {
 	outline: none;
 }
@@ -164,6 +176,8 @@ button, .button
 	color: #354F66;
 	font-weight: bold;
 	width: auto!important;
+	-moz-border-radius: 10px;
+	border-radius: 10px;
 }
 
 input.button
@@ -171,8 +185,16 @@ input.button
 	padding: 1px 3px;
 }
 
+
+a.button
+{
+	color: #354F66;
+	text-decoration: none;
+}
+
 button:hover, .button:hover
 {
+	color: #354F66;
 	background-color: #BDD2E5;
 	border: 2px solid #354F66;
 	padding: 1px 4px;
@@ -278,7 +300,7 @@ form fieldset p
 		
 label
 {
-	width: 200px;
+	width: 25%;
 	float: left;
 	display: inline;
 }
@@ -319,21 +341,28 @@ input[type=hidden], input.hidden
 	top: -100px;
 }
 
+input[type=disabled], input.disabled, select[type=disabled], select.disabled, .protected
+{
+	background-color: #CCCCCC;
+}
+
 input.text
 {
+	float: left;
 	display: inline;
-	width: 200px;
+	width: 65%;
+	margin: 0 5px 0 5%;
 }
 
-input.checkbox, input.radio
+input.checkbox, input.radio, input[type=checkbox], input[type=radio]
 {
 	float: none;
 	border: none;
 	background-color: transparent;
-	height: 12px;
-	width: 12px;
+	height: 16px!important;
+	width: 16px!important;
 	padding: 0;
-	position: absolute;
+	margin: 2px 2px 2px 5%!important;
 }
 
 #newsletter input.checkbox
@@ -351,7 +380,11 @@ input.checkbox	
 
 select
 {
+	float: left;
 	display: inline;
+	width: 65%;
+	margin: 0 5px 0 5%;
+	padding: 1px 2px;
 }
 
 textarea
@@ -431,7 +464,7 @@ form#login-form fieldset p
 	margin: 10px 20px;
 	font-size: 11px;
 	background-color: #f6fbfe;
-	border: 2px solid #bdd2e5;
+	border: 1px solid #bdd2e5;
 	-moz-border-radius: 5px;
 	border-radius: 5px;
 	padding: 5px 7px;
@@ -439,23 +472,27 @@ form#login-form fieldset p
 
 
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
-/* --- Query Dialog  ---*/
+/* --- Query Search Dialog  ---*/
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
 
 #query_container
 {
 	clear: both;
 	margin: 20px;
-	border: 2px solid #527EA3;
-	-moz-border-radius: 3px;
-	border-radius: 3px;
+	border: 1px solid #527EA3;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
 	background-color: #F6FBFE;
 }
 
 #expl_search
 {
-	padding: 10px;
-	background-color: #F6FBFE;
+	margin: 10px;
+}
+
+#expl_search form
+{
+	height: 90px;
 }
 
 #show_query_dialog
@@ -463,16 +500,27 @@ form#login-form fieldset p
 	background-color: transparent;
 	line-height: normal;
 	border: none;     
+	float: left;
+	display: inline;
 	overflow: visible; /* Fix for IE */
 }
 
+.foundQueries
+{
+	float: left;
+	display: inline;
+	margin: 8px 0 0 50px;
+	font-size: 10px;
+}
+
 button#show_query_dialog
 {
 	font-weight: normal;
 	text-decoration: underline;
 	width: 80px;
 	height: 25px;
-	margin: 0px 0px 0px 0px;
+	margin: 0px 0px 0px 5px;
+	padding: 0px 0px 1px 18px;
 	background: url(../img/query_bg.png);
 	background-repeat: no-repeat;
 	background-color: #F6FBFE;
@@ -480,8 +528,7 @@ button#show_query_dialog
 	height: 25px;
 	width: 100%;
 	display: block;
-	padding: 0px 0px 1px 18px;
-	font-size: 10px;
+	font-size: 13px;
 	text-decoration: none;
 	text-align: left;
 }
@@ -489,9 +536,31 @@ button#show_query_dialog
 button#show_query_dialog.query_open
 {
 	background-position: 8px 1px;
-	border-bottom: 1px solid #BDD2E5;
 }
 
+#sql_search_result h4
+{
+	margin-left: -40px;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Page Navigation  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#page_navigation
+{
+	margin: 20px 0;
+	font-size: 10px;
+}
+
+#page_navigation a
+{
+	margin-right: 5px;	
+}
+
+
+
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
 /* --- Main Layout - Header / Logo / Content / Footer  ---*/
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
@@ -521,34 +590,41 @@ button#show_query_dialog.query_open
 
 #expl_sidebar
 {
-	border: 2px solid #527EA3;
-	-moz-border-radius: 3px;
-	border-radius: 3px;
+	border: 1px solid #527EA3;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
 	width: 340px;
 	float: left;
 	display: inline;
 	padding-bottom: 20px;
-	min-height: 600px;
 	background-color: #F6FBFE;
+	overflow: auto;
 }
 
 #expl_content
 {
 	margin: 0 0 0 354px;
-	border: 2px solid #527EA3;
-	-moz-border-radius: 3px;
-	border-radius: 3px;
+	border: 1px solid #527EA3;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
 	padding: 20px;
 	background-color: #F6FBFE;
+	overflow: auto;
 }
 
 #expl_footer
 {
-	margin: 20px 20px 0 20px;
+	height: 20px;
+	margin: 20px;
 	clear: both;
 	font-size: 11px;
 }
 
+#expl_footer p 
+{
+	margin: 0;
+}
+
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
 /* --- Sidebar Explorer  ---*/
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
@@ -579,7 +655,7 @@ button#show_query_dialog.query_open
 
 #expl_sidebar li.branch
 {
-	border-bottom: 0px;
+	border-bottom: none;
 }
 
 #expl_sidebar li.empty
@@ -600,16 +676,18 @@ button#show_query_dialog.query_open
 
 #expl_sidebar li p a
 {
+	color: #545D66;
 	display: block;
 	padding: 2px 5px;
 	text-decoration: none;
 	border: 1px solid #F6FBFE;
-	-moz-border-radius: 3px;
-	border-radius: 3px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
 }
 
 #expl_sidebar li p a:hover
 {
+	color: #545D66;
 	border: 1px solid #BDD2E5;
 }
 
@@ -626,22 +704,23 @@ button#show_query_dialog.query_open
 	padding: 2px 5px;
 	text-decoration: none;
 	border: 1px solid #354F66;
-	-moz-border-radius: 3px;
-	border-radius: 3px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
 	background-color: #527EA3;
-	color: #BDD2E5;
+	color: #FFFFFF;
 }
 
 #expl_sidebar li p.selected a:hover
 {
 	color: #FFFFFF;
+	background-color: #83a3be;
 }
 
 #expl_sidebar li ul
 {
 	border-top: 1px dotted black;
-	margin-left: -1em;
-	padding-left: 2em;
+	margin-left: -10px;
+	padding-left: 18px;
 }
 
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
@@ -661,30 +740,133 @@ button#show_query_dialog.query_open
 /* ################################################################# */
 
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
-/* --- Properties  ---*/
+/* --- Header  ---*/
 /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
 
-.edit_properties_container
+#expl_content_header h2
 {
-	border-top: 1px dotted #354F66;
-	margin: 30px 0 0 0;
-	padding: 10px 0;
+	float: left;
+	display: inline;
 }
 
-.edit_properties_container form fieldset ul#multiyvalueproperty
+
+#expl_content_header form.deleteNote
 {
-	margin: 0 0 0 313px;
-	padding: 0;
+	float: right;
+	display: inline;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Properties  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+.edit_properties_container
+{
+	margin: 10px 0 0 0;
+	padding: 10px 0;
 }
 
 .add_property
 {
-	margin: 0 10px 0 300px;
 }
 
 .property_element
 {
 	padding: 10px;
 	border: 1px solid #BDD2E5;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
 	margin: 0 0 10px 0;
+}
+
+.edit_properties
+{
+	margin: 20px 0 0 30%;
+}
+
+.saveAs
+{
+	float: left;
+	display: inline;
+	margin-left: 5%;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Multivalue Properties  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+.multivalued ul
+{
+	width: 66%;
+	float: left;
+	display: inline;
+	margin-left: 5%;
+	clear: none;
+	padding: 0 0 0 15px;
+}
+
+.addMultivalueproperty
+{
+	clear: both;
+	margin: 0 0 0 30%;
+}
+
+.addMultivalueproperty input,
+.addMultivalueproperty select
+{
+	width: 88%;
+	margin-left: 0;
+}
+
+.addMultivalueproperty a.button
+{
+	float: left;
+	display: inline;
+	margin-top: 2px;
+}
+
+.multivalued ul li
+{
+	padding: 3px 5px 5px 5px;
+}
+
+.multivalued ul li a.button
+{
+	float: right;
+	display: inline;
+}
+
+.multivalued ul li:hover
+{
+	-moz-border-radius: 5px;
+	border-radius: 5px;
+	background-color: #BDD2E5;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Propoerty Table  ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+table.propoerty_table
+{
+	border-collapse: separate;
+	border-spacing: 0;
+	table-layout: fixed;
+	width: 100%;
+}
+
+table.propoerty_table td 
+{
+	text-align: left;
+	vertical-align: top;
+}
+
+table.propoerty_table td input,
+table.propoerty_table td select
+{
+	margin: 0;
+	width: 90%;
 }
\ No newline at end of file

Modified: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js?rev=991918&r1=991917&r2=991918&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js (original)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/explorer/js/explorer.js Thu Sep  2 12:42:45 2010
@@ -42,15 +42,35 @@ init_load = function(path, resourceType)
 }
 
 /** toggle a node in the menu */
-explorer_toggle = function(path, resourceType) {
+explorer_toggle = function( path, resourceType ) {
+  var id = path_2_id( path ); // replacing / with _
+  var is_open = $('p#'+id+'>a').hasClass('open');
+  
+  load_props("/" + path);
+  
+  if (is_open){
+    //remove children
+    $('p#'+id).parent().find('ul').each(function(){
+      $(this).empty();
+      this.parentNode.removeChild( this )
+    });
+    $('p#'+id+">a").removeClass('open');  // closed
+    $('p#'+id).parent().removeClass('branch'); // remove css class    
+  } else {
+    load_branch(path);
+  }
+}
+
+/** NOT IN USE: cached toggling - subtree is cached **/
+explorer_toggle2 = function( path, resourceType ) {
 	var id = path_2_id( path ); // replacing / with _
 	var is_open = $('p#' + id + '>a').hasClass('open');
 
 	load_props("/" + path, resourceType);
 
 	var subtree = $('ul', $('p#' + id).parent());
-	if (is_open) {
-		if (subtree.length != 0) // should always resolve to true...
+	if ( is_open ) {
+		if ( subtree.length != 0 ) // should always resolve to true...
 		{
 			subtree.hide();
 		}
@@ -70,7 +90,7 @@ explorer_toggle = function(path, resourc
 /** load branch/subtree **/
 load_branch = function( path, callback ) {
 	if (path != '') {
-		var id = path_2_id( path ); // replacing / with _
+		var id = path_2_id( path );
 		$('p#' + id + ">a").removeAttr('href'); // remove onclick
 
 		// fetch children
@@ -87,25 +107,34 @@ load_branch = function( path, callback )
 	}
 }
 
-load_props = function(path, resourceType) {
-	var id = path_2_id( path ); // replacing / with _
-	//id = id.replace(/^_/, ""); // remove trailing _
+var currentPath = null;
+var currentResourceType = null;
+load_props = function( path, resourceType ) {
+	// check whether currently selected node is on 'path'
+	//var currently_selected_node = $('#expl_content').data( "currently_selected_node" );
+	//if (currently_selected_node && path == currently_selected_node) return;
+	
+	$('#expl_content').data("currently_selected_node", path);
+	
+	var id = path_2_id( path );
 	if ($('p#' + id))
 	{
 		$('p', $('#expl_sidebar')).removeClass('selected'); // deselect all
 		$('p[id="' + id + '"]').addClass('selected'); // select the current node
 	}
-	else
-	{
-		alert('p#' + id);
-	}
 	$.get(path + ".explorer.edit."+ (resourceType == null ? '' : (resourceType.replace(':','_') + '.') ) + "html", function(data) {
-		if (data.length > 0) {
-			$('#expl_content').html(data);
+		if ( data.length > 0 ) {
+			$('#expl_content').html( data );
+			currentPath = path;
+			currentResourceType = resourceType;
 		}
 	});
 }
 
+reload_properties = function() {
+	load_props(currentPath, currentResourceType);
+}
+
 add_prop = function(node) {
 	var name = $('#expl_add_prop_name').attr('value');
 	var type = $('#expl_add_prop_type').val();
@@ -119,7 +148,8 @@ add_prop = function(node) {
 	params[name + '@TypeHint'] = type;
 	params[name] = value;
 	$.post(node, params, function(data) {
-		window.location = node + '.explorer.html';
+		reload_properties();
+		// window.location = node + '.explorer.html';
 	});
 }
 
@@ -127,6 +157,7 @@ search = function(language, expression, 
 	// search and load search results
 	$.get("/.explorer.search.html", { "language" : language, "expression" : expression, "page" : page }, function(data) {
 		$('#sql_search_result').html(data);
+		adjust_height();
 	});
 }
 
@@ -165,3 +196,24 @@ path_2_id = function(path) {
 	id = id.replace(/\]/g, '_');// due to the css selectors
 	return id;
 }
+
+update_credentials = function() {
+	var info = Sling.getSessionInfo();
+	if ( info )
+	{
+		document.getElementById("username").innerHTML = info.userID;
+		document.getElementById("workspace").innerHTML = info.workspace;
+		document.getElementById("menu_username").innerHTML = info.userID;
+	}
+	if ( info && info.authType ) { 	
+	  document.getElementById("login").style.display="none";
+	  document.getElementById("logout").style.display="block";
+	  document.getElementById("menu_login").style.display="none";
+	  document.getElementById("menu_logout").style.display="block";
+	} else {	
+	  document.getElementById("login").style.display="block";
+	  document.getElementById("logout").style.display="none";
+	  document.getElementById("menu_login").style.display="block";
+	  document.getElementById("menu_logout").style.display="none";
+	}
+}

Modified: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit.esp?rev=991918&r1=991917&r2=991918&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit.esp (original)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/edit.esp Thu Sep  2 12:42:45 2010
@@ -22,6 +22,7 @@
 <%
     var path = resource.path;
     var readonly = false;    
+
     var session = request.resourceResolver.adaptTo(Packages.javax.jcr.Session);
     if (session)
     {
@@ -36,20 +37,25 @@
 		isJcrNode = true;
 	} catch (e) {}
 %>
-<h2><%= Packages.org.apache.sling.api.resource.ResourceUtil.getName(resource) %></h2>
+	<div id="expl_content_header">
+	<h2><%= Packages.org.apache.sling.api.resource.ResourceUtil.getName( resource ) %></h2>
+	<form class="deleteNote" action="<%=path%>" method="post">
+	  <input name=":operation" type="hidden" value="delete">
+	  <input name=":redirect" type="hidden" value="<%= Packages.org.apache.sling.api.resource.ResourceUtil.getParent(resource) %>.explorer.html">
+	  <input type="submit" class="button" value="delete this node">
+	</form>
+	<div class="clear"></div>
+</div>
+  
 <p><a href="<%= path %>.explorer.html"><%=path%></a> <%if(isJcrNode){%>(JCR identifier: <%= currentNode.getIdentifier() %>) <%}%> </p>
     <%
     try {
         if ( session ) { // currentNode && 
             session.checkPermission(path, "remove");
             %>
-<div>
-  <form action="<%=path%>" method="post">
-  <input name=":operation" type="hidden" value="delete">
-  <input name=":redirect" type="hidden" value="<%= Packages.org.apache.sling.api.resource.ResourceUtil.getParent(resource) %>.explorer.html">
-  <input type="submit" class="button" value="delete this node">
-  </form>
-</div>
+
+
+
 
             <%
         }
@@ -58,151 +64,136 @@
     }
     %>
 
-<div class="edit_properties_container">
-  <h3>properties</h3>
+
   <%
   
-    var props = resource.adaptTo(Packages.org.apache.sling.api.resource.PersistableValueMap);
-    if (!props) {
+    var properties = resource.adaptTo(Packages.org.apache.sling.api.resource.ValueMap);
+    if (!properties) {
         readonly = true;
-        props = Packages.org.apache.sling.api.resource.ResourceUtil.getValueMap(resource)
+        properties = Packages.org.apache.sling.api.resource.ResourceUtil.getValueMap(resource)
     }
-  
-    var propKeys = props.keySet().toArray();
-    for (var idx in propKeys) {
-        var id = propKeys[idx];
-        var val = props.get(id, Packages.javax.jcr.Property);
-        var type;
-		var isProperty = false;
-		var isMultivalueProperty = false;
-
-        if ( val ) 
-		{
-			isProperty = true;
-            type = Packages.javax.jcr.PropertyType.nameFromValue( val.type );
-			isMultivalueProperty = val.isMultiple();
-        } 
-		else 
-		{
-            val = props.get( id );
-            type = "String";
-        }
-
-        %>
-		<div id="property_element_<%= id %>" class="property_element">
-        <form id="properties_form_<%= id %>" action="<%=path%>" method="post">
-			<fieldset>
-				<label for="<%= id %>"><%= id %> [ <%= type %> <% if ( isMultivalueProperty ) {%>MULTIVALUE<% } %>] </label>
-				<% if ( isMultivalueProperty ) 
-				{ %>			
-					<input type="hidden" name="<%= id %>@TypeHint" value="<%= type %>[]" /> 
-					<ul id="<%= id %>_entries">
-					<% 
-					for ( var idx in val.getValues() )
-					{ 
-						var entry = val.getValues()[idx];	%>
-						<li>
-							<input type="hidden" name="<%= id %>" value="<%= entry.getString() %>" />
-							<%= entry.getString() %> 
-							<% if ( canModifyProperties && !val.getDefinition().isProtected() ) { %>
-							<a href="#" onclick="$(this).parent().remove();update_property('<%= id %>');">x</a>
-							<% } %>
-						</li>
-					<% 
-					} 
+	var primaryNodeTypeId = "jcr:primaryType";
+	var primaryNodeType = properties.get(primaryNodeTypeId, Packages.javax.jcr.Property);
+	if ( primaryNodeType ) {
+	%>		
+	<div class="edit_properties_container">
+		<h3>general</h3>
+		<div id="property_element_<%= primaryNodeTypeId %>" class="property_element">
+		<fieldset>
+			<label for="<%= primaryNodeTypeId %>"><%= primaryNodeTypeId %> [ <%= Packages.javax.jcr.PropertyType.nameFromValue( primaryNodeType.type ) %>] </label>
+			<%  
+			var primaryNodeTypes = session.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
+			if ( primaryNodeTypes.hasNext() ) { %>
+			<select class="prop_value protected" name ="<%= primaryNodeTypeId %>" id="<%= primaryNodeTypeId %>">
+				<% while ( primaryNodeTypes.hasNext() ) {
+					var primaryNodeType = primaryNodeTypes.nextNodeType();
 					%>
-					</ul>
-					<% if ( canModifyProperties && !val.getDefinition().isProtected() ) { %>
-						<input id="<%= id %>_new_entry" type="text" class="text add_property" /><a href="#" onclick="add_property_entry('<%= id %>')" class="button">add</a>
-					<% } %>
-			
-				<% 
-				} else { %>
-	            <% if ( id.equals( "jcr:primaryType" ) ) { %>            	
-	                <%  var primaryNodeTypes = session.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
-	                	if ( primaryNodeTypes.hasNext() ) { %>
-					    <select class="prop_value" name ="<%= id %>" id="<%= id %>">
-					    	<% while ( primaryNodeTypes.hasNext() ) {
-					    		var primaryNodeType = primaryNodeTypes.nextNodeType();
-					    		%>
-					    		<option <% if ( primaryNodeType.getName().equals( val.toString() ) ) { %> selected <%}%>><%=primaryNodeType.getName()%></option>
-					    	<% } %>
-					    </select>
-				    <% } %>
-	            <% } 
-				else 
-				{ 
-					if ( isProperty )
-					{
-						switch ( val.getType() ) { 
-							case Packages.javax.jcr.PropertyType.DATE : %>
-								<input  class="prop_value text datepicker" name="<%= id %>" id="<%= id %>" value="<%= val %>" />
-							<%
-							break; 
-							case Packages.javax.jcr.PropertyType.BOOLEAN : %>
-								<input type="hidden" name="<%= id %>" id="<%= id %>_cb" value="<%= val %>" >
-								<input type="checkbox" id="<%= id %>" <% if ( val.getBoolean() ) { %>checked<% } %> onchange="$('#<%= 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();
-									var resourceType = '';
-									/*
-									var node = refNode.adaptTo(Packages.javax.jcr.Node);
-									if ( node && node.hasProperty( 'sling:resourceType' ) ) {
-										resourceType = node.getProperty('sling:resourceType');
-									}
-									*/
-							%>
-								-> <a href="#" onclick="skip_to('<%= refNode.getPath() %>', '<%= resourceType %>')"><%= refNode.getPath() %> (<%= refNode.getIdentifier() %>)</a><input class="prop_value text" id="<%= id %>" name="<%= id %>" value="<%= val %>" />
-							<% 
-								} catch ( ex ) {}
-								break;
-							default: %>
-								<input class="prop_value text" id="<%= id %>" name="<%= id %>" value="<%= val %>" />							
-							<% 
-								break; 
-						} // switch 
-					}
-					else {
+					<option <% if ( primaryNodeType.getName().equals( primaryNodeType.toString() ) ) { %> selected <%}%>><%= primaryNodeType.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, "Name", mixinTypes, false );
 					%>
-						<input class="prop_value text" id="<%= id %>" name="<%= id %>" value="<%= val %>" /> [not a property!]
-					<%
-					}
+					<% 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>
+	<%  
+	}	
+    var propKeys = properties.keySet().toArray();
+	if ( (propKeys.length > 0) || canModifyProperties ) { %>
+		<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();
 			} 
-		%>
-			<input name=":redirect" type="hidden" value="<%=path%>.explorer.html">
-			</fieldset>
-        </form>       	
-
-	
-        <% if ( canModifyProperties && isProperty && !val.getDefinition().isProtected() ) { %>
-			<div class="edit_properties">
-				<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>  
+			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 %> [ <%= type %> <% if ( isMultivalueProperty ) {%>MULTIVALUE<% } %>] </label>
+					<% if ( isMultivalueProperty ) 
+					{  
+						create_multivalueinput_for_type( id, type, val, true );
+					} else { 
+						if ( isProperty )
+						{
+							create_input_for_type( id, val.getType(), val, ( canModifyProperties && !val.getDefinition().isProtected() ), false  );
+						}
+						else {
+						%>
+							<input class="prop_value text" id="<%= id %>" name="<%= id %>" value="<%= val %>" /> [not a property!]
+						<%
+						}
+					} 
+			%>
+				<input name=":redirect" type="hidden" value="<%=path%>.explorer.html">
+				</fieldset>
+			</form>       	
 
-        <%
-    } // for
-    %>
-</div>
-	<div id="mixintypes">
-		<h3>mixin types...still to come</h3>
+		
+			<% 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) {
+    if (!readonly && canModifyProperties ) {
     %>
-		<div >
-		  <h3>add property</h3>
-		  <table>
+		<div class="blubb">
+		  <h4>add property</h4>
+		  <div class="property_element">
+		  <table class="propoerty_table">
 		  <thead class="smallLabel">
 		  <tr>
 		  <td>Name</td>
@@ -214,7 +205,7 @@
 		  <tbody>
 		  <tr>
 			  <td><input id="expl_add_prop_name" type="text" class="text"/></td>
-			  <td><input id="expl_add_prop_multi" type="checkbox"></td>
+			  <td><input id="expl_add_prop_multi" class="checkbox" type="checkbox"></td>
 			  <td>
 				  <select id="expl_add_prop_type">
 					<option>Name</option>
@@ -233,13 +224,11 @@
 			  </tr>
 		  </tbody>
 		  </table>
+		  </div>
 		</div>
 
     <%
     }
-    %>
-   
-    <%
     if (session) {
         try {       
           session.checkPermission(path, "add_node");
@@ -247,7 +236,8 @@
 <div >
   <h3>add new sub-node</h3>
   <form action="<%=path%>/*" method="post">
-  <table>
+  <div class="property_element">
+  <table class="propoerty_table">
   <thead class="smallLabel">
   <tr>
   <td>Name hint</td>
@@ -282,6 +272,7 @@
   </tr>
   </tbody>
   </table>
+  </div>
   </form>
 </div>
 
@@ -304,6 +295,9 @@
 		$("#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',
@@ -346,7 +340,7 @@
 			case 'Boolean' :
 				prop_val_input = '<input type="hidden" name="' 
 						+ field_name + '" id="'
-						+ field_name + '" value="false"><input type="checkbox" onchange="$(\'#'
+						+ field_name + '" value="false"><input class="checkbox" type="checkbox" onchange="$(\'#'
 						+ field_name + '\').val(this.checked ? \'true\' : \'false\');">';
 				break;
 			case 'Date' :
@@ -363,21 +357,23 @@
 	// adding click handlers for "delete property" links (x)
 	function add_property_entry( id )
 	{				
-		var value = $("input:text[id="+ id +"_new_entry]").val();
+		var value = $("[id="+ id +"_new_entry]").val();
 		var li_html = '<li><input type="hidden" name="' 
 					+ id + '" value="' 
 					+ value + '" />'
-					+ value + ' <a href="#" onclick="$(this).parent().remove();">x</a></li>';
+					+ 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);
+		update_property( id );
 	}
 
+	// submit property
 	function update_property( id )
 	{
 		$.post('<%= path %>', 
-			$('#properties_form_'+id).serialize(), 
+			$("form[id='properties_form_"+id+"']" ).serialize(), 
 			function( data ) {
 				// todo: animate "Saved"
+				reload_properties();
 		} );
 	}
 	
@@ -389,22 +385,22 @@
 			params, 
 			function( data ) {
 				// todo: success? if yes...
-				$("#property_element_" + id).remove();
+				$("[id=property_element_" + id+"]").remove();
 				// todo: animate "Deleted"
 		} );
 	}
 			
 	function decorate_datepicker() {
-		$(".datepicker").datetimebox({
+		$(".datepicker:not(.protected)").datetimebox({
 		showOn: 'both',
 		buttonImageOnly: true,
-		buttonImage: 'calendar.gif',
+		buttonImage: '/libs/sling/explorer/img/calendar.gif',
 		buttonText: 'Calendar',
 		dateFormat: 'yy-mm-dd hh:ii',
 		changeYear: true,
 		changeMonth: true,
 		closeText: 'Confirm',
-		closeImage: 'calendar_close.gif',
+		closeImage: '/libs/sling/explorer/img/calendar.gif',
 		timeText: 'Time (hh:mm): ',
 		prevText: 'Previous',
 		nextText: 'Next',
@@ -428,4 +424,79 @@
 		});
 }
 </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 (!omitName) { %> name="<%= id %>" <% } %> id="<%= id %>" value="<%= val %>" />
+		<%
+		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(!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();
+				var resourceType = '';
+				/*
+				var node = refNode.adaptTo(Packages.javax.jcr.Node);
+				if ( node && node.hasProperty( 'sling:resourceType' ) ) {
+					resourceType = node.getProperty('sling:resourceType');
+				}
+				*/
+		%>
+			-> <a href="#" onclick="skip_to('<%= refNode.getPath() %>', '<%= resourceType %>')"><%= 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 ) {
+%>
+	<input type="hidden" name="<%= id %>@TypeHint" value="<%= type %>[]" /> 
+	<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>	
+		<% 
+
+	}
+
+}
+%>
\ No newline at end of file

Modified: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp?rev=991918&r1=991917&r2=991918&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp (original)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/explorer.esp Thu Sep  2 12:42:45 2010
@@ -64,82 +64,13 @@ catch (ex) {  }
 						
 			<fieldset>			
 				<p>
-					<label for="j_username">Username:</label>&nbsp;<input type="text" class="text" accesskey="u" name="j_username" id="j_username" />&nbsp;
+					<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>
-		 
-		<script type="text/javascript">
-		// <![CDATA[
-			$( function() {		
-				// query - sliding window
-				$("button#show_query_dialog").click(function () {
-					$('button#show_query_dialog').toggleClass('query_open');
-					$("#expl_search").slideToggle("slow");
-				});
-				
-				
-				// login - sliding window
-				$("a#show_login_dialog").click(function () {
-					$('a#show_login_dialog').toggleClass('login_open');
-					$("#login-dialog").slideToggle("slow");
-				});
-				
-				$('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");
-								update_credentials();
-							}
-							else
-							{
-								// failed to login!
-							}
-					});
-					return false;
-				});
-				
-				$('a#do_logout').click( function(e) {
-					// ajax logout
-					$.get( '/system/sling/logout.html', function(data) { 
-						update_credentials();
-					} );
-				});
-				
-				update_credentials();
-			});
-			
-			function update_credentials()
-			{		
-				var info = Sling.getSessionInfo();
-				document.getElementById("username").innerHTML = info.userID;
-				document.getElementById("workspace").innerHTML = info.workspace;
-				document.getElementById("menu_username").innerHTML = info.userID;
-				
-				if ("anonymous" == info.userID) {
-				  // anonymous, assume not logged int
-				  document.getElementById("login").style.display="block";
-				  document.getElementById("logout").style.display="none";
-				  document.getElementById("menu_login").style.display="block";
-				  document.getElementById("menu_logout").style.display="none";
-				} else {
-				  document.getElementById("login").style.display="none";
-				  document.getElementById("logout").style.display="block";
-				  document.getElementById("menu_login").style.display="none";
-				  document.getElementById("menu_logout").style.display="block";
-				}
-			}
-		// ]]>
-		</script>
-	
 	</div>
 	
     <div class="menu">
@@ -155,11 +86,12 @@ catch (ex) {  }
           <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>
+            </a><!-- <span id="height"></span> -->
           </div>
 	
 		<div id="query_container">	
-			<button id="show_query_dialog">Query</button>
+			<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>
@@ -181,20 +113,21 @@ catch (ex) {  }
 								} // 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;" /> 
-					</p>
-					
+						<br class="clear" />
+					</p>					
 				</form>
-				<div id="sql_search_result">
-				</div>
+				<div id="sql_search_result"></div>
 			</div>
 		</div>
 
@@ -209,8 +142,7 @@ catch (ex) {  }
 
 		<div id="expl_content">
 			content
-		</div>
-		
+		</div>		
 		<div class="clear"></div>
 	
 	</div>
@@ -218,10 +150,7 @@ catch (ex) {  }
 		<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>. To login with a different
-           username (use <em>admin/admin</em> to be allowed to write to the
-           repository), follow <a href="system/sling/logout"
-           title="Click to Logout">this link</a> to logout first.
+           workspace <b id="workspace">????</b>.
         </p>
         
         <p id="login" style="display:none">
@@ -229,16 +158,77 @@ catch (ex) {  }
            to be allowed to write to the repository), follow
            <a href="system/sling/login" title="Click to Login">this link</a>.
         </p>
-        
-        <script type="text/javascript">
+<!--		
+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() {
+				// 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();
 			});
-        </script>
-		  Note that this explorer is still <b>experimental</b>
-		  - 
-		  <a href="http://svn.apache.org/repos/asf/sling/trunk/contrib/explorers/jquery" target="_new">patches</a> are welcome!
-		</div>
-	</div>	
+			
+			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>

Modified: sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/search.esp
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/search.esp?rev=991918&r1=991917&r2=991918&view=diff
==============================================================================
--- sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/search.esp (original)
+++ sling/trunk/contrib/explorers/jquery/src/main/resources/libs/sling/servlet/default/explorer/search.esp Thu Sep  2 12:42:45 2010
@@ -31,7 +31,7 @@ if ( session )
 	var page = parseInt(request.getParameter("page") || 1);
 	var queryManager = session.getWorkspace().getQueryManager();
 %>
-Query results:
+<h3>Query results:</h3>
 <ul>
 <%	
 	var countExpression = expression; // must contain an 'order by' clause
@@ -57,15 +57,19 @@ Query results:
 		}
 	}
 	var overallEntryCount = 'unknown';
+	var durationInMs = 'unknown';
 	if ( countExpression.toLowerCase().match(/order\s*by/) )
 	{
-		var countQuery = queryManager.createQuery( countExpression , language );  
+		var countQuery = queryManager.createQuery( countExpression , language );
+		var start = new Date();
 		var results = countQuery.execute();
+		var end = new Date();
+		var durationInMs = end.getTime() - start.getTime();
 		overallEntryCount = results.getRows().getSize();
 		knownNumberOfHits = true;
 	}
 	%>
-	<br/>Hits: <%= overallEntryCount %><br/>
+	<h4>Hits: <%= overallEntryCount %> (took <%= durationInMs %>ms)</h4>
 	<%
 	
 	var query = queryManager.createQuery( expression, language ); 
@@ -108,8 +112,8 @@ Query results:
 </ul>
 <div id="page_navigation">
 <% if (page > 1) { %>
-	<a href="#" id="first_page" title="first page">|&lt;</a> 
-	<a href="#" id="previous_page" title="previous page">
+	<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>
@@ -123,11 +127,11 @@ $('#first_page').click( function(e) {
 <% } %>
 <%= ((page - 1) * entriesPerPage) + 1 %>..<%= ((page - 1) * entriesPerPage) + count %>
 <% if ( moreToCome ) { %>
-<a href="#" id="next_page" title="next page">
+<a href="#" class="button" id="next_page" title="next page">
 <%= (page * entriesPerPage) + 1 %>..<%= ((page + 1) * entriesPerPage) %>
 </a>
 <% if (lastPage) { %>
-<a href="#" id="last_page">&gt;|</a>
+<a href="#" class="button" id="last_page">&gt;|</a>
 <% } %>
 </div>
 <script>