[sword-svn] r218 - in trunk: . layouts src/org/crosswire
src/org/crosswire/swordweb
jansorg at crosswire.org
jansorg at crosswire.org
Fri Oct 7 14:17:23 MST 2005
Author: jansorg
Date: 2005-10-07 14:17:23 -0700 (Fri, 07 Oct 2005)
New Revision: 218
Added:
trunk/src/org/crosswire/swordweb/
trunk/src/org/crosswire/swordweb/HorizontallyParallelTextRendering.java
trunk/src/org/crosswire/swordweb/ModuleEntryRenderer.java
trunk/src/org/crosswire/swordweb/ModuleTextRendering.java
trunk/src/org/crosswire/swordweb/RangeInformation.java
trunk/src/org/crosswire/swordweb/SidebarItemRenderer.java
trunk/src/org/crosswire/swordweb/SidebarModuleView.java
trunk/src/org/crosswire/swordweb/SimpleEntryRenderer.java
trunk/src/org/crosswire/swordweb/SimpleModuleView.java
trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java
trunk/src/org/crosswire/swordweb/VerticallyParallelTextRendering.java
Modified:
trunk/blues.css
trunk/fulllibrary.jsp
trunk/init.jsp
trunk/layouts/base-layout.jsp
trunk/parallelstudy.jsp
trunk/parchment.css
trunk/passagestudy.jsp
trunk/preferences.jsp
trunk/sandy.css
trunk/wash.css
Log:
fixes and enhancements to swordweb
Modified: trunk/blues.css
===================================================================
--- trunk/blues.css 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/blues.css 2005-10-07 21:17:23 UTC (rev 218)
@@ -387,6 +387,7 @@
border-bottom: 1px solid #dddddd;
border-top: 1px solid #dddddd;
background-color: #eeeeee;
+ text-align: center;
}
ul.booknav li{
Modified: trunk/fulllibrary.jsp
===================================================================
--- trunk/fulllibrary.jsp 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/fulllibrary.jsp 2005-10-07 21:17:23 UTC (rev 218)
@@ -2,7 +2,9 @@
<%@ page import="java.util.Enumeration,java.util.Vector" %>
<%@ page import="gnu.regexp.RE" %>
+<%@ page import="org.crosswire.swordweb.*" %>
+
<%
Vector catTreeOpen = (Vector)session.getAttribute("catTreeOpen");
@@ -48,11 +50,25 @@
<tiles:put name="sidebar_left" type="string">
<div id="library">
-
<h2><t:t>OSIS Library</t:t></h2>
- <ul>
+ <ul>
<%
+ SidebarModuleView sidebarView = new SimpleModuleView(mgr);
+ SidebarItemRenderer modRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
+ public String renderModuleItem(SWModule module) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<li><a href=\"fulllibrary.jsp?show=")
+ .append(URLEncoder.encode(module.getName()))
+ .append("#cv\" title=\"Information about this module\">")
+ .append(module.getDescription().replaceAll("&", "&"))
+ .append("</a></li>");
+
+ return ret.toString();
+ }
+ };
+
Vector leaves = new Vector();
+ Vector modules = new Vector();
for (int i = 0; i < modInfo.length; i++) {
if (!leaves.contains(modInfo[i].category)) {
leaves.add(modInfo[i].category);
@@ -66,22 +82,13 @@
</li>
<%
if (open) {
-%>
- <ul>
-<%
for (int j = 0; j < modInfo.length; j++) {
if (modInfo[i].category.equals(modInfo[j].category)) {
- SWModule module = mgr.getModuleByName(modInfo[j].name);
- if (module != null) {
-%>
- <li><a href="fulllibrary.jsp?show=<%= URLEncoder.encode(modInfo[j].name) %>"><%= modInfo[j].name %></a> <%= module.getDescription() %></li>
-<%
- }
+ modules.add(modInfo[j].name);
}
}
-%>
- </ul>
-<%
+
+ out.print( sidebarView.renderView( modules, modRenderer ) ); //insert the sub list of the modules in the current category
}
}
Modified: trunk/init.jsp
===================================================================
--- trunk/init.jsp 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/init.jsp 2005-10-07 21:17:23 UTC (rev 218)
@@ -31,14 +31,15 @@
styleFiles = new Vector();
styleDescriptions = new Vector();
- styleNames.add("Parchment");
+ styleNames.add("Washed Out");
+ styleFiles.add("wash.css");
+
+ styleNames.add("Parchment");
styleFiles.add("parchment.css");
styleNames.add("Sandy Creek");
styleFiles.add("sandy.css");
- styleNames.add("Washed Out");
- styleFiles.add("wash.css");
tabNames = new Vector();
tabLinks = new Vector();
Modified: trunk/layouts/base-layout.jsp
===================================================================
--- trunk/layouts/base-layout.jsp 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/layouts/base-layout.jsp 2005-10-07 21:17:23 UTC (rev 218)
@@ -51,9 +51,10 @@
<legend><t:t>by keyword or phrase:</t:t></legend> <input type="text" name="searchTerm" value="<%=searchTerm%>" size="10" /> <input type="submit" value="go" title="Search by keyword or phrase" />
</fieldset>
</form>
+ <h2><t:t>Go to:</t:t></h2>
<form action="<tiles:getAsString name="lookup_url"/>">
<fieldset>
- <legend><t:t>by verse or passage:</t:t></legend> <input type="text" name="key" size="10" /> <input type="submit" value="go" title="Search by verse or passage" />
+ <legend><t:t>verse or passage:</t:t></legend> <input type="text" name="key" size="10" /> <input type="submit" value="go" title="Go to verse or passage" />
</fieldset>
</form>
</div>
Modified: trunk/parallelstudy.jsp
===================================================================
--- trunk/parallelstudy.jsp 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/parallelstudy.jsp 2005-10-07 21:17:23 UTC (rev 218)
@@ -1,4 +1,5 @@
<%@ include file="init.jsp" %>
+<%@ page import="org.crosswire.swordweb.*" %>
<%
session.setAttribute("lastModType", "Bible");
@@ -47,6 +48,43 @@
session.setAttribute("morph", (morph)?"on":"off");
boolean startList = false;
+
+ String parallelViewType = (String) session.getAttribute("parallelViewType");
+ buf = request.getParameter("parallelViewType");
+ if (buf != null) {
+ parallelViewType = buf;
+ }
+ if (parallelViewType == null) {
+ parallelViewType = "sidebyside";
+ }
+ session.setAttribute("parallelViewType", parallelViewType);
+
+ SidebarModuleView sidebarView = new SimpleModuleView(mgr);
+ SidebarItemRenderer delModRenderer = new SidebarItemRenderer() {
+ public String renderModuleItem(SWModule module) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<li><a href=\"parallelstudy.jsp?del=")
+ .append(URLEncoder.encode(module.getName()))
+ .append("#cv\" title=\"Remove from displayed modules\">")
+ .append(module.getDescription().replaceAll("&", "&"))
+ .append("</a></li>");
+
+ return ret.toString();
+ }
+ };
+
+ SidebarItemRenderer addModRenderer = new SidebarItemRenderer() {
+ public String renderModuleItem(SWModule module) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<li><a href=\"parallelstudy.jsp?add=")
+ .append(URLEncoder.encode(module.getName()))
+ .append("#cv\" title=\"Add to displayed modules\">")
+ .append(module.getDescription().replaceAll("&", "&"))
+ .append("</a></li>");
+
+ return ret.toString();
+ }
+ };
%>
@@ -64,68 +102,43 @@
<h3><t:t>Displayed modules</t:t></h3>
<p><t:t>click to remove</t:t></p>
<%
- startList = false;
+ Vector modules = new Vector();
+
+ modules.clear();
for (int i = 0; i < parDispModules.size(); i++) {
SWModule module = mgr.getModuleByName((String)parDispModules.get(i));
if (module != null && ((module.getCategory().equals(SwordOrb.BIBLES))||(module.getCategory().equals("Cults / Unorthodox / Questionable Material")))) {
- if (!startList) { out.print("<ul>"); startList = true; }
- %>
- <li>
- <a href="parallelstudy.jsp?del=<%= URLEncoder.encode(module.getName()) %>#cv" title="Remove from displayed modules">
- <%= module.getDescription().replaceAll("&", "&") %>
- </a>
- </li>
- <%
+ modules.add(module.getName());
}
}
- if (startList) { out.print("</ul>"); startList = true; }
+
+ out.print( sidebarView.renderView(modules, delModRenderer) );
%>
<h3><t:t>Available modules</t:t></h3>
<p><t:t>click to add</t:t></p>
<%
- startList = false;
+
+ modules.clear();
for (int i = 0; i < modInfo.length; i++) {
- if (modInfo[i].category.equals(SwordOrb.BIBLES)) {
- SWModule module = mgr.getModuleByName(modInfo[i].name);
- if ( parDispModules.contains(module.getName()) ) {
- continue;
- }
-
- if (!startList) { out.print("<ul>"); startList = true; }
- %>
- <li>
- <a href="parallelstudy.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>#cv" title="Add to displayed modules">
- <%= module.getDescription().replaceAll("&", "&") %>
- </a>
- </li>
- <%
+ if (modInfo[i].category.equals(SwordOrb.BIBLES) && !parDispModules.contains(modInfo[i].name)) {
+ modules.add(modInfo[i].name);
}
}
- if (startList) { out.print("</ul>"); startList = true; }
+
+ out.print( sidebarView.renderView(modules, addModRenderer) );
%>
<h3><t:t>Cults / Unorthodox / Questionable Material</t:t></h3><p><t:t>click to add</t:t></p>
<%
- startList = false;
+ modules.clear();
for (int i = 0; i < modInfo.length; i++) {
- if (modInfo[i].category.equals("Cults / Unorthodox / Questionable Material")) {
- SWModule module = mgr.getModuleByName(modInfo[i].name);
- if ( parDispModules.contains(module.getName()) ) {
- continue;
- }
-
- if (!startList) { out.print("<ul>"); startList = true; }
- %>
- <li>
- <a href="parallelstudy.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>#cv" title="Add to displayed modules">
- <%= module.getDescription().replaceAll("&", "&") %>
- </a>
- </li>
- <%
+ if (modInfo[i].category.equals("Cults / Unorthodox / Questionable Material") && !parDispModules.contains(modInfo[i].name)) {
+ modules.add(modInfo[i].name);
}
}
- if (startList) { out.print("</ul>"); startList = true; }
+
+ out.print( sidebarView.renderView(modules, addModRenderer) );
%>
</div>
@@ -142,6 +155,13 @@
</ul>
</div>
-->
+ <div id="studytools">
+ <h2><t:t>Parallel viewing:</t:t></h2>
+ <ul>
+ <li><a href="parallelstudy.jsp?parallelViewType=sidebyside">Side by side</a></li>
+ <li><a href="parallelstudy.jsp?parallelViewType=toptobottom">Top to bottom</a></li>
+ </ul>
+ </div>
<div id="commentaries">
<h2><t:t>Comentaries:</t:t></h2>
@@ -149,49 +169,34 @@
<h3><t:t>Displayed modules</t:t></h3>
<p><t:t>click to remove</t:t></p>
<%
- startList = false;
+ Vector modules = new Vector();
for (int i = 0; i < parDispModules.size(); i++) {
SWModule module = mgr.getModuleByName((String)parDispModules.get(i));
if (module != null && module.getCategory().equals(SwordOrb.COMMENTARIES)) {
- if (!startList) { out.print("<ul>"); startList = true; }
- %>
- <li>
- <a href="parallelstudy.jsp?del=<%= URLEncoder.encode(module.getName()) %>#cv" title="Remove from displayed modules">
- <%= module.getDescription().replaceAll("&", "&") %>
- </a>
- </li>
- <%
+ modules.add(module.getName());
}
}
- if (startList) { out.print("</ul>"); startList = true; }
+
+ out.print( sidebarView.renderView(modules, delModRenderer) );
%>
<h3><t:t>Available modules</t:t></h3>
<p><t:t>click to add</t:t></p>
<%
- startList = false;
+ modules.clear();
for (int i = 0; i < modInfo.length; i++) {
- if (modInfo[i].category.equals(SwordOrb.COMMENTARIES)) {
- SWModule module = mgr.getModuleByName(modInfo[i].name);
- if ( parDispModules.contains(module.getName()) ) {
- continue;
- }
- if (!startList) { out.print("<ul>"); startList = true; }
- %>
- <li>
- <a href="parallelstudy.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>#cv" title="Add to displayed modules">
- <%= module.getDescription().replaceAll("&", "&") %>
- </a>
- </li>
- <%
+ if (modInfo[i].category.equals(SwordOrb.COMMENTARIES) && !parDispModules.contains(modInfo[i].name)) {
+ modules.add(modInfo[i].name);
}
}
- if (startList) { out.print("</ul>"); startList = true; }
+
+ out.print( sidebarView.renderView(modules, addModRenderer) );
%>
</div>
- </tiles:put>
+ </tiles:put> <%-- end of right sightbat tag area --%>
+
<tiles:put name="content" type="string">
<%
if (activeModule != null) {
@@ -208,147 +213,62 @@
</div>
<% //insert next and previous chapter links
- // activeKey contains the current key ATM
- // Split up into book, chapter and verse.
- // Then add and subtract 1 to the chapter to the next and previous one
-
- String bookname = activeKey.substring(0, activeKey.lastIndexOf(" "));
- int chapter = Integer.parseInt( activeKey.substring(activeKey.lastIndexOf(" ")+1, activeKey.indexOf(":")) );
- //int verse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
-
- String prevChapterString = bookname + " " + String.valueOf(chapter-1) + ":1";
- String nextChapterString = bookname + " " + String.valueOf(chapter+1) + ":1";
-
+ String prevChapterString = RangeInformation.getPreviousChapter(activeKey, activeModule);
+ String nextChapterString = RangeInformation.getNextChapter(activeKey, activeModule);
%>
<ul class="booknav">
<li><a href="parallelstudy.jsp?key=<%= URLEncoder.encode(prevChapterString) %>" title="Display <%= prevChapterString %>"><t:t>previous chapter</t:t></a></li>
- <!-- <li><a href="" title="display all of Romans 8"><t:t>this chapter</t:t></a></li> -->
+ <li><h3><%= activeKey %></h3></li>
<li><a href="parallelstudy.jsp?key=<%= URLEncoder.encode(nextChapterString) %>" title="Display <%= nextChapterString %>"><t:t>next chapter</t:t></a></li>
</ul>
<%-- table which contains all verse items --%>
- <table>
- <caption>
- </caption>
-
- <colgroup>
- <% //setup col attributes
- for (int i = 0; i < parDispModules.size(); i++) {
- SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
- %>
- <col width="<%= 100/parDispModules.size() %>%" />
<%
- }
- %>
- </colgroup>
+ Vector moduleList = new Vector();
+ for (int i = 0; i < parDispModules.size(); i++) {
+ moduleList.add( mgr.getModuleByName((String)parDispModules.get(i)) );
+ }
+
+ Vector entryList = null;
+ if ((activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) || (activeModule.getCategory().equals(SwordOrb.BIBLES))) {
+ entryList = RangeInformation.getChapterEntryList(activeKey, activeModule);
+ }
+ else { //a simple commentary entry, not multiple ones
+ entryList = new Vector();
+ entryList.add(activeKey);
+ }
+
+ ModuleTextRendering rendering = null;
+ ModuleEntryRenderer entryRenderer = null;
+ if (parallelViewType.equals("sidebyside")) {
+ rendering = new HorizontallyParallelTextRendering();
+ entryRenderer = new StandardEntryRenderer( new String("parallelstudy.jsp"), activeKey, mgr );
+ }
+ else { //if (parallelViewType.equals("toptobottom"))
+ rendering = new VerticallyParallelTextRendering();
+ entryRenderer = new SimpleEntryRenderer( new String("parallelstudy.jsp"), activeKey, mgr );
+ }
- <thead>
-
- <%
- activeModule = mgr.getModuleByName((String)parDispModules.get(0));
- if (activeModule.getCategory().equals(SwordOrb.BIBLES) ||
- activeModule.getCategory().equals(SwordOrb.COMMENTARIES) ||
- activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material"))
- {
- %>
-
- <tr>
-
- <% //insert module names at the top
- for (int i = 0; i < parDispModules.size(); i++) {
- SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
- %>
- <th>
- "<%= mod.getDescription().replaceAll("&", "&") + " (" + mod.getName() + ")" %>"
- </th>
- <%
- }
- %>
-
- </tr>
- </thead>
-
- <tbody>
- <%
- String chapterPrefix = activeKey.substring(0, activeKey.indexOf(":"));
- int activeVerse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
- for (activeModule.setKeyText(chapterPrefix + ":1"); (activeModule.error() == (char)0); activeModule.next()) {
-
- String keyText = activeModule.getKeyText();
- if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":"))))
- break;
-
- int curVerse = Integer.parseInt(keyText.substring(keyText.indexOf(":")+1));
- mgr.setGlobalOption("Strong's Numbers",
- ((strongs) && (curVerse >= activeVerse -1) && (curVerse <= activeVerse + 1)) ? "on" : "off");
- mgr.setGlobalOption("Morphological Tags",
- ((morph) && (curVerse >= activeVerse -1) && (curVerse <= activeVerse + 1)) ? "on" : "off");
- %>
-
-
- <tr>
- <%
- for (int i = 0; i < parDispModules.size(); i++) {
- SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
- boolean rtol = ("RtoL".equalsIgnoreCase(mod.getConfigEntry("Direction")));
-
- if (mod != activeModule)
- mod.setKeyText( keyText );
- %>
- <td <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
- <span class="versenum">
- <a <%= (keyText.equals(activeKey)) ? "id=\"cv\"" : "" %> href="parallelstudy.jsp?key=<%= URLEncoder.encode(keyText) %>#cv"> <%= keyText.substring(keyText.indexOf(":")+1) %></a>
- </span>
-
- <%
- String lang = mod.getConfigEntry("Lang");
-// <span xml:lang="<%= (lang.equals("")) ? "en" : lang
- %>
-
- <%= new String(mod.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
-<%
-// </span>
-%>
-
- </td>
- <%
- }
- %>
- </tr>
- <%
- }
- %>
- <tr>
-
- <% //insert module names at the top
- for (int i = 0; i < parDispModules.size(); i++) {
- SWModule mod = mgr.getModuleByName((String)parDispModules.get(i));
- String copyLine = mod.getConfigEntry("ShortCopyright");
- String promoLine = mod.getConfigEntry("ShortPromo");
- if (copyLine.equalsIgnoreCase("<swnull>"))
- copyLine = "";
- if (promoLine.equalsIgnoreCase("<swnull>"))
- promoLine = "";
- if (mod.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
- copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
- }
- %>
- <td>
- <div class="copyLine"><%= copyLine %></div>
- <div class="promoLine"><%= promoLine %></div>
- </td>
- <%
- }
- %>
-
- </tr>
- <%
+ if (strongs) {
+ entryRenderer.enableFilterOption("Strong's Numbers");
}
+ if (morph) {
+ entryRenderer.enableFilterOption("Morphological Tags");
+ }
+
+ out.print( rendering.render(moduleList, entryList, entryRenderer) ); //print out the text page
+
+
+ String copyLine = activeModule.getConfigEntry("ShortCopyright");
+ if (copyLine.equalsIgnoreCase("<swnull>")) {
+ copyLine = "";
+ }
+ if (activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
+ copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
+ }
%>
- </tbody>
- </table>
</div>
</tiles:put>
Modified: trunk/parchment.css
===================================================================
(Binary files differ)
Modified: trunk/passagestudy.jsp
===================================================================
--- trunk/passagestudy.jsp 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/passagestudy.jsp 2005-10-07 21:17:23 UTC (rev 218)
@@ -1,4 +1,5 @@
<%@ include file="init.jsp" %>
+<%@ page import="org.crosswire.swordweb.*" %>
<%
session.setAttribute("lastModType", "Bible");
@@ -55,6 +56,21 @@
}
}
}
+
+ //the sidebar rendering object is shared in the left (Bibles) and right (Commentaries) sidebar
+ SidebarModuleView sidebarView = new SimpleModuleView(mgr);
+ SidebarItemRenderer displayModRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
+ public String renderModuleItem(SWModule module) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<li><a href=\"passagestudy.jsp?mod=")
+ .append(URLEncoder.encode(module.getName()))
+ .append("#cv\" title=\"Read text of this module\">")
+ .append(module.getDescription().replaceAll("&", "&"))
+ .append("</a></li>");
+
+ return ret.toString();
+ }
+ };
%>
<tiles:insert beanName="basic" flush="true" >
@@ -65,28 +81,21 @@
<h2><t:t>Translations:</t:t></h2>
<h3><t:t>Preferred Translations</t:t></h3>
- <% if (prefBibles.size() > 0) { %>
+ <% if (prefBibles.size() > 0) {
+ out.print( sidebarView.renderView(prefBibles, displayModRenderer) ); //render the preferred Bibles section
+
+ } else { //no preferred Bibles
+ %>
<ul>
- <%
- for (int i = 0; i < prefBibles.size(); i++) {
- SWModule module = mgr.getModuleByName((String)prefBibles.get(i));
- %>
- <li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(module.getName())+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
- }
- %>
- </ul>
- <% } else { %>
- <ul>
<li><t:t>Preferred Translations can be selected from the preferences tab</t:t></li>
</ul>
<% } %>
- <%
- boolean open = toolsTreeOpen.contains("allBibles");
- %>
-<h3><t:t>All Translations</t:t></h3>
+ <%
+ boolean open = toolsTreeOpen.contains("allBibles");
+ %>
+ <h3><t:t>All Translations</t:t></h3>
<%
if (open) { //already open
%>
@@ -100,21 +109,15 @@
}
%>
<%
- if ((open) && (modInfo.length > 0)) {
-%>
- <ul>
-<%
+ if (open && (modInfo.length > 0)) {
+ Vector modules = new Vector();
for (int i = 0; i < modInfo.length; i++) {
if (modInfo[i].category.equals(SwordOrb.BIBLES)) {
- SWModule module = mgr.getModuleByName(modInfo[i].name);
- %>
- <li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(modInfo[i].name)+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
+ modules.add(modInfo[i].name);
}
}
-%>
- </ul>
-<%
+ modules.removeAll( prefBibles );
+ out.print( sidebarView.renderView(modules, displayModRenderer) ); //render the complete Bible modules list
}
%>
</div>
@@ -132,22 +135,15 @@
<div id="commentaries">
<h2><t:t>Comentaries:</t:t></h2>
<h3><t:t>Preferred Comentaries:</t:t></h3>
- <% if (prefCommentaries.size() > 0) { %>
- <ul>
- <%
- for (int i = 0; i < prefCommentaries.size(); i++) {
- SWModule module = mgr.getModuleByName((String)prefCommentaries.get(i));
- %>
- <li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(module.getName())+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
- }
- %>
- </ul>
- <% } else { %>
- <ul>
- <li><t:t>Preferred commentaries can be selected from the preferences tab</t:t></li>
- </ul>
- <% } %>
+ <%
+ if (prefCommentaries.size() > 0) {
+ out.print( sidebarView.renderView(prefCommentaries, displayModRenderer) ); //render the preferred Commentaries list
+ } else {
+ %>
+ <ul>
+ <li><t:t>Preferred commentaries can be selected from the preferences tab</t:t></li>
+ </ul>
+ <% } %>
@@ -169,21 +165,17 @@
%>
<%
- if ((open) && (modInfo.length > 0)) {
-%>
- <ul>
-<%
+ if (open && (modInfo.length > 0)) {
+ Vector modules = new Vector();
+
for (int i = 0; i < modInfo.length; i++) {
if (modInfo[i].category.equals(SwordOrb.COMMENTARIES)) {
- SWModule module = mgr.getModuleByName(modInfo[i].name);
- %>
- <li><a href="passagestudy.jsp?mod=<%= URLEncoder.encode(modInfo[i].name)+"#cv" %>" title="view Romans 8:26-39 in <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
+ modules.add(modInfo[i].name);
}
}
-%>
- </ul>
-<%
+ modules.removeAll( prefCommentaries );
+
+ out.print( sidebarView.renderView(modules, displayModRenderer) ); //render the complete Commentary module list
}
%>
</div>
@@ -196,153 +188,58 @@
%>
<div id="passagestudy">
- <h2><%= activeKey %></h2>
- <h3><a href="fulllibrary.jsp?show=<%= URLEncoder.encode(activeModule.getName()) %>"><%= activeModule.getDescription().replaceAll("&", "&") + " (" + activeModule.getName() + ")" %></a></h3>
+<%-- <h2><%= activeKey %></h2> --%>
<% //insert next and previous chapter links
- // activeKey contains the current key ATM
- // Split up into book, chapter and verse.
- // Then add and subtract 1 to the chapter to the next and previous one
-
- String bookname = activeKey.substring(0, activeKey.lastIndexOf(" "));
- int chapter = Integer.parseInt( activeKey.substring(activeKey.lastIndexOf(" ")+1, activeKey.indexOf(":")) );
- //int verse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
-
- String prevChapterString = bookname + " " + String.valueOf(chapter-1) + ":1";
- String nextChapterString = bookname + " " + String.valueOf(chapter+1) + ":1";
-
+ String prevChapterString = RangeInformation.getPreviousChapter(activeKey, activeModule);
+ String nextChapterString = RangeInformation.getNextChapter(activeKey, activeModule);
%>
<ul class="booknav">
<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(prevChapterString) %>" title="Display <%= prevChapterString %>"><t:t>previous chapter</t:t></a></li>
- <!-- <li><a href="" title="display all of Romans 8"><t:t>this chapter</t:t></a></li> -->
+ <li><h3><%= activeKey %></h3></li>
<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(nextChapterString) %>" title="Display <%= nextChapterString %>"><t:t>next chapter</t:t></a></li>
</ul>
<%
+ Vector moduleList = new Vector();
+ moduleList.add( activeModule );
+
+ Vector entryList;
if ((activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) || (activeModule.getCategory().equals(SwordOrb.BIBLES))) {
- String chapterPrefix = activeKey.substring(0, activeKey.indexOf(":"));
- int activeVerse = Integer.parseInt(activeKey.substring(activeKey.indexOf(":")+1));
- int anchorVerse = (activeVerse > 2)?activeVerse - 2: -1;
- boolean first = true;
- for (activeModule.setKeyText(chapterPrefix + ":1"); (activeModule.error() == (char)0); activeModule.next()) {
- if (first) {
- %>
- <table>
- <%
- first = false;
- }
- String keyText = activeModule.getKeyText();
- int curVerse = Integer.parseInt(keyText.substring(keyText.indexOf(":")+1));
- if (!chapterPrefix.equals(keyText.substring(0, keyText.indexOf(":"))))
- break;
- mgr.setGlobalOption("Strong's Numbers",
- ((strongs) && (curVerse >= activeVerse -1) && (curVerse <= activeVerse + 1)) ? "on" : "off");
- mgr.setGlobalOption("Morphological Tags",
- ((morph) && (curVerse >= activeVerse -1) && (curVerse <= activeVerse + 1)) ? "on" : "off");
- boolean rtol = ("RtoL".equalsIgnoreCase(activeModule.getConfigEntry("Direction")));
- %>
- <%
- String[] heads = activeModule.getEntryAttribute("Heading", "Preverse", "0");
- if (heads.length > 0) {
- %>
- <tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
- <h3>
- <%= new String(heads[0].getBytes("iso8859-1"), "UTF-8") %>
- </h3></div></td><tr>
- <%
- }
- %>
- <tr>
-
- <%
- if (!rtol) {
- %>
- <td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
- <span class="versenum"><a <%= (curVerse == anchorVerse)?"id=\"cv\"":"" %> href="passagestudy.jsp?key=<%= URLEncoder.encode(keyText)+"#cv" %>">
- <%= keyText.substring(keyText.indexOf(":")+1) %></a>
- </span></div></td>
- <%
- }
- %>
-
- <td><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
-
- <%
- String lang = activeModule.getConfigEntry("Lang");
-// <div xml:lang="<%= (lang.equals("")) ? "en" : lang
- %>
- <%= new String(activeModule.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
-<%
-// </div>
-%>
- </div></td>
- <%
- if (rtol) {
- %>
- <td valign="top" align="right"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
- <span class="versenum"><a <%= (curVerse == anchorVerse)?"id=\"cv\"":"" %> href="passagestudy.jsp?key=<%= URLEncoder.encode(keyText)+"#cv" %>">
- <%= keyText.substring(keyText.indexOf(":")+1) %></a>
- </span></div></td>
- <%
- }
- %>
-
-
- </tr>
- <%
- if (keyText.equals(activeKey)) {
- if (showStrong != null) {
- String [] keyInfo = activeModule.getKeyChildren();
- SWModule lex = mgr.getModuleByName(("1".equals(keyInfo[0])) ? "StrongsHebrew":"StrongsGreek");
- lex.setKeyText(showStrong);
- %>
- <tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
- <div class="lexiconentry"><p>
- <%= new String(lex.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
- </p></div>
- </div></td></tr>
- <% } %>
- <%
- if (showMorph != null) {
- String [] keyInfo = activeModule.getKeyChildren();
- SWModule lex = mgr.getModuleByName(("1".equals(keyInfo[0])) ? "StrongHebrew":"Robinson");
- lex.setKeyText(showMorph);
- %>
- <tr><td colspan="2"><div <%= rtol ? "dir=\"rtl\"" : "" %> class="<%= (keyText.equals(activeKey)) ? "currentverse" : "verse" %>">
- <div class="lexiconentry"><p>
- <%= new String(lex.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
- </p></div>
- </div></td></tr>
- <% }
- }
- }
- if (!first) {
- %>
- </table>
- <%
- }
+ entryList = RangeInformation.getChapterEntryList(activeKey, activeModule);
}
- else {
- %>
- <div class="verse">
- <span class="versenum"><%= activeKey %></span>
- <%= new String(activeModule.getRenderText().getBytes("iso8859-1"), "UTF-8") %>
- </div>
- <%
+ else { //a simple commentary entry, not multiple ones
+ entryList = new Vector();
+ entryList.add(activeKey);
}
+
+ ModuleTextRendering rendering = new HorizontallyParallelTextRendering(); //passagestudy is a parallel view with just one module at the same time
+ ModuleEntryRenderer entryRenderer = new StandardEntryRenderer( new String("passagestudy.jsp"), activeKey, mgr );
+ if (strongs) {
+ entryRenderer.enableFilterOption("Strong's Numbers");
+ }
+ if (morph) {
+ entryRenderer.enableFilterOption("Morphological Tags");
+ }
+
+ //Do the actual rendering
+ out.print( rendering.render(moduleList, entryList, entryRenderer) );
+
String copyLine = activeModule.getConfigEntry("ShortCopyright");
- if (copyLine.equalsIgnoreCase("<swnull>"))
+ if (copyLine.equalsIgnoreCase("<swnull>")) {
copyLine = "";
+ }
if (activeModule.getCategory().equals("Cults / Unorthodox / Questionable Material")) {
copyLine = "<t:t>WARNING: This text is considered unorthodox by most of Christendom.</t:t> " + copyLine;
}
%>
+
<div class="copyLine"><%= copyLine %></div>
- <ul class="booknav">
+<%-- <ul class="booknav">
<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(prevChapterString) %>" title="Display <%= prevChapterString %>"><t:t>previous chapter</t:t></a></li>
- <!-- <li><a href="" title="display all of Romans 8"><t:t>this chapter</t:t></a></li> -->
+ <li><h3><%= activeKey %></h3></li>
<li><a href="passagestudy.jsp?key=<%= URLEncoder.encode(nextChapterString) %>" title="Display <%= nextChapterString %>"><t:t>next chapter</t:t></a></li>
- </ul>
+ </ul> --%>
<div class="promoLine"><%= promoLine %></div>
</div>
</tiles:put>
Modified: trunk/preferences.jsp
===================================================================
--- trunk/preferences.jsp 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/preferences.jsp 2005-10-07 21:17:23 UTC (rev 218)
@@ -1,4 +1,5 @@
<%@ include file="init.jsp" %>
+<%@ page import="org.crosswire.swordweb.*" %>
<%
String addModule = (String)request.getParameter("add");
@@ -33,6 +34,31 @@
saveModPrefsCookie(response, "PrefBibles", prefBibles);
saveModPrefsCookie(response, "PrefCommentaries", prefCommentaries);
+ SidebarModuleView sidebarView = new SimpleModuleView(mgr);
+ SidebarItemRenderer selectModRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
+ public String renderModuleItem(SWModule module) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<li><a href=\"preferences.jsp?add=")
+ .append(URLEncoder.encode(module.getName()))
+ .append("#cv\" title=\"Add this module\">")
+ .append(module.getDescription().replaceAll("&", "&"))
+ .append("</a></li>");
+
+ return ret.toString();
+ }
+ };
+ SidebarItemRenderer removeModRenderer = new SidebarItemRenderer() { //an anonymous class which renders a list of modules with links to read each of them
+ public String renderModuleItem(SWModule module) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<li><a href=\"preferences.jsp?del=")
+ .append(URLEncoder.encode(module.getName()))
+ .append("#cv\" title=\"Remove this module\">")
+ .append(module.getDescription().replaceAll("&", "&"))
+ .append("</a></li>");
+
+ return ret.toString();
+ }
+ };
%>
<tiles:insert beanName="basic" flush="true" >
@@ -44,33 +70,22 @@
<h2><t:t>Translations:</t:t></h2>
<h3><t:t>Preferred Translations</t:t></h3>
<%
- if (prefBibles.size() > 0) {
- out.println("<ul>");
- }
- for (int i = 0; i < prefBibles.size(); i++) {
- SWModule module = mgr.getModuleByName((String)prefBibles.get(i));
+
+ out.print( sidebarView.renderView(prefBibles, selectModRenderer) ); //render the preferred Bibles section
%>
- <li><a href="preferences.jsp?add=<%= URLEncoder.encode(module.getName()) %>" title="Add <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
- }
- if (prefBibles.size() > 0) {
- out.println("</ul>");
- }
- %>
<h3><t:t>All Translations</t:t></h3>
- <ul>
<%
+ Vector modules = new Vector();
for (int i = 0; i < modInfo.length; i++) {
if (modInfo[i].category.equals(SwordOrb.BIBLES)) {
- SWModule module = mgr.getModuleByName(modInfo[i].name);
- %>
- <li><a href="preferences.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>" title="Add <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
+ modules.add(modInfo[i].name);
}
}
+ modules.removeAll(prefBibles); //don't insert the pref mods again
+
+ out.print( sidebarView.renderView(modules, selectModRenderer) ); //render the preferred Bibles section
%>
- </ul>
</div>
</tiles:put>
@@ -80,100 +95,69 @@
<h2><t:t>Comentaries:</t:t></h2>
<h3><t:t>Preferred Comentaries</t:t></h3>
+
<%
- if (prefCommentaries.size() > 0) {
- out.println("<ul>");
- }
- for (int i = 0; i < prefCommentaries.size(); i++) {
- SWModule module = mgr.getModuleByName((String)prefCommentaries.get(i));
+ out.print( sidebarView.renderView(prefCommentaries, selectModRenderer) ); //render the preferred Bibles section
%>
- <li><a href="preferences.jsp?add=<%= URLEncoder.encode(module.getName()) %>" title="Add <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
- }
- if (prefCommentaries.size() > 0) {
- out.println("</ul>");
- }
- %>
-<h3><t:t>All Comentaries</t:t></h3>
- <ul>
+ <h3><t:t>All Comentaries</t:t></h3>
<%
+ Vector modules = new Vector();
for (int i = 0; i < modInfo.length; i++) {
if (modInfo[i].category.equals(SwordOrb.COMMENTARIES)) {
- SWModule module = mgr.getModuleByName(modInfo[i].name);
- %>
- <li><a href="preferences.jsp?add=<%= URLEncoder.encode(modInfo[i].name) %>" title="Add <%= module.getDescription().replaceAll("&", "&") %>"><%= module.getDescription().replaceAll("&", "&") %></a></li>
- <%
+ modules.add(modInfo[i].name);
}
- }
+ }
+ modules.removeAll(prefCommentaries);//don't show the preferred mods again
+
+ out.print( sidebarView.renderView(modules, selectModRenderer) ); //render the preferred Bibles section
%>
- </ul>
</div>
</tiles:put>
<tiles:put name="content" type="string">
-<div id="preferences">
+ <div id="preferences">
<h2><t:t>Preferred Translations</t:t></h2>
- <p><t:t>Click to remove. Reselect on the side to move to the top.</t:t></p>
+ <p><t:t>Click to remove. Reselect on the side to move to the top.</t:t></p>
<%
- if (prefBibles.size() > 0) {
- out.println("<ul>");
- }
- for (int i = 0; i < prefBibles.size(); i++) {
- SWModule mod = mgr.getModuleByName((String)prefBibles.get(i));
+ out.print( sidebarView.renderView(prefBibles, removeModRenderer) ); //render the preferred Bibles section
%>
- <li><a href="preferences.jsp?del=<%= URLEncoder.encode(mod.getName()) %>"><%= mod.getDescription() %> (<%= mod.getName() %>)</a></li>
-
- <%
- }
- if (prefBibles.size() > 0) {
- out.println("</ul>");
- }
- %>
<h2><t:t>Preferred Commentaries</t:t></h2>
- <p><t:t>Click to remove. Reselect on the side to move to the top.</t:t></p>
+ <p><t:t>Click to remove. Reselect on the side to move to the top.</t:t></p>
<%
- if (prefCommentaries.size() > 0) {
- out.println("<ul>");
- }
- for (int i = 0; i < prefCommentaries.size(); i++) {
- SWModule mod = mgr.getModuleByName((String)prefCommentaries.get(i));
+ out.print( sidebarView.renderView(prefCommentaries, removeModRenderer) ); //render the preferred Bibles section
%>
- <li><a href="preferences.jsp?del=<%= URLEncoder.encode(mod.getName()) %>"><%= mod.getDescription() %> (<%= mod.getName() %>)</a></li>
-
- <%
- }
- if (prefCommentaries.size() > 0) {
- out.println("</ul>");
- }
- %>
+
<h2><t:t>Preferred Style</t:t></h2>
<ul>
-<% for (int i = 0; i < styleNames.size(); i++) { %>
- <li><a href="preferences.jsp?setStyle=<%= URLEncoder.encode((String)styleNames.get(i)) %>" title="<%= (String) styleNames.get(i) %>"><t:t><%= (String) styleNames.get(i) %></t:t></a></li>
-<% } %>
+ <% for (int i = 0; i < styleNames.size(); i++) { %>
+ <li><a href="preferences.jsp?setStyle=<%= URLEncoder.encode((String)styleNames.get(i)) %>" title="<%= (String) styleNames.get(i) %>"><t:t><%= (String) styleNames.get(i) %></t:t></a></li>
+ <% } %>
</ul>
<h2><t:t>Tabs</t:t></h2>
<ul>
-<% for (int i = 0; i < tabNames.size(); i++) {
- boolean visible = !"false".equals(showTabs.get(i));
- String n = (String)tabNames.get(i);
- String l = (String)tabLinks.get(i);
- if (!"preferences.jsp".equals(l)) {
- %>
- <li><a href="preferences.jsp?<%=(visible)?"hide":"show"%>Tab=<%= Integer.toString(i)%>" title="<%= ((visible)?"Hide ":"Show ") + n %> Tab"><t:t><%= ((visible)?"Hide ":"Show ") + n %> Tab</t:t></a></li>
-<% }} %>
+ <% for (int i = 0; i < tabNames.size(); i++) {
+ boolean visible = !"false".equals(showTabs.get(i));
+ String n = (String)tabNames.get(i);
+ String l = (String)tabLinks.get(i);
+ if (!"preferences.jsp".equals(l)) {
+ %>
+ <li><a href="preferences.jsp?<%=(visible)?"hide":"show"%>Tab=<%= Integer.toString(i)%>" title="<%= ((visible)?"Hide ":"Show ") + n %> Tab"><t:t><%= ((visible)?"Hide ":"Show ") + n %> Tab</t:t></a></li>
+ <% }
+ }
+ %>
</ul>
+
<h2 id="misc"><t:t>Misc Options</t:t></h2>
<ul>
<li><a id="headings" href="preferences.jsp?Headings=<%= "Off".equalsIgnoreCase(headings)?"On":"Off" %>#misc" title="<%= "Off".equalsIgnoreCase(headings)?"Show":"Hide" %> Headings in Bibles"><t:t><%= "Off".equalsIgnoreCase(headings)?"Show":"Hide" %> Headings in Bibles</t:t></a></li>
<li><a id="javascript" href="preferences.jsp?Javascript=<%= "Off".equalsIgnoreCase(javascript)?"On":"Off" %>#misc" title="<%= "Off".equalsIgnoreCase(javascript)?"Use":"Don't Use" %> Javascript"><t:t><%= "Off".equalsIgnoreCase(javascript)?"Use":"Don't Use" %> Javascript</t:t></a></li>
</ul>
-</div>
+ </div>
</tiles:put>
</tiles:insert>
Modified: trunk/sandy.css
===================================================================
--- trunk/sandy.css 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/sandy.css 2005-10-07 21:17:23 UTC (rev 218)
@@ -505,6 +505,14 @@
margin: 0px 1.1em 0px 0px;
}
+#passagestudy ul li h3 {
+display: inline;
+list-style-type: none;
+line-height: 2em;
+font-size: 1.3em;
+margin: 0px 1.1em 0px 0px;
+}
+
#passagestudy ul li a {
color:#000;
}
@@ -540,6 +548,7 @@
margin: 0px 0px 5px 0px;
padding: 0px 0px 0px 1em;
text-indent: 0px;
+text-align: center;
}
#paralleldisplay ul li {
@@ -550,6 +559,15 @@
margin: 0px 1.1em 0px 0px;
}
+#paralleldisplay ul li h3 {
+display: inline;
+list-style-type: none;
+line-height: 2em;
+font-size: 1.3em;
+margin: 0px 1.1em 0px 0px;
+}
+
+
#paralleldisplay ul li a {
color:#000;
}
Added: trunk/src/org/crosswire/swordweb/HorizontallyParallelTextRendering.java
===================================================================
--- trunk/src/org/crosswire/swordweb/HorizontallyParallelTextRendering.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/HorizontallyParallelTextRendering.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,59 @@
+package org.crosswire.swordweb;
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.net.URLEncoder;
+
+import org.crosswire.sword.orb.SWModule;
+import org.crosswire.sword.orb.SWMgr;
+
+public class HorizontallyParallelTextRendering implements ModuleTextRendering {
+ private Vector _modules;
+ private String _range;
+
+ public String render( Vector modules, Vector entryList, ModuleEntryRenderer renderer ) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<table>");
+
+ ret.append("<colgroup>");//setup col attributes
+ for (int i = 0; i < modules.size(); i++) {
+ ret.append("<col width=\"").append(100/modules.size()).append("%\" />");
+ }
+ ret.append("</colgroup>");
+
+ ret.append("<thead><tr>");
+
+ Enumeration moduleEnum = modules.elements();
+ while (moduleEnum.hasMoreElements()) {
+ SWModule mod = (SWModule)moduleEnum.nextElement();
+ ret.append("<th><a href=\"fulllibrary.jsp?show=").append(URLEncoder.encode(mod.getName())).append("\">");
+ ret.append( mod.getDescription().replaceAll("&", "&")).append(" (").append(mod.getName()).append(")");
+ ret.append("</a></th>");
+
+ }
+ ret.append("</tr></thead>");
+
+ ret.append("<tbody>");
+
+ Vector swordMods = new Vector();
+ moduleEnum = modules.elements();
+ while ( moduleEnum.hasMoreElements() ) {
+ try {
+ SWModule mod = (SWModule)moduleEnum.nextElement();
+ swordMods.add(mod);
+ }
+ catch (Exception e){
+ break;
+ }
+ }
+
+ Enumeration entryEnum = entryList.elements();
+ while ( entryEnum.hasMoreElements() ) {
+ ret.append( renderer.render(swordMods, (String)entryEnum.nextElement()) );
+ }
+
+ ret.append("</tbody>").append("</table>");
+
+ return ret.toString();
+ }
+}
Added: trunk/src/org/crosswire/swordweb/ModuleEntryRenderer.java
===================================================================
--- trunk/src/org/crosswire/swordweb/ModuleEntryRenderer.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/ModuleEntryRenderer.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,10 @@
+package org.crosswire.swordweb;
+
+import java.util.Vector;
+import org.crosswire.sword.orb.*;
+
+public interface ModuleEntryRenderer {
+ public String render( SWModule module, String key );
+ public String render( Vector modules, String key );
+ public void enableFilterOption(String name);
+}
Added: trunk/src/org/crosswire/swordweb/ModuleTextRendering.java
===================================================================
--- trunk/src/org/crosswire/swordweb/ModuleTextRendering.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/ModuleTextRendering.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,8 @@
+package org.crosswire.swordweb;
+
+import java.util.*;
+
+public interface ModuleTextRendering {
+
+ public String render( Vector modules, Vector entryList, ModuleEntryRenderer renderer );
+}
Added: trunk/src/org/crosswire/swordweb/RangeInformation.java
===================================================================
--- trunk/src/org/crosswire/swordweb/RangeInformation.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/RangeInformation.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,56 @@
+package org.crosswire.swordweb;
+
+import java.util.Vector;
+import java.net.URLEncoder;
+
+import org.crosswire.sword.orb.SWModule;
+
+public final class RangeInformation {
+ public static Vector getChapterEntryList(String keyInChapter, SWModule module) {
+ Vector ret = new Vector();
+
+ if (keyInChapter.contains(":")) {
+ String chapterPrefix = keyInChapter.substring(0, keyInChapter.indexOf(":"));
+ int i = 0;
+ for (module.setKeyText(chapterPrefix + ":1"); (module.error() == (char)0); module.next()) {
+ if (!module.getKeyText().startsWith(chapterPrefix)) { //don't continue if we're int he next chapter
+ break;
+ }
+ if (i > 50)
+ break;
+ i++;
+ ret.addElement( module.getKeyText() );
+ }
+ }
+
+ return ret;
+ }
+
+ public static String getPreviousChapter(String keyInChapter, SWModule module) {
+ StringBuffer ret = new StringBuffer();
+
+ final String bookname = keyInChapter.substring(0, keyInChapter.lastIndexOf(" "));
+ final int chapter = Integer.parseInt( keyInChapter.substring(keyInChapter.lastIndexOf(" ")+1, keyInChapter.indexOf(":")) );
+
+ ret.append(bookname).append(" ").append(String.valueOf(chapter-1)).append(":1");
+
+ module.setKeyText(ret.toString());
+ ret = new StringBuffer( module.getKeyText() );
+ return ret.substring(0, ret.indexOf(":"));
+ }
+
+ public static String getNextChapter(String keyInChapter, SWModule module) {
+ StringBuffer ret = new StringBuffer();
+
+ final String bookname = keyInChapter.substring(0, keyInChapter.lastIndexOf(" "));
+ final int chapter = Integer.parseInt( keyInChapter.substring(keyInChapter.lastIndexOf(" ")+1, keyInChapter.indexOf(":")) );
+
+ ret.append(bookname).append(" ").append(String.valueOf(chapter+1)).append(":1");
+
+ module.setKeyText(ret.toString());
+
+ ret = new StringBuffer( module.getKeyText() );
+ return ret.substring(0, ret.indexOf(":"));
+ }
+
+}
\ No newline at end of file
Added: trunk/src/org/crosswire/swordweb/SidebarItemRenderer.java
===================================================================
--- trunk/src/org/crosswire/swordweb/SidebarItemRenderer.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/SidebarItemRenderer.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,14 @@
+package org.crosswire.swordweb;
+
+import org.crosswire.sword.orb.SWModule;
+
+/** Renders a single module into something useful, e.g. a HTML link.
+ *
+ */
+public interface SidebarItemRenderer {
+ /** Does the actual rendering.
+ * @param module The module to use for the rendering.
+ * @return A HTML text string for this module.
+ */
+ public String renderModuleItem(SWModule module);
+}
Added: trunk/src/org/crosswire/swordweb/SidebarModuleView.java
===================================================================
--- trunk/src/org/crosswire/swordweb/SidebarModuleView.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/SidebarModuleView.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,17 @@
+package org.crosswire.swordweb;
+
+import org.crosswire.sword.orb.SWModule;
+import java.util.Vector;
+
+/** Renders a sidebar module list.
+ * Pages like passagestudy or parallelstudy share the same code to render the list of modules on their sidebars (left and right).
+ * This class supports to reuse this code. It offers a method to render a module list in a style which is set by the displayed page.
+ */
+public interface SidebarModuleView {
+ /** Render a sidebar module list using a provided renderer object.
+ * @param mods
+ * @param renderer This renderer object is used to insert the rendered HTML items for each module. This is necessary because each page has different needs for these items.
+ * @return The complete list of modules. It includes HTML list markers like ul and /ul around it if the renderer uses HTML ul list. No need to insert them on your own.
+ */
+ public String renderView(Vector mods, SidebarItemRenderer renderer);
+}
Added: trunk/src/org/crosswire/swordweb/SimpleEntryRenderer.java
===================================================================
--- trunk/src/org/crosswire/swordweb/SimpleEntryRenderer.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/SimpleEntryRenderer.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,100 @@
+package org.crosswire.swordweb;
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.net.URLEncoder;
+
+import org.crosswire.sword.orb.*;
+
+public class SimpleEntryRenderer implements ModuleEntryRenderer {
+ private String _scriptName;
+ private String _highlightKey;
+ private SWMgr _mgr;
+ private Vector _filterOptions = new Vector();
+
+ public SimpleEntryRenderer( String scriptName, String highlightKey, SWMgr mgr ) {
+ _scriptName = scriptName;
+ _highlightKey = highlightKey;
+ _mgr = mgr;
+ }
+
+ public void enableFilterOption(String name) {
+ _filterOptions.add(name);
+ }
+
+ public String render( Vector modules, String key ) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<tr>");
+ final int verse = Integer.parseInt( key.substring(key.indexOf(":") + 1) );
+
+ boolean insertedVerse = false;
+ SWModule mod = null;
+ Enumeration modEnum = modules.elements();
+ while (modEnum.hasMoreElements()) {
+ mod = (SWModule)modEnum.nextElement();
+
+ ret.append("<tr>");
+ if (!insertedVerse) {
+ StringBuffer verseLink;
+ final String hrefURL = URLEncoder.encode(key);
+ if (key.equals(_highlightKey)) { //highlight this key, insert the #cv marker in the link
+ verseLink = new StringBuffer("<a id=\"cv\" href=\"" + _scriptName + "?key=" + hrefURL + "#cv\">");
+ }
+ else { //just a normal verse, no currentverse class and no cv marker
+ verseLink = new StringBuffer("<a href=\"" + _scriptName + "?key=" + hrefURL + "#cv\">");
+ }
+ verseLink.append(verse).append("</a>"); //link end is the same for both (highlighted and plain link)
+
+ ret.append("<td><span class=\"versenum\">").append(verseLink).append("</span></td>");
+ insertedVerse = true;
+ }
+ else {
+ ret.append("<td></td>");
+ }
+ ret.append("<td>").append(mod.getName()).append("</td>");
+
+ final boolean rtol = ("RtoL".equalsIgnoreCase(mod.getConfigEntry("Direction")));
+ if (rtol) {
+ ret.append("<td dir=\"rtl\">");
+ }
+ else {
+ ret.append("<td>");
+ }
+ ret.append( this.render(mod, key) ).append("</td>");
+ ret.append("</tr>");
+ }
+
+ ret.append("</tr>");
+ return ret.toString();
+ }
+
+ public String render( SWModule module, String key ) {
+ StringBuffer ret = new StringBuffer();
+
+ final int verse = Integer.parseInt( key.substring(key.indexOf(":") + 1) );
+ final int highlightVerse = Integer.parseInt( _highlightKey.substring(key.indexOf(":") + 1) );
+ final boolean enableFilterOptions = (verse >= highlightVerse -1) && (verse <= highlightVerse + 1);
+
+ Enumeration filterEnum = _filterOptions.elements();
+ while (filterEnum.hasMoreElements()) {
+ _mgr.setGlobalOption((String)filterEnum.nextElement(), enableFilterOptions ? "on" : "off");
+ }
+
+ if (key.equals(_highlightKey)) { //highlight this key, insert the #cv marker in the link
+ ret.append("<div class=\"currentverse\">");
+ }
+ else { //just a normal verse, no currentverse class and no cv marker
+ ret.append("<div class=\"verse\">");
+ }
+
+ try {
+ module.setKeyText(key);
+ ret.append(new String(module.getRenderText().getBytes("iso8859-1"), "UTF-8"));
+ }
+ catch (Exception e) {
+ }
+
+ ret.append("</div>");
+ return ret.toString();
+ }
+}
Added: trunk/src/org/crosswire/swordweb/SimpleModuleView.java
===================================================================
--- trunk/src/org/crosswire/swordweb/SimpleModuleView.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/SimpleModuleView.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,34 @@
+package org.crosswire.swordweb;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.crosswire.sword.orb.SWModule;
+import org.crosswire.sword.orb.SWMgr;
+
+public class SimpleModuleView implements SidebarModuleView {
+ private SWMgr _mgr;
+
+ public SimpleModuleView(SWMgr mgr) {
+ _mgr = mgr;
+ }
+
+ public String renderView(Vector mods, SidebarItemRenderer renderer) {
+ StringBuffer ret = new StringBuffer();
+
+ if (mods.size() > 0) {
+ ret.append("<ul>");
+ Enumeration e = mods.elements();
+ while (e.hasMoreElements()) {
+ SWModule mod = _mgr.getModuleByName( (String)e.nextElement() );
+ if (mod != null) {
+ ret.append(renderer.renderModuleItem(mod));
+ }
+ }
+
+ ret.append("</ul>");
+ }
+
+ return ret.toString();
+ }
+}
\ No newline at end of file
Added: trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java
===================================================================
--- trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/StandardEntryRenderer.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,84 @@
+package org.crosswire.swordweb;
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.net.URLEncoder;
+
+import org.crosswire.sword.orb.*;
+
+public class StandardEntryRenderer implements ModuleEntryRenderer {
+ private String _scriptName;
+ private String _highlightKey;
+ private SWMgr _mgr;
+ private Vector _filterOptions = new Vector();
+
+ public StandardEntryRenderer( String scriptName, String highlightKey, SWMgr mgr ) {
+ _scriptName = scriptName;
+ _highlightKey = highlightKey;
+ _mgr = mgr;
+ }
+
+ public void enableFilterOption(String name) {
+ _filterOptions.add(name);
+ }
+
+ public String render( Vector modules, String key ) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<tr>");
+
+ Enumeration modEnum = modules.elements();
+ while (modEnum.hasMoreElements()) {
+ SWModule mod = (SWModule)modEnum.nextElement();
+ final boolean rtol = ("RtoL".equalsIgnoreCase(mod.getConfigEntry("Direction")));
+
+ if (rtol) {
+ ret.append("<td dir=\"rtl\">");
+ }
+ else {
+ ret.append("<td>");
+ }
+ ret.append( this.render(mod, key) );
+ ret.append("</td>");
+ }
+
+ ret.append("</tr>");
+ return ret.toString();
+ }
+
+ public String render( SWModule module, String key ) {
+ StringBuffer ret = new StringBuffer();
+
+ final int verse = Integer.parseInt( key.substring(key.indexOf(":") + 1) );
+ final int highlightVerse = Integer.parseInt( _highlightKey.substring(key.indexOf(":") + 1) );
+ final boolean enableFilterOptions = (verse >= highlightVerse -1) && (verse <= highlightVerse + 1);
+
+ Enumeration filterEnum = _filterOptions.elements();
+ while (filterEnum.hasMoreElements()) {
+ _mgr.setGlobalOption((String)filterEnum.nextElement(), enableFilterOptions ? "on" : "off");
+ }
+
+ final String hrefURL = URLEncoder.encode(key);
+ StringBuffer verseLink;
+ if (key.equals(_highlightKey)) { //highlight this key, insert the #cv marker in the link
+ ret.append("<div class=\"currentverse\">");
+ verseLink = new StringBuffer("<a id=\"cv\" href=\"" + _scriptName + "?key=" + hrefURL + "#cv\">");
+ }
+ else { //just a normal verse, no currentverse class and no cv marker
+ ret.append("<div class=\"verse\">");
+ verseLink = new StringBuffer("<a href=\"" + _scriptName + "?key=" + hrefURL + "#cv\">");
+ }
+ verseLink.append(verse).append("</a>"); //link end is the same for both (highlighted and plain link)
+
+
+ ret.append("<span class=\"versenum\">").append(verseLink).append("</span> ");
+ try {
+ module.setKeyText(key);
+ ret.append(new String(module.getRenderText().getBytes("iso8859-1"), "UTF-8"));
+ }
+ catch (Exception e) {
+ }
+
+ ret.append("</div>");
+ return ret.toString();
+ }
+}
Added: trunk/src/org/crosswire/swordweb/VerticallyParallelTextRendering.java
===================================================================
--- trunk/src/org/crosswire/swordweb/VerticallyParallelTextRendering.java 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/src/org/crosswire/swordweb/VerticallyParallelTextRendering.java 2005-10-07 21:17:23 UTC (rev 218)
@@ -0,0 +1,44 @@
+package org.crosswire.swordweb;
+
+import java.util.Vector;
+import java.util.Enumeration;
+import java.net.URLEncoder;
+
+import org.crosswire.sword.orb.SWModule;
+import org.crosswire.sword.orb.SWMgr;
+
+public class VerticallyParallelTextRendering implements ModuleTextRendering {
+ private Vector _modules;
+ private String _range;
+
+ public String render( Vector modules, Vector entryList, ModuleEntryRenderer renderer ) {
+ StringBuffer ret = new StringBuffer();
+ ret.append("<table>");
+ ret.append("<tbody>");
+
+ Vector swordMods = new Vector();
+ Enumeration moduleEnum = modules.elements();
+ while ( moduleEnum.hasMoreElements() ) {
+ try {
+ SWModule mod = (SWModule)moduleEnum.nextElement();
+ swordMods.add(mod);
+ }
+ catch (Exception e){
+ break;
+ }
+ }
+
+ Enumeration entryEnum = entryList.elements();
+ while ( entryEnum.hasMoreElements() ) {
+ String currentEntry = (String)entryEnum.nextElement();
+ boolean insertedVerse = false;
+
+ ret.append( renderer.render(swordMods, currentEntry) );
+ ret.append("<tr><td><div style=\"height:10px;\"/><td></tr>"); //an empty line between verses
+ }
+
+ ret.append("</tbody>").append("</table>");
+
+ return ret.toString();
+ }
+}
Modified: trunk/wash.css
===================================================================
--- trunk/wash.css 2005-10-04 01:28:25 UTC (rev 217)
+++ trunk/wash.css 2005-10-07 21:17:23 UTC (rev 218)
@@ -638,6 +638,8 @@
margin: 0px 0px 5px 0px;
padding: 0px 0px 0px 1em;
text-indent: 0px;
+text-align: center;
+vertical-align:middle;
}
#passagestudy ul li {
@@ -648,6 +650,14 @@
margin: 0px 1.1em 0px 0px;
}
+#passagestudy ul li h3 {
+display: inline;
+list-style-type: none;
+line-height: 2em;
+font-size: 1.3em;
+margin: 0px 1.1em 0px 0px;
+}
+
#passagestudy ul li a {
color:#000;
}
@@ -677,6 +687,8 @@
margin: 0px 0px 5px 0px;
padding: 0px 0px 0px 1em;
text-indent: 0px;
+text-align: center;
+vertical-align: middle;
}
#paralleldisplay ul li {
@@ -687,6 +699,14 @@
margin: 0px 1.1em 0px 0px;
}
+#paralleldisplay ul li h3 {
+display: inline;
+list-style-type: none;
+line-height: 2em;
+font-size: 1.3em;
+margin: 0px 1.1em 0px 0px;
+}
+
#paralleldisplay ul li a {
color:#000;
}
@@ -805,19 +825,19 @@
font-weight: bold;
}
-.word-layer {
+.word-layer { /* The layer which appears after clicking on a word */
visibility: hidden;
position:absolute;
left:50px;
top:50px;
width:200px;
- background-color: #fff3cf;
+ background-color: #EEEEEE;
margin-left : 0;
overflow: visible;
z-index:6;
border: 1px #000000;
border-style: solid;
- padding: 7px 7px 7px 7px;
+ padding: 7px;
color : #000000;
font-size : x-small;
font-style : normal;
@@ -832,15 +852,16 @@
line-height : normal;
}
-span.curWord {
- text-decoration: underline;
+/* Formating options for the grammatical highlighting */
+span.curWord { /* The clicked word */
+ text-decoration: underline;
font-weight : bold;
- background: #a1895F;
+ background: #C5D6EA;
}
-span.sameLemmaMorph {
- text-decoration: underline;
+span.sameLemmaMorph { /* The other words with the same morph code */
+ text-decoration: underline;
font-weight : bold;
}
-span.sameLemma {
+span.sameLemma { /* The other words with the same lemma on the page */
font-weight : bold;
}
More information about the sword-cvs
mailing list