[Tynstep-svn] r236 - in tags: . step-0.2/step-core step-0.2/step-web step-0.2/step-web/src/main/webapp step-0.2/step-web/src/main/webapp/css step-0.2/step-web/src/main/webapp/js

ryan1234 at crosswire.org ryan1234 at crosswire.org
Wed Feb 29 20:26:31 MST 2012


Author: ryan1234
Date: 2012-02-29 20:26:31 -0700 (Wed, 29 Feb 2012)
New Revision: 236

Added:
   tags/step-0.2/
Modified:
   tags/step-0.2/step-core/pom.xml
   tags/step-0.2/step-web/db-create.sql
   tags/step-0.2/step-web/db-drop.sql
   tags/step-0.2/step-web/src/main/webapp/css/initial-layout.css
   tags/step-0.2/step-web/src/main/webapp/index.html
   tags/step-0.2/step-web/src/main/webapp/js/init.js
   tags/step-0.2/step-web/src/main/webapp/js/lexicon_definition.js
   tags/step-0.2/step-web/src/main/webapp/js/timeline.js
   tags/step-0.2/step-web/src/main/webapp/js/ui_hooks.js
   tags/step-0.2/step-web/src/main/webapp/panemenu.html
Log:
>From Ryan M.

Started to work on the UI for STEP - specifically with the timeline feature.  Creating a separate copy of the source with a tag just for testing.

Modified: tags/step-0.2/step-core/pom.xml
===================================================================
--- trunk/step/step-core/pom.xml	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-core/pom.xml	2012-03-01 03:26:31 UTC (rev 236)
@@ -81,10 +81,14 @@
 			<artifactId>jsword</artifactId>
 		</dependency>
 		<dependency>
+			<groupId>org.crosswire.common.util</groupId>
+			<artifactId>jsword-common</artifactId>
+			<version>1.6</version>
+		</dependency>		
+		<dependency>
 			<groupId>org.jdom</groupId>
 			<artifactId>jdom</artifactId>
 		</dependency>
-				
 		<dependency>
 			<groupId>commons-lang</groupId>
 			<artifactId>commons-lang</artifactId>

Modified: tags/step-0.2/step-web/db-create.sql
===================================================================
--- trunk/step/step-web/db-create.sql	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/db-create.sql	2012-03-01 03:26:31 UTC (rev 236)
@@ -5,6 +5,18 @@
   constraint pk_bookmark primary key (id))
 ;
 
+create table geo_place (
+  id                        integer not null,
+  esv_name                  varchar(255),
+  root                      varchar(255),
+  latitude                  double(17),
+  longitude                 double(17),
+  comment                   varchar(255),
+  precision                 integer,
+  constraint ck_geo_place_precision check (precision in (0,1,2)),
+  constraint pk_geo_place primary key (id))
+;
+
 create table history (
   id                        integer not null,
   history_reference         varchar(255) not null,
@@ -23,30 +35,28 @@
   constraint pk_hot_spot primary key (id))
 ;
 
+create table relational_person (
+  id                        integer not null,
+  name                      varchar(255),
+  father_id                 integer,
+  mother_id                 integer,
+  code                      varchar(255),
+  constraint uq_relational_person_code unique (code),
+  constraint pk_relational_person primary key (id))
+;
+
 create table scripture_reference (
-  scripture_reference_id    integer not null,
-  target_id                 integer,
+  id                        integer not null,
+  geo_place_id              integer,
+  timeline_event_id         integer,
+  relational_person_id      integer,
   target_type               integer,
   start_verse_id            integer,
   end_verse_id              integer,
-  constraint ck_scripture_reference_target_type check (target_type in (0)),
-  constraint pk_scripture_reference primary key (scripture_reference_id))
+  constraint ck_scripture_reference_target_type check (target_type in (0,1)),
+  constraint pk_scripture_reference primary key (id))
 ;
 
-create table scripture_target (
-  targetTypeId              integer(31) not null,
-  id                        integer not null,
-  summary                   varchar(255),
-  from_date                 bigint,
-  to_date                   bigint,
-  from_precision            integer,
-  to_precision              integer,
-  hot_spot_id               integer,
-  constraint ck_scripture_target_from_precision check (from_precision in (0,1,2,3)),
-  constraint ck_scripture_target_to_precision check (to_precision in (0,1,2,3)),
-  constraint pk_scripture_target primary key (id))
-;
-
 create table session (
   id                        integer not null,
   j_session_id              varchar(255),
@@ -65,29 +75,47 @@
   constraint pk_timeband primary key (id))
 ;
 
+create table timeline_event (
+  id                        integer not null,
+  summary                   varchar(255),
+  from_date                 timestamp,
+  to_date                   timestamp,
+  from_precision            integer,
+  to_precision              integer,
+  hot_spot_id               integer,
+  constraint ck_timeline_event_from_precision check (from_precision in (0,1,2,3)),
+  constraint ck_timeline_event_to_precision check (to_precision in (0,1,2,3)),
+  constraint pk_timeline_event primary key (id))
+;
+
 create table users (
   id                        integer not null,
   name                      varchar(255),
-  password                  varchar(255),
-  email_address             varchar(255),
+  password                  varbinary(255) not null,
+  salt                      varbinary(255) not null,
+  email_address             varchar(255) not null,
   country                   varchar(255),
   constraint pk_users primary key (id))
 ;
 
 create sequence bookmark_seq;
 
+create sequence geo_place_seq;
+
 create sequence history_seq;
 
 create sequence hot_spot_seq;
 
+create sequence relational_person_seq;
+
 create sequence scripture_reference_seq;
 
-create sequence scripture_target_seq;
-
 create sequence session_seq;
 
 create sequence timeband_seq;
 
+create sequence timeline_event_seq;
+
 create sequence users_seq;
 
 alter table bookmark add constraint fk_bookmark_user_1 foreign key (user_id) references users (id) on delete restrict on update restrict;
@@ -96,11 +124,19 @@
 create index ix_history_user_2 on history (user_id);
 alter table hot_spot add constraint fk_hot_spot_timeband_3 foreign key (timeband_id) references timeband (id) on delete restrict on update restrict;
 create index ix_hot_spot_timeband_3 on hot_spot (timeband_id);
-alter table scripture_reference add constraint fk_scripture_reference_target_4 foreign key (target_id) references scripture_target (id) on delete restrict on update restrict;
-create index ix_scripture_reference_target_4 on scripture_reference (target_id);
-alter table scripture_target add constraint fk_scripture_target_hotSpot_5 foreign key (hot_spot_id) references hot_spot (id) on delete restrict on update restrict;
-create index ix_scripture_target_hotSpot_5 on scripture_target (hot_spot_id);
-alter table session add constraint fk_session_user_6 foreign key (user_id) references users (id) on delete restrict on update restrict;
-create index ix_session_user_6 on session (user_id);
+alter table relational_person add constraint fk_relational_person_father_4 foreign key (father_id) references relational_person (id) on delete restrict on update restrict;
+create index ix_relational_person_father_4 on relational_person (father_id);
+alter table relational_person add constraint fk_relational_person_mother_5 foreign key (mother_id) references relational_person (id) on delete restrict on update restrict;
+create index ix_relational_person_mother_5 on relational_person (mother_id);
+alter table scripture_reference add constraint fk_scripture_reference_geoPlac_6 foreign key (geo_place_id) references geo_place (id) on delete restrict on update restrict;
+create index ix_scripture_reference_geoPlac_6 on scripture_reference (geo_place_id);
+alter table scripture_reference add constraint fk_scripture_reference_timelin_7 foreign key (timeline_event_id) references timeline_event (id) on delete restrict on update restrict;
+create index ix_scripture_reference_timelin_7 on scripture_reference (timeline_event_id);
+alter table scripture_reference add constraint fk_scripture_reference_relatio_8 foreign key (relational_person_id) references relational_person (id) on delete restrict on update restrict;
+create index ix_scripture_reference_relatio_8 on scripture_reference (relational_person_id);
+alter table session add constraint fk_session_user_9 foreign key (user_id) references users (id) on delete restrict on update restrict;
+create index ix_session_user_9 on session (user_id);
+alter table timeline_event add constraint fk_timeline_event_hotSpot_10 foreign key (hot_spot_id) references hot_spot (id) on delete restrict on update restrict;
+create index ix_timeline_event_hotSpot_10 on timeline_event (hot_spot_id);
 
 

