• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Anyone know anything about Simile Timeline?

HumblePie

Lifer
Anyone ever work with this open source javascript code before?

http://www.simile-widgets.org/wiki/Timeline

It's been somewhat of a pain in the ass to figure some things out with it when it comes to loading it dynamically to different dynamic elements on the screen. Hell, just getting it to load all it's javascript files correctly has been a major pain.
 
I've worked with it in the past a pretty good amount and we did some cool things with it, but I unfortunately don't have access to my code anymore to remember what I did. If you want, feel free to PM me about specific things and I can see what I remember
 
Well since I've been fiddling around with this I haven't figured out what is causing the problem I am having. Here is what I've done and what is happening. I went to this page here.

http://code.google.com/p/simile-widgets/downloads/list

I downloaded both the minimum and full source code versions of this widget. I've tried both just to see if either made a difference.

I am displaying a page of info on a Sharepoint 2007 website. I have created a Content Editor Web Part in a webpart zone on the page I was going to place this widget.

The HTML code for the CEWP has the following:

Code:
<head>
<script>
	Timeline_ajax_url="https://www.mySite.com/sites/cp/ScriptsLibrary/timeline_ajax/simile-ajax-api.js";
	Timeline_urlPrefix="https://www.mySite.com/sites/cp/ScriptsLibrary/timeline_js/";
</script>

<script src="https://www.mySite.com/sites/cp/ScriptsLibrary/timeline_js/timeline-api.js?bundle=true" type="text/javascript"></script>

<script type="text/javascript" src="ScriptsLibrary/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="ScriptsLibrary/lib/jquery.hoverIntent.js"></script>
<script type="text/javascript" src="ScriptsLibrary/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="ScriptsLibrary/jquery.cluetip.js"></script>
<style>@import "jquery.cluetip.css";</style>

<script type="text/javascript" src="ScriptsLibrary/TinyMCE/tiny_mce_src.js"></script>
<script type="text/javascript" src="ScriptsLibrary/TinyMCE/InitMCE.js"></script>

<link rel="stylesheet" href="printSettings.css" type="text/css" media="print"/>
<style>@import "myStyles.css";</style>
	
<script type="text/javascript" src="ScriptsLibrary/javascriptUtils.js"></script>
<script type="text/javascript" src="ScriptsLibrary/sharepointListUtils.js"></script>
<script type="text/javascript" src="ScriptsLibrary/buildMySite.js"></script>
</head>

<div id="javascriptWarningDiv" style="text-align: center; width: 100&#37;; font-size: x-large; font-weight: bolder;">
	Your current browser either does not support javascript, or it has been 
	disabled, or you do not have permissions to the ScriptsLibrary folder. 
	Please use a different browser, or enable javascript, or contact the site administrator.</div>

<script type="text/javascript">
	startPage();
</script>



From here the code in buildMySite.js removes the warning banner DIV tag and starts building the parts of a webpage I need to display various sorts of data. The data can be edited using the Tiny MCE WYSIWYG editor code I found. That Tiny MCE was a bitch to get how I wanted it as well. At least the Tiny MCE had slightly better examples, documentation, and help for problems.

I do not have the Timeline widget displayed immediately when the page loads. Nor am I having the timeline widget load data from an XML or JSON file as pretty much all the examples for the widget I have found does. This is because I'm trying to use dynamic data from a Sharepoint list that can be edited at anytime. The data the timeline widget does use is initially displayed first in a flat list format that looks like a spreadsheet. The user can click on various buttons on the page to bring up the Tiny MCE editor to enter or change data in the Sharepoint list the page is using. I want the user at any point though to be able to click on a "Show Timeline" button on the page that will toggle the timeline widget. Here is the relevant code from javascript file I am using to accomplish this.

Code:
////////////////////////////////////////////////////////////////
//
// Function loadingImgDivFunction
//      This function will call the function given by the 
//      argument funcPointer after a delayed time period
//      from the argument timeout. The default timeout 
//      period is 10. This way the loading animated GIF
//      will be display correctly in IE while either
//      elements on the page change or data is loading.
//
function loadingImgDivFunction(funcPointer, timeout)
{
	if (loadingImgDiv != null)
	{
		loadingImgDiv.style.display = "";
		mainDiv.style.cursor = "wait";
	}
	
	if ((timeout == null) ||
		(timeout == "") ||
		(timeout == "NaN"))
	{
		timeout = 10;
	}
	setTimeout(funcPointer, timeout);
}


////////////////////////////////////////////////////////////////
//
// Function showTimeLineButtonFunc
//      This function is called when the Show Timeline
//      button on the screen is pressed. It calls the
//      function setSharepointListToUse to set up various 
//      variables and data to be used when the function
//     buildTimeLineDiv is eventually called after a delay
//
function showTimeLineButtonFunc()
{
	setSharepointListToUse();
	setTimeout("buildTimeLine()");
}

