diff --git a/vc_vidyo/indico_vc_vidyo/forms.py b/vc_vidyo/indico_vc_vidyo/forms.py index 93b57a4..dd8adf0 100644 --- a/vc_vidyo/indico_vc_vidyo/forms.py +++ b/vc_vidyo/indico_vc_vidyo/forms.py @@ -16,19 +16,28 @@ from __future__ import unicode_literals +import re + from wtforms.fields.core import BooleanField from wtforms.fields.simple import StringField, TextAreaField -from wtforms.validators import DataRequired +from wtforms.validators import DataRequired, Length, Regexp from indico.web.forms.base import IndicoForm from indico.util.i18n import _ -from indico.web.forms.fields import SingleUserField +from indico.web.forms.fields import PrincipalField, IndicoPasswordField + +ROOM_NAME_RE = re.compile(r'[\w\-]+') class VCRoomForm(IndicoForm): - name = StringField(_('Name'), [DataRequired()], description=_('The name of the room')) - description = TextAreaField(_('Description'), description=_('The description of the room')) - moderator = SingleUserField(_('Moderator'), description=_('The moderator of the room')) + name = StringField(_('Name'), [DataRequired(), Length(min=3, max=60), Regexp(ROOM_NAME_RE)], + description=_('The name of the room')) + description = TextAreaField(_('Description'), [DataRequired()], description=_('The description of the room')) + moderator = PrincipalField(_('Moderator'), multiple=False, description=_('The moderator of the room')) auto_mute = BooleanField(_('Auto mute'), - description=_('The VidyoDesktop clients will join the meeting muted by default' + description=_('The VidyoDesktop clients will join the meeting muted by default ' '(audio and video)')) + moderator_pin = IndicoPasswordField(_('Moderator PIN'), toggle=True, description=_('Used to moderate the VC Room')) + room_pin = IndicoPasswordField(_('Room PIN'), toggle=True, + description=_('Used to protect the access to the VC Room ' + '(leave blank for open access)')) diff --git a/vc_vidyo/indico_vc_vidyo/plugin.py b/vc_vidyo/indico_vc_vidyo/plugin.py index 4012eb9..f258ca7 100644 --- a/vc_vidyo/indico_vc_vidyo/plugin.py +++ b/vc_vidyo/indico_vc_vidyo/plugin.py @@ -16,28 +16,45 @@ from __future__ import unicode_literals +from wtforms.fields import IntegerField, TextAreaField from wtforms.fields.html5 import URLField, EmailField from wtforms.fields.simple import StringField +from wtforms.validators import NumberRange +from indico.core.config import Config from indico.core.plugins import IndicoPlugin, url_for_plugin, IndicoPluginBlueprint from indico.modules.vc import VCPluginSettingsFormBase, VCPluginMixin from indico.util.i18n import _ -from indico.web.forms.fields import MultipleItemsField, EmailListField, UnsafePasswordField +from indico.web.forms.fields import EmailListField, UnsafePasswordField +from indico.web.forms.widgets import CKEditorWidget from indico_vc_vidyo.forms import VCRoomForm class PluginSettingsForm(VCPluginSettingsFormBase): - event_types = MultipleItemsField(_('Supported event types'), fields=(('type', 'Type'),), - description=_("Kind of event types (conference, meeting, simple_event) supported")) - vidyo_support = EmailField(_('Vidyo email support')) - notify_emails = EmailListField(_('Notification emails'), - description=_('Additional email addresses who will always receive notifications' - '(one per line)')) + support_email = EmailField(_('Vidyo email support')) + notification_emails = EmailListField( + _('Notification emails'), + description=_('Additional email addresses who will always receive notifications (one per line)') + ) username = StringField(_('Username'), description=_('Indico username for Vidyo')) password = UnsafePasswordField(_('Password'), description=_('Indico password for Vidyo')) - api_base_url = URLField(_('Vidyo API base URL')) - api_wsdl_url = URLField(_('Admin API WSDL URL')) - user_api = StringField(_('User API Service')) + admin_api_wsdl = URLField(_('Admin API WSDL URL')) + user_api_wsdl = URLField(_('User API WSDL URL')) + indico_room_prefix = IntegerField(_('Indico rooms prefix'), [NumberRange(min=0)], + description=_('The prefix for Indico rooms')) + room_group_name = StringField(_("Public rooms' group name"), + description=_('Group name for public video conference rooms created by Indico')) + authenticators = StringField(_('Authenticators'), + description=_('Authenticators to convert Indico users to Vidyo accounts')) + num_days_old = IntegerField(_('VC room age threshold'), [NumberRange(min=1)], + description=_('Number of days after an Indico event when a video conference room is ' + 'considered old')) + max_rooms_warning = IntegerField(_('Max. num. VC rooms before warning'), [NumberRange(min=1)], + description=_('Maximum number of rooms until a warning is sent to the managers')) + vidyo_phone_link = URLField(_('VidyoVoice phone number'), + description=_('Link to the list of VidyoVoice phone numbers')) + creation_email_footer = TextAreaField(_('Creation email footer'), widget=CKEditorWidget(), + description=_('Footer to append to emails sent upon creation of a VC room')) class VidyoPlugin(VCPluginMixin, IndicoPlugin): @@ -46,7 +63,27 @@ class VidyoPlugin(VCPluginMixin, IndicoPlugin): Video conferencing with Vidyo """ configurable = True + strict_settings = True settings_form = PluginSettingsForm + default_settings = { + 'managers': [], + 'authorized_users': [], + 'notify_managers': True, + 'support_email': Config.getInstance().getSupportEmail(), + 'notification_emails': [], + 'username': 'indico', + 'password': None, + 'admin_api_wsdl': 'https://yourvidyoportal/services/v1_1/VidyoPortalAdminService?wsdl', + 'user_api_wsdl': 'https://yourvidyoportal/services/v1_1/VidyoPortalUserService?wsdl', + 'indico_room_prefix': 10, + 'room_group_name': 'Indico', + 'authenticators': ', '.join(auth[0] for auth in Config.getInstance().getAuthenticatorList()), + 'num_days_old': 180, + 'max_rooms_warning': 5000, + 'vidyo_phone_link': None, + 'creation_email_footer': None + + } vc_room_form = VCRoomForm @property