Modified: tags/step-0.2/step-web/db-drop.sql
===================================================================
--- trunk/step/step-web/db-drop.sql	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/db-drop.sql	2012-03-01 03:26:31 UTC (rev 236)
@@ -2,35 +2,43 @@
 
 drop table if exists bookmark;
 
+drop table if exists geo_place;
+
 drop table if exists history;
 
 drop table if exists hot_spot;
 
+drop table if exists relational_person;
+
 drop table if exists scripture_reference;
 
-drop table if exists scripture_target;
-
 drop table if exists session;
 
 drop table if exists timeband;
 
+drop table if exists timeline_event;
+
 drop table if exists users;
 
 SET REFERENTIAL_INTEGRITY TRUE;
 
 drop sequence if exists bookmark_seq;
 
+drop sequence if exists geo_place_seq;
+
 drop sequence if exists history_seq;
 
 drop sequence if exists hot_spot_seq;
 
+drop sequence if exists relational_person_seq;
+
 drop sequence if exists scripture_reference_seq;
 
-drop sequence if exists scripture_target_seq;
-
 drop sequence if exists session_seq;
 
 drop sequence if exists timeband_seq;
 
+drop sequence if exists timeline_event_seq;
+
 drop sequence if exists users_seq;
 

Modified: tags/step-0.2/step-web/src/main/webapp/css/initial-layout.css
===================================================================
--- trunk/step/step-web/src/main/webapp/css/initial-layout.css	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/src/main/webapp/css/initial-layout.css	2012-03-01 03:26:31 UTC (rev 236)
@@ -176,12 +176,60 @@
 #bottomSection { 
 	height: 0px;
 	position: absolute;
-	bottom: 0px;
+	bottom: 5px;
 	left: 0px;
-	width: 100%;
+	width: 99%;
+	border: 1px solid #000; 
+	margin-left: 5px; 
+	margin-right: 5px;
+	display: none;
 }
 
+#bottomSection > div
+{
+	width: 100%; 
+	background-color: #147000; 
+	color: #fff; 
+	text-align: right;
+}
 
+/* Close button */
+#bottomSection > div span
+{
+	cursor: pointer; 
+	margin: 5px;
+}
+
+#bottomSection #leftArrow
+{
+	height: 105px; 
+	width: 20px; 
+	background-color: #fff;
+	border: 1px solid #ccc; 
+	position: absolute; 
+	top: 28px; 
+	left: 0px; 
+	z-index: 9999;
+	font-size: 30px;
+	color: #ccc;
+	padding-top: 70px;
+}
+
+#bottomSection #rightArrow
+{
+	height: 105px; 
+	width: 20px; 
+	background-color: #fff;
+	border: 1px solid #ccc; 
+	position: absolute; 
+	top: 28px; 
+	right: 0px; 
+	z-index: 9999;
+	font-size: 30px;
+	color: #ccc;
+	padding-top: 70px;
+}
+
 .no-left-border {
 	/* border-left: none; */
 	margin-left: -1px; 
@@ -255,8 +303,11 @@
 	width: 100%;
 }
 
+/**************************/
+/* LEXICON DEFINITION
+/**************************/
 #lexiconDefinition {
-	display: inline-block;
+	display: none;
 	z-index: 9999;
 	width: 400px;
 	bottom: 0px;
@@ -264,6 +315,13 @@
 	left: -1000px;
 }
 
