changeset 286:91be4027b2a8

Improve HTML of some tools. git-svn-id: https://luan-java.googlecode.com/svn/trunk@287 21e917c8-12df-6dd8-5cb6-c86387c605b9
author hugo.tech@gmail.com <hugo.tech@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Wed, 03 Dec 2014 02:26:19 +0000
parents 582e8db4cdb6
children 4d53e9fc1bd9
files dist/jars/luan-core-trunk.jar dist/jars/luan-logging-trunk.jar dist/jars/luan-lucene-trunk.jar dist/jars/luan-mail-trunk.jar dist/jars/luan-web-trunk.jar dist/scripts/build-luan.sh lucene/src/luan/modules/lucene/Web_search.luan web/src/luan/modules/web/web_run.luan web/src/luan/modules/web/web_shell.luan
diffstat 9 files changed, 105 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
Binary file dist/jars/luan-core-trunk.jar has changed
Binary file dist/jars/luan-logging-trunk.jar has changed
Binary file dist/jars/luan-lucene-trunk.jar has changed
Binary file dist/jars/luan-mail-trunk.jar has changed
Binary file dist/jars/luan-web-trunk.jar has changed
--- a/dist/scripts/build-luan.sh	Tue Dec 02 06:17:45 2014 +0000
+++ b/dist/scripts/build-luan.sh	Wed Dec 03 02:26:19 2014 +0000
@@ -24,9 +24,9 @@
 
 cd $LUAN_HOME
 SRC=logging/src
