Automated merge with ssh://openslides.org/openslides

This commit is contained in:
Emanuel Schuetze 2012-04-27 08:04:53 +02:00
commit 8ed8ca0c58
11 changed files with 102 additions and 27 deletions

View File

@ -44,4 +44,5 @@ class ItemOrderForm(Form, CssClassMixin):
class ConfigForm(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

View File

@ -167,18 +167,20 @@ class AgendaPDF(PDFView):
story.append(Paragraph(item.get_title(), stylesheet['Item'])) story.append(Paragraph(item.get_title(), stylesheet['Item']))
class Config(FormView): #
permission_required = 'config.can_manage_config' # rene: empty for now so comment it out to keep it from appearing in the settings
form_class = ConfigForm #
template_name = 'agenda/config.html' #class Config(FormView):
# permission_required = 'config.can_manage_config'
def get_initial(self): # form_class = ConfigForm
return {'agenda_countdown_time': config['agenda_countdown_time']} # template_name = 'agenda/config.html'
#
def form_valid(self, form): # def get_initial(self):
config['agenda_countdown_time'] = form.cleaned_data['agenda_countdown_time'] # return {}
messages.success(self.request, _('Agenda settings successfully saved.')) #
return super(Config, self).form_valid(form) # def form_valid(self, form):
# messages.success(self.request, _('Agenda settings successfully saved.'))
# return super(Config, self).form_valid(form)
def register_tab(request): def register_tab(request):

View File

@ -22,10 +22,8 @@ import webbrowser
from contextlib import nested from contextlib import nested
import django.conf import django.conf
from django.db import DatabaseError
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
from django.utils.crypto import get_random_string from django.utils.crypto import get_random_string
from django.contrib.auth.models import User
import openslides import openslides
@ -143,6 +141,10 @@ def run_syncdb():
def check_database(): def check_database():
"""Detect if database was deleted and recreate if necessary""" """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: try:
User.objects.count() User.objects.count()
@ -153,7 +155,9 @@ def check_database():
return False return False
def create_or_reset_admin_user(): 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: try:
obj = User.objects.get(username = "admin") obj = User.objects.get(username = "admin")
except User.DoesNotExist: except User.DoesNotExist:

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@ -42,17 +42,24 @@ $(function() {
}); });
// control countdown // control countdown
$('.projector_countdown').click(function(event) { $('.projector_countdown_btn').click(function(event) {
event.preventDefault(); event.preventDefault();
var link = $(this); var link = $(this);
var requestData = {};
if (link.attr('id') == "countdown_set") {
requestData = { "countdown_time" : $( "#countdown_time" ).val() };
}
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: link.attr('href'), url: link.attr('href'),
data: requestData,
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
} }
}); });
}); });
$('.countdown_visible_link').click(function(event) { $('.countdown_visible_link').click(function(event) {
event.preventDefault(); event.preventDefault();
var link = $(this); var link = $(this);

View File

@ -38,6 +38,35 @@
visibility: hidden; 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 */
#iframe { #iframe {
-ms-zoom: 0.25; -ms-zoom: 0.25;

View File

@ -25,6 +25,17 @@
return true; 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() { $(function() {
$( ".column" ).sortable({ $( ".column" ).sortable({
connectWith: ".column" connectWith: ".column"
@ -132,16 +143,24 @@
{# Countdown #} {# Countdown #}
{% if overlay.def_name == "Countdown" %} {% if overlay.def_name == "Countdown" %}
| |
<a href="{% url config_agenda %}">{{countdown_time}}{% trans "sec" %}</a> <span class="projector_countdown_spinbox">
<a class="projector_countdown" href="{% url countdown_reset %}" title="{% trans 'Reset countdown' %}"> <input class="projector_countdown_spinval" id="countdown_time" name="countdown_time" type="number" min="0" value="{{countdown_time}}">
<img src="{% static 'images/icons/skip-backward.png' %}" /> {% trans "sec" %}
</a> &nbsp;
<a id="countdown_play" class="projector_countdown" href="{% url countdown_start %}" title="{% trans 'Start countdown' %}" onclick="javascript:switchButtons('stop')"> <a id="countdown_set" class="projector_countdown_btn" href="{% url countdown_set_default %}" title="{% trans 'Save as default' %}">
<img src="{% static 'images/icons/play.png' %}" /> <img src="{% static 'images/icons/document-save.png' %}" />
</a> </a>
<a id="countdown_stop" class="projector_countdown" href="{% url countdown_stop %}" title="{% trans 'Stop countdown' %}" onclick="javascript:switchButtons('play')"> <span class="icon clear">&nbsp;&nbsp;&nbsp;&nbsp;</span>
<img src="{% static 'images/icons/pause.png' %}" /> <a class="projector_countdown_btn" href="{% url countdown_reset %}" title="{% trans 'Reset countdown' %}" onclick="javascript:switchButtons('play')">
</a> <img src="{% static 'images/icons/skip-backward.png' %}" />
</a>
<a id="countdown_play" class="projector_countdown_btn" href="{% url countdown_start %}" title="{% trans 'Start countdown' %}" onclick="javascript:switchButtons('stop')">
<img src="{% static 'images/icons/play.png' %}" />
</a>
<a id="countdown_stop" class="projector_countdown_btn" href="{% url countdown_stop %}" title="{% trans 'Stop countdown' %}" onclick="javascript:switchButtons('play')">
<img src="{% static 'images/icons/pause.png' %}" />
</a>
</span>
{% endif %} {% endif %}
{% if overlay.def_name == "Message" %} {% if overlay.def_name == "Message" %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}

View File

@ -85,4 +85,7 @@ urlpatterns = patterns('projector.views',
url(r'^countdown/stop/$', 'projector_countdown', {'command': 'stop'}, url(r'^countdown/stop/$', 'projector_countdown', {'command': 'stop'},
name='countdown_stop'), name='countdown_stop'),
url(r'^countdown/set-default/$', 'projector_countdown', {'command': 'set_default'},
name='countdown_set_default'),
) )

View File

@ -221,6 +221,16 @@ def projector_countdown(request, command):
config['countdown_pause_stamp'] = time() config['countdown_pause_stamp'] = time()
config['countdown_state'] = 'paused' 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 request.is_ajax():
if command == "show": if command == "show":
link = reverse('countdown_close') link = reverse('countdown_close')