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

This commit is contained in:
Oskar Hahn 2012-04-14 11:18:54 +02:00
commit c0bf5ba822
7 changed files with 27 additions and 17 deletions

View File

@ -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,11 @@ 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)

View File

@ -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):

View File

@ -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):
@ -144,5 +144,3 @@ class AssignmentPoll(BasePoll, CountInvalid, CountVotesCast, PublishPollMixin):
CountInvalid.append_pollform_fields(self, fields) CountInvalid.append_pollform_fields(self, fields)
CountVotesCast.append_pollform_fields(self, fields) CountVotesCast.append_pollform_fields(self, fields)
#register_slidemodel(AssignmentPoll, category=_('Elections'))

View File

@ -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,

View File

@ -31,5 +31,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'))

View File

@ -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 %}&nbsp;&nbsp;&nbsp;{% endfor %} {% for i in slide.get_ancestors %}&nbsp;&nbsp;&nbsp;{% 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 %}

View File

@ -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
@ -32,6 +33,8 @@ 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'],
}) })