[sword-svn] r240 - in trunk: src webapp

scribe at crosswire.org scribe at crosswire.org
Sat Jan 28 21:12:26 MST 2006


Author: scribe
Date: 2006-01-28 21:12:14 -0700 (Sat, 28 Jan 2006)
New Revision: 240

Modified:
   trunk/src/Makefile
   trunk/webapp/blues.css
   trunk/webapp/fetchdata.jsp
   trunk/webapp/init.jsp
   trunk/webapp/passagestudy.jsp
   trunk/webapp/sandy.css
   trunk/webapp/swordweb.js
   trunk/webapp/wash.css
Log:
Added basic footnote/crossref support


Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/src/Makefile	2006-01-29 04:12:14 UTC (rev 240)
@@ -1,9 +1,10 @@
 TOMCAT_HOME=/usr/local/tomcat
-instdir=..
-all: ../WEB-INF/classes/org/crosswire/web/i18n/TranslateTag.class
+instdir=../webapp
 
-../WEB-INF/classes/org/crosswire/web/i18n/TranslateTag.class: org/crosswire/web/i18n/TranslateTag.java
-	javac -classpath ${TOMCAT_HOME}/common/lib/jsp-api.jar:${TOMCAT_HOME}/common/lib/servlet-api.jar:../WEB-INF/classes:../WEB-INF/lib/greekconverter.jar -d ../WEB-INF/classes -sourcepath . ./org/crosswire/web/i18n/*.java ./org/crosswire/web/util/*.java ./org/crosswire/swordweb/*.java
+all: ${instdir}/WEB-INF/classes/org/crosswire/web/i18n/TranslateTag.class
 
+${instdir}/WEB-INF/classes/org/crosswire/web/i18n/TranslateTag.class: org/crosswire/web/i18n/TranslateTag.java
+	javac -classpath ${TOMCAT_HOME}/common/lib/jsp-api.jar:${TOMCAT_HOME}/common/lib/servlet-api.jar:${instdir}/WEB-INF/classes:${instdir}/WEB-INF/lib/greekconverter.jar -d ${instdir}/WEB-INF/classes -sourcepath . ./org/crosswire/web/i18n/*.java ./org/crosswire/web/util/*.java ./org/crosswire/swordweb/*.java
+
 clean:
-	rm -rf ../WEB-INF/classes/org/crosswire/web/*
+	rm -rf ${instdir}/WEB-INF/classes/org/crosswire/web/*

Modified: trunk/webapp/blues.css
===================================================================
--- trunk/webapp/blues.css	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/webapp/blues.css	2006-01-29 04:12:14 UTC (rev 240)
@@ -462,3 +462,22 @@
 span.sameLemma {
      font-weight : bold;
 }
+
+.fn {
+	cursor:pointer;
+	vertical-align: super;
+     margin-left : 0;
+     overflow: visible;
+     padding: 7px 7px 7px 7px;
+     color : #0000FF;
+     font-size : x-small;
+     font-style : normal;
+     font-weight : normal;
+     font-variant : normal;
+     word-spacing : normal;
+     letter-spacing : normal;
+     text-transform : none;
+     text-align : left;
+     text-indent : 0;
+     line-height : normal;
+}

Modified: trunk/webapp/fetchdata.jsp
===================================================================
--- trunk/webapp/fetchdata.jsp	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/webapp/fetchdata.jsp	2006-01-29 04:12:14 UTC (rev 240)
@@ -3,12 +3,16 @@
     contentType="text/html;charset=utf-8"
 %>
 <%@ page import="org.crosswire.sword.orb.*" %>
+<%@ page import="java.net.URLEncoder" %>
 <%
 
 	SWMgr mgr = SwordOrb.getSWMgrInstance(session);
 	SWModule book = null;
 	String key = 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)) {
@@ -16,15 +20,44 @@
 	}
 	// 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");
+								}
+								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 {
 %>
 			<%= new String(book.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
 <%
+			}
 		}
 	}
 	// betacode lookup from perseus

Modified: trunk/webapp/init.jsp
===================================================================
--- trunk/webapp/init.jsp	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/webapp/init.jsp	2006-01-29 04:12:14 UTC (rev 240)
@@ -133,6 +133,26 @@
 		response.addCookie(c);
 	}
 
+	String footnotes = (String)request.getParameter("Footnotes");
+	if (footnotes == null)
+		footnotes = (String)session.getAttribute("Footnotes");
+	else {	// set style cookie
+		Cookie c = new Cookie("Footnotes", footnotes);
+		c.setMaxAge(java.lang.Integer.MAX_VALUE);
+		c.setPath("/");
+		response.addCookie(c);
+	}
+
+	String xrefs = (String)request.getParameter("Cross-references");
+	if (xrefs == null)
+		xrefs = (String)session.getAttribute("Cross-references");
+	else {	// set style cookie
+		Cookie c = new Cookie("Cross-references", xrefs);
+		c.setMaxAge(java.lang.Integer.MAX_VALUE);
+		c.setPath("/");
+		response.addCookie(c);
+	}
+
 	String headings = (String)request.getParameter("Headings");
 	if (headings == null)
 		headings = (String)session.getAttribute("Headings");
@@ -210,6 +230,12 @@
 			else if (cookies[i].getName().equals("Headings")) {
 				headings = cookies[i].getValue();
 			}
+			else if (cookies[i].getName().equals("Footnotes")) {
+				footnotes = cookies[i].getValue();
+			}
+			else if (cookies[i].getName().equals("Cross-references")) {
+				xrefs = cookies[i].getValue();
+			}
 			else if (cookies[i].getName().equals("Javascript")) {
 				javascript = cookies[i].getValue();
 			}
@@ -270,10 +296,14 @@
 	session.setAttribute("ParDispModules", parDispModules);
 	session.setAttribute("PrefStyle", prefStyle);
 	session.setAttribute("Headings", headings);
+	session.setAttribute("Footnotes", footnotes);
+	session.setAttribute("Cross-references", xrefs);
 	session.setAttribute("Javascript", javascript);
 	session.setAttribute("showTabs", showTabs);
 	mgr.setJavascript(!"Off".equalsIgnoreCase(javascript));
 	mgr.setGlobalOption("Headings", ("Off".equalsIgnoreCase(headings)) ? "Off":"On");
+	mgr.setGlobalOption("Footnotes", ("On".equalsIgnoreCase(footnotes)) ? "On":"Off");
+	mgr.setGlobalOption("Cross-references", ("On".equalsIgnoreCase(xrefs)) ? "On":"Off");
 
 	{
 	String lang = request.getParameter("lang");

Modified: trunk/webapp/passagestudy.jsp
===================================================================
--- trunk/webapp/passagestudy.jsp	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/webapp/passagestudy.jsp	2006-01-29 04:12:14 UTC (rev 240)
@@ -124,6 +124,8 @@
 	<div id="studytools">
 		<h2>Word Study:</h2>
 			<ul>
+			<li><a href="passagestudy.jsp?Footnotes=<%= ("On".equalsIgnoreCase(footnotes)) ? "Off" : "On" %>#cv" title="Turn <%= ("On".equalsIgnoreCase(footnotes)) ? "Off" : "On"%> Footnotes"><t:t><%= ("On".equalsIgnoreCase(footnotes)) ? "Hide" : "Show" %> Footnotes</t:t></a></li>
+			<li><a href="passagestudy.jsp?Cross-references=<%= ("On".equalsIgnoreCase(xrefs)) ? "Off" : "On" %>#cv" title="Turn <%= ("On".equalsIgnoreCase(xrefs)) ? "Off" : "On"%> Cross-references"><t:t><%= ("On".equalsIgnoreCase(xrefs)) ? "Hide" : "Show" %> Cross-references</t:t></a></li>
 			<li><a href="passagestudy.jsp?strongs=<%= (strongs) ? "off" : "on" %>#cv" title="Turn <%= (strongs) ? "off" : "on"%> Strongs numbers"><t:t><%= (strongs) ? "Hide" : "Show" %> Strongs</t:t></a></li>
 			<li><a href="passagestudy.jsp?morph=<%= (morph) ? "off" : "on" %>#cv" title="Turn <%= (morph) ? "off" : "on" %> morphology"><t:t><%= (morph) ? "Hide" : "Show" %> Morphology</t:t></a></li>
 			</ul>
@@ -242,7 +244,7 @@
 					boolean rtol = ("RtoL".equalsIgnoreCase(activeModule.getConfigEntry("Direction")));
 			%>
 			<%
-					String[] heads = activeModule.getEntryAttribute("Heading", "Preverse", "0");
+					String[] heads = activeModule.getEntryAttribute("Heading", "Preverse", "0", true);
 					if (heads.length > 0) {
 			%>
 					<tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">

Modified: trunk/webapp/sandy.css
===================================================================
--- trunk/webapp/sandy.css	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/webapp/sandy.css	2006-01-29 04:12:14 UTC (rev 240)
@@ -391,7 +391,7 @@
 padding: 0 0 0px 0;
 }
 
-#searchresults dt {
+dt {
 margin: 0px 0px 0px 0px;
 padding: 0px 2px 0px 2px;
 background: #eee;
@@ -400,26 +400,26 @@
 line-height: 1.8em;
 }
 
-#searchresults dt span {
+dt span {
 float: right;
 margin: -1.8em 0 0 0;
 font-style: italic;
 }
 
-#searchresults dd {
+dd {
 background: #fff;
 margin: 0px 0px 0px 0px;
 padding: 2px 5px 5px 3em;
 }
 
-#searchresults dt a {
+dt a {
 text-decoration: none;
 display:block;
 color:#000;
 font-size:1.1em;
 }
 
-#searchresults dt a:hover {
+dt a:hover {
 text-decoration: none;
 background-color: #DEDACA;
 color:#f00;
@@ -686,3 +686,22 @@
 span.sameLemma {
      font-weight : bold;
 }
+
+.fn {
+	cursor:pointer;
+	vertical-align: super;
+     margin-left : 0;
+     overflow: visible;
+     padding: 7px 7px 7px 7px;
+     color : #0000FF;
+     font-size : x-small;
+     font-style : normal;
+     font-weight : normal;
+     font-variant : normal;
+     word-spacing : normal;
+     letter-spacing : normal;
+     text-transform : none;
+     text-align : left;
+     text-indent : 0;
+     line-height : normal;
+}

Modified: trunk/webapp/swordweb.js
===================================================================
--- trunk/webapp/swordweb.js	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/webapp/swordweb.js	2006-01-29 04:12:14 UTC (rev 240)
@@ -148,7 +148,7 @@
 }
 
 
-function p(mod, key, wordnum, extratext) {
+function p(mod, key, wordnum, extratext, fnnum) {
 
 	/* check for aliases */
 	if (mod == "G") mod = "StrongsGreek";
