[Tynstep-svn] r254 - in trunk/step: step-core/src/main/java/com/tyndalehouse/step/core/guice/providers step-core/src/main/java/com/tyndalehouse/step/core/service/impl step-core/src/main/resources/com/tyndalehouse/step/core/data/create/hotspot step-core/src/main/resources/com/tyndalehouse/step/core/service/impl step-web step-web/src/main/java/com/tyndalehouse/step/guice step-web/src/main/java/com/tyndalehouse/step/rest/framework step-web/src/main/webapp step-web/src/main/webapp/WEB-INF step-web/src/main/webapp/css step-web/src/main/webapp/js
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Tue Apr 24 06:13:39 MST 2012
Author: ChrisBurrell
Date: 2012-04-24 06:13:39 -0700 (Tue, 24 Apr 2012)
New Revision: 254
Added:
trunk/step/step-web/src/main/webapp/js/top_menu.js
Removed:
trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/framework/EbeanServletContextListener.java
Modified:
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java
trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/data/create/hotspot/hotspots.csv
trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/service/impl/interlinear.xsl
trunk/step/step-web/pom.xml
trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java
trunk/step/step-web/src/main/webapp/WEB-INF/web.xml
trunk/step/step-web/src/main/webapp/css/passage.css
trunk/step/step-web/src/main/webapp/index.html
trunk/step/step-web/src/main/webapp/js/init.js
trunk/step/step-web/src/main/webapp/js/passage.js
trunk/step/step-web/src/main/webapp/js/timeline.js
trunk/step/step-web/src/main/webapp/topmenu.html
Log:
Adding interlinear changes TYNSTEP-138, TYNSTEP-139 and TYNSTEP-137
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java 2012-04-24 13:13:39 UTC (rev 254)
@@ -36,6 +36,7 @@
private final String url;
private final String username;
private final String password;
+ private BasicDataSource ds;
/**
* We inject some properties in to the datasource provider
@@ -78,20 +79,19 @@
final ServerConfig config = new ServerConfig();
config.setName("db");
- final BasicDataSource ds = new BasicDataSource();
- ds.setDefaultAutoCommit(false);
- ds.setDriverClassName(this.driverClassName);
- ds.setPoolPreparedStatements(this.poolStatements);
- ds.setMaxActive(this.maxActive);
- ds.setMaxIdle(this.maxIdle);
- ds.setMaxOpenPreparedStatements(this.maxOpenStatements);
- ds.setValidationQuery(this.validationQuery);
- ds.setUrl(this.url);
- ds.setUsername(this.username);
- ds.setPassword(this.password);
+ this.ds = new BasicDataSource();
+ this.ds.setDefaultAutoCommit(false);
+ this.ds.setDriverClassName(this.driverClassName);
+ this.ds.setPoolPreparedStatements(this.poolStatements);
+ this.ds.setMaxActive(this.maxActive);
+ this.ds.setMaxIdle(this.maxIdle);
+ this.ds.setMaxOpenPreparedStatements(this.maxOpenStatements);
+ this.ds.setValidationQuery(this.validationQuery);
+ this.ds.setUrl(this.url);
+ this.ds.setUsername(this.username);
+ this.ds.setPassword(this.password);
- config.setDataSource(ds);
-
+ config.setDataSource(this.ds);
// config.addPackage("com.tyndalehouse.step.core.data.entities");
addEntities(config);
@@ -126,4 +126,10 @@
config.addClass(TimelineEventsAndDate.class);
}
+ /**
+ * @return the ds
+ */
+ public BasicDataSource getDs() {
+ return this.ds;
+ }
}
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java 2012-04-24 13:13:39 UTC (rev 254)
@@ -242,6 +242,7 @@
final String interlinearVersion, final String reference) {
if (tsep.getParameter(LookupOption.INTERLINEAR.getXsltParameterName()) != null) {
tsep.setParameter("interlinearReference", reference);
+ tsep.setParameter("VLine", false);
if (isNotBlank(interlinearVersion)) {
tsep.setParameter("interlinearVersion", interlinearVersion);
@@ -267,6 +268,8 @@
tsep.setParameter(LookupOption.TINY_VERSE_NUMBERS.getXsltParameterName(), true);
}
}
+
+ tsep.setParameter("baseVersion", version);
}
@Override
@@ -413,19 +416,17 @@
@Override
public List<String> getBibleBookNames(final String bookStart, final String version) {
- if (isBlank(bookStart)) {
- return new ArrayList<String>();
- }
+ final String lookup = isBlank(bookStart) ? "" : bookStart;
Versification versification = Versifications.instance().getVersification(version);
if (versification == null) {
versification = Versifications.instance().getDefaultVersification();
}
- final List<String> books = getBooksFromVersification(bookStart, versification);
+ final List<String> books = getBooksFromVersification(lookup, versification);
if (books.isEmpty()) {
- return getBooksFromVersification(bookStart, Versifications.instance().getDefaultVersification());
+ return getBooksFromVersification(lookup, Versifications.instance().getDefaultVersification());
}
return books;
Modified: trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/data/create/hotspot/hotspots.csv
===================================================================
--- trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/data/create/hotspot/hotspots.csv 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/data/create/hotspot/hotspots.csv 2012-04-24 13:13:39 UTC (rev 254)
@@ -1,4 +1,4 @@
Start,End,Scale,Magnify,Description,Color
-"-2000-01-01T00:00:00.000","-1252-11-01T00:00:00.000",CENTURY,0.000625,Pre-Pre-Exodus,#DCBFF6
+"-2000-01-01T00:00:00.000","-1252-11-01T00:00:00.000",DECADE,0.000625,Pre-Pre-Exodus,#DCBFF6
"-1255-11-01T00:00:00.000","-1251-11-01T00:00:00.000",YEAR,0.25,Pre-Exodus,#FAEBD7
"-1251-12-11T00:00:00.000","-1250-12-31T00:00:00.000",WEEK,3,Exodus Plagues,#A7FABB
Modified: trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/service/impl/interlinear.xsl
===================================================================
--- trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/service/impl/interlinear.xsl 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-core/src/main/resources/com/tyndalehouse/step/core/service/impl/interlinear.xsl 2012-04-24 13:13:39 UTC (rev 254)
@@ -95,6 +95,7 @@
<xsl:param name="morphFunctionCall" select="'javascript:showMorph'" />
<!-- a comma separated list of versions to display, if provided, then we display the interlinear -->
+ <xsl:param name="baseVersion" select="''" />
<xsl:param name="interlinearVersion" select="''" />
<xsl:param name="interlinearReference" select="''" />
@@ -272,7 +273,7 @@
<!-- Always output the verse -->
<xsl:choose>
<xsl:when test="$VLine = 'true'">
- <div class="l"><a name="{@osisID}"><xsl:call-template name="versenum"/></a><xsl:apply-templates/></div>
+ <span class="l interlinear"><a name="{@osisID}"><xsl:call-template name="versenum"/></a><xsl:apply-templates/></span>
</xsl:when>
<xsl:otherwise>
<span class="interlinear"><xsl:call-template name="versenum"/><xsl:apply-templates/></span>
@@ -360,9 +361,9 @@
-->
<xsl:choose>
<xsl:when test="$TinyVNum = 'true' and $Notes = 'true'">
- <span class="w">
+ <span class="w verseStart">
<!-- the verse number -->
- <a name="{@osisID}"><span class="verseNumber"><xsl:value-of select="$versenum"/></span></a>
+ <a name="{@osisID}"><span class="verseNumber"><xsl:value-of select="concat($versenum, ' ', $baseVersion)"/></span></a>
<!-- output a filling gap for strongs -->
<xsl:if test="$StrongsNumbers = 'true'">
@@ -383,9 +384,9 @@
</span>
</xsl:when>
<xsl:when test="$TinyVNum = 'true' and $Notes = 'false'">
- <span class="w">
+ <span class="w verseStart">
<!-- the verse number -->
- <a name="{@osisID}"><span class="text"><span class="verseNumber"><xsl:value-of select="$versenum"/></span></span></a>
+ <a name="{@osisID}"><span class="text"><span class="verseNumber"><xsl:value-of select="concat($versenum, ' ', $baseVersion)"/></span></span></a>
<!-- output a filling gap for strongs -->
<xsl:if test="$StrongsNumbers = 'true'">
Modified: trunk/step/step-web/pom.xml
===================================================================
--- trunk/step/step-web/pom.xml 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/pom.xml 2012-04-24 13:13:39 UTC (rev 254)
@@ -21,6 +21,11 @@
<artifactId>step-core</artifactId>
</dependency>
<dependency>
+ <groupId>org.avaje</groupId>
+ <artifactId>ebean</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>
Modified: trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java
===================================================================
--- trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java 2012-04-24 13:13:39 UTC (rev 254)
@@ -1,5 +1,15 @@
package com.tyndalehouse.step.guice;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Enumeration;
+
+import javax.servlet.ServletContextEvent;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
@@ -15,14 +25,42 @@
*
*/
public class StepServletConfig extends GuiceServletContextListener {
+ private final Logger LOGGER = LoggerFactory.getLogger(StepServletConfig.class);
+ private Injector injector;
@Override
protected Injector getInjector() {
- return Guice.createInjector(new StepCoreModule(), new WebContextModule(), new ServletModule() {
- @Override
- protected void configureServlets() {
- serve("/rest/*").with(FrontController.class);
+ this.injector = Guice.createInjector(new StepCoreModule(), new WebContextModule(),
+ new ServletModule() {
+ @Override
+ protected void configureServlets() {
+ serve("/rest/*").with(FrontController.class);
+ }
+ });
+ return this.injector;
+ }
+
+ @Override
+ public void contextDestroyed(final ServletContextEvent servletContextEvent) {
+ deregisterDbDrivers();
+ super.contextDestroyed(servletContextEvent);
+
+ }
+
+ /**
+ * Deregisters database drivers to prevent leaks
+ */
+ private void deregisterDbDrivers() {
+ final Enumeration<Driver> drivers = DriverManager.getDrivers();
+ while (drivers.hasMoreElements()) {
+ final Driver driver = drivers.nextElement();
+
+ try {
+ DriverManager.deregisterDriver(driver);
+ this.LOGGER.info("Deregistering Jdbc driver: {}", driver);
+ } catch (final SQLException e) {
+ this.LOGGER.error("Error deregistering driver " + driver.toString(), e);
}
- });
+ }
}
}
Deleted: trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/framework/EbeanServletContextListener.java
===================================================================
--- trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/framework/EbeanServletContextListener.java 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/framework/EbeanServletContextListener.java 2012-04-24 13:13:39 UTC (rev 254)
@@ -1,20 +0,0 @@
-package com.tyndalehouse.step.rest.framework;
-
-import javax.servlet.ServletContextEvent;
-
-import com.avaje.ebeaninternal.server.core.ServletContextListener;
-
-/**
- * Overrides the creation to avoid creation of Ebean - this is handled by Guice
- *
- * TODO: remove this in favour of context listener? if so refactor of tests required
- *
- * @author Chris
- *
- */
-public class EbeanServletContextListener extends ServletContextListener {
- @Override
- public void contextInitialized(final ServletContextEvent event) {
- // DO NOTHING
- }
-}
Modified: trunk/step/step-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/step/step-web/src/main/webapp/WEB-INF/web.xml 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/webapp/WEB-INF/web.xml 2012-04-24 13:13:39 UTC (rev 254)
@@ -30,13 +30,13 @@
</listener>
<listener>
- <listener-class>com.tyndalehouse.step.rest.framework.EbeanServletContextListener</listener-class>
+ <listener-class>com.avaje.ebeaninternal.server.core.ServletContextListener</listener-class>
</listener>
-
<listener>
<listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class>
</listener>
+
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
Modified: trunk/step/step-web/src/main/webapp/css/passage.css
===================================================================
--- trunk/step/step-web/src/main/webapp/css/passage.css 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/webapp/css/passage.css 2012-04-24 13:13:39 UTC (rev 254)
@@ -36,6 +36,10 @@
padding-right: 2px;
}
+.interlinear .verseNumber {
+ clear: left;
+}
+
.smallHeaders {
font-size: 6pt;
padding-right: 2px;
@@ -51,9 +55,19 @@
}
span.w {
- margin-top: 20px;
+ margin-top: 20px;
+ margin-top: 20px;
+ border-left: dotted darkgrey 1px;
+ text-align: center;
+ padding-left: 2px !important;
}
+span.verseStart {
+ clear: left;
+}
+
+
+
span.strongs a {
color: orange;
text-decoration: none;
Modified: trunk/step/step-web/src/main/webapp/index.html
===================================================================
--- trunk/step/step-web/src/main/webapp/index.html 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/webapp/index.html 2012-04-24 13:13:39 UTC (rev 254)
@@ -40,6 +40,7 @@
<script src="js/ui_hooks.js" type="text/javascript"></script>
<script src="js/timeline.js" type="text/javascript"></script>
<script src="js/geography.js" type="text/javascript"></script>
+ <script src="js/top_menu.js" type="text/javascript"></script>
<script src="js/toolbar_menu.js" type="text/javascript"></script>
<script src="js/interlinear_popup.js" type="text/javascript"></script>
<script src="js/login.js" type="text/javascript"></script>
Modified: trunk/step/step-web/src/main/webapp/js/init.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/init.js 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/webapp/js/init.js 2012-04-24 13:13:39 UTC (rev 254)
@@ -88,7 +88,9 @@
//customtheme: ["#1c5a80", "#18374a"],
contentsource: ["topMenu", "topmenu.html"]
});
+// new TopMenu($("#topMenu-ajax");
+
$.get("panemenu.html", function(data) {
var menusToBe = $(".innerMenus");
menusToBe.html(data);
Modified: trunk/step/step-web/src/main/webapp/js/passage.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/passage.js 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/webapp/js/passage.js 2012-04-24 13:13:39 UTC (rev 254)
@@ -91,7 +91,7 @@
response(text);
});
},
- minLength: 1,
+ minLength: 0,
delay: 0,
select : function(event, ui) {
$(this).val(ui.item.value);
Modified: trunk/step/step-web/src/main/webapp/js/timeline.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/timeline.js 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/webapp/js/timeline.js 2012-04-24 13:13:39 UTC (rev 254)
@@ -53,7 +53,7 @@
end: Timeline.DateTime.parseIso8601DateTime(item.end),
magnify: item.magnify,
unit: Timeline.DateTime[item.scale],
- color: item.color,
+// color: item.color,
description: item.description
});
});
@@ -93,17 +93,17 @@
];
var decorators = [];
- $.each(zones, function(index, item) {
- decorators.push(new Timeline.SpanHighlightDecorator({
- startDate: item.start,
- endDate: item.end,
- color: item.color,
- opacity: 50,
- startLabel: item.description,
-// endLabel: "END",
- cssClass: 't-highlight1'
- }));
- });
+// $.each(zones, function(index, item) {
+// decorators.push(new Timeline.SpanHighlightDecorator({
+// startDate: item.start,
+// endDate: item.end,
+// color: item.color,
+// opacity: 50,
+// startLabel: item.description,
+//// endLabel: "END",
+// cssClass: 't-highlight1'
+// }));
+// });
self.bands[0].decorators = decorators;
Added: trunk/step/step-web/src/main/webapp/js/top_menu.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/top_menu.js (rev 0)
+++ trunk/step/step-web/src/main/webapp/js/top_menu.js 2012-04-24 13:13:39 UTC (rev 254)
@@ -0,0 +1,100 @@
+
+/**
+ * Represents the menu that will be at the top of the passage container
+ */
+function TopMenu(menuRoot) {
+ this.menuRoot = $(menuRoot);
+ var self = this;
+
+ ddsmoothmenu.init({
+ mainmenuid: menuRoot.id, //menu DIV id
+ zIndexStart: 1000,
+ orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
+ classname: 'ddsmoothmenu topMenu', //class added to menu's outer DIV
+ //customtheme: ["#1c5a80", "#18374a"],
+ contentsource: ["topMenu", "topmenu.html"]
+ });
+
+ this.setDefaultOptions();
+
+// $(menuRoot).hear("pane-menu-toggle-item-" + this.passageId, function(selfElement, menuOptionName) {
+// self.toggleMenuItem(menuOptionName);
+// });
+}
+
+/**
+ * @param selected true to select
+ * @param menuItem the item name
+ */
+TopMenu.prototype.selectMenuItem = function(menuItem, selected) {
+ if(selected) {
+ this.tickMenuItem(menuItem);
+ } else {
+ this.untickMenuItem(menuItem);
+ }
+}
+
+
+/**
+ * toggles the tick next to the element
+ * @param name of the element
+ */
+TopMenu.prototype.toggleMenuItem = function(selectedItem) {
+ if(this.checkItemIsSelectable(selectedItem)) {
+ var matchedSelectedIcon = $(this.getItemSelector(selectedItem)).children(".selectingTick");
+ if(matchedSelectedIcon.length) {
+ this.untickMenuItem(selectedItem);
+ } else {
+ this.tickMenuItem(selectedItem);
+ }
+
+ //fire off options?
+ //fire-off an event indicating that menu options have changed!
+// $.shout("toolbar-menu-options-changed-" + this.passageId);
+ }
+}
+
+
+/**
+ * puts a tick next to the menu item
+ * @param selectedItem the name attribute of the element to click
+ */
+TopMenu.prototype.tickMenuItem = function(selectedItem) {
+ this.getItemSelector(selectedItem).not(":has(img)").append("<img class='selectingTick' src='images/selected.png' />");
+}
+
+/**
+ * removes the tick next to the menu item
+ * @param selectedItem name of the item to untick
+ */
+TopMenu.prototype.untickMenuItem = function(selectedItem) {
+ $("img.selectingTick", this.getItemSelector(selectedItem)).remove();
+}
+
+/**
+ * The menu item can be selected
+ * @param selectedItem the name of the item to be selected
+ * @return true if the item can be selected
+ */
+TopMenu.prototype.checkItemIsSelectable = function(selectedItem) {
+ //we only deal with elements that are enabled
+ if(this.getItemSelector(selectedItem).hasClass("disabled")) {
+ return false;
+ }
+ return true;
+}
+
+/**
+ * sets up the default options for the menu
+ */
+TopMenu.prototype.setDefaultOptions = function() {
+ this.toggleMenuItem("LIMIT_AVAILABLE_MODULES");
+}
+
+/**
+ * returns all menu items matching the name specified
+ * TODO could add cache here based on name
+ */
+TopMenu.prototype.getItemSelector = function(name) {
+ return $("*[name = '" + name + "']", this.menuRoot);
+}
Property changes on: trunk/step/step-web/src/main/webapp/js/top_menu.js
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/step/step-web/src/main/webapp/topmenu.html
===================================================================
--- trunk/step/step-web/src/main/webapp/topmenu.html 2012-04-23 11:52:53 UTC (rev 253)
+++ trunk/step/step-web/src/main/webapp/topmenu.html 2012-04-24 13:13:39 UTC (rev 254)
@@ -13,6 +13,7 @@
<ul>
<li><a href="#" class="notYetImplemented">Install Bibles [Coming soon]</a></li>
<li><a href="#" class="notYetImplemented">Update [Coming soon]</a></li>
+ <li><a href="#" name="LIMIT_AVAILABLE_MODULES" onclick="toggleMenuItem(this);">Show only my Bibles in my language</a></li>
<li><a href="#" class="notYetImplemented">User preferences [Coming soon]</a></li>
</ul>
</li>
More information about the Tynstep-svn
mailing list