[sword-svn] r371 - trunk/webapp/examples
scribe at crosswire.org
scribe at crosswire.org
Sun Jun 20 23:22:59 MST 2010
Author: scribe
Date: 2010-06-20 23:22:59 -0700 (Sun, 20 Jun 2010)
New Revision: 371
Modified:
trunk/webapp/examples/parsevs.jsp
Log:
added more features to parsevs
Modified: trunk/webapp/examples/parsevs.jsp
===================================================================
--- trunk/webapp/examples/parsevs.jsp 2010-06-21 06:21:12 UTC (rev 370)
+++ trunk/webapp/examples/parsevs.jsp 2010-06-21 06:22:59 UTC (rev 371)
@@ -1,27 +1,61 @@
+<%@ page
+ language="java"
+ contentType="text/html;charset=utf-8"
+%>
<%@ page import="java.io.*" %>
<%@ page import="java.util.Hashtable" %>
+<%@ page import="org.crosswire.sword.orb.*" %>
+
<%
+ SWMgr mgr = SwordOrb.getSWMgrInstance(request);
String util = "/usr/bin/vs2osisref";
+String util2 = "/usr/bin/parsekey";
String vs = request.getParameter("vs");
+String locale = request.getParameter("lo");
+String context = request.getParameter("co");
+if (vs == null) vs = "";
+if (locale == null) locale = "en";
+if (context == null) context = "gen.1.1";
+vs = new String(vs.getBytes("iso8859-1"), "UTF-8");
+context = new String(context.getBytes("iso8859-1"), "UTF-8");
-
%>
<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/>
+<table>
+ <tr><td>Adhoc text:</td><td><input type="text" name="vs" size="80" value="<%=vs%>" /></td></tr>
+ <tr><td>Context:</td><td><input type="text" name="co" size="80" value="<%=context%>" /></td></tr>
+ <tr><td>Locale: first</td><td>
+ <select name="lo">
+<%
+ String[] locales = mgr.getAvailableLocales();
+ for (int i = 0; i < locales.length; i++) {
+%>
+ <option value="<%= locales[i]%>" <%= locales[i].equals(locale) ? "selected=\"selected\"":"" %>><%=locales[i]%></option>
+<%
+ }
+ %>
+ </select> (then fallback to "en")</td></tr>
+</table>
<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);
+if (vs != null && vs.length() > 0) {
+ int result = 0;
+%>
+<br/><h3>Verse List:</h3><br/>
+<%
+ result = runCommand(new String[] {util2, vs, locale, "KJV", context}, out, true, true);
+%>
+<br/><h3>OSIS Reference:</h3><br/>
+<%
+ result = runCommand(new String[] {util, vs, context, locale}, out, true, true);
}
%>
@@ -46,6 +80,7 @@
String line;
while ((line = input.readLine()) != null) {
+// line = new String(line.getBytes("UTF-8"), "iso8859-1");
if (canonize) {
line = org.crosswire.utils.HTTPUtils.canonize(line);
}
More information about the sword-cvs
mailing list