Merge pull request #640 from normanjaeckel/Fixes

Some Fixes
This commit is contained in:
Oskar Hahn 2013-05-13 05:06:29 -07:00
commit 865860a96f
8 changed files with 44 additions and 19 deletions

View File

@ -77,7 +77,7 @@ class Item(MPTTModel, SlideMixin):
"""
Type of the agenda item.
See Agenda.ITEM_TYPE for more informations.
See Item.ITEM_TYPE for more information.
"""
duration = models.CharField(null=True, blank=True, max_length=5,
@ -191,11 +191,11 @@ class Item(MPTTModel, SlideMixin):
* normal slide of the item
The method returns only one of them according to the config value
'presentation_argument' and the attribut 'related_sid'.
'presentation_argument' and the attribute 'related_sid'.
"""
if config['presentation_argument'] == 'summary':
data = {'title': self.get_title(),
'items': self.get_children(),
'items': self.get_children().filter(type__exact=Item.AGENDA_ITEM),
'template': 'projector/AgendaSummary.html'}
elif config['presentation_argument'] == 'show_list_of_speakers':

View File

@ -84,7 +84,10 @@ def agenda_list_of_speakers(sender, **kwargs):
"""
slide = get_slide_from_sid(get_active_slide(only_sid=True), element=True)
if not isinstance(slide, Item):
# Only show list of speakers on Agenda-Items
# Only show list of speakers overlay on agenda items
return None
if config['presentation_argument'] == 'show_list_of_speakers':
# Do not show list of speakers overlay on the list of speakers slide
return None
clear_projector_cache()
list_of_speakers = slide.get_list_of_speakers(

View File

@ -35,8 +35,8 @@
</style>
<div id="overlay_list_of_speaker_box">
<h3>{% trans 'List of speakers' %}:</h3>
{% if list_of_speakers %}
<h3>{% trans "List of speakers" %}:</h3>
<ul>
{% for speaker_dict in list_of_speakers %}
<li>

View File

@ -135,7 +135,7 @@
<p>
{% if is_on_the_list_of_speakers %}
<a href="{% url 'agenda_speaker_delete' object.id %}" class="btn">{% trans "Remove me from the list" %}</a>
{% elif not object.speaker_list_closed and perms.can_be_speaker %}
{% elif not object.speaker_list_closed and perms.agenda.can_be_speaker %}
<a href="{% url 'agenda_speaker_append' object.id %}" class="btn">{% trans "Put me on the list" %}</a>
{% endif %}
</p>

View File

@ -450,13 +450,14 @@ class CurrentListOfSpeakersView(RedirectView):
"""
Returns the URL to the item_view if:
* the current slide is an item and
* the user has the permission to see the item
* the current slide is an item,
* the user has the permission to see the item and
* the list of speakers of the item is not closed,
in other case, it returns the URL to the dashboard.
This method also add the request.user to the list of speakers, if he
has the right permissions.
This method also adds the request.user to the list of speakers, if he
has the right permissions and the list is not closed.
"""
item = self.get_item()
request = self.request
@ -466,6 +467,10 @@ class CurrentListOfSpeakersView(RedirectView):
'Please choose the agenda item manually from the agenda.'))
return reverse('dashboard')
if item.speaker_list_closed:
messages.error(request, _('The list of speakers is closed.'))
return reverse('dashboard')
if self.request.user.has_perm('agenda.can_be_speaker'):
try:
Speaker.objects.add(self.request.user, item)

View File

@ -6,7 +6,9 @@
{% block content %}
<h1>{% trans 'Version' %}</h1>
<ul>
{% for version in versions %}
<p>{{ version.0 }} {% trans "Version" %}: {{ version.1 }}</p>
<li>{{ version.0 }} {% trans "Version" %} {{ version.1 }}</li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -19,7 +19,7 @@ from openslides.utils.views import TemplateView
class VersionView(TemplateView):
"""
Show version infos.
Shows version infos.
"""
template_name = 'core/version.html'
@ -32,20 +32,35 @@ class VersionView(TemplateView):
# OpenSlides version. During development the git commit id is added.
openslides_version_string = get_version()
if not RELEASE:
openslides_version_string += ' Commit: %s' % get_git_commit_id()
openslides_version_string += ' Commit %s' % get_git_commit_id()
context['versions'] = [('OpenSlides', openslides_version_string)]
# Versions of plugins.
for plugin in settings.INSTALLED_PLUGINS:
# Get plugin
try:
mod = import_module(plugin)
plugin_version = get_version(mod.VERSION)
except (ImportError, AttributeError, AssertionError):
except ImportError:
continue
# Get version.
try:
plugin_name = mod.NAME
plugin_version = mod.get_version()
except AttributeError:
plugin_name = mod.__name__.split('.')[0]
try:
plugin_version = mod.VERSION
except AttributeError:
continue
# Get name.
try:
plugin_name = mod.get_name()
except AttributeError:
try:
plugin_name = mod.NAME
except AttributeError:
plugin_name = mod.__name__.split('.')[0]
context['versions'].append((plugin_name, plugin_version))
return context

View File

@ -102,9 +102,9 @@ def import_users(csv_file):
user.reset_password()
count_success += 1
except csv.Error:
error_messages.appen(_('Import aborted because of severe errors in the input file.'))
error_messages.append(_('Import aborted because of severe errors in the input file.'))
except UnicodeDecodeError:
error_messages.appen(_('Import file has wrong character encoding, only UTF-8 is supported!'))
error_messages.append(_('Import file has wrong character encoding, only UTF-8 is supported!'))
return (count_success, error_messages)