Created
February 17, 2015 19:13
-
-
Save pferreir/1789fdf29ad5f1eb2bb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/indico/modules/vc/controllers.py b/indico/modules/vc/controllers.py | |
index c0ee5cc..44eee64 100644 | |
--- a/indico/modules/vc/controllers.py | |
+++ b/indico/modules/vc/controllers.py | |
@@ -28,6 +28,7 @@ from indico.modules.vc.views import WPVCManageEvent | |
from indico.util.date_time import now_utc | |
from indico.util.i18n import _ | |
from indico.web.flask.util import url_for | |
+ | |
from MaKaC.webinterface.rh.conferenceModif import RHConferenceModifBase | |
@@ -57,7 +58,7 @@ class RHVCManageEvent(RHVCManageEventBase): | |
except ValueError: | |
raise IndicoError(_('This page is not available for legacy events.')) | |
return WPVCManageEvent.render_template('manage_event.html', self._conf, event=self._conf, | |
- event_vc_rooms=vc_rooms) | |
+ event_vc_rooms=vc_rooms, vc_systems=get_vc_plugins().keys()) | |
class RHVCManageEventSelectService(RHVCManageEventBase): | |
@@ -84,6 +85,7 @@ class RHVCManageEventCreate(RHVCManageEventBase): | |
return redirect(url_for('.manage_vc_rooms', self.event)) | |
form = self.plugin.create_form(event=self.event) | |
+ | |
if form.validate_on_submit(): | |
data = form.data | |
diff --git a/indico/modules/vc/plugins.py b/indico/modules/vc/plugins.py | |
index 94259e4..1252d67 100644 | |
--- a/indico/modules/vc/plugins.py | |
+++ b/indico/modules/vc/plugins.py | |
@@ -15,10 +15,13 @@ | |
# along with Indico; if not, see <http://www.gnu.org/licenses/>. | |
from __future__ import unicode_literals | |
+import re | |
from flask import render_template | |
from wtforms.fields.core import BooleanField | |
+from wtforms.fields.simple import StringField | |
+from wtforms.validators import DataRequired, Length, Regexp | |
from indico.util.decorators import classproperty | |
from indico.util.i18n import _ | |
@@ -27,6 +30,8 @@ from indico.web.flask.templating import get_overridable_template_name | |
from indico.web.forms.base import IndicoForm, FormDefaults | |
from indico.web.forms.fields import PrincipalField | |
+ROOM_NAME_RE = re.compile(r'[\w\-]+') | |
+ | |
class VCPluginSettingsFormBase(IndicoForm): | |
managers = PrincipalField(_('Managers'), description=_('Service managers')) | |
@@ -82,6 +87,9 @@ class VCPluginMixin(object): | |
class VCRoomFormBase(IndicoForm): | |
+ name = StringField(_('Name'), [DataRequired(), Length(min=3, max=60), Regexp(ROOM_NAME_RE)], | |
+ description=_('The name of the room')) | |
+ | |
def __init__(self, *args, **kwargs): | |
self.vc_room = kwargs.pop('vc_room') | |
self.event = kwargs.pop('event') | |
diff --git a/indico/modules/vc/templates/vc/manage_event.html b/indico/modules/vc/templates/vc/manage_event.html | |
index db62f96..997618f 100644 | |
--- a/indico/modules/vc/templates/vc/manage_event.html | |
+++ b/indico/modules/vc/templates/vc/manage_event.html | |
@@ -50,7 +50,15 @@ | |
<div class="message-text">{% trans %}No video conference rooms have been added yet.{% endtrans %}</div> | |
</div> | |
{% endif %} | |
- <a class="i-button bottom i-form-button icon-plus js-create-room" href="{{ url_for_plugin('.manage_vc_rooms_select', event) }}">{% trans %}Create new room{% endtrans %}</a> | |
+ {% if vc_systems|length == 1 %} | |
+ <a data-vc-system="{{vc_systems[0].name}}" class="i-button bottom i-form-button icon-plus js-create-room" href="{{ url_for_plugin('.manage_vc_rooms_create', event, service=vc_systems[0]) }}"> | |
+ {%- trans %}Create new room{% endtrans -%} | |
+ </a> | |
+ {% elif vc_systems|length > 1 %} | |
+ <a class="i-button bottom i-form-button icon-plus js-create-room" href="{{ url_for_plugin('.manage_vc_rooms_select', event) }}"> | |
+ {%- trans %}Create new room{% endtrans -%} | |
+ </a> | |
+ {% endif %} | |
</div> | |
<script> | |
eventManageVCRooms(); | |
@@ -64,7 +72,7 @@ | |
}); | |
}); | |
- $('.js-create-room').ajaxDialog({ | |
+ $('.js-create-room:not([data-vc-system])').ajaxDialog({ | |
title: $T('Video services') | |
}); | |
</script> | |
diff --git a/indico/modules/vc/templates/vc/manage_event_create_room.html b/indico/modules/vc/templates/vc/manage_event_create_room.html | |
index e69de29..77a38a5 100644 | |
--- a/indico/modules/vc/templates/vc/manage_event_create_room.html | |
+++ b/indico/modules/vc/templates/vc/manage_event_create_room.html | |
@@ -0,0 +1,17 @@ | |
+{% extends 'admin/base.html' %} | |
+{% from 'forms/form_widget.html' import form_header, form_fieldset, form_footer, form_rows %} | |
+ | |
+{% block title %} | |
+ Dummy Plugin | |
+{% endblock %} | |
+{% block subtitle %}{{ plugin.title }}{% endblock %} | |
+{%- block content %} | |
+ {{ form_header(id='vc-room-form') }} | |
+ | |
+ {{ form_rows(form) }} | |
+ | |
+ {% call form_footer() %} | |
+ <input class="i-button big highlight" type="submit" value="{% trans %}Save{% endtrans %}"> | |
+ <a href="{{ url_for('vc.manage_vc_rooms', event) }}" class="i-button big" data-button-back>{% trans %}Cancel{% endtrans %}</a> | |
+ {% endcall %} | |
+{%- endblock %} | |
diff --git a/indico/modules/vc/util.py b/indico/modules/vc/util.py | |
index ae59f47..6f0fab4 100644 | |
--- a/indico/modules/vc/util.py | |
+++ b/indico/modules/vc/util.py | |
@@ -37,4 +37,7 @@ def get_vc_plugins(): | |
def get_vc_plugin_by_service_name(plugin_name): | |
"""Returns a video conference plugin""" | |
for name, plugin in get_vc_plugins().iteritems(): | |
- return plugin if name == plugin_name else None | |
+ if name == plugin_name: | |
+ return plugin | |
+ else: | |
+ return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment