Strabon

changeset 616:398331eac419

Fix auto scroll for all views (except download).
Navigation bar expands the selected group automatically.
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Sat Sep 29 09:37:21 2012 +0300 (2012-09-29)
parents 32af1c2fc1da
children 62e39ced8771
files endpoint/WebContent/query.jsp
line diff
     1.1 --- a/endpoint/WebContent/query.jsp	Sat Sep 29 00:06:06 2012 +0300
     1.2 +++ b/endpoint/WebContent/query.jsp	Sat Sep 29 09:37:21 2012 +0300
     1.3 @@ -27,15 +27,49 @@
     1.4  			return true;
     1.5  		}
     1.6  	</script>
     1.7 -<%
     1.8 +	<%
     1.9 +	// get query parameter or attribute (the attribute comes from ConnectionBean)
    1.10 +	String query = "";
    1.11 +	if (request.getParameter("query") != null) {
    1.12 +		query = request.getParameter("query");
    1.13 +		
    1.14 +	} else if (request.getAttribute("query") != null) {
    1.15 +		query = (String) request.getAttribute("query");
    1.16 +		
    1.17 +	}
    1.18 +	
    1.19 +	if ("null".equals(query)) {
    1.20 +		query = "";
    1.21 +	}
    1.22 +	
    1.23 +	// get format parameter or attribute (the attribute comes from ConnectionBean)
    1.24 +	String selFormat = "";
    1.25 +	if (request.getParameter("format") != null) {
    1.26 +		selFormat = request.getParameter("format");
    1.27 +		
    1.28 +	} else if (request.getAttribute("format") != null) {
    1.29 +		selFormat = (String) request.getAttribute("format");
    1.30 +		
    1.31 +	}
    1.32 +		
    1.33 +	// get handle parameter or attribute (the attribute comes from ConnectionBean)
    1.34 +	String handle = "";
    1.35 +	if (request.getParameter("handle") != null) {
    1.36 +		handle = request.getParameter("handle");
    1.37 +		
    1.38 +	} else if (request.getAttribute("handle") != null) {
    1.39 +		handle = (String) request.getAttribute("handle");
    1.40 +		
    1.41 +	}
    1.42 +
    1.43  	if (request.getAttribute("pathToKML") != null) {
    1.44  	if ("map_local".equals(request.getAttribute("handle"))) {
    1.45  %>
    1.46  	<script type="text/javascript" src="js/geoxml3-kmz.js"></script>
    1.47  	<script type="text/javascript" src="js/ProjectedOverlay.js"></script>	
    1.48 -	<%
    1.49 -			}
    1.50 -		%>
    1.51 +<%
    1.52 +	}
    1.53 +%>
    1.54  	<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
    1.55  	<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    1.56  	<script type="text/javascript">
    1.57 @@ -63,29 +97,24 @@
    1.58  			ctaLayer.setMap(map);
    1.59  		<%}%>
    1.60  		
    1.61 -		
    1.62 -		
    1.63 -		<%if ("map".equals(request.getAttribute("handle")) || "map_local".equals(request.getAttribute("handle")) || "plain".equals(request.getAttribute("handle"))) {%>		
    1.64 +		<%if ("map".equals(request.getAttribute("handle")) || "map_local".equals(request.getAttribute("handle"))) {%>	
    1.65  			$('html, body').animate({
    1.66  				scrollTop: $("#divResultsStart").offset().top
    1.67  			}, 1000);
    1.68  		<%}%>
    1.69  		}
    1.70 -	</script> 
    1.71 +	</script>
    1.72  	<%	} else { %>
    1.73   	<script type="text/javascript">
    1.74  		function initialize() {
    1.75 -	<%
    1.76 -	if ("plain".equals(request.getAttribute("handle")) ||
    1.77 -			(("".equals(request.getAttribute("handle")) || request.getAttribute("handle") == null) &&
    1.78 -			 (!"".equals(request.getAttribute("format")) || request.getAttribute("format") != null))
    1.79 -		) {
    1.80 +	<%	
    1.81 +	if (query != "" || selFormat != "" || handle != "") {
    1.82  	%>
    1.83  	$('html, body').animate({
    1.84  		scrollTop: $("#divResultsStart").offset().top
    1.85  	}, 1000);
    1.86  	<%}%>
    1.87 -	}
    1.88 +		}
    1.89  	</script>
    1.90  	<%}%>
    1.91  
    1.92 @@ -98,7 +127,8 @@
    1.93  			// Accordion
    1.94  			$("#accordion").accordion({ 
    1.95  				header: "h3",
    1.96 -				fillSpace: true
    1.97 +				fillSpace: true,
    1.98 +				navigation: true
    1.99  			});
   1.100  			//hover states on the static widgets
   1.101  			$('#dialog_link, ul#icons li').hover(
   1.102 @@ -147,6 +177,7 @@
   1.103  							
   1.104  							Iterator <StrabonBeanWrapperConfiguration> entryListIterator = strabonWrapper.getEntries().iterator();
   1.105  							boolean first = true;
   1.106 +							String hash = "";
   1.107  							while(entryListIterator.hasNext())
   1.108  							{
   1.109  								StrabonBeanWrapperConfiguration entry = entryListIterator.next();
   1.110 @@ -162,17 +193,21 @@
   1.111  									
   1.112  									String label=entry.getLabel();
   1.113  									String bean=entry.getBean();
   1.114 -									String style = "";
   1.115 +									String style = "", href = "";
   1.116  									if (bean == null) {
   1.117 -										bean = "#";
   1.118 +										hash = new Integer(Math.abs(label.hashCode())).toString();
   1.119 +										href="href=\"#"+hash+"\"";
   1.120  									} else {
   1.121 +										hash = new Integer(Math.abs(label.hashCode()*bean.hashCode())).toString();
   1.122 +										href = "href=\"" +bean + "#"+ hash+"\"";
   1.123  										style = "class=\"navText\"";
   1.124  									}
   1.125 +									
   1.126  									%>
   1.127 -									<div><h3><a <%=style%> href="<%=bean%>"><%=label%></a></h3><div>
   1.128 +									<div><h3><a <%=style%> <%=href%>><%=label%></a></h3><div>
   1.129  									<%
   1.130  								} else {
   1.131 -									String href="\""+URLEncoder.encode(entry.getBean(),"utf-8")+"?view=HTML&handle="+entry.getHandle()+"&query="+URLEncoder.encode(entry.getStatement(),"utf-8")+"&format="+URLEncoder.encode(entry.getFormat(),"utf-8")+"\"";
   1.132 +									String href="\""+URLEncoder.encode(entry.getBean(),"utf-8")+"?view=HTML&handle="+entry.getHandle()+"&query="+URLEncoder.encode(entry.getStatement(),"utf-8")+"&format="+URLEncoder.encode(entry.getFormat(),"utf-8")+(hash == "" ? "" : "#" + hash)+"\"";
   1.133  									String title="\""+entry.getTitle()+"\"";
   1.134  									String label=entry.getLabel();
   1.135  				%>
   1.136 @@ -203,41 +238,6 @@
   1.137  <%}%>
   1.138  <tr>
   1.139  <td id="output">stSPARQL Query:</td>
   1.140 -<%
   1.141 -	// get query parameter or attribute (the attribute comes from ConnectionBean)
   1.142 -	String query = "";
   1.143 -	if (request.getParameter("query") != null) {
   1.144 -		query = request.getParameter("query");
   1.145 -		
   1.146 -	} else if (request.getAttribute("query") != null) {
   1.147 -		query = (String) request.getAttribute("query");
   1.148 -		
   1.149 -	}
   1.150 -	
   1.151 -	if ("null".equals(query)) {
   1.152 -		query = "";
   1.153 -	}
   1.154 -	
   1.155 -	// get format parameter or attribute (the attribute comes from ConnectionBean)
   1.156 -	String selFormat = "";
   1.157 -	if (request.getParameter("format") != null) {
   1.158 -		selFormat = request.getParameter("format");
   1.159 -		
   1.160 -	} else if (request.getAttribute("format") != null) {
   1.161 -		selFormat = (String) request.getAttribute("format");
   1.162 -		
   1.163 -	}
   1.164 -		
   1.165 -	// get handle parameter or attribute (the attribute comes from ConnectionBean)
   1.166 -	String handle = "";
   1.167 -	if (request.getParameter("handle") != null) {
   1.168 -		handle = request.getParameter("handle");
   1.169 -		
   1.170 -	} else if (request.getAttribute("handle") != null) {
   1.171 -		handle = (String) request.getAttribute("handle");
   1.172 -		
   1.173 -	}
   1.174 -%>
   1.175  <td id="output"><textarea name="query" title="pose your query/update here" rows="15" cols="100"><%=query%></textarea></td>
   1.176  </tr>
   1.177  <tr>