renamed beamer in projector

This commit is contained in:
Oskar Hahn 2012-02-06 22:08:08 +01:00
parent 65887c8c21
commit 16c37661f7
26 changed files with 107 additions and 124 deletions

View File

@ -15,7 +15,7 @@ from django.contrib import messages
from django.core.context_processors import csrf from django.core.context_processors import csrf
from openslides.system.api import config_get from openslides.system.api import config_get
from beamer.api import get_active_element from projector.api import get_active_element
def is_summary(): def is_summary():

View File

@ -18,8 +18,8 @@ except ImportError:
from django.db import models from django.db import models
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from beamer.models import Element from projector.models import Element
from beamer.api import element_register from projector.api import element_register
from system.api import config_set from system.api import config_set
from application.models import Application from application.models import Application
from poll.models import Poll from poll.models import Poll
@ -41,14 +41,14 @@ class Item(models.Model, Element):
prefix = 'item' prefix = 'item'
def beamer(self): def slide(self):
""" """
Return a map with all Data for the Beamer Return a map with all Data for the Slide
""" """
return { return {
'item': self, 'item': self,
'title': self.title, 'title': self.title,
'template': 'beamer/AgendaText.html', 'template': 'projector/AgendaText.html',
} }
@property @property
@ -137,7 +137,7 @@ class Item(models.Model, Element):
def get_absolute_url(self, link='view'): def get_absolute_url(self, link='view'):
""" """
Return the URL to this item. By default it is the Link to its Return the URL to this item. By default it is the Link to its
beamer-view. slide
link can be: link can be:
* view * view

View File

