[sword-svn] r261 - trunk/webapp/examples

scribe at www.crosswire.org scribe at www.crosswire.org
Thu Sep 28 13:11:49 MST 2006


Author: scribe
Date: 2006-09-28 13:11:47 -0700 (Thu, 28 Sep 2006)
New Revision: 261

Added:
   trunk/webapp/examples/liddellscott.jsp
   trunk/webapp/examples/parsevs.jsp
Modified:
   trunk/webapp/examples/search.jsp
   trunk/webapp/examples/suggest.jsp
Log:
updated examples


Added: trunk/webapp/examples/liddellscott.jsp
===================================================================
--- trunk/webapp/examples/liddellscott.jsp	2006-07-10 23:21:30 UTC (rev 260)
+++ trunk/webapp/examples/liddellscott.jsp	2006-09-28 20:11:47 UTC (rev 261)
@@ -0,0 +1,12 @@
+<html>
+<body>
+
+<h1>Liddell/Scott lookup from Perseus</h1>
+
+<form name="vsForm" action="../fetchdata.jsp">
+   <input type="hidden" name="mod" value="betacode" />
+   Lexicon Key: <input type="text" name="key" size="80" value="γένος" /> <br/>
+	<input type="submit" value="go" title="lookup />
+</form>
+</body>
+</html>

Added: trunk/webapp/examples/parsevs.jsp
===================================================================
--- trunk/webapp/examples/parsevs.jsp	2006-07-10 23:21:30 UTC (rev 260)
+++ trunk/webapp/examples/parsevs.jsp	2006-09-28 20:11:47 UTC (rev 261)
@@ -0,0 +1,62 @@
+<%@ page import="java.io.*" %>
+<%@ page import="java.util.Hashtable" %>
+<%
+
+String util = "/usr/bin/vs2osisref";
+String vs = request.getParameter("vs");
+
+
+
+%>
+
+
+<h1>Adhoc verse reference to OSIS reference</h1>
+
+<form name="vsForm" action="">
+   Adhoc text: <input type="text" name="vs" size="80" value="<%=(vs != null)?vs:""%>" /> <br/>
+	<input type="submit" value="go" title="Search by keyword or phrase" />
+</form>
+
+Result:<br/><br/>
+
+<%
+if (vs != null) {
+	int result = runCommand(new String[] {util, vs}, out, true, true);
+}
+%>
+
+<%!
+
+static Object writeSemephore = new Object();
+static Hashtable ltoks = new Hashtable();
+
+int runCommand(String command[], Writer result, boolean html, boolean canonize) {
+	int retVal = -1;
+	try {
+//result.write("running command:");
+//for (int i = 0; i < command.length; i++)
+//	result.write("["+command[i]+"]");
+//result.flush();
+//return 0;
+		java.lang.Process p = Runtime.getRuntime().exec(command);
+
+		InputStream is = p.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader input = new BufferedReader(isr);
+
+		String line;
+		while ((line = input.readLine()) != null) {
+            		if (canonize) {
+				line = org.crosswire.utils.HTTPUtils.canonize(line);
+			}
+			result.write(line + ((!html) ? "\n ":"<br>"));
+		}
+		retVal = p.waitFor();
+	}
+	catch (Exception e) {e.printStackTrace();}
+	return retVal;
+}
+
+
+%>
+

Modified: trunk/webapp/examples/search.jsp
===================================================================
--- trunk/webapp/examples/search.jsp	2006-07-10 23:21:30 UTC (rev 260)
+++ trunk/webapp/examples/search.jsp	2006-09-28 20:11:47 UTC (rev 261)
@@ -9,7 +9,7 @@
 
 <%
 	SWMgr mgr = SwordOrb.getSWMgrInstance(request);
-	SWModule book = mgr.getModuleByName("NASB");
+	SWModule book = mgr.getModuleByName("ASV");
 %>
 
 <html>
@@ -26,7 +26,7 @@
 	SearchHit[] results = book.search(searchTerm, searchType, searchOptions, searchRange);
 %>
 
-<p> There are <%= results.length %> results searching for "<%= searchTerm %>" in <%= book.getName() %></p>
+<p> There are <%= results.length %> results searching for "<%= searchTerm %>" in the <%= book.getDescription() %> (<%= book.getName() %>)</p>
 <table border="1">
 <tr><th>Reference</th><th>Text</th></tr>
 

Modified: trunk/webapp/examples/suggest.jsp
===================================================================
--- trunk/webapp/examples/suggest.jsp	2006-07-10 23:21:30 UTC (rev 260)
+++ trunk/webapp/examples/suggest.jsp	2006-09-28 20:11:47 UTC (rev 261)
@@ -106,6 +106,7 @@
 <body>
 
 <h1>SWORDWeb suggest Example</h1>
+<h2>This is experimental and doesn't work right yet.</h2>
 
 <form name="suggestForm" action="">
   <select name="modName">




More information about the sword-cvs mailing list