-#CLASSPATH=$LUAN_HOME/core/src:$LUAN_HOME/$SRC
-#for i in $LUAN_HOME/logging/ext/* ; do CLASSPATH=$CLASSPATH:$i ; done
-#javac -classpath $CLASSPATH `find $SRC -name *.java`
+CLASSPATH=$LUAN_HOME/core/src:$LUAN_HOME/$SRC
+for i in $LUAN_HOME/logging/ext/* ; do CLASSPATH=$CLASSPATH:$i ; done
+javac -classpath $CLASSPATH `find $SRC -name *.java`
 cd $SRC
 jar cvf $LUAN_HOME/dist/jars/luan-logging-$VERSION.jar `find . -name *.class -o -name *.luan`
 
--- a/lucene/src/luan/modules/lucene/Web_search.luan	Tue Dec 02 06:17:45 2014 +0000
+++ b/lucene/src/luan/modules/lucene/Web_search.luan	Wed Dec 03 02:26:19 2014 +0000
@@ -3,45 +3,70 @@
 import "luan:String"
 
 
+local function basic_style() %>
+	body {font-family:'Arial',sans-serif;font-size:16px}
+	input {padding:.5em;border-radius:10px;border:1px solid #ccc;font-size:16px}
+	input.btn {background:#3B619D;color:#FFF;padding:.5em 2em;font-size:20px}
+	h1 {font-weight:bold;font-size: 20px}
+	p {margin:1em 0 .2em}
+	span.label {min-width:100px;display:inline-block;text-align:right}
+	div.tip{color:#888;font-size:80%}
+	table.results {margin-top:2em;border-collapse:collapse;font-size:90%}
+	table.results th {background:#eee}
+	table.results th,table.results td {border-left:1px solid #bbb;padding:.4em}
+<% end
+
 local function form() %>
-<html>
-<body>
-<form method="post">
-<p>Query: <input name="query" size="60" /></p>
-<p>Rows: <input name="rows" value="20" /></p>
-<p>Sort: <input name="sort" size="60" /></p>
-<p><input type="submit" /></p>
-</form>
-</body>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>Lucene Query</title>
+		<style><% basic_style() %></style>
+	</head>
+	<body>
+		<h1>Lucene Query</h1>
+		<form name="form0" method="post">
+			<p>
+				<span class="label">Query:</span> <input name="query" size="60" />
+				<div class="tip"><span class="label"></span> Query examples: { type = 'user' }</div>
+			</p>
+			<p><span class="label">Max Rows:</span> <input name="rows" value="20" maxlength="5" onkeypress="return event.charCode >= 48 && event.charCode <= 57" style="width:3em"/></p>
+			<p><span class="label">Sort:</span> <input name="sort" size="60" /></p>
+			<p><input type="submit" class="btn"/></p>
+		</form>
+		<script>document.form0.query.focus();</script>
+	</body>
 </html>
 <% end
 
 
 local function result(query,sort,headers,table) %>
-<html>
-<body>
-<p>Query: <b><%=repr(query)%></b></p>
-<p>Sort: <b><%=repr(sort)%></b></p>
-<table border="1">
-<tr><th></th>
-<%
-for _, header in ipairs(headers) do
-	%><th><%=header%></th><%
-end
-%>
-</tr>
-<%
-for i, row in ipairs(table) do
-	%>
-	<tr><td><%=i%></td>
-	<%
-	for col in range(1,#headers) do
-		%><td><%= row[col] or "" %></td><%
-	end
-	%></tr><%
-end
-%>
-</body>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<style><% basic_style() %></style>
+	</head>
+	<body>
+		<h1>Lucene Query Results</h1>
+			<p><span class="label">Query:</span> <b><%=repr(query)%></b></p>
+			<p><span class="label">Sort:</span> <b><%=repr(sort)%></b></p>
+			<table class="results">
+				<tr>
+					<th></th>
+					<% for _, header in ipairs(headers) do %>
+						<th><%=header%></th>
+					<% end %>
+				</tr>
+				<% for i, row in ipairs(table) do %>
+					<tr>
+						<td><%=i%></td>
+						<% for col in range(1, #headers) do %>
+							<td><%= row[col] or "" %></td>
+						<% end %>
+					</tr>
+				<% end %>
+			</table>
+	</body>
 </html>
 <% end
 
--- a/web/src/luan/modules/web/web_run.luan	Tue Dec 02 06:17:45 2014 +0000
+++ b/web/src/luan/modules/web/web_run.luan	Wed Dec 03 02:26:19 2014 +0000
@@ -18,17 +18,31 @@
 	end
 end
 
+local function basic_style() %>
+	body {font-family:'Arial',sans-serif;font-size:16px;text-align:center}
+	input,textarea {padding:.5em;border-radius:10px;border:1px solid #ccc;font-size:16px;display:block}
+	textarea {width:50%;margin:0 auto}
+	input.btn {background:#3B619D;color:#FFF;padding:.5em 2em;font-size:20px;margin:.5em auto}
+	h1 {font-weight:bold;font-size: 20px}
+	p {margin:1em 0 .2em}
+<% end
+
 local function form() %>
-<html>
-<body>
-<form method="post">
-<input type="hidden" name="content_type" value="text/plain" />
-<input type="submit" value="Execute Luan code below">
-<br />
-<textarea name="code" rows="30" cols="90" wrap="off">
-</textarea>
-</form>
-</body>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>Run Luan Code</title>
+		<style><% basic_style() %></style>
+	</head>
+	<body>
+		<h1>Run Luan Code</h1>
+		<form name="form0" method="post">
+			<input type="hidden" name="content_type" value="text/plain" />
+			<textarea name="code" rows="20" cols="90" wrap="off"></textarea>
+			<input type="submit" class="btn" value="Execute Luan Code"/>
+		</form>
+		<script>document.form0.code.focus();</script>
+	</body>
 </html>
 <% end
 
--- a/web/src/luan/modules/web/web_shell.luan	Tue Dec 02 06:17:45 2014 +0000
+++ b/web/src/luan/modules/web/web_shell.luan	Wed Dec 03 02:26:19 2014 +0000
@@ -33,24 +33,33 @@
 
 	local write = Http.response.text_writer().write
 	write(%>
-<html>
-<title>Luan Shell</title>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>Luan Shell</title>
+		<style>
+			body {font-family:'Arial',sans-serif;font-size:16px}
+			input {padding:.5em;border-radius:10px;border:1px solid #ccc;font-size:16px}
+			input.btn {background:#3B619D;color:#FFF;padding:.3em 0;font-size:20px;min-width:4em;}
+			h1 {font-weight:bold;font-size: 20px}
+			p {margin:1em 0 .2em}
+		</style>
+	</head>
 	<body>
-		<p>This is a command shell.  Enter commands below.
+		<h1>Luan Shell</h1>
+		<p>This is a command shell.  Enter commands below.</p>
 		<pre><%)
 		for _,v in ipairs(history) do
 			write(v)
 		end
 		write(%></pre>
-		<form name='theForm' method='post'>
-			% <input name='cmd' size=60>
-			<input type=submit value=run>
-			<input type=submit name=clear value=clear>
+		<form name='form0' method='post'>
+			% <input name='cmd' size="60">
+			<input type="submit" class="btn" value="run">
+			<input type="submit" class="btn" name="clear" value="clear">
 		</form>
-		
-		<script>document.theForm.cmd.focus();</script>
-		
-		<p/>
+
+		<script>document.form0.cmd.focus();</script>
 	</body>
 </html>
 <%)