@ -11,7 +11,7 @@
<li class="{% active request '/agenda/new/' %}"><a href="{% url item_new %}">{%trans "New item" %}</a></li> <li class="{% active request '/agenda/new/' %}"><a href="{% url item_new %}">{%trans "New item" %}</a></li>
{% endif %} {% endif %}
{% if perms.agenda.can_see_projector %} {% if perms.agenda.can_see_projector %}
<li><a href="{% url beamer_show %}"><img src="/static/images/icons/video-projector.png"> {%trans 'Projector view' %}</a></li> <li><a href="{% url projector_show %}"><img src="/static/images/icons/video-projector.png"> {%trans 'Projector view' %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -52,18 +52,18 @@
<input type="checkbox" name="countdown" onchange="document.location='{% if countdown_visible == "True" %}{% url countdown_close %}{% else %}{% url countdown_open %}{% endif %}'" <input type="checkbox" name="countdown" onchange="document.location='{% if countdown_visible == "True" %}{% url countdown_close %}{% else %}{% url countdown_open %}{% endif %}'"
{% if countdown_visible == "True" %}checked{% endif %}> {% if countdown_visible == "True" %}checked{% endif %}>
{% trans "Countdown" %} (<a href="{% url config_agenda %}">{{countdown_time}}{% trans "sec" %}</a>){% if countdown_visible == "True" %}: {% trans "Countdown" %} (<a href="{% url config_agenda %}">{{countdown_time}}{% trans "sec" %}</a>){% if countdown_visible == "True" %}:
<a class="beamer_countdown" href="{% url countdown_reset countdown_time %}" title="{% trans 'Reset countdown' %}"><img src="/static/images/icons/media-skip-backward.png"></a> <a class="projector_countdown" href="{% url countdown_reset countdown_time %}" title="{% trans 'Reset countdown' %}"><img src="/static/images/icons/media-skip-backward.png"></a>
<a class="beamer_countdown" href="{% url countdown_start %}" title="{% trans 'Start countdown' %}"><img src="/static/images/icons/media-playback-start.png"></a> <a class="projector_countdown" href="{% url countdown_start %}" title="{% trans 'Start countdown' %}"><img src="/static/images/icons/media-playback-start.png"></a>
<a class="beamer_countdown" href="{% url countdown_stop %}" title="{% trans 'Stop countdown' %}"><img src="/static/images/icons/media-playback-pause.png"></a> <a class="projector_countdown" href="{% url countdown_stop %}" title="{% trans 'Stop countdown' %}"><img src="/static/images/icons/media-playback-pause.png"></a>
{% endif %} {% endif %}
<p></p> <p></p>
<!-- beamer control --> <!-- projector control -->
{% trans "Adjust projector view" %}: {% trans "Adjust projector view" %}:
<a class="beamer_edit" href="{% url beamer_bigger %}" title="{% trans 'Zoom in' %}"><img src="/static/images/icons/zoom-in.png"></a> <a class="projector_edit" href="{% url projector_bigger %}" title="{% trans 'Zoom in' %}"><img src="/static/images/icons/zoom-in.png"></a>
<a class="beamer_edit" href="{% url beamer_smaller %}" title="{% trans 'Zoom out' %}"><img src="/static/images/icons/zoom-out.png"></a> <a class="projector_edit" href="{% url projector_smaller %}" title="{% trans 'Zoom out' %}"><img src="/static/images/icons/zoom-out.png"></a>
<a class="beamer_edit" href="{% url beamer_up %}" title="{% trans 'Scroll text up' %}"><img src="/static/images/icons/go-up.png"></a> <a class="projector_edit" href="{% url projector_up %}" title="{% trans 'Scroll text up' %}"><img src="/static/images/icons/go-up.png"></a>
<a class="beamer_edit" href="{% url beamer_down %}" title="{% trans 'Scroll text down' %}"><img src="/static/images/icons/go-down.png"></a> <a class="projector_edit" href="{% url projector_down %}" title="{% trans 'Scroll text down' %}"><img src="/static/images/icons/go-down.png"></a>
<a class="beamer_edit" href="{% url beamer_clean %}" title="{% trans 'Reset projector view' %}"><img src="/static/images/icons/view-restore.png"></a> <a class="projector_edit" href="{% url projector_clean %}" title="{% trans 'Reset projector view' %}"><img src="/static/images/icons/view-restore.png"></a>
</div> </div>
{% endif %} {% endif %}

View File

@ -1,4 +1,4 @@
{% extends "beamer.html" %} {% extends "base-projector.html" %}
{% block title %}{{ block.super }} - {% block title %}{{ block.super }} -
{% if title %} {{ title }} {% else %} {%trans "Agenda" %} {% endif %} {% if title %} {{ title }} {% else %} {%trans "Agenda" %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "beamer.html" %} {% extends "base-projector.html" %}
{% block title %}{{ block.super }} - {{ item.title }}{% endblock %} {% block title %}{{ block.super }} - {{ item.title }}{% endblock %}
{% block content %} {% block content %}
{% if item.text %} {% if item.text %}

View File

@ -110,20 +110,6 @@ class ViewTest(TestCase):
def anonymClient(self): def anonymClient(self):
return Client() return Client()
def testBeamer(self):
c = self.anonymClient
response = c.get('/beamer/')
self.assertEqual(response.status_code, 302)
c = self.adminClient
response = c.get('/beamer/')
self.assertEqual(response.status_code, 200)
response = c.get('/agenda/%d/' % self.item1.id)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context['item'], self.item1.cast())
self.assertEqual(response.templates[0].name, 'beamer/ItemText.html')
def testActivate(self): def testActivate(self):
c = self.adminClient c = self.adminClient

View File

@ -17,7 +17,7 @@ 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 beamer.api import get_active_element from projector.api import get_active_element
from agenda.models import Item from agenda.models import Item
from agenda.api import is_summary, children_list, \ from agenda.api import is_summary, children_list, \
del_confirm_form_for_items del_confirm_form_for_items
@ -37,14 +37,10 @@ def view(request, item_id):
Shows the Slide. Shows the Slide.
""" """
item = Item.objects.get(id=item_id) item = Item.objects.get(id=item_id)
votes = assignment_votes(item) return render_to_response('projector/AgendaText.html',
polls = assignment_polls(item)
return render_to_response('beamer/%s.html' % item.type,
{ {
'item': item.cast(), 'item': item,
'ajax': 'off', 'ajax': 'off',
'votes': votes,
'polls': polls,
}, },
context_instance=RequestContext(request)) context_instance=RequestContext(request))

