Merged.
This commit is contained in:
commit
1528ab90c6
@ -10,7 +10,7 @@
|
|||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
|
|
||||||
def is_summary():
|
def is_summary():
|
||||||
|
@ -19,7 +19,7 @@ from django.db import models
|
|||||||
|
|
||||||
from mptt.models import MPTTModel, TreeForeignKey
|
from mptt.models import MPTTModel, TreeForeignKey
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
from projector.projector import SlideMixin
|
from projector.projector import SlideMixin
|
||||||
from projector.api import register_slidemodel
|
from projector.api import register_slidemodel
|
||||||
@ -27,6 +27,7 @@ from projector.api import register_slidemodel
|
|||||||
from agenda.api import is_summary
|
from agenda.api import is_summary
|
||||||
from utils.translation_ext import xugettext as _
|
from utils.translation_ext import xugettext as _
|
||||||
|
|
||||||
|
|
||||||
class Item(MPTTModel, SlideMixin):
|
class Item(MPTTModel, SlideMixin):
|
||||||
"""
|
"""
|
||||||
An Agenda Item
|
An Agenda Item
|
||||||
@ -131,11 +132,23 @@ class Item(MPTTModel, SlideMixin):
|
|||||||
order_insertion_by = ['weight', 'title']
|
order_insertion_by = ['weight', 'title']
|
||||||
|
|
||||||
|
|
||||||
register_slidemodel(Item, category=_('Agenda'), model_name=_('Agenda Item'))
|
register_slidemodel(Item, model_name=_('Agenda Item'))
|
||||||
|
|
||||||
# TODO: put this in another file
|
# TODO: put this in another file
|
||||||
|
|
||||||
from projector.api import register_slidefunc
|
from projector.api import register_slidefunc
|
||||||
from agenda.slides import agenda_show
|
from agenda.slides import agenda_show
|
||||||
|
|
||||||
register_slidefunc(_('Agenda'), agenda_show, category=_('Agenda'))
|
register_slidefunc(_('Agenda'), agenda_show)
|
||||||
|
|
||||||
|
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from openslides.config.signals import default_config_value
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(default_config_value, dispatch_uid="agenda_default_config")
|
||||||
|
def default_config(sender, key, **kwargs):
|
||||||
|
return {
|
||||||
|
'agenda_countdown_time': 60,
|
||||||
|
}.get(key)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "system/base_system.html" %}
|
{% extends "config/base_config.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from utils.pdf import stylesheet
|
|||||||
from utils.views import TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView, FormView
|
from utils.views import TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView, FormView
|
||||||
from utils.template import Tab
|
from utils.template import Tab
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
from projector.api import get_active_slide, set_active_slide
|
from projector.api import get_active_slide, set_active_slide
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ class AgendaPDF(PDFView):
|
|||||||
|
|
||||||
|
|
||||||
class Config(FormView):
|
class Config(FormView):
|
||||||
permission_required = 'system.can_manage_system'
|
permission_required = 'config.can_manage_config'
|
||||||
form_class = ConfigForm
|
form_class = ConfigForm
|
||||||
template_name = 'agenda/config.html'
|
template_name = 'agenda/config.html'
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ from projector.api import register_slidemodel
|
|||||||
from projector.models import SlideMixin
|
from projector.models import SlideMixin
|
||||||
|
|
||||||
from participant.models import Profile
|
from participant.models import Profile
|
||||||
from system import config
|
from config.models import config
|
||||||
from utils.utils import _propper_unicode
|
from utils.utils import _propper_unicode
|
||||||
from utils.translation_ext import xugettext as _
|
from utils.translation_ext import xugettext as _
|
||||||
from poll.models import BaseOption, BasePoll, CountVotesCast, CountInvalid, Vote
|
from poll.models import BaseOption, BasePoll, CountVotesCast, CountInvalid, Vote
|
||||||
@ -494,7 +494,7 @@ class AVersion(models.Model):
|
|||||||
.filter(id__lte=self.id).count()
|
.filter(id__lte=self.id).count()
|
||||||
return self._aid
|
return self._aid
|
||||||
|
|
||||||
register_slidemodel(Application, category=_('Applications'))
|
register_slidemodel(Application)
|
||||||
|
|
||||||
|
|
||||||
class ApplicationOption(BaseOption):
|
class ApplicationOption(BaseOption):
|
||||||
@ -527,3 +527,17 @@ class ApplicationPoll(BasePoll, CountInvalid, CountVotesCast):
|
|||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('application_poll_view', args=[self.id])
|
return reverse('application_poll_view', args=[self.id])
|
||||||
|
|
||||||
|
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from openslides.config.signals import default_config_value
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(default_config_value, dispatch_uid="application_default_config")
|
||||||
|
def default_config(sender, key, **kwargs):
|
||||||
|
return {
|
||||||
|
'application_min_supporters': 4,
|
||||||
|
'application_preamble': 'Die Versammlung möge beschließen,',
|
||||||
|
'application_pdf_ballot_papers_selection': '1',
|
||||||
|
'application_pdf_title': _('Applications'),
|
||||||
|
}.get(key)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "system/base_system.html" %}
|
{% extends "config/base_config.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ from reportlab.lib import colors
|
|||||||
from reportlab.lib.units import cm
|
from reportlab.lib.units import cm
|
||||||
from reportlab.platypus import PageBreak, Paragraph, Spacer, Table, TableStyle
|
from reportlab.platypus import PageBreak, Paragraph, Spacer, Table, TableStyle
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
from settings import SITE_ROOT
|
from settings import SITE_ROOT
|
||||||
from utils.pdf import stylesheet
|
from utils.pdf import stylesheet
|
||||||
from utils.views import PDFView
|
from utils.views import PDFView
|
||||||
@ -777,7 +777,7 @@ class ApplicationPollPDF(PDFView):
|
|||||||
|
|
||||||
|
|
||||||
class Config(FormView):
|
class Config(FormView):
|
||||||
permission_required = 'system.can_manage_system'
|
permission_required = 'config.can_manage_config'
|
||||||
form_class = ConfigForm
|
form_class = ConfigForm
|
||||||
template_name = 'application/config.html'
|
template_name = 'application/config.html'
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class Assignment(models.Model, SlideMixin):
|
|||||||
('can_manage_assignment', _("Can manage assignment", fixstr=True)),
|
('can_manage_assignment', _("Can manage assignment", fixstr=True)),
|
||||||
)
|
)
|
||||||
|
|
||||||
register_slidemodel(Assignment, category=_('Elections'))
|
register_slidemodel(Assignment)
|
||||||
|
|
||||||
|
|
||||||
class AssignmentOption(BaseOption):
|
class AssignmentOption(BaseOption):
|
||||||
@ -150,5 +150,14 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin):
|
|||||||
if link == 'delete':
|
if link == 'delete':
|
||||||
return ('assignment_poll_delete', [str(self.id)])
|
return ('assignment_poll_delete', [str(self.id)])
|
||||||
|
|
||||||
#register_slidemodel(AssignmentPoll, category=_('Elections'))
|
|
||||||
|
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from openslides.config.signals import default_config_value
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(default_config_value, dispatch_uid="assignment_default_config")
|
||||||
|
def default_config(sender, key, **kwargs):
|
||||||
|
return {
|
||||||
|
'assignment_pdf_ballot_papers_selection': '1',
|
||||||
|
'assignment_pdf_title': _('Elections'),
|
||||||
|
}.get(key)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "system/base_system.html" %}
|
{% extends "config/base_config.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from reportlab.lib import colors
|
|||||||
from reportlab.lib.units import cm
|
from reportlab.lib.units import cm
|
||||||
from reportlab.platypus import PageBreak, Paragraph, Spacer, Table, TableStyle
|
from reportlab.platypus import PageBreak, Paragraph, Spacer, Table, TableStyle
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
from utils.utils import template, permission_required, gen_confirm_form, del_confirm_form, ajax_request
|
from utils.utils import template, permission_required, gen_confirm_form, del_confirm_form, ajax_request
|
||||||
from utils.pdf import print_assignment_poll
|
from utils.pdf import print_assignment_poll
|
||||||
@ -439,7 +439,7 @@ class AssignmentPDF(PDFView):
|
|||||||
|
|
||||||
|
|
||||||
class Config(FormView):
|
class Config(FormView):
|
||||||
permission_required = 'system.can_manage_system'
|
permission_required = 'config.can_manage_config'
|
||||||
form_class = ConfigForm
|
form_class = ConfigForm
|
||||||
template_name = 'assignment/config.html'
|
template_name = 'assignment/config.html'
|
||||||
|
|
||||||
|
1
openslides/config/__init__.py
Normal file
1
openslides/config/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
openslides.system.forms
|
openslides.config.forms
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Forms for the system app.
|
Forms for the config app.
|
||||||
|
|
||||||
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
@ -14,7 +14,7 @@ from django.forms import Form, CharField, TextInput, BooleanField, IntegerField,
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from utils.forms import CssClassMixin
|
from utils.forms import CssClassMixin
|
||||||
from system import config
|
from models import config
|
||||||
|
|
||||||
|
|
||||||
class SystemConfigForm(Form, CssClassMixin):
|
class SystemConfigForm(Form, CssClassMixin):
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
openslides.system.models
|
openslides.config.models
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Models for the system app.
|
Models for the config app.
|
||||||
|
|
||||||
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
@ -13,21 +13,12 @@ from pickle import dumps, loads
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.dispatch import receiver
|
||||||
|
|
||||||
from utils.translation_ext import xugettext as _
|
from utils.translation_ext import xugettext as _
|
||||||
|
|
||||||
DEFAULT_DATA = {
|
from openslides.config.signals import default_config_value
|
||||||
'event_name': 'OpenSlides',
|
|
||||||
'event_description': 'Presentation and voting system',
|
|
||||||
'agenda_countdown_time': 60,
|
|
||||||
'application_min_supporters': 4,
|
|
||||||
'application_preamble': 'Die Versammlung möge beschließen,',
|
|
||||||
'application_pdf_ballot_papers_selection': '1',
|
|
||||||
'application_pdf_title': _('Applications'),
|
|
||||||
'assignment_pdf_ballot_papers_selection': '1',
|
|
||||||
'assignment_pdf_title': _('Elections'),
|
|
||||||
'system_url': 'http://127.0.0.1:8000',
|
|
||||||
'system_welcometext': 'Welcome to OpenSlides!',
|
|
||||||
}
|
|
||||||
|
|
||||||
class ConfigStore(models.Model):
|
class ConfigStore(models.Model):
|
||||||
key = models.CharField(max_length=100, primary_key=True)
|
key = models.CharField(max_length=100, primary_key=True)
|
||||||
@ -39,9 +30,10 @@ class ConfigStore(models.Model):
|
|||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = 'config'
|
verbose_name = 'config'
|
||||||
permissions = (
|
permissions = (
|
||||||
('can_manage_system', _("Can manage system configuration", fixstr=True)),
|
('can_manage_config', _("Can manage config configuration", fixstr=True)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# I used base64 to save pickled Data, there has to be another way see:
|
# I used base64 to save pickled Data, there has to be another way see:
|
||||||
# http://stackoverflow.com/questions/2524970/djangounicodedecodeerror-while-storing-pickled-data
|
# http://stackoverflow.com/questions/2524970/djangounicodedecodeerror-while-storing-pickled-data
|
||||||
@ -57,14 +49,16 @@ class Config(object):
|
|||||||
self.config
|
self.config
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.load_config()
|
self.load_config()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return self.config[key]
|
return self.config[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
try:
|
|
||||||
return DEFAULT_DATA[key]
|
for receiver, value in default_config_value.send(sender='config', key=key):
|
||||||
except KeyError:
|
if value is not None:
|
||||||
return None
|
return value
|
||||||
|
return None
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
try:
|
try:
|
||||||
@ -79,6 +73,21 @@ class Config(object):
|
|||||||
self.load_config()
|
self.load_config()
|
||||||
self.config[key] = value
|
self.config[key] = value
|
||||||
|
|
||||||
|
config = Config()
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(default_config_value, dispatch_uid="config_default_config")
|
||||||
|
def default_config(sender, key, **kwargs):
|
||||||
|
return {
|
||||||
|
'event_name': 'OpenSlides',
|
||||||
|
'event_description': 'Presentation and voting system',
|
||||||
|
'system_url': 'http://127.0.0.1:8000',
|
||||||
|
'system_welcometext': 'Welcome to OpenSlides!',
|
||||||
|
}.get(key)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils.importlib import import_module
|
from django.utils.importlib import import_module
|
||||||
@ -88,7 +97,7 @@ from openslides.utils.signals import template_manipulation
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(template_manipulation, dispatch_uid="system_base_system")
|
@receiver(template_manipulation, dispatch_uid="config_submenu")
|
||||||
def set_submenu(sender, request, context, **kwargs):
|
def set_submenu(sender, request, context, **kwargs):
|
||||||
if not request.path.startswith('/config/'):
|
if not request.path.startswith('/config/'):
|
||||||
return None
|
return None
|
15
openslides/config/signals.py
Normal file
15
openslides/config/signals.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
openslides.config.signals
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Defines Signals for the config.
|
||||||
|
|
||||||
|
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
||||||
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.dispatch import Signal
|
||||||
|
|
||||||
|
default_config_value = Signal(providing_args=['key'])
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "system/base_system.html" %}
|
{% extends "config/base_config.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
@ -13,8 +13,8 @@
|
|||||||
<button class="button" type="submit">
|
<button class="button" type="submit">
|
||||||
<span class="icon ok">{%trans 'Save' %}</span>
|
<span class="icon ok">{%trans 'Save' %}</span>
|
||||||
</button>
|
</button>
|
||||||
<a href='{% url config_system %}'>
|
<a href='{% url config_config %}'>
|
||||||
<button class="button" type="button" onclick="window.location='{% url config_system %}'">
|
<button class="button" type="button" onclick="window.location='{% url config_config %}'">
|
||||||
<span class="icon cancel">{%trans 'Cancel' %}</span>
|
<span class="icon cancel">{%trans 'Cancel' %}</span>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "system/base_system.html" %}
|
{% extends "config/base_config.html" %}
|
||||||
|
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
openslides.system.urls
|
openslides.config.urls
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
URL list for the system app.
|
URL list for the config app.
|
||||||
|
|
||||||
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
@ -17,7 +17,7 @@ import settings
|
|||||||
|
|
||||||
from views import GeneralConfig
|
from views import GeneralConfig
|
||||||
|
|
||||||
urlpatterns = patterns('system.views',
|
urlpatterns = patterns('config.views',
|
||||||
url(r'^general/$',
|
url(r'^general/$',
|
||||||
GeneralConfig.as_view(),
|
GeneralConfig.as_view(),
|
||||||
name='config_general',
|
name='config_general',
|
@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
openslides.system.views
|
openslides.config.views
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Views for the system app.
|
Views for the config app.
|
||||||
|
|
||||||
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
:copyright: 2011 by the OpenSlides team, see AUTHORS.
|
||||||
:license: GNU GPL, see LICENSE for more details.
|
:license: GNU GPL, see LICENSE for more details.
|
||||||
@ -21,15 +21,15 @@ from utils.utils import template, permission_required
|
|||||||
from utils.views import FormView
|
from utils.views import FormView
|
||||||
from utils.template import Tab
|
from utils.template import Tab
|
||||||
|
|
||||||
from system.forms import SystemConfigForm, EventConfigForm
|
from forms import SystemConfigForm, EventConfigForm
|
||||||
|
|
||||||
from system import config
|
from models import config
|
||||||
|
|
||||||
|
|
||||||
class GeneralConfig(FormView):
|
class GeneralConfig(FormView):
|
||||||
permission_required = 'system.can_manage_system'
|
permission_required = 'config.can_manage_config'
|
||||||
form_class = EventConfigForm
|
form_class = EventConfigForm
|
||||||
template_name = 'system/general.html'
|
template_name = 'config/general.html'
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
return {
|
return {
|
||||||
@ -55,9 +55,9 @@ class GeneralConfig(FormView):
|
|||||||
|
|
||||||
|
|
||||||
class Config(FormView):
|
class Config(FormView):
|
||||||
permission_required = 'system.can_manage_system'
|
permission_required = 'config.can_manage_config'
|
||||||
form_class = SystemConfigForm
|
form_class = SystemConfigForm
|
||||||
template_name = 'system/system.html'
|
template_name = 'config/config.html'
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
return {
|
return {
|
||||||
@ -93,6 +93,6 @@ def register_tab(request):
|
|||||||
return Tab(
|
return Tab(
|
||||||
title=_('Configuration'),
|
title=_('Configuration'),
|
||||||
url=reverse('config_general'),
|
url=reverse('config_general'),
|
||||||
permission=request.user.has_perm('system.can_manage_system'),
|
permission=request.user.has_perm('config.can_manage_config'),
|
||||||
selected=selected,
|
selected=selected,
|
||||||
)
|
)
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
openslides.system.opennslides_settings
|
openslides.opennslides_settings
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
OpenSlides default settings.
|
OpenSlides default settings.
|
||||||
@ -103,7 +103,7 @@ INSTALLED_APPS = (
|
|||||||
'application',
|
'application',
|
||||||
'assignment',
|
'assignment',
|
||||||
'participant',
|
'participant',
|
||||||
'system',
|
'config',
|
||||||
)
|
)
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
|
@ -23,7 +23,7 @@ from agenda.models import Item
|
|||||||
from application.models import Application
|
from application.models import Application
|
||||||
from assignment.models import Assignment
|
from assignment.models import Assignment
|
||||||
from participant.models import Profile
|
from participant.models import Profile
|
||||||
from system.models import ConfigStore
|
from config.models import ConfigStore
|
||||||
|
|
||||||
USER_VISIBLE_PERMISSIONS = reduce(list.__add__, [
|
USER_VISIBLE_PERMISSIONS = reduce(list.__add__, [
|
||||||
[p[0] for p in Item._meta.permissions],
|
[p[0] for p in Item._meta.permissions],
|
||||||
|
@ -42,7 +42,7 @@ from utils.utils import (template, permission_required, gen_confirm_form,
|
|||||||
ajax_request, decodedict, encodedict)
|
ajax_request, decodedict, encodedict)
|
||||||
from utils.pdf import print_userlist, print_passwords
|
from utils.pdf import print_userlist, print_passwords
|
||||||
from utils.template import Tab
|
from utils.template import Tab
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
from django.db.models import Avg, Max, Min, Count
|
from django.db.models import Avg, Max, Min, Count
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from system import config
|
from config.models import config
|
||||||
from projector import SLIDE, Slide
|
from projector import SLIDE, Slide
|
||||||
|
|
||||||
|
|
||||||
@ -35,10 +35,12 @@ def set_active_slide(sid):
|
|||||||
config["presentation"] = sid
|
config["presentation"] = sid
|
||||||
|
|
||||||
|
|
||||||
def register_slidemodel(model, category=None, model_name=None):
|
def register_slidemodel(model, model_name=None):
|
||||||
#TODO: Warn if there already is a slide with this prefix
|
#TODO: Warn if there already is a slide with this prefix
|
||||||
if model_name is None:
|
if model_name is None:
|
||||||
model_name = model.prefix
|
model_name = model.prefix
|
||||||
|
|
||||||
|
category = model.__module__.split('.')[0]
|
||||||
SLIDE[model.prefix] = Slide(
|
SLIDE[model.prefix] = Slide(
|
||||||
model_slide=True,
|
model_slide=True,
|
||||||
model=model,
|
model=model,
|
||||||
@ -48,8 +50,9 @@ def register_slidemodel(model, category=None, model_name=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def register_slidefunc(key, func, category=None):
|
def register_slidefunc(key, func):
|
||||||
#TODO: Warn if there already is a slide with this prefix
|
#TODO: Warn if there already is a slide with this prefix
|
||||||
|
category = func.__module__.split('.')[0]
|
||||||
SLIDE[key] = Slide(
|
SLIDE[key] = Slide(
|
||||||
model_slide=False,
|
model_slide=False,
|
||||||
func=func,
|
func=func,
|
||||||
|
@ -3,9 +3,10 @@ from django.db import models
|
|||||||
from api import register_slidemodel
|
from api import register_slidemodel
|
||||||
from projector import SlideMixin
|
from projector import SlideMixin
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
from utils.translation_ext import xugettext as _
|
from utils.translation_ext import xugettext as _
|
||||||
|
|
||||||
|
|
||||||
class ProjectorSlide(models.Model, SlideMixin):
|
class ProjectorSlide(models.Model, SlideMixin):
|
||||||
prefix = 'ProjectorSlide'
|
prefix = 'ProjectorSlide'
|
||||||
|
|
||||||
@ -13,6 +14,14 @@ class ProjectorSlide(models.Model, SlideMixin):
|
|||||||
text = models.TextField(null=True, blank=True, verbose_name=_("Text"))
|
text = models.TextField(null=True, blank=True, verbose_name=_("Text"))
|
||||||
weight = models.IntegerField(default=0, verbose_name=_("Weight"))
|
weight = models.IntegerField(default=0, verbose_name=_("Weight"))
|
||||||
|
|
||||||
|
def slide(self):
|
||||||
|
return {
|
||||||
|
'slide': self,
|
||||||
|
'title': self.title,
|
||||||
|
'template': 'projector/ProjectorSlide.html',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
@ -31,5 +40,5 @@ class ProjectorMessage(models.Model):
|
|||||||
return self.def_name
|
return self.def_name
|
||||||
|
|
||||||
|
|
||||||
register_slidemodel(ProjectorSlide, category=_('Projector'), model_name=_('Projector Slide'))
|
register_slidemodel(ProjectorSlide, model_name=_('Projector Slide'))
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ from time import time
|
|||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
from openslides.projector.signals import projector_messages
|
from openslides.projector.signals import projector_messages
|
||||||
|
|
||||||
|
14
openslides/projector/templates/projector/ProjectorSlide.html
Normal file
14
openslides/projector/templates/projector/ProjectorSlide.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{% extends "base-projector.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block title %}{{ block.super }} - {{ slide.title }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if slide.text %}
|
||||||
|
<h1>{{ slide.title }}</h1>
|
||||||
|
{{ slide.text|safe|linebreaks }}
|
||||||
|
{% else %}
|
||||||
|
<div class="item_fullscreen">{{ slide.title }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
@ -77,14 +77,14 @@
|
|||||||
{% for slide in slides %}
|
{% for slide in slides %}
|
||||||
{% if slide.model_slide %}
|
{% if slide.model_slide %}
|
||||||
<ul style="line-height: 180%">
|
<ul style="line-height: 180%">
|
||||||
{% for item in slide.get_items %}
|
{% for slide in slide.get_items %}
|
||||||
<li class="{% if item.active %}activeline{% endif %}"><a href="{% url projector_activate_slide item.sid %}"
|
<li class="{% if slide.active %}activeline{% endif %}"><a href="{% url projector_activate_slide slide.sid %}"
|
||||||
class="activate_link {% if item.active %}active{% endif %}"
|
class="activate_link {% if slide.active %}active{% endif %}"
|
||||||
><div></div></a>
|
><div></div></a>
|
||||||
{% for i in item.get_ancestors %} {% endfor %}
|
{% for i in slide.get_ancestors %} {% endfor %}
|
||||||
<a href="{% url projector_edit_slide item.id %}">{{ item }}</a>
|
<a href="{% url projector_edit_slide slide.id %}">{{ slide }}</a>
|
||||||
{% if item.children.exists %}
|
{% if slide.children.exists %}
|
||||||
<a href="{% url projector_activate_summary item.sid %}"><img src="/static/images/icons/view-list-tree.png" title="{% trans 'Select item overview' %}"></a>
|
<a href="{% url projector_activate_summary slide.sid %}"><img src="/static/images/icons/view-list-tree.png" title="{% trans 'Select item overview' %}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -17,6 +17,7 @@ from django.template import RequestContext
|
|||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.utils.datastructures import SortedDict
|
||||||
|
|
||||||
|
|
||||||
from utils.views import TemplateView, RedirectView
|
from utils.views import TemplateView, RedirectView
|
||||||
@ -25,13 +26,15 @@ from utils.utils import template, permission_required, \
|
|||||||
from utils.template import render_block_to_string
|
from utils.template import render_block_to_string
|
||||||
from utils.template import Tab
|
from utils.template import Tab
|
||||||
|
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
from api import get_active_slide, set_active_slide
|
from api import get_active_slide, set_active_slide
|
||||||
from projector import SLIDE
|
from projector import SLIDE
|
||||||
from models import ProjectorMessage
|
from models import ProjectorMessage
|
||||||
from openslides.projector.signals import projector_messages
|
from openslides.projector.signals import projector_messages
|
||||||
|
|
||||||
|
import settings
|
||||||
|
|
||||||
|
|
||||||
class ControlView(TemplateView):
|
class ControlView(TemplateView):
|
||||||
template_name = 'projector/control.html'
|
template_name = 'projector/control.html'
|
||||||
@ -44,8 +47,13 @@ class ControlView(TemplateView):
|
|||||||
if not categories.has_key(slide.category):
|
if not categories.has_key(slide.category):
|
||||||
categories[slide.category] = []
|
categories[slide.category] = []
|
||||||
categories[slide.category].append(slide)
|
categories[slide.category].append(slide)
|
||||||
|
|
||||||
|
ordered_categories = SortedDict()
|
||||||
|
for app in settings.INSTALLED_APPS:
|
||||||
|
if app in categories:
|
||||||
|
ordered_categories[app] = categories[app]
|
||||||
context.update({
|
context.update({
|
||||||
'categories': categories,
|
'categories': ordered_categories,
|
||||||
'countdown_visible': config['countdown_visible'],
|
'countdown_visible': config['countdown_visible'],
|
||||||
'countdown_time': config['agenda_countdown_time'],
|
'countdown_time': config['agenda_countdown_time'],
|
||||||
})
|
})
|
||||||
@ -82,6 +90,8 @@ def active_slide(request):
|
|||||||
|
|
||||||
data['ajax'] = 'on'
|
data['ajax'] = 'on'
|
||||||
data['messages'] = []
|
data['messages'] = []
|
||||||
|
|
||||||
|
# Projector Messages
|
||||||
active_defs = ProjectorMessage.objects.filter(active=True).values_list('def_name', flat=True)
|
active_defs = ProjectorMessage.objects.filter(active=True).values_list('def_name', flat=True)
|
||||||
for receiver, response in projector_messages.send(sender='active_slide', register=False, call=active_defs):
|
for receiver, response in projector_messages.send(sender='active_slide', register=False, call=active_defs):
|
||||||
if response is not None:
|
if response is not None:
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
from system.models import Config
|
|
||||||
# TODO: Test that this is not thead-save
|
|
||||||
config = Config()
|
|
@ -29,7 +29,7 @@ urlpatterns = patterns('',
|
|||||||
(r'^application/', include('application.urls')),
|
(r'^application/', include('application.urls')),
|
||||||
(r'^assignment/', include('assignment.urls')),
|
(r'^assignment/', include('assignment.urls')),
|
||||||
(r'^participant/', include('participant.urls')),
|
(r'^participant/', include('participant.urls')),
|
||||||
(r'^config/', include('system.urls')),
|
(r'^config/', include('config.urls')),
|
||||||
(r'^projector/', include('projector.urls')),
|
(r'^projector/', include('projector.urls')),
|
||||||
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_DOC_ROOT}),
|
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_DOC_ROOT}),
|
||||||
(r'^i18n/', include('django.conf.urls.i18n')),
|
(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
class AnonymousAuth(object):
|
class AnonymousAuth(object):
|
||||||
"""
|
"""
|
||||||
|
@ -36,7 +36,7 @@ from openslides.agenda.models import Item
|
|||||||
from openslides.application.models import Application
|
from openslides.application.models import Application
|
||||||
from openslides.assignment.models import Assignment
|
from openslides.assignment.models import Assignment
|
||||||
from openslides.participant.models import Profile
|
from openslides.participant.models import Profile
|
||||||
from system import config
|
from config.models import config
|
||||||
from openslides.settings import SITE_ROOT
|
from openslides.settings import SITE_ROOT
|
||||||
from openslides.utils.utils import permission_required
|
from openslides.utils.utils import permission_required
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from system import config
|
from config.models import config
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user