+#lexiconPopupClose
+{
+	float: right; 
+	padding-top: 4px; 
+	padding-right: 4px;
+	cursor: pointer;
+}
 /**************************/
 /* LOGIN POPUP
 /**************************/

Modified: tags/step-0.2/step-web/src/main/webapp/index.html
===================================================================
--- trunk/step/step-web/src/main/webapp/index.html	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/src/main/webapp/index.html	2012-03-01 03:26:31 UTC (rev 236)
@@ -88,8 +88,8 @@
 			    <div class="passageText ui-widget">
 			    	<div class="headingContainer">
 						<a class="bookmarkPassageLink">Add a bookmark</a>
-				    	<input id="leftPassageReference" class="heading editable passageReference" size="30" value="Jhn 1:1" />
-				    	<input id="leftPassageBook" class="heading editable passageVersion" size="5" value="ESV" />
+				    	<input id="rightPassageReference" class="heading editable passageReference" size="30" value="Jhn 1:1" />
+				    	<input id="rightPassageBook" class="heading editable passageVersion" size="5" value="ESV" />
 			    	</div>
 			    	<div class="passageContent"></div>
 				</div>
@@ -97,7 +97,17 @@
 		</div>
 	</div>
 	
-	<div id="bottomSection" class="bottomModule timeline">No modules have yet been loaded.</div>
+	<div id="bottomSection" class="bottomModule timeline">
+		<div style="height: 25px;">
+			<span id="timelineContext" style="float: left;"></span>
+			<span style="float: right;" onclick="hideBottomSection();">Close</span>
+		</div>
+		<div id="leftArrow" onclick="TimelineLeftArrow();" style="cursor: pointer;"><</div>
+		<div id="bottomSectionContent" style="clear: both;">	
+			No modules have yet been loaded.
+		</div>
+		<div id="rightArrow" onclick="TimelineRightArrow();" style="cursor: pointer;">></div>		
+	</div>
 </div>
 
 <div class="interlinearPopup">

Modified: tags/step-0.2/step-web/src/main/webapp/js/init.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/init.js	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/src/main/webapp/js/init.js	2012-03-01 03:26:31 UTC (rev 236)
@@ -30,7 +30,7 @@
 	var topMenuHeight = $("#topMenu").height();
 	var headingContainerHeight = $(".headingContainer").height();
 	var imageAndFooterHeight = $(".northBookmark").height() + $(".logo").height();
-	var bottomSectionHeight = $("#bottomSection").height();
+	var bottomSectionHeight = $("#bottomSection").height() + 100;
 	var windowWithoutMenuNorModule = windowHeight - topMenuHeight - bottomSectionHeight; 
 	var columnHeight = windowWithoutMenuNorModule;
 	var bookmarkHeight = windowWithoutMenuNorModule - imageAndFooterHeight ;
@@ -263,11 +263,11 @@
 }
 
 /**
- * initialises the modules 
+ * initialises the modules 	
  * @param passages a list of passages that were provided
  */
 function initModules(passages) {
-	var bottomSection = $("#bottomSection");
+	var bottomSection = $("#bottomSectionContent");
 	
 	new TimelineWidget(bottomSection);
 	new GeographyWidget(bottomSection, passages);

Modified: tags/step-0.2/step-web/src/main/webapp/js/lexicon_definition.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/lexicon_definition.js	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/src/main/webapp/js/lexicon_definition.js	2012-03-01 03:26:31 UTC (rev 236)
@@ -13,13 +13,17 @@
 
 LexiconDefinition.prototype.getPopup = function() {
 	if(this.popup) {
+		this.popup.css('display', 'inline-block');
 		return this.popup;
 	}
 	
 	//create the popup container
-	$("body").append("<span id='lexiconDefinition'><ul></ul></span>");
+	$("body").append("<span id='lexiconDefinition'><ul><span id='lexiconPopupClose'>X</span></ul></span>");
 	this.popup = $("#lexiconDefinition");
 	this.popup.tabs().draggable();
+	$('#lexiconPopupClose').click(function() {
+		$('#lexiconDefinition').hide();
+	});
 	return this.popup;
 }
 

Modified: tags/step-0.2/step-web/src/main/webapp/js/timeline.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/timeline.js	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/src/main/webapp/js/timeline.js	2012-03-01 03:26:31 UTC (rev 236)
@@ -54,6 +54,8 @@
 	}
 }
 