////////////////////////////////////////////////////////////////
//
// Function buildTimeLine
//     This function grabs the html element div tag on the
//     screen to use for displaying the timeline widget.
//     Then using the data pulled from the sharepoint list,
//     this function builds the timeline.
//
function buildTimeLine()
{
	timelineElem = document.getElementById(headings[2] + "-" + editType[2] + "_DataDisplayElement");
	if (timelineElem == null)
	{
		return;
	}
	
	// Clear out the element incase there was old info located there.
	if (timelineElem.firstChild != null)
	{
		Dom.remove(timelineElem.firstChild);
	}
	timelineElem.innerHTML = "";
	
	timelineElem.className = "timeline-default";
	timelineElem.style.height = "100%";
	timelineElem.style.width = "100%";
	timelineElem.style.margin = "0px";
	timelineElem.style.padding = "0px";
	timelineElem.style.overflow = "";
	
	var eventSource = new Timeline.DefaultEventSource(0);
	for (i = 0; i < currentList.length; i++) 
	{
		if (currentList[i][listIndex.Type] == "Range")
		{
			var spDate = currentList[i][listIndex.Start].split(" ")[0];
			var startDate = new Date();
			startDate.setFullYear(spDate.split("-")[0]);
			startDate.setMonth(spDate.split("-")[1]);
			startDate.setDate(spDate.split("-")[2]);
			
			var spDate = currentList[i][listIndex.End].split(" ")[0];
			var endDate = new Date();
			endDate.setFullYear(spDate.split("-")[0]);
			endDate.setMonth(spDate.split("-")[1]);
			endDate.setDate(spDate.split("-")[2]);
		}
		else if (currentList[i][listIndex.Type] == "Instance")
		{
			var spDate = currentList[i][listIndex.Due].split(" ")[0];
			var startDate = new Date();
			startDate.setFullYear(spDate.split("-")[0]);
			startDate.setMonth(spDate.split("-")[1]);
			startDate.setDate(spDate.split("-")[2]);
			
			var endDate = startDate;
		}
		else
		{
		        return;
		}

		
		var evt = new Timeline.DefaultEventSource.Event({
			start: startDate,
			end: endDate,
			instant: (currentList[i][listIndex.Type] == "Instance" ? true : false),
			text: currentList[i][listIndex.Index] + " " + currentList[i][listIndex.Title],
			description: (currentList[i][listIndex.Description] == "" ? "No Description set for this milestone" : currentList[i][listIndex.Description]),
			icon: "ScriptsLibrary/timeline_js/images/dark-blue-circle.png",
			color: "red",
			textColor : "black",
			caption: "Click for pop up with description"
		});
		
		eventSource.add(evt);
	}
	
	var theme = Timeline.ClassicTheme.create();
	theme.event.bubble.width = 350;
	theme.event.bubble.height = 400;
	
	var d = new Date();
	var bandInfos = [
		Timeline.createBandInfo({
			width:          "85%", 
			intervalUnit:   Timeline.DateTime.MONTH, 
			intervalPixels: 200,
			eventSource:    eventSource,
			date:           d,
			theme:          theme,
			layout:         'original'  // original, overview, detailed
		}),
		Timeline.createBandInfo({
			width:          "15%", 
			intervalUnit:   Timeline.DateTime.YEAR, 
			intervalPixels: 200,
			eventSource:    eventSource,
			date:           d,
			theme:          theme,
			layout:         'overview'  // original, overview, detailed
		})
	];
	bandInfos[1].syncWith = 0;
	bandInfos[1].highlight = true;
				
	newTimeline = Timeline.create(timelineElem, bandInfos, Timeline.HORIZONTAL);
	
	document.body.onresize = function() {onResize();};

	loadingImgDiv.style.display = "none";
	mainDiv.style.cursor = "auto";

 }


function onResize()
{
	if (resizeTimerID == null)
	{
		resizeTimerID = window.setTimeout(function()
		{
			resizeTimerID = null;
			if (newTimeline != null)
			{
				newTimeline.layout();
			}
		}, 500);
	}
}





The code I have above does work correctly when everything is loaded. Basically the user is able to toggle the timeline on and off with data from the Sharepoint list displayed. To reiterate, it does work as shown above, but not consistently. Here is the problem I am having. The javascript files for the timeline widget don't always load correctly for some reason. Either timeline-bundle.js doesn't load, or simile-ajax-bundle.js doesn't load, or something else doesn't load. This doesn't happen with examples I have found for this widget. But for some reason I'll get problems loading the associated JS files sometimes when I refresh my web page. Sometimes it works and loads perfectly fine. I can toggle the timeline on and off perfectly fine. Then when I hit refresh the next time the page loads the timeline code doesn't load correctly. Then it won't toggle on and off. I have to hit refresh on my page again and hope it loads correctly the next time. This inconsistent behavior will not do.

Has anyone run into this problem using this widget?
 
Last edited:
Well after hours trying to figure this out I finally did. It's the way the scripts load. If there is too large of a delay in how it dynamically loads it's parts then it errors out. I was able to get the examples to finally break the same way as my sharepoint page by forcing in a delay for loading. Doesn't always break, but randomly enough that it renders this open source piece unusable for my needs.

Luckily found another timeline javascript open source piece that does the same thing called Timeglider. Time to try that one out then and give up on Timeline as the code was never designed to work over various firewalls and secure connections.
 
Back
Top