View File

@ -17,8 +17,8 @@ from django.db.models import Max
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from beamer.api import element_register from projector.api import element_register
from beamer.models import Element from projector.models import Element
from participant.models import Profile from participant.models import Profile
from system.api import config_get from system.api import config_get
@ -430,14 +430,14 @@ class Application(models.Model, Element):
results.append([option.yes, option.no, option.undesided, poll.votesinvalidf, poll.votescastf]) results.append([option.yes, option.no, option.undesided, poll.votesinvalidf, poll.votescastf])
return results return results
def beamer(self): def slide(self):
""" """
return the beamer dict return the slide dict
""" """
data = super(Application, self).beamer() data = super(Application, self).slide()
data['application'] = self data['application'] = self
data['title'] = self.title data['title'] = self.title
data['template'] = 'beamer/Application.html' data['template'] = 'projector/Application.html'
return data return data
@models.permalink @models.permalink

View File

@ -1,4 +1,4 @@
{% extends "beamer.html" %} {% extends "base-projector.html" %}
{% load tags %} {% load tags %}
{% block title %}{{ block.super }} - {{ item.title }}{% endblock %} {% block title %}{{ block.super }} - {{ item.title }}{% endblock %}
{% block content %} {% block content %}

View File

@ -15,8 +15,8 @@ from django.utils.translation import ugettext as _
from participant.models import Profile from participant.models import Profile
from beamer.models import Element from projector.models import Element
from beamer.api import element_register from projector.api import element_register
class Assignment(models.Model, Element): class Assignment(models.Model, Element):
@ -117,14 +117,14 @@ class Assignment(models.Model, Element):
poll.add_option(candidate) poll.add_option(candidate)
return poll return poll
def beamer(self): def slide(self):
""" """
return the beamer dict return the slide dict
""" """
data = super(Assignment, self).beamer() data = super(Assignment, self).slide()
data['assignment'] = self data['assignment'] = self
data['title'] = self.name data['title'] = self.name
data['template'] = 'beamer/Assignment.html' data['template'] = 'projector/Assignment.html'
return data return data
@models.permalink @models.permalink

View File

@ -1,4 +1,4 @@
{% extends "beamer.html" %} {% extends "base-projector.html" %}
{% block title %}{{ block.super }} - #{{ item.title }}{% endblock %} {% block title %}{{ block.super }} - #{{ item.title }}{% endblock %}
{% block header %} {% block header %}
<link type="text/css" rel="stylesheet" media="all" href="/static/styles/assignment.css" /> <link type="text/css" rel="stylesheet" media="all" href="/static/styles/assignment.css" />

View File

@ -1,47 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.beamer.urls
~~~~~~~~~~~~~~~~~~~~~~
URL list for the beamer app.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('beamer.views',
url(r'^$', 'beamer',
name='beamer_show'),
url(r'^bigger$', 'beamer_edit', {'direction': 'bigger'},
name='beamer_bigger'),
url(r'^smaller$', 'beamer_edit', {'direction': 'smaller'}, name='beamer_smaller'),
url(r'^up$', 'beamer_edit', {'direction': 'up'},
name='beamer_up'),
url(r'^beamer/down$', 'beamer_edit', {'direction': 'down'},
name='beamer_down'),
url(r'^beamer/clean$', 'beamer_edit', {'direction': 'clean'},
name='beamer_clean'),
url(r'^beamer/countdown/show$', 'beamer_countdown', {'command': 'show'},
name='countdown_open'),
url(r'^beamer/countdown/hide$', 'beamer_countdown', {'command': 'hide'},
name='countdown_close'),
url(r'^beamer/countdown/reset/(?P<time>\d+)$', 'beamer_countdown', {'command': 'reset'},
name='countdown_reset'),
url(r'^beamer/countdown/start$', 'beamer_countdown', {'command': 'start'},
name='countdown_start'),
url(r'^beamer/countdown/stop$', 'beamer_countdown', {'command': 'stop'},
name='countdown_stop'),
)

