[sword-svn] r420 - trunk/webapp

scribe at crosswire.org scribe at crosswire.org
Mon Sep 22 18:07:05 MST 2014


Author: scribe
Date: 2014-09-22 18:07:05 -0700 (Mon, 22 Sep 2014)
New Revision: 420

Modified:
   trunk/webapp/fetchdata.jsp
   trunk/webapp/swordweb.js
Log:
added intermodule link handling.
added ability for fetchdata to handle widechar keys


Modified: trunk/webapp/fetchdata.jsp
===================================================================
--- trunk/webapp/fetchdata.jsp	2014-08-23 10:03:44 UTC (rev 419)
+++ trunk/webapp/fetchdata.jsp	2014-09-23 01:07:05 UTC (rev 420)
@@ -21,6 +21,7 @@
 	SWMgr mgr = SwordOrb.getSWMgrInstance(request);
 	SWModule book = null;
 	String ks = request.getParameter("key");
+	if (ks != null) ks = new String(ks.getBytes("iso8859-1"), "UTF-8");
 	String modName = request.getParameter("mod");
 	String fn = request.getParameter("fn");
 	String format = request.getParameter("format");

Modified: trunk/webapp/swordweb.js
===================================================================
--- trunk/webapp/swordweb.js	2014-08-23 10:03:44 UTC (rev 419)
+++ trunk/webapp/swordweb.js	2014-09-23 01:07:05 UTC (rev 420)
@@ -195,15 +195,18 @@
 }
 
 
-function p(mod, key, wordnum, extratext, fnnum, srcMod) {
+function p(mod, key, wordnum, extratext, fnnum, srcMod, showKeyHeader) {
 
 	if (key.substring(0,1) == '@') mod = 'strongshebkey';
-	windowBar=
+	var windowBar=
             '<div align="right">'+
             '<a href="#" onclick="p(\''+mod+'\', \''+key+'\', \''+wordnum+'\', \''+extratext+'\', \''+fnnum+'\', \''+srcMod+'\');return false;">'+
             '<img border="0" src="images/x.png"/>'+
             '</a>'+
             '</div>';
+	if (showKeyHeader) {
+		windowBar = '<div style="border-bottom:1px solid #ccc;"><div style="float:left;">'+key+'</div>'+windowBar+'</div>';
+	}
 	var page = '';
 	skeyPre=""
 	/* check for aliases */
@@ -216,7 +219,7 @@
 		mod = "StrongsHebrew";
 	}
 
-	if (fnnum.length > 2 && fnnum.substring(0,2) == 'p:') {
+	if (fnnum && fnnum.length > 2 && fnnum.substring(0,2) == 'p:') {
 		page = fnnum.substring(2);
 		fnnum = '';
 	}
@@ -244,8 +247,9 @@
 		xmlhttp.open("GET", url, true);
 		xmlhttp.onreadystatechange=function() {
 			if (xmlhttp.readyState==4) {
+				var result = xmlhttp.responseText;
 				if (mod != "betacode") {
-					resultBody="<div class=\"verse\">"+xmlhttp.responseText + "<br/>"+"<div id=\"dm\">";
+					resultBody="<div class=\"verse\">"+ result + "<br/>"+"<div id=\"dm\">";
 					if ((extratext != null) && (extratext.length > 0)) {
 						if (mod == 'strongshebkey') {
 							resultBody += "<a href=\"#\" onclick=\"pd('"+extratext+"', 'whmmorph');return false;\">"+extratext+"</a>";
@@ -255,7 +259,7 @@
 						}
 					}
 					resultBody += "</div>";
-					if ((fnnum == null) || (fnnum == '')) {
+					if ((fnnum == null || fnnum == '') && !showKeyHeader) {
 						resultBody += "<dl>";
 						resultBody += "<dt><a href=\"wordsearchresults.jsp?mod="+srcMod+"&searchTerm=lemma:"+skeyPre+encodeURIComponent(key)+"&colorKey="+encodeURIComponent(key)+"&colorMorph="+encodeURIComponent(extratext)+"\"><t:t>Search for lemma </t:t>"+skeyPre+key+"<t:t> (any morphology) in </t:t>"+srcMod+"</a></dt>";
 						resultBody += "</dl>";
@@ -314,6 +318,13 @@
 	}
 }
 
+//intermodule link
+function im(mod, key) {
+	var k = decodeURIComponent(key);
+	p(mod, k, 'im'+k, null, null, null, true);
+	return false;
+}
+
 function f(mod, key, fnnum, extratext) {
 	p(mod, key, 'fn'+key+fnnum, extratext, fnnum);
 }




More information about the sword-cvs mailing list