rainbow.setSpectrum('#bb0000', '#e65911', '#f3ad17', 'green');
+function pad(num) {
+ var s = num+"";
+ while (s.length < 2) s = "0" + s;
+ return s;
+}
+
$(window).ready(function() {
var pageHeight = $(window).height();
var navHeight = pageHeight - 125;
$('#desk_center').css({"max-height": navHeight + 'px'});
-
- // chronometer
- $('.autotimer').each(function(){
- var timer = new Timer();
- $timerSpan = $(this);
- var value = $timerSpan.text()
- // convert text value of timer to seconds
- var timeArray = value.split(':');
- var seconds = parseInt(timeArray[0], 10) * 3600 + parseInt(timeArray[1], 10) * 60 + parseInt(timeArray[2], 10);
- timer.start({precision: 'seconds', startValues: {seconds: seconds}});
- $timerSpan.html(timer.getTimeValues().toString());
- timer.addEventListener('secondsUpdated', function (e) {
- $timerSpan.html(timer.getTimeValues().toString());
- });
- });
+ launchTimer();
});
+
+
+var launchTimer = function(){
+ // chronometer
+ $('.autotimer').each(function(){
+ window.timer = new Timer();
+ $timerSpan = $(this);
+ var value = $timerSpan.text()
+ // convert text value of timer to seconds
+ var timeArray = value.split(':');
+ var seconds = parseInt(timeArray[0], 10) * 3600 + parseInt(timeArray[1], 10) * 60 + parseInt(timeArray[2], 10);
+ window.timer.start({precision: 'seconds', startValues: {seconds: seconds}});
+ window.timer.addEventListener('secondsUpdated', function (e) {
+ var timeValues = window.timer.getTimeValues();
+ var hours = timeValues.days * 24 + timeValues.hours
+ $timerSpan.html(pad(hours) + ':' + pad(timeValues.minutes) + ':' + pad(timeValues.seconds));
+ });
+ });
+}
+
delta = timer - datetime.timedelta(seconds=seminar.duration.as_seconds())
return delta.total_seconds()
+def export_seminar_revisions():
+ pass
+
class SeminarAccessMixin(object):
timer = get_seminar_timer(user, seminar)
delta_sec = get_seminar_delta(user, seminar)
context['delta_sec'] = delta_sec
- context['timer'] = str(timer).split('.')[0]
+ totsec = timer.total_seconds()
+ h = totsec//3600
+ m = (totsec%3600) // 60
+ sec =(totsec%3600)%60
+ context['timer'] = "%d:%d:%d" %(h,m,sec)
return context
def render_to_response(self, context):
context['seminar_progress'] = progress
context['seminar_validated'] = validated
delta_sec = context['delta_sec']
+
if progress == 100 and not validated and self.template_name == 'teleforma/seminar_detail.html':
messages.info(self.request, _("You have successfully terminated your e-learning seminar. A training testimonial will be available as soon as the pedagogical team validate all your answers (48h maximum)."))
elif progress < 100 and validated and self.template_name == 'teleforma/seminar_detail.html' and missing_steps == set('5'):