[sword-svn] r251 - trunk/webapp

scribe at crosswire.org scribe at crosswire.org
Sun May 21 17:59:13 MST 2006


Author: scribe
Date: 2006-05-21 17:59:10 -0700 (Sun, 21 May 2006)
New Revision: 251

Modified:
   trunk/webapp/fetchdata.jsp
Log:
add support for '|' separated multikey lookups


Modified: trunk/webapp/fetchdata.jsp
===================================================================
--- trunk/webapp/fetchdata.jsp	2006-05-12 06:45:45 UTC (rev 250)
+++ trunk/webapp/fetchdata.jsp	2006-05-22 00:59:10 UTC (rev 251)
@@ -8,73 +8,84 @@
 
 	SWMgr mgr = SwordOrb.getSWMgrInstance(request);
 	SWModule book = null;
-	String key = request.getParameter("key");
+	String ks = request.getParameter("key");
 	String modName = request.getParameter("mod");
 	String fn = request.getParameter("fn");
 	mgr.setGlobalOption("Footnotes", "Off");
 	mgr.setGlobalOption("Cross-references", "Off");
 
-	// hack until LXXM morph is cleaned up -----
-	if ("Packard".equals(modName)) {
-		while (key.indexOf("  ") > -1) key = key.replaceAll("  ", " ");
-	}
-	// end of LXXM Packard hack ----------------
 
-	// normal SWORD mod lookup
-	if (!"betacode".equals(modName)) {
-		if (modName != null) {
-			book = mgr.getModuleByName(modName);
-		}
-		if ((key != null) && (book != null)) {
-			book.setKeyText(key);
-			if (fn != null) {
-				try {
-					String[] type = book.getEntryAttribute("Footnote", fn, "type", false);
-					if ((type.length > 0) && type[0].equalsIgnoreCase("crossReference")) {
-						String[] attr = book.getEntryAttribute("Footnote", fn, "refList", false);
-						if (attr.length > 0) {
-							String[] keys = book.parseKeyList(attr[0]);
-							if (keys.length > 0) {
-								out.print("<dl>");
-								for (int i = 0; i < keys.length; i++) {
-									book.setKeyText(keys[i]);
-									out.print("<dt><a href=\"passagestudy.jsp?key=" + URLEncoder.encode(new String(book.getKeyText().getBytes("iso8859-1"), "UTF-8"))+"#cv\">" + new String(book.getKeyText().getBytes("iso8859-1"), "UTF-8") + "</a></dt><dd>" + new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8")+"</dd>\n");
+	if (ks != null) {
+		String k[] = ks.split("\\|");
+		for (int i = 0; i < k.length; i++) {
+			String key = k[i];
+			if (i > 0) out.print("<br/>__________________<br/><br/>");
+			// hack until LXXM morph is cleaned up -----
+			if ("Packard".equals(modName)) {
+				while (key.indexOf("  ") > -1) key = key.replaceAll("  ", " ");
+			}
+			// end of LXXM Packard hack ----------------
+
+			// normal SWORD mod lookup
+			if (!"betacode".equals(modName)) {
+				if (modName != null) {
+					book = mgr.getModuleByName(modName);
+				}
+				if ((key != null) && (book != null)) {
+					book.setKeyText(key);
+					if (("StrongsGreek".equals(modName)) && ("3588".equals(key))) {
+						out.print("with Greek Article");
+					}
+					else if (fn != null) {
+						try {
+							String[] type = book.getEntryAttribute("Footnote", fn, "type", false);
+							if ((type.length > 0) && type[0].equalsIgnoreCase("crossReference")) {
+								String[] attr = book.getEntryAttribute("Footnote", fn, "refList", false);
+								if (attr.length > 0) {
+									String[] keys = book.parseKeyList(attr[0]);
+									if (keys.length > 0) {
+										out.print("<dl>");
+										for (int j = 0; j < keys.length; j++) {
+											book.setKeyText(keys[j]);
+											out.print("<dt><a href=\"passagestudy.jsp?key=" + URLEncoder.encode(new String(book.getKeyText().getBytes("iso8859-1"), "UTF-8"))+"#cv\">" + new String(book.getKeyText().getBytes("iso8859-1"), "UTF-8") + "</a></dt><dd>" + new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8")+"</dd>\n");
+										}
+										out.print("</dl>");
+									}
 								}
-								out.print("</dl>");
 							}
+							else {
+								String[] attr = book.getEntryAttribute("Footnote", fn, "body", true);
+								if (attr.length > 0) {
+									out.print(attr[0]);
+								}
+							}
 						}
+						catch (Exception e) { e.printStackTrace(); }
 					}
 					else {
-						String[] attr = book.getEntryAttribute("Footnote", fn, "body", true);
-						if (attr.length > 0) {
-							out.print(attr[0]);
-						}
+		%>
+					<%= new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
+		<%
 					}
 				}
-				catch (Exception e) { e.printStackTrace(); }
 			}
+			// betacode lookup from perseus
 			else {
-%>
-			<%= new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
-<%
+				key = new String(key.getBytes("iso8859-1"), "UTF-8");
+				String ls = org.crosswire.swordweb.PerseusUtils.getLiddellScottDef(key);
+				if (ls.length() > 0) {
+		%>
+				<%= ls %>
+		<div class="copyLine">from Liddell and Scott, <i>An Intermediate Greek-English Lexicon</i><br/>
+		Courtesy of <a href="http://www.perseus.tufts.edu">Perseus Digital Library</a></div>
+		<%
+				}
+				else {
+		%>
+				<h2><span class="verse"><%= key %></span></h2>
+		<%
+				}
 			}
 		}
 	}
-	// betacode lookup from perseus
-	else {
-		key = new String(key.getBytes("iso8859-1"), "UTF-8");
-		String ls = org.crosswire.swordweb.PerseusUtils.getLiddellScottDef(key);
-		if (ls.length() > 0) {
 %>
-		<%= ls %>
-<div class="copyLine">from Liddell and Scott, <i>An Intermediate Greek-English Lexicon</i><br/>
-Courtesy of <a href="http://www.perseus.tufts.edu">Perseus Digital Library</a></div>
-<%
-		}
-		else {
-%>
-		<h2><span class="verse"><%= key %></span></h2>
-<%
-		}
-	}
-%>



More information about the sword-cvs mailing list