| 1 |
// $Id: timemap_simile-timeline.js,v 1.2 2008/06/03 02:34:15 sethfreach Exp $
|
| 2 |
if (Drupal.jsEnabled) {
|
| 3 |
var tl;
|
| 4 |
var eventSources = new Array();
|
| 5 |
var now = new Date();
|
| 6 |
var uid, timezoneOffset, basepath;
|
| 7 |
|
| 8 |
function timemap_onLoad() {
|
| 9 |
var eventSource = new Timeline.DefaultEventSource(0);
|
| 10 |
var theme = Timeline.ClassicTheme.create();
|
| 11 |
|
| 12 |
var bandInfos = [
|
| 13 |
Timeline.createBandInfo({
|
| 14 |
eventSource: eventSource,
|
| 15 |
date: now,
|
| 16 |
width: "65%",
|
| 17 |
intervalUnit: Timeline.DateTime.HOUR,
|
| 18 |
timeZone: timezoneOffset,
|
| 19 |
intervalPixels: 100
|
| 20 |
}),
|
| 21 |
Timeline.createBandInfo({
|
| 22 |
eventSource: eventSource,
|
| 23 |
date: now,
|
| 24 |
width: "20%",
|
| 25 |
intervalUnit: Timeline.DateTime.DAY,
|
| 26 |
timeZone: timezoneOffset,
|
| 27 |
intervalPixels: 200,
|
| 28 |
showEventText: false,
|
| 29 |
trackHeight: 0.6,
|
| 30 |
trackGap: 0.2
|
| 31 |
}),
|
| 32 |
Timeline.createBandInfo({
|
| 33 |
eventSource: eventSource,
|
| 34 |
date: now,
|
| 35 |
width: "15%",
|
| 36 |
intervalUnit: Timeline.DateTime.WEEK,
|
| 37 |
timeZone: timezoneOffset,
|
| 38 |
intervalPixels: 200,
|
| 39 |
showEventText: false,
|
| 40 |
trackHeight: 0.3,
|
| 41 |
trackGap: 0.2
|
| 42 |
})
|
| 43 |
];
|
| 44 |
bandInfos[1].syncWith = 0;
|
| 45 |
bandInfos[1].highlight = true;
|
| 46 |
bandInfos[2].syncWith = 1;
|
| 47 |
bandInfos[2].highlight = true;
|
| 48 |
|
| 49 |
Timeline.loadJSON(basepath + "index.php?q=timemap/map/serv/" + uid, function(json, url) {
|
| 50 |
eventSource.loadJSON(json, url);
|
| 51 |
});
|
| 52 |
tl = Timeline.create(document.getElementById("timemap"), bandInfos);
|
| 53 |
|
| 54 |
eventSources[0] = eventSource;
|
| 55 |
}
|
| 56 |
|
| 57 |
var resizeTimerID = null;
|
| 58 |
function timemap_onResize() {
|
| 59 |
if (resizeTimerID == null) {
|
| 60 |
resizeTimerID = window.setTimeout(function() {
|
| 61 |
resizeTimerID = null;
|
| 62 |
tl.layout();
|
| 63 |
}, 500);
|
| 64 |
}
|
| 65 |
}
|
| 66 |
|
| 67 |
jQuery().ready(function(){
|
| 68 |
uid = $('#timemap').attr('uid');
|
| 69 |
timezoneOffset = $('#timemap').attr('offset') / 3600;
|
| 70 |
basepath = $('#time_map').attr('basepath');
|
| 71 |
timemap_onLoad();
|
| 72 |
$('body').resize('timemap_onResize');
|
| 73 |
|
| 74 |
/*
|
| 75 |
$('.time_report_person_selector').change(function() {
|
| 76 |
var uid = this.id.replace(/time_person_/, '');
|
| 77 |
if (this.checked) {
|
| 78 |
var eventSource = new Timeline.DefaultEventSource(uid);
|
| 79 |
tl.loadJSON("/index.php?q=timemap/map/serv/" + uid, function(json, url) {
|
| 80 |
eventSources[0].loadJSON(json, url);
|
| 81 |
});
|
| 82 |
eventSources[uid] = eventSource;
|
| 83 |
} else {
|
| 84 |
var es = eventSources[uid];
|
| 85 |
es.clear();
|
| 86 |
}
|
| 87 |
});
|
| 88 |
*/
|
| 89 |
|
| 90 |
});
|
| 91 |
}
|