summaryrefslogtreecommitdiffstats
path: root/public/media/js
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-25 09:37:35 +0200
committerSebastian Wagner2011-10-25 09:37:35 +0200
commitb9ab2aa96a8b93c92233fd0c5f845c329a7383dd (patch)
treeaae141ad7ef4dbec312d03bc174dc85a299fe3af /public/media/js
parentminor (diff)
downloadpoolctrl-b9ab2aa96a8b93c92233fd0c5f845c329a7383dd.tar.gz
poolctrl-b9ab2aa96a8b93c92233fd0c5f845c329a7383dd.tar.xz
poolctrl-b9ab2aa96a8b93c92233fd0c5f845c329a7383dd.zip
current timeline implemented
Diffstat (limited to 'public/media/js')
-rwxr-xr-xpublic/media/js/fullcalendar.js44
1 files changed, 42 insertions, 2 deletions
diff --git a/public/media/js/fullcalendar.js b/public/media/js/fullcalendar.js
index 099af56..b8c8183 100755
--- a/public/media/js/fullcalendar.js
+++ b/public/media/js/fullcalendar.js
@@ -3833,6 +3833,7 @@ function AgendaEventRenderer() {
var calendar = t.calendar;
var formatDate = calendar.formatDate;
var formatDates = calendar.formatDates;
+ var timeLineInterval;
@@ -3859,6 +3860,13 @@ function AgendaEventRenderer() {
setHeight(); // no params means set to viewHeight
}
renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId);
+
+ // current_time_indication hack
+ if (opt('currentTimeIndicator')) {
+ window.clearInterval(timeLineInterval);
+ timeLineInterval = window.setInterval(setTimeIndicator, 30000);
+ setTimeIndicator();
+ }
}
@@ -4148,7 +4156,39 @@ function AgendaEventRenderer() {
eventElementHandlers(event, eventElement);
}
+ // draw a horizontal line indicating the current time
+ function setTimeIndicator() {
+
+ var container = getBodyContent();
+ var timeline = container.children('.fc-timeline');
+ if (timeline.length == 0) { // if timeline isn't there, add it
+ timeline = $('<hr>').addClass('fc-timeline').appendTo(container);
+ }
+
+ var cur_time = new Date();
+ if (t.visStart < cur_time && t.visEnd > cur_time) {
+ timeline.show();
+ } else {
+ timeline.hide();
+ return;
+ }
+
+ var secs = (cur_time.getHours() * 60 * 60) + (cur_time.getMinutes() * 60) + cur_time.getSeconds();
+ var percents = secs / 86400; // 24 * 60 * 60 = 86400, # of seconds in
+ // a day
+
+ timeline.css('top', Math.floor(container.height() * percents - 1) + 'px');
+ if (t.name == 'agendaWeek') { // week view, don't want the timeline to
+ // go the whole way across
+ var daycol = $('.fc-today', t.element);
+ //var left = daycol.position().left + 1;
+ //var width = daycol.width();
+ //timeline.css({left: left + 'px', width: width + 'px' });
+ var width = daycol.width() * 8;
+ timeline.css({width: width + 'px' });
+ }
+ }
/*
* Dragging
@@ -4225,7 +4265,7 @@ function AgendaEventRenderer() {
stop: function(ev, ui) {
hoverListener.stop();
var cell = hoverListener.stop();
- //var date = t.cellDate(cell);
+ // var date = t.cellDate(cell);
clearOverlays();
trigger('eventDragStop', eventElement, event, ev, ui);
if (revert) {
@@ -4321,7 +4361,7 @@ function AgendaEventRenderer() {
},
stop: function(ev, ui) {
var cell = hoverListener.stop();
- //var date = t.cellDate(cell);
+ // var date = t.cellDate(cell);
clearOverlays();
trigger('eventDragStop', eventElement, event, ev, ui);
if (cell && (dayDelta || minuteDelta || allDay)) {