@@ -169,13 +169,26 @@
 	else {
 		b.innerHTML="Please wait...";
 		showhide("onlywlayer", "visible");
-		xmlhttp.open("GET", "fetchdata.jsp?mod="+mod+"&key="+encodeURIComponent(key),true);
+		url = "fetchdata.jsp?mod="+mod+"&key="+encodeURIComponent(key);
+		if (fnnum != null)
+			url += "&fn="+encodeURIComponent(fnnum);
+		xmlhttp.open("GET", url, true);
 		xmlhttp.onreadystatechange=function() {
 			if (xmlhttp.readyState==4) {
-				if (mod != "betacode")
-					b.innerHTML="<div class=\"verse\">"+xmlhttp.responseText + "<br/>"+"<div id=\"dm\"><a href=\"#\" onclick=\"pd('"+extratext+"');return false;\">"+extratext+"</a></div></div>";
-				else
-					b.innerHTML="<div class=\"verse\">"+xmlhttp.responseText + "<br/>"+"<div id=\"dm\"><a href=\"#\" onclick=\"pe('"+extratext+"');return false;\">"+extratext+"</a></div></div>";
+				if (mod != "betacode") {
+					resultBody="<div class=\"verse\">"+xmlhttp.responseText + "<br/>"+"<div id=\"dm\">";
+					if ((extratext != null) && (extratext.length > 0)) {
+						resultBody += "<a href=\"#\" onclick=\"pd('"+extratext+"');return false;\">"+extratext+"</a></div></div>";
+					}
+					b.innerHTML=resultBody;
+				}
+				else {
+					resultBody ="<div class=\"verse\">"+xmlhttp.responseText + "<br/>"+"<div id=\"dm\">";
+					if ((extratext != null) && (extratext.length > 0)) {
+						resultBody += "<a href=\"#\" onclick=\"pe('"+extratext+"');return false;\">"+extratext+"</a></div></div>";
+					}
+					b.innerHTML=resultBody;
+				}
 				lastword = wordnum;
 			}
 		}
@@ -215,8 +228,10 @@
 	}
 }
 
