diff --git a/vc_vidyo/indico_vc_vidyo/__init__.py b/vc_vidyo/indico_vc_vidyo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/vc_vidyo/indico_vc_vidyo/forms.py b/vc_vidyo/indico_vc_vidyo/forms.py new file mode 100644 index 0000000..93b57a4 --- /dev/null +++ b/vc_vidyo/indico_vc_vidyo/forms.py @@ -0,0 +1,34 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN). +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# Indico is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Indico; if not, see . + +from __future__ import unicode_literals + +from wtforms.fields.core import BooleanField +from wtforms.fields.simple import StringField, TextAreaField +from wtforms.validators import DataRequired + +from indico.web.forms.base import IndicoForm +from indico.util.i18n import _ +from indico.web.forms.fields import SingleUserField + + +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')) + auto_mute = BooleanField(_('Auto mute'), + description=_('The VidyoDesktop clients will join the meeting muted by default' + '(audio and video)')) diff --git a/vc_vidyo/indico_vc_vidyo/plugin.py b/vc_vidyo/indico_vc_vidyo/plugin.py new file mode 100644 index 0000000..4012eb9 --- /dev/null +++ b/vc_vidyo/indico_vc_vidyo/plugin.py @@ -0,0 +1,57 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN). +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# Indico is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Indico; if not, see . + +from __future__ import unicode_literals + +from wtforms.fields.html5 import URLField, EmailField +from wtforms.fields.simple import StringField + +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_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)')) + 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')) + + +class VidyoPlugin(VCPluginMixin, IndicoPlugin): + """Vidyo + + Video conferencing with Vidyo + """ + configurable = True + settings_form = PluginSettingsForm + vc_room_form = VCRoomForm + + @property + def logo_url(self): + return url_for_plugin(self.name + '.static', filename='images/logo.png') + + def get_blueprints(self): + return IndicoPluginBlueprint('vc_vidyo', __name__) diff --git a/vc_vidyo/indico_vc_vidyo/static/images/logo.png b/vc_vidyo/indico_vc_vidyo/static/images/logo.png new file mode 100644 index 0000000..0ae3677 Binary files /dev/null and b/vc_vidyo/indico_vc_vidyo/static/images/logo.png differ diff --git a/vc_vidyo/indico_vc_vidyo/templates/manage_event_create_room.html b/vc_vidyo/indico_vc_vidyo/templates/manage_event_create_room.html new file mode 100644 index 0000000..8cb1393 --- /dev/null +++ b/vc_vidyo/indico_vc_vidyo/templates/manage_event_create_room.html @@ -0,0 +1,20 @@ +{% extends 'admin/base.html' %} +{% from 'forms/form_widget.html' import form_header, form_fieldset, form_footer, form_rows %} + +{% block title %} + {%- if existing_vc_room -%} + {% trans %}Edit {% endtrans %} + {%- else -%} + {% trans %}Create {% endtrans %} + {%- endif -%} + {% trans %}Video Conference Room{% endtrans %} +{% endblock %} +{% block subtitle %}{{ plugin.title }}{% endblock %} +{%- block content %} + {{ form_header(id='vc-room-form') }} + {{ form_rows(form) }} + {% call form_footer() %} + + {% trans %}Cancel{% endtrans %} + {% endcall %} +{%- endblock %} diff --git a/vc_vidyo/indico_vc_vidyo/util.py b/vc_vidyo/indico_vc_vidyo/util.py new file mode 100644 index 0000000..75f1ae5 --- /dev/null +++ b/vc_vidyo/indico_vc_vidyo/util.py @@ -0,0 +1,33 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN). +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# Indico is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Indico; if not, see . + +from __future__ import unicode_literals + +from indico.util.user import retrieve_principals + + +def get_auth_users(): + """Returns a list of authorized users + + :return: list of Avatar/Group objects + """ + from indico_vc_vidyo.plugin import VidyoPlugin + return retrieve_principals(VidyoPlugin.settings.get('authorized_users')) + + +def is_auth_user(user): + """Checks if a user is authorized""" + return any(principal.containsUser(user) for principal in get_auth_users()) diff --git a/vc_vidyo/setup.py b/vc_vidyo/setup.py new file mode 100644 index 0000000..4c49929 --- /dev/null +++ b/vc_vidyo/setup.py @@ -0,0 +1,44 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN). +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# Indico is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Indico; if not, see . + +from __future__ import unicode_literals + +from setuptools import setup, find_packages + + +setup( + name='indico_vc_vidyo', + version='0.1', + url='https://github.com/indico/indico-plugins', + license='https://www.gnu.org/licenses/gpl-3.0.txt', + author='Indico Team', + author_email='indico-team@cern.ch', + packages=find_packages(), + zip_safe=False, + include_package_data=True, + platforms='any', + install_requires=[ + 'indico>=1.9.1', + 'sleekxmpp' + ], + classifiers=[ + 'Environment :: Plugins', + 'Environment :: Web Environment', + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', + 'Programming Language :: Python :: 2.7' + ], + entry_points={'indico.plugins': {'vc_vidyo = indico_vc_vidyo.plugin:VidyoPlugin'}} +)