diff --git a/openslides/projector/models.py b/openslides/projector/models.py index c48c33cd6..cd6334516 100644 --- a/openslides/projector/models.py +++ b/openslides/projector/models.py @@ -1,3 +1,4 @@ + from django.db import models from django.dispatch import receiver @@ -52,4 +53,8 @@ register_slidemodel(ProjectorSlide, model_name=_('Projector Slide')) def default_config(sender, key, **kwargs): return { 'projector_message': '', + 'countdown_time': 60, + 'countdown_start': False, + 'bigger': 100, + 'up': 0, }.get(key) diff --git a/openslides/projector/projector.py b/openslides/projector/projector.py index 0cbc976cc..62de5a58f 100644 --- a/openslides/projector/projector.py +++ b/openslides/projector/projector.py @@ -86,8 +86,9 @@ def countdown(sender, **kwargs): if kwargs['register']: return name if name in kwargs['call']: - starttime = config['countdown_start'] - seconds = max(0, int(starttime + config['agenda_countdown_time'] - time())) + if config['countdown_start'] is False: + config['countdown_start'] = time() + seconds = max(0, int(config['countdown_start'] + config['countdown_time'] - time())) return (name, seconds) return None diff --git a/openslides/projector/static/javascript/projector.js b/openslides/projector/static/javascript/projector.js index 6ba261696..9c2611568 100644 --- a/openslides/projector/static/javascript/projector.js +++ b/openslides/projector/static/javascript/projector.js @@ -45,47 +45,3 @@ $(document).ready(function() { switchajax(); presentation_reload(); }); - -// *** Countdown variables and functions *** -var timer_value; -var timer_is_running=false; -var timer_is_visible=false; -var timerIntervalId; - -function resetTimer(value) { - stopTimer() - timer_value = value; - updateTimer(); -} -function stopTimer() { - timer_is_running = false; - clearInterval(timerIntervalId); -} - -function startTimer() { - timer_is_running = true; - if (timer_value > 0) { - timerIntervalId = setInterval("decrementTimer()", 1000); - } -} -function decrementTimer() { - timer_value--; - if (timer_value <= 0) { - timer_value = 0; - stopTimer(); - } - updateTimer(); -} -function convertSeconds(s) { - var m = Math.floor(s / 60); - s %= 60; - var h = Math.floor(m / 60); - m %= 60; - return (h>0?h+':':'') + (h>0&&m<10?'0':'') + m + ':' + (s<10?'0':'') + s; -} - -function updateTimer() { - if (timer_value >= 0) { - $("#countdown").html(convertSeconds(timer_value)); - } -} diff --git a/openslides/projector/views.py b/openslides/projector/views.py index 1f72aa6a8..b3ecb1f24 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -153,9 +153,6 @@ def active_slide(request, sid=None): 'time': datetime.now().strftime('%H:%M'), 'bigger': config['bigger'], 'up': config['up'], - 'countdown_visible': config['countdown_visible'], - 'countdown_time': config['agenda_countdown_time'], - 'countdown_control': config['countdown_control'], 'overlay': data['overlay'] } return ajax_request(jsondata) @@ -189,11 +186,7 @@ def projector_edit(request, direction): @permission_required('projector.can_manage_projector') def projector_countdown(request, command): #todo: why is there the time argument? - if command == 'show': - config['countdown_visible'] = True - elif command == 'hide': - config['countdown_visible'] = False - elif command == 'reset': + if command == 'reset': config['countdown_start'] = time() elif command == 'start': config['countdown_run'] = True