diff --git a/openslides/participant/forms.py b/openslides/participant/forms.py index 4827f9efb..4fb13a570 100644 --- a/openslides/participant/forms.py +++ b/openslides/participant/forms.py @@ -24,21 +24,6 @@ class UserCreateForm(forms.ModelForm, CssClassMixin): groups = forms.ModelMultipleChoiceField( queryset=Group.objects.exclude(name__iexact='anonymous'), label=_("User groups"), required=False) - is_active = forms.BooleanField(label=_("Active"), required=False, - initial=True) - - class Meta: - model = User - exclude = ('username', 'password', 'is_staff', 'is_superuser', - 'last_login', 'date_joined', 'user_permissions') - - -class UserEditForm(forms.ModelForm, CssClassMixin): - first_name = forms.CharField(label=_("First name")) - last_name = forms.CharField(label=_("Last name")) - groups = forms.ModelMultipleChoiceField(queryset=Group.objects.all(), - label=_("User groups"), required=False) - is_active = forms.BooleanField(label=_("Active"), required=False) class Meta: model = User @@ -111,6 +96,7 @@ class UsersettingsForm(forms.ModelForm, CssClassMixin): model = User fields = ('username', 'first_name', 'last_name', 'email') + class UserImportForm(forms.Form, CssClassMixin): csvfile = forms.FileField(widget=forms.FileInput(attrs={'size': '50'}), label=_("CSV File")) diff --git a/openslides/projector/models.py b/openslides/projector/models.py index 0d108d282..e6e51716a 100644 --- a/openslides/projector/models.py +++ b/openslides/projector/models.py @@ -50,7 +50,8 @@ class ProjectorSlide(models.Model, SlideMixin): class Meta: permissions = ( ('can_manage_projector', ugettext_noop("Can manage the projector")), - ('can_see_projector', ugettext_noop("Can see projector")), + ('can_see_projector', ugettext_noop("Can see the projector")), + ('can_see_dashboard', ugettext_noop("Can see the dashboard")), ) diff --git a/openslides/projector/projector.py b/openslides/projector/projector.py index 4d2e2d326..140592698 100644 --- a/openslides/projector/projector.py +++ b/openslides/projector/projector.py @@ -105,12 +105,14 @@ class Widget(object): """ Class for a Widget for the Projector-Tab. """ - def __init__(self, name, html=None, template=None, context={}): + def __init__(self, name, html=None, template=None, context={}, + permission_required=None): self.name = name if html is not None: self.html = html elif template is not None: self.html = render_to_string(template, context) + self.permission_required = permission_required def get_name(self): return self.name.lower() diff --git a/openslides/projector/templates/projector/base_projector.html b/openslides/projector/templates/projector/base_projector.html index be2a1e811..4d4e545df 100644 --- a/openslides/projector/templates/projector/base_projector.html +++ b/openslides/projector/templates/projector/base_projector.html @@ -7,18 +7,18 @@ {% block title %}{{ block.super}} – {% trans 'Projector' %} {% endblock %} {% block submenu %} - {% url projector_control as url_projectoroverview %} + {% url dashboard as url_dashboard %}

{% trans "Projector" %}

{% endblock %} diff --git a/openslides/projector/templates/projector/control.html b/openslides/projector/templates/projector/dashboard.html similarity index 99% rename from openslides/projector/templates/projector/control.html rename to openslides/projector/templates/projector/dashboard.html index de71aa244..2057e010a 100644 --- a/openslides/projector/templates/projector/control.html +++ b/openslides/projector/templates/projector/dashboard.html @@ -14,7 +14,7 @@ {% endblock %} {% block content %} -

{% trans 'Projector' %}

+

{% trans 'Dashboard' %}

