[sword-svn] r456 - trunk/webapp/examples
scribe at crosswire.org
scribe at crosswire.org
Mon Jan 3 14:43:45 EST 2022
Author: scribe
Date: 2022-01-03 14:43:45 -0500 (Mon, 03 Jan 2022)
New Revision: 456
Modified:
trunk/webapp/examples/suggest.jsp
Log:
updated the suggest example to actually work reasonably well
Modified: trunk/webapp/examples/suggest.jsp
===================================================================
--- trunk/webapp/examples/suggest.jsp 2021-07-06 16:45:32 UTC (rev 455)
+++ trunk/webapp/examples/suggest.jsp 2022-01-03 19:43:45 UTC (rev 456)
@@ -4,7 +4,7 @@
%>
<%@ page import="org.crosswire.sword.orb.*" %>
<%
- SWMgr mgr = SwordOrb.getSWMgrInstance(request);
+ SWMgr mgr = SwordOrb.getSWMgrInstance(request, false);
String mod = request.getParameter("mod");
String key = request.getParameter("key");
if (key != null) key = new String(key.getBytes("UTF-8"), "iso8859-1");
@@ -81,23 +81,23 @@
function suggest(mod, key) {
- lexindex=document.getElementById("lexindex");
- lexentry=document.getElementById("lexentry");
- lexentry.innerHTML="Please wait...";
- xmlhttp.open("GET", "suggest.jsp?mod="+mod+"&key="+encodeURIComponent(key)+"&action=keyList",true);
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4) {
- lexindex.innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.send(null);
- xmlhttp2.open("GET", "suggest.jsp?mod="+mod+"&key="+encodeURIComponent(key)+"&action=entryBody",true);
- xmlhttp2.onreadystatechange=function() {
- if (xmlhttp2.readyState==4) {
- lexentry.innerHTML=xmlhttp2.responseText;
- }
- }
- xmlhttp2.send(null);
+ lexindex=document.getElementById("lexindex");
+ lexentry=document.getElementById("lexentry");
+ lexentry.innerHTML="Please wait...";
+ xmlhttp.open("GET", "suggest.jsp?mod="+mod+"&key="+encodeURIComponent(key)+"&action=keyList",true);
+ xmlhttp.onreadystatechange=function() {
+ if (xmlhttp.readyState==4) {
+ lexindex.innerHTML=xmlhttp.responseText;
+ xmlhttp2.open("GET", "suggest.jsp?mod="+mod+"&key="+encodeURIComponent(key)+"&action=entryBody",true);
+ xmlhttp2.onreadystatechange=function() {
+ if (xmlhttp2.readyState==4) {
+ lexentry.innerHTML=xmlhttp2.responseText;
+ }
+ }
+ xmlhttp2.send(null);
+ }
+ }
+ xmlhttp.send(null);
}
-->
@@ -106,21 +106,22 @@
<body>
<h1>SWORDWeb suggest Example</h1>
-<h2>This is experimental and doesn't work right yet.</h2>
<form name="suggestForm" action="">
<select name="modName">
<%
ModInfo[] modInfo = mgr.getModInfoList();
for (int i = 0; i < modInfo.length; i++) {
- SWModule book = mgr.getModuleByName(modInfo[i].name);
+ if (SwordOrb.LEXDICTS.equals(modInfo[i].category)) {
+ SWModule book = mgr.getModuleByName(modInfo[i].name);
%>
<option value="<%= modInfo[i].name %>" <%= modInfo[i].name.equals(mod) ? "selected=\"selected\"":"" %>><%=modInfo[i].description + " ("+modInfo[i].name+")" %></option>
<%
+ }
}
%>
</select><br />
- Lookup: <input type="text" value="<%=(key != null)?key:""%>" onkeyup="suggest(document.suggestForm.modName.value, this.value); return false;" />
+ Lookup: <input type="text" value="<%=(key != null)?key:""%>" onkeyup="suggest(document.suggestForm.modName.value, this.value); return false;" autofocus="autofocus" />
</form>
<table width="100%">
More information about the sword-cvs
mailing list