+function f(mod, key, fnnum, extratext) {
+	p(mod, key, 'fn'+fnnum, extratext, fnnum);
+}
 
-
 function showhide (layer, vis) {
 
 	var l = document.getElementById(layer);

Modified: trunk/webapp/wash.css
===================================================================
--- trunk/webapp/wash.css	2006-01-29 04:04:14 UTC (rev 239)
+++ trunk/webapp/wash.css	2006-01-29 04:12:14 UTC (rev 240)
@@ -527,7 +527,7 @@
 padding: 0 0 0px 0;
 }
 
-#searchresults dt {
+dt {
 margin: 0px 0px 0px 0px;
 padding: 0px 2px 0px 2px;
 background: #eee;
@@ -536,26 +536,26 @@
 line-height: 1.8em;
 }
 
-#searchresults dt span {
+dt span {
 float: right;
 margin: -1.8em 0 0 0;
 font-style: italic;
 }
 
-#searchresults dd {
+dd {
 background: #fff;
 margin: 0px 0px 0px 0px;
 padding: 2px 5px 5px 3em;
 }
 
-#searchresults dt a {
+dt a {
 text-decoration: none;
 display:block;
 color:#000;
 font-size:1.1em;
 }
 
-#searchresults dt a:hover {
+dt a:hover {
 text-decoration: none;
 background-color: #C5D6EA;
 color:#f00;
@@ -876,3 +876,22 @@
 .word-layer.span.sameLemma { /* The other words with the same lemma on the page */
      font-weight : bold;
 }
+
+.fn {
+	cursor:pointer;
+	vertical-align: super;
+     margin-left : 0;
+     overflow: visible;
+     padding: 7px 7px 7px 7px;
+     color : #0000FF;
+     font-size : x-small;
+     font-style : normal;
+     font-weight : normal;
+     font-variant : normal;
+     word-spacing : normal;
+     letter-spacing : normal;
+     text-transform : none;
+     text-align : left;
+     text-indent : 0;
+     line-height : normal;
+}



More information about the sword-cvs mailing list