From 7b7f43b04a640c23dcfc636aee5fc421eea92206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20K=C3=B6cher?= Date: Thu, 26 Apr 2012 12:43:35 +0200 Subject: [PATCH 1/6] #97: Countdown: move countdown config input field from config tab to portlet --- openslides/agenda/forms.py | 3 +- openslides/agenda/views.py | 26 +++++----- .../static/images/icons/document-save.png | Bin 0 -> 563 bytes .../static/images/icons/spin-down.png | Bin 0 -> 269 bytes .../projector/static/images/icons/spin-up.png | Bin 0 -> 255 bytes .../static/javascript/projector-control.js | 23 ++++++++- .../static/styles/projector-control.css | 29 +++++++++++ .../templates/projector/control.html | 45 ++++++++++++++---- openslides/projector/urls.py | 3 ++ openslides/projector/views.py | 10 ++++ 10 files changed, 115 insertions(+), 24 deletions(-) create mode 100644 openslides/projector/static/images/icons/document-save.png create mode 100644 openslides/projector/static/images/icons/spin-down.png create mode 100644 openslides/projector/static/images/icons/spin-up.png diff --git a/openslides/agenda/forms.py b/openslides/agenda/forms.py index b147ce2a2..e67f44f29 100644 --- a/openslides/agenda/forms.py +++ b/openslides/agenda/forms.py @@ -44,4 +44,5 @@ class ItemOrderForm(Form, CssClassMixin): class ConfigForm(Form, CssClassMixin): - agenda_countdown_time = IntegerField(widget=TextInput(attrs={'class':'small-input'}),label=_("Countdown (in seconds)"),initial=60, min_value=0) + pass + diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 133065fb2..64e63afcf 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -167,18 +167,20 @@ class AgendaPDF(PDFView): story.append(Paragraph(item.get_title(), stylesheet['Item'])) -class Config(FormView): - permission_required = 'config.can_manage_config' - form_class = ConfigForm - template_name = 'agenda/config.html' - - def get_initial(self): - return {'agenda_countdown_time': config['agenda_countdown_time']} - - def form_valid(self, form): - config['agenda_countdown_time'] = form.cleaned_data['agenda_countdown_time'] - messages.success(self.request, _('Agenda settings successfully saved.')) - return super(Config, self).form_valid(form) +# +# rene: empty for now so comment it out to keep it from appearing in the settings +# +#class Config(FormView): +# permission_required = 'config.can_manage_config' +# form_class = ConfigForm +# template_name = 'agenda/config.html' +# +# def get_initial(self): +# return {} +# +# def form_valid(self, form): +# messages.success(self.request, _('Agenda settings successfully saved.')) +# return super(Config, self).form_valid(form) def register_tab(request): diff --git a/openslides/projector/static/images/icons/document-save.png b/openslides/projector/static/images/icons/document-save.png new file mode 100644 index 0000000000000000000000000000000000000000..8072aea3268164eb2028a0cebfe44da82b4f4aca GIT binary patch literal 563 zcmV-30?hr1P)XvKK@k7Ytwo{YB(9F? z;2_0Ku;{F~yQsL?!9iy?1;;|c4%SjZ%{70TwwHKcBH=J-%EN&+{;d zhN(E7P<- zOhP?!y}wyJm`;b*`kqJvqBiX|nL~L2fd*Ux1d!eYF6Tbg5P<9ZC&&uF5~UDVJ~Kya z$B9GKW9yGCk1)gXRIvtRXipPk@<6(R{ z10;&Qkze=csdPHpgO1qUX}3Wtm&>>~JBMXkI4Be#D>XTZ+DDB(A$cT#*xhj)kQiey zO%sM;K-YE1@`TY9(UZv}-m29|6TcYK$LKUNox!$kO4I`&Fl}aA7Py>1;e44jn~%EA z#v7jv1002ovPDHLkV1jI` B^11*3 literal 0 HcmV?d00001 diff --git a/openslides/projector/static/images/icons/spin-down.png b/openslides/projector/static/images/icons/spin-down.png new file mode 100644 index 0000000000000000000000000000000000000000..e54993882a90d3e1ad314a48cb7b4c4e579bacf9 GIT binary patch literal 269 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~c!NS16s9VwA1>`Um2e~^jtUD+363Agn@^*J& z_}|`tWO>_3{Xdb-9@Oh_kcxYaaac@_i)|A%^oz&#R{@rd5 z-LWz8Xsei}W^kM6giROH4$d%jcRTaq(Z2PE&d#uUbe6l_*=FOW4~$ovQ+^7FT#x{| Om%-E3&t;ucLK6TrOJ~;r literal 0 HcmV?d00001 diff --git a/openslides/projector/static/images/icons/spin-up.png b/openslides/projector/static/images/icons/spin-up.png new file mode 100644 index 0000000000000000000000000000000000000000..7830c52a7061261624fed981684a7cb5b6bf81fc GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~c!2%?s>bJ`PDaPU;cPEB*=VV?2IZR33?k)`f z+xyS#2l6-zJR*yMDt3b~qt%~~nCIJLySC#hNjg_=EG977~7*Pb!t zV+>?qxcFUsV`od3Z@}*6sFyN%3kq1&1K+8Z@GS@sVC@XreXWjFQPA+L$z;yY9K0)6 z6ixSVX}vVr%3I*hoH<{41+N}_lNN_>x4>uzT9*CbmizRx0S13 vW<38@%i)&BrJK8Q+Yi|kqy3zpU+D9%Q&QM+gwx;-&^ZjAu6{1-oD!M= 0) ? count - 1 : count)); + }); + + $('.projector_countdown_spinup').click(function(event) { + event.preventDefault(); + var count = parseInt($( "#countdown_time" ).val()); + + $( "#countdown_time" ).val(count + 1); + }); + $('.countdown_visible_link').click(function(event) { event.preventDefault(); var link = $(this); diff --git a/openslides/projector/static/styles/projector-control.css b/openslides/projector/static/styles/projector-control.css index 114655465..05320ad2a 100644 --- a/openslides/projector/static/styles/projector-control.css +++ b/openslides/projector/static/styles/projector-control.css @@ -38,6 +38,35 @@ visibility: hidden; } +/*.projector_countdown_spinval {*/ +#countdown_time { + width: 40px; + height: 16px; +} + +.projector_countdown_spinbox { + height: 16px; + width: auto; + position: relative; + display: inline-block; +} + +.projector_countdown_spinup { + position: absolute; + top: 0px; + left: 35px; +} + +.projector_countdown_spindown { + position: absolute; + top: 8px; + left: 35px; +} + +.projector_countdown_btn { + margin-top: auto; +} + /* iframe */ #iframe { -ms-zoom: 0.25; diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/control.html index 428d74a58..ae7823322 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/control.html @@ -25,6 +25,17 @@ return true; }; + function spinCount(delta) { + var count = parseInt($( "#countdown_time" ).val()); + + if (count + delta < 0) { + delta = 0; + } + + $( "#countdown_time" ).val(count + delta); + return false; + }; + $(function() { $( ".column" ).sortable({ connectWith: ".column" @@ -132,16 +143,30 @@ {# Countdown #} {% if overlay.def_name == "Countdown" %} | - {{countdown_time}}{% trans "sec" %} - - - - - - - - - + + + + + + + + + {% trans "sec" %} +   + + + +      + + + + + + + + + + {% endif %} {% if overlay.def_name == "Message" %}
{% csrf_token %} diff --git a/openslides/projector/urls.py b/openslides/projector/urls.py index cd30af47b..3ea30144a 100644 --- a/openslides/projector/urls.py +++ b/openslides/projector/urls.py @@ -85,4 +85,7 @@ urlpatterns = patterns('projector.views', url(r'^countdown/stop/$', 'projector_countdown', {'command': 'stop'}, name='countdown_stop'), + + url(r'^countdown/set-default/$', 'projector_countdown', {'command': 'set_default'}, + name='countdown_set_default'), ) diff --git a/openslides/projector/views.py b/openslides/projector/views.py index 6e72267d7..6cde356c8 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -221,6 +221,16 @@ def projector_countdown(request, command): config['countdown_pause_stamp'] = time() config['countdown_state'] = 'paused' + elif command == 'set_default': + try: + config['agenda_countdown_time'] = int(request.GET['countdown_time']) + + except ValueError: + pass + + except AttributeError: + pass + if request.is_ajax(): if command == "show": link = reverse('countdown_close') From 8da2f0f041fd673748359c8a33f0e067ed138708 Mon Sep 17 00:00:00 2001 From: Andy Kittner Date: Fri, 27 Apr 2012 01:09:12 +0200 Subject: [PATCH 2/6] Fix start script broken by r550 Defer importing modules that require the DJANGO_SETTINGS_MODULE to be available until prepare_openslides() had a chance to set everything up. --- openslides/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openslides/main.py b/openslides/main.py index b67c89a83..2a1ac79bc 100644 --- a/openslides/main.py +++ b/openslides/main.py @@ -22,10 +22,8 @@ import webbrowser from contextlib import nested import django.conf -from django.db import DatabaseError from django.core.management import execute_from_command_line from django.utils.crypto import get_random_string -from django.contrib.auth.models import User import openslides @@ -143,6 +141,10 @@ def run_syncdb(): def check_database(): """Detect if database was deleted and recreate if necessary""" + # can't be imported in global scope as they already require + # the settings module during import + from django.db import DatabaseError + from django.contrib.auth.models import User try: User.objects.count() @@ -153,7 +155,9 @@ def check_database(): return False def create_or_reset_admin_user(): - + # can't be imported in global scope as it already requires + # the settings module during import + from django.contrib.auth.models import User try: obj = User.objects.get(username = "admin") except User.DoesNotExist: From f45eb68fb4c7ab17fd835bc2d2312f80aa7eddb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Ko=CC=88cher?= Date: Fri, 27 Apr 2012 07:46:47 +0200 Subject: [PATCH 3/6] #159 Countdown reset should change 'pause' back to 'play'. --- openslides/projector/templates/projector/control.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/control.html index ae7823322..809078ceb 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/control.html @@ -157,7 +157,7 @@      - + From c0b78f52ea474b1d10d905b7c8ddff55704f5c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Ko=CC=88cher?= Date: Fri, 27 Apr 2012 07:50:20 +0200 Subject: [PATCH 4/6] Backout changeset 3dafb78cc57f4ce55b8e4517eb48fd9e9e744e2d --- openslides/projector/templates/projector/control.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/control.html index 809078ceb..ae7823322 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/control.html @@ -157,7 +157,7 @@      - + From c3c7228ab95ec5d01a7f19992dccbf9e2760efff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Ko=CC=88cher?= Date: Fri, 27 Apr 2012 07:51:42 +0200 Subject: [PATCH 5/6] #159 Countdown reset should change 'pause' back to 'play'. --- openslides/projector/templates/projector/control.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/control.html index ae7823322..809078ceb 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/control.html @@ -157,7 +157,7 @@      - + From 030ff09ec0a7ed76b71ac467f9c9f1ffb5f6c006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Ko=CC=88cher?= Date: Fri, 27 Apr 2012 07:59:23 +0200 Subject: [PATCH 6/6] #97: (Aftermath) Quick cross-browser fix: remove the spin-buttons and use input type=number. If your browser is HTML5 it should show a spin box, otherwise the fallback (type=text) will work equally well. --- .../static/javascript/projector-control.js | 14 -------------- .../projector/templates/projector/control.html | 8 +------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/openslides/projector/static/javascript/projector-control.js b/openslides/projector/static/javascript/projector-control.js index 36a6eb255..1dac0be48 100644 --- a/openslides/projector/static/javascript/projector-control.js +++ b/openslides/projector/static/javascript/projector-control.js @@ -60,20 +60,6 @@ $(function() { }); }); - $('.projector_countdown_spindown').click(function(event) { - event.preventDefault(); - var count = parseInt($( "#countdown_time" ).val()); - - $( "#countdown_time" ).val( ((count - 1 >= 0) ? count - 1 : count)); - }); - - $('.projector_countdown_spinup').click(function(event) { - event.preventDefault(); - var count = parseInt($( "#countdown_time" ).val()); - - $( "#countdown_time" ).val(count + 1); - }); - $('.countdown_visible_link').click(function(event) { event.preventDefault(); var link = $(this); diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/control.html index 809078ceb..f997d9ce2 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/control.html @@ -144,13 +144,7 @@ {% if overlay.def_name == "Countdown" %} | - - - - - - - + {% trans "sec" %}