PageRenderTime 44ms CodeModel.GetById 28ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/test/src/solidstack/hyperdb/schemas.slt

http://solidstack.googlecode.com/
Unknown | 37 lines | 36 code | 1 blank | 0 comment | 0 complexity | 8efa1e73a77f41c6b4636b99a3e039c4 MD5 | raw file
Possible License(s): Apache-2.0
 1<%@ template version="1.0" language="groovy" contentType="text/html; charset=UTF-8" %>
 2<%@ template import="solidstack.hyperdb.*" %>
 3<%
 4include( template: "/template", title: "Schemas", body: {
 5	def database = request.getParameter( "database" )
 6	def user = request.getParameter( "user" )
 7	def connections = session.getAttribute( "connections" )
 8	def connection = connections.getConnection( database, user )
 9	def schemas = Database.getSchemas( connection ).values();
10%>
11		<table id="tables">
12			<tr><th>Schema</th><th># tables</th><th># views</th></tr>
13<%		for( def schema : schemas ) { %>
14			<tr><td>${schema.name}</td><td>${schema.tableCount}</td><td>${schema.viewCount}</td></tr>
15<%		} %>
16		</table>
17<% } ) %>
18		<script>
19			function dataRowClick()
20			{
21				var schema = this.parentElement.cells[ 0 ].innerText
22				window.location = "schemas/" + schema + "/" + ( this.cellIndex == 1 ? "tables" : "views" )
23				return false
24			}
25			
26			walker( document.body,
27				function( node )
28				{
29					if( node instanceof HTMLTableRowElement )
30					{
31						node.cells[ 1 ].onclick = dataRowClick
32						node.cells[ 2 ].onclick = dataRowClick
33					}
34					return true
35				}
36			)
37		</script>