View File

@ -130,7 +130,7 @@ INSTALLED_APPS = (
'poll', 'poll',
'assignment', 'assignment',
'utils', 'utils',
'beamer', 'projector',
) )
TEMPLATE_CONTEXT_PROCESSORS = ( TEMPLATE_CONTEXT_PROCESSORS = (

View File

@ -1,5 +1,5 @@
from system.api import config_set, config_get from system.api import config_set, config_get
from beamer.models import ELEMENT from projector.models import ELEMENT
def get_element_from_eid(eid): def get_element_from_eid(eid):
@ -20,7 +20,7 @@ def get_active_element(only_eid=False):
if only_id is True, returns only the id of this item. Returns None if not Item if only_id is True, returns only the id of this item. Returns None if not Item
is active. Does not Raise Item.DoesNotExist is active. Does not Raise Item.DoesNotExist
""" """
from beamer.models import Element from projector.models import Element
eid = config_get("presentation", None) eid = config_get("presentation", None)
if only_eid: if only_eid:

View File

@ -6,9 +6,9 @@ ELEMENT = {}
class Element(object): class Element(object):
def beamer(self): def slide(self):
""" """
Return a map with all Data for the Beamer Return a map with all Data for a Slide
""" """
return { return {
'element': self, 'element': self,
@ -30,7 +30,7 @@ class Element(object):
""" """
Return True, if the the element is the active one. Return True, if the the element is the active one.
""" """
from beamer.api import get_active_element from projector.api import get_active_element
return True if get_active_element(only_eid=True) == self.eid else False return True if get_active_element(only_eid=True) == self.eid else False
def set_active(self): def set_active(self):

View File

@ -4,10 +4,10 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
{% load tags %} {% load tags %}
<head> <head>
<link type="text/css" rel="stylesheet" href="/static/styles/beamer.css"> <link type="text/css" rel="stylesheet" href="/static/styles/projector.css">
<link rel="shortcut icon" href="/static/images/favicon.png" type="image/png" /> <link rel="shortcut icon" href="/static/images/favicon.png" type="image/png" />
<script type="text/javascript" src="/static/javascript/jquery.js"></script> <script type="text/javascript" src="/static/javascript/jquery.js"></script>
<script type="text/javascript" src="/static/javascript/beamer.js"></script> <script type="text/javascript" src="/static/javascript/projector.js"></script>
<title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title> <title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title>
{% block header %} {% block header %}
{% endblock %} {% endblock %}
@ -19,7 +19,7 @@
<div id="ajaxswitcher"></div> <div id="ajaxswitcher"></div>
<div id="header"> <div id="header">
<div id="logo"><img src="/static/images/logo-beamer.png"></div> <div id="logo"><img src="/static/images/logo-projector.png"></div>
<div class="event_name">{% get_config 'event_name' %}</div> <div class="event_name">{% get_config 'event_name' %}</div>
<div class="event_description">{% get_config 'event_description' %}</div> <div class="event_description">{% get_config 'event_description' %}</div>
</div> </div>

View File

@ -0,0 +1,48 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.projector.urls
~~~~~~~~~~~~~~~~~~~~~~
URL list for the projector app.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('projector.views',
url(r'^$', 'active_slide',
name='projector_show'),
url(r'^bigger$', 'projector_edit', {'direction': 'bigger'},
name='projector_bigger'),
url(r'^smaller$', 'projector_edit', {'direction': 'smaller'},
name='projector_smaller'),
url(r'^up$', 'projector_edit', {'direction': 'up'},
name='projector_up'),
url(r'^projector/down$', 'projector_edit', {'direction': 'down'},
name='projector_down'),
url(r'^projector/clean$', 'projector_edit', {'direction': 'clean'},
name='projector_clean'),
url(r'^projector/countdown/show$', 'projector_countdown', {'command': 'show'},
name='countdown_open'),
url(r'^projector/countdown/hide$', 'projector_countdown', {'command': 'hide'},
name='countdown_close'),
url(r'^projector/countdown/reset/(?P<time>\d+)$', 'projector_countdown', {'command': 'reset'},
name='countdown_reset'),
url(r'^projector/countdown/start$', 'projector_countdown', {'command': 'start'},
name='countdown_start'),
url(r'^projector/countdown/stop$', 'projector_countdown', {'command': 'stop'},
name='countdown_stop'),
)

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
openslides.beamer.views openslides.projector.views
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Views for the beamer app. Views for the projector 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.
@ -28,11 +28,11 @@ from agenda.api import is_summary, children_list, \
del_confirm_form_for_items del_confirm_form_for_items
from agenda.models import Item from agenda.models import Item
from beamer.api import get_active_element, assignment_votes, assignment_polls from projector.api import get_active_element, assignment_votes, assignment_polls
@permission_required('agenda.can_see_projector') @permission_required('agenda.can_see_projector')
def beamer(request): def active_slide(request):
""" """
Shows the active Slide. Shows the active Slide.
""" """
@ -45,7 +45,7 @@ def beamer(request):
if element is None: if element is None:
data = {} data = {}
else: else:
data = element.beamer() data = element.slide()
data['ajax'] = 'on' data['ajax'] = 'on'
@ -59,7 +59,7 @@ def beamer(request):
items = element.children.filter(hidden=False) items = element.children.filter(hidden=False)
data['title'] = element.title data['title'] = element.title
data['items'] = items data['items'] = items
data['template'] = 'beamer/AgendaSummary.html' data['template'] = 'projector/AgendaSummary.html'
if request.is_ajax(): if request.is_ajax():
@ -84,7 +84,7 @@ def beamer(request):
@permission_required('agenda.can_manage_agenda') @permission_required('agenda.can_manage_agenda')
def beamer_edit(request, direction): def projector_edit(request, direction):
if direction == 'bigger': if direction == 'bigger':
config_set('bigger', int(config_get('bigger', 100)) + 10) config_set('bigger', int(config_get('bigger', 100)) + 10)
elif direction == 'smaller': elif direction == 'smaller':
@ -103,7 +103,7 @@ def beamer_edit(request, direction):
@permission_required('agenda.can_manage_agenda') @permission_required('agenda.can_manage_agenda')
def beamer_countdown(request, command, time=60): def projector_countdown(request, command, time=60):
if command == 'show': if command == 'show':
config_set('countdown_visible', True) config_set('countdown_visible', True)
elif command == 'hide': elif command == 'hide':

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -78,8 +78,8 @@ $(function() {
hideClosedSlides(true); hideClosedSlides(true);
} }
// control beamer // control the projector
$('.beamer_edit').click(function(event) { $('.projector_edit').click(function(event) {
event.preventDefault(); event.preventDefault();
link = $(this); link = $(this);
$.ajax({ $.ajax({
@ -92,7 +92,7 @@ $(function() {
}); });
// control countdown // control countdown
$('.beamer_countdown').click(function(event) { $('.projector_countdown').click(function(event) {
event.preventDefault(); event.preventDefault();
link = $(this); link = $(this);
$.ajax({ $.ajax({

View File

@ -2,7 +2,7 @@ function presentation_reload() {
if ($('#config > #ajax').html() == 'on') { if ($('#config > #ajax').html() == 'on') {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/beamer', url: '/projector',
dataType: 'json', dataType: 'json',
data: '', data: '',
success: function(data) { success: function(data) {

View File

@ -1,5 +1,5 @@
/** /**
* OpenSlides Beamer Style * OpenSlides projector Style
*/ */
body{ body{
margin : 0px; margin : 0px;

View File

@ -24,7 +24,7 @@ urlpatterns = patterns('',
(r'', include('openslides.participant.urls')), (r'', include('openslides.participant.urls')),
(r'', include('openslides.assignment.urls')), (r'', include('openslides.assignment.urls')),
(r'', include('openslides.system.urls')), (r'', include('openslides.system.urls')),
(r'beamer', include('beamer.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')),
) )