{% trans "Adjust projector view" %}: diff --git a/openslides/projector/templates/projector/new.html b/openslides/projector/templates/projector/new.html index 0f77d64b9..c63e5e0ac 100644 --- a/openslides/projector/templates/projector/new.html +++ b/openslides/projector/templates/projector/new.html @@ -15,8 +15,8 @@ - - diff --git a/openslides/projector/urls.py b/openslides/projector/urls.py index efba5bbf0..d5a95793a 100644 --- a/openslides/projector/urls.py +++ b/openslides/projector/urls.py @@ -12,7 +12,7 @@ from django.conf.urls.defaults import patterns, url -from openslides.projector.views import (ControlView, ActivateView, +from openslides.projector.views import (DashboardView, ActivateView, CustomSlideCreateView, CustomSlideUpdateView, CustomSlideDeleteView, CountdownEdit, ProjectorEdit, Projector, ActivateOverlay) @@ -35,9 +35,9 @@ urlpatterns = patterns('', name='projctor_preview_slide', ), - url(r'^control/$', - ControlView.as_view(), - name='projector_control', + url(r'^dashboard/$', + DashboardView.as_view(), + name='dashboard', ), url(r'^activate/$', diff --git a/openslides/projector/views.py b/openslides/projector/views.py index ae1e90770..a47bfe880 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -36,12 +36,12 @@ from openslides.projector.projector import SLIDE, Widget from openslides.projector.signals import projector_overlays -class ControlView(TemplateView, AjaxMixin): +class DashboardView(TemplateView, AjaxMixin): """ Overview over all possible slides, the overlays and a liveview. """ - template_name = 'projector/control.html' - permission_required = 'projector.can_manage_projector' + template_name = 'projector/dashboard.html' + permission_required = 'projector.can_see_dashboard' def get_projector_overlays(self): overlays = [] @@ -73,7 +73,7 @@ class ControlView(TemplateView, AjaxMixin): } def get_context_data(self, **kwargs): - context = super(ControlView, self).get_context_data(**kwargs) + context = super(DashboardView, self).get_context_data(**kwargs) widgets = SortedDict() for app in settings.INSTALLED_APPS: @@ -88,7 +88,8 @@ class ControlView(TemplateView, AjaxMixin): continue for widget in modul_widgets: - widgets[widget.get_name()] = widget + if self.request.user.has_perm(widget.permission_required): + widgets[widget.get_name()] = widget context.update({ @@ -182,7 +183,7 @@ class ActivateView(RedirectView): Activate a Slide. """ permission_required = 'projector.can_manage_projector' - url = 'projector_control' + url = 'dashboard' allow_ajax = True def pre_redirect(self, request, *args, **kwargs): @@ -199,7 +200,7 @@ class ProjectorEdit(RedirectView): Scale or scroll the projector. """ permission_required = 'projector.can_manage_projector' - url = 'projector_control' + url = 'dashboard' allow_ajax = True def pre_redirect(self, request, *args, **kwargs): @@ -223,7 +224,7 @@ class CountdownEdit(RedirectView): Start, stop or reset the countdown. """ permission_required = 'projector.can_manage_projector' - url = 'projector_control' + url = 'dashboard' allow_ajax = True def pre_redirect(self, request, *args, **kwargs): @@ -273,7 +274,7 @@ class ActivateOverlay(RedirectView): """ Activate or deactivate an overlay. """ - url = 'projector_control' + url = 'dashboard' allow_ajax = True permission_required = 'projector.can_manage_projector' @@ -308,7 +309,7 @@ class CustomSlideCreateView(CreateView): template_name = 'projector/new.html' model = ProjectorSlide context_object_name = 'customslide' - success_url = 'projector_control' + success_url = 'dashboard' apply_url = 'customslide_edit' @@ -320,7 +321,7 @@ class CustomSlideUpdateView(UpdateView): template_name = 'projector/new.html' model = ProjectorSlide context_object_name = 'customslide' - success_url = 'projector_control' + success_url = 'dashboard' apply_url = 'customslide_edit' @@ -330,7 +331,7 @@ class CustomSlideDeleteView(DeleteView): """ permission_required = 'projector.can_manage_projector' model = ProjectorSlide - url = 'projector_control' + url = 'dashboard' def register_tab(request): @@ -339,9 +340,10 @@ def register_tab(request): """ selected = True if request.path.startswith('/projector/') else False return Tab( - title=_('Projector'), - url=reverse('projector_control'), - permission=request.user.has_perm('projector.can_manage_projector'), + title=_('Dashboard'), + url=reverse('dashboard'), + permission=request.user.has_perm('projector.can_manage_projector') or + request.user.has_perm('projector.can_see_dashboard'), selected=selected, ) @@ -356,7 +358,7 @@ def get_widgets(request): template='projector/widget.html', context={ 'slides': ProjectorSlide.objects.all(), - 'welcomepage_is_active': not bool(config["presentation"]), - } + 'welcomepage_is_active': not bool(config["presentation"])}, + permission_required = 'projector.can_manage_projector', ), ]