+var tl2;
+
 TimelineWidget.prototype.onLoad = function() {
     var zones = [];
     this.theme = Timeline.ClassicTheme.create();
@@ -67,7 +69,8 @@
     	var bands = self.getBands(json.events);
 
     	if(!self.tl) {
-    		self.tl = Timeline.create(self.rootElement[0], bands, Timeline.HORIZONTAL);    	
+    		self.tl = Timeline.create(self.rootElement[0], bands, Timeline.HORIZONTAL); 
+    		tl2 = self.tl;
     	}
     	
 //    	bands[0].eventSource.loadJSON(json, TIMELINE_GET_EVENTS_IN_PERIOD +"-101690000000000/-101580000000000");
@@ -87,6 +90,8 @@
     var date = "-1250";
     var zones = [];
     
+    var i = 0;
+    
 	$.each(events, function(index, event) {
 		//TODO this can be optmized, since we are re-creating the uiTimebands every time
 		var hotspot = self.hotspots[event.hotSpotId];
@@ -97,7 +102,7 @@
 			if(obtained[hotspot.timebandId] == null) {
 				obtained[hotspot.timebandId] = true;
 				var bandInfo = Timeline.createBandInfo({
-					width:          "50px", 
+					width:          "180px", 
 					trackGap: 0.2,
 					trackHeight: 0.5,
 					intervalUnit:   unit, 
@@ -110,12 +115,17 @@
 				});
 				
 				bandInfo.stepTimebandId = hotspot.timebandId;
-				uiTimebands.push( bandInfo );
+				
+				if (i == 2)
+				{
+					uiTimebands.push( bandInfo );
+				}
 			}
 		}
+		
+		i++;
 	});
-
-//    alert(uiTimebands);
+	
 	return uiTimebands;
 }
 
@@ -139,8 +149,9 @@
 			
 		    return band.stepTimebandId == hotspot.timebandId;
 		});
-//		alert(eventsOnBand.length);
-		band.eventSource.loadJSON({ dateTimeFormat: json.dateTimeFormat, events: eventsOnBand }, TIMELINE_GET_EVENTS_IN_PERIOD +"-101690000000000/-101580000000000");
+
+		band.eventSource.loadJSON({ dateTimeFormat: json.dateTimeFormat, events: eventsOnBand }, 
+			TIMELINE_GET_EVENTS_IN_PERIOD +"-101690000000000/-101580000000000");
 	});
 	
 };
@@ -177,4 +188,63 @@
             self.tl.layout();
         }, 500);
     }
+}
+
+/* Overriding the fill in bubble from the timeline library. */
+Timeline.DefaultEventSource.Event.prototype.fillInfoBubble = function (elmt, theme, labeller) { 
+	var start = new Date(this.getStart());
+	start = (start.getFullYear() < 0) ? Math.abs(start.getFullYear()) + " BC" : start.getFullYear() + " AD";
+	
+	var end = new Date(this.getEnd());
+	end = (end.getFullYear() < 0) ? Math.abs(end.getFullYear()) + " BC" : end.getFullYear() + " AD";	
+	
+	var doc = elmt.ownerDocument; 
+	var title = this.getText(); 
+	var link = this.getLink(); 
+	var image = this.getImage(); 
+
+	if (image != null) { 
+		var img = doc.createElement("img"); 
+		img.src = image; 
+		theme.event.bubble.imageStyler(img); 
+		elmt.appendChild(img); 
+	} 
+	var divTitle = doc.createElement("div"); 
+	var textTitle = doc.createTextNode(title); 
+	if (link != null) { 
+		var a = doc.createElement("a"); 
+		a.href = link; 
+		a.appendChild(textTitle); 
+		divTitle.appendChild(a); 
+	} else { 
+		divTitle.appendChild(textTitle); 
+	} 
+	theme.event.bubble.titleStyler(divTitle); 
+	elmt.appendChild(divTitle); 
+	var divBody = doc.createElement("div"); 
+	this.fillDescription(divBody); 
+	theme.event.bubble.bodyStyler(divBody); 
+	elmt.appendChild(divBody); 
+	// This is where they define the times in the bubble 
+	var divTime = doc.createElement("div"); 
+	divTime.innerHTML = start + " - " + end; 
+	elmt.appendChild(divTime); 
+	var divWiki = doc.createElement("div"); 
+	this.fillWikiInfo(divWiki); 
+	theme.event.bubble.wikiStyler(divWiki); 
+	elmt.appendChild(divWiki); 
+} 
+
+function TimelineLeftArrow()
+{
+	var band = tl2.getBand(0);
+	var newDate = Timeline.DateTime.parseGregorianDateTime(band.getMinVisibleDate().getFullYear() - 300);
+	band.scrollToCenter(newDate);
+}
+
+function TimelineRightArrow()
+{
+	var band = tl2.getBand(0);
+	var newDate = Timeline.DateTime.parseGregorianDateTime(band.getMaxVisibleDate().getFullYear() + 300);
+	band.scrollToCenter(newDate);
 }
\ No newline at end of file

Modified: tags/step-0.2/step-web/src/main/webapp/js/ui_hooks.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/ui_hooks.js	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/src/main/webapp/js/ui_hooks.js	2012-03-01 03:26:31 UTC (rev 236)
@@ -125,8 +125,8 @@
 /**
  * Shows the timeline module
  */
-function showTimelineModule() {
-	showBottomSection();
+function showTimelineModule(menuItem) {
+	showBottomSection(menuItem);
 	$.shout("show-timeline");
 };
 
@@ -141,8 +141,35 @@
 /**
  * shows the bottom section
  */
-function showBottomSection() {
+function showBottomSection(menuItem) {
+	if (getPassageId(menuItem) == 0)
+	{
+		var verse = $('#leftPassageReference').val();
+		$('#timelineContext').html(verse);
+	}
+	else
+	{
+		var verse = $('#rightPassageReference').val();
+		$('#timelineContext').html(verse);	
+	}
+
 	var bottomSection = $("#bottomSection");
-	bottomSection.height(bottomSection.parent().parent().height() / 2);
+	var bottomSectionContent = $("#bottomSectionContent");
+	
+	bottomSection.show();
+	bottomSection.height(250);
+	bottomSectionContent.height(225);
+	
 	refreshLayout();
 }
+
+function hideBottomSection() {
+	var bottomSection = $("#bottomSection");
+	var bottomSectionContent = $("#bottomSectionContent");
+
+	bottomSection.hide();
+	bottomSection.height(0);
+	bottomSectionContent.height(0);
+	
+	refreshLayout();
+}

Modified: tags/step-0.2/step-web/src/main/webapp/panemenu.html
===================================================================
--- trunk/step/step-web/src/main/webapp/panemenu.html	2011-05-16 21:16:25 UTC (rev 232)
+++ tags/step-0.2/step-web/src/main/webapp/panemenu.html	2012-03-01 03:26:31 UTC (rev 236)
@@ -10,7 +10,7 @@
 	</li>
 	<li><a href="#">Context</a>
 	<ul>
-		<li><a href="#" onclick="showTimelineModule();">Timeline</a></li>
+		<li><a href="#" onclick="showTimelineModule(this);">Timeline</a></li>
 		<li><a href="#" onclick="showGeographyModule(this);">Maps</a></li>
 	</ul>
 	</li>




More information about the Tynstep-svn mailing list