diff --git a/vc_vidyo/indico_vc_vidyo/blueprint.py b/vc_vidyo/indico_vc_vidyo/blueprint.py
new file mode 100644
index 0000000..7b57497
--- /dev/null
+++ b/vc_vidyo/indico_vc_vidyo/blueprint.py
@@ -0,0 +1,25 @@
+# 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.core.plugins import IndicoPluginBlueprint
+
+from indico_vc_vidyo.controllers import RHVidyoRoomOwner
+
+blueprint = IndicoPluginBlueprint('vc_vidyo', 'indico_vc_vidyo')
+
+# Room management
+blueprint.add_url_rule('/event//manage/videoconference/vidyo//room-owner/',
+ 'set_room_owner', RHVidyoRoomOwner, methods=('POST',), defaults={'service': 'vidyo'})
diff --git a/vc_vidyo/indico_vc_vidyo/controllers.py b/vc_vidyo/indico_vc_vidyo/controllers.py
new file mode 100644
index 0000000..a001b2e
--- /dev/null
+++ b/vc_vidyo/indico_vc_vidyo/controllers.py
@@ -0,0 +1,38 @@
+# 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 .
+
+import transaction
+from flask import flash, jsonify, session
+
+from indico.modules.vc.controllers import RHVCSystemEventBase
+from indico.modules.vc.exceptions import VCRoomError
+from indico.util.i18n import _
+
+
+class RHVidyoRoomOwner(RHVCSystemEventBase):
+ def _process(self):
+ result = {}
+ self.vc_room.vidyo_extension.owned_by_user = session.user
+ try:
+ self.plugin.update_room(self.vc_room, self.event)
+ except VCRoomError as err:
+ result['error'] = {'message': err.message}
+ result['success'] = False
+ transaction.abort()
+ else:
+ flash(_("You are now the owner of the room '{room.name}'".format(room=self.vc_room)), 'success')
+ result['success'] = True
+ return jsonify(result)
diff --git a/vc_vidyo/indico_vc_vidyo/plugin.py b/vc_vidyo/indico_vc_vidyo/plugin.py
index 8c1af57..480ad18 100644
--- a/vc_vidyo/indico_vc_vidyo/plugin.py
+++ b/vc_vidyo/indico_vc_vidyo/plugin.py
@@ -25,7 +25,7 @@ from wtforms.validators import NumberRange, DataRequired
from indico.core.auth import multipass
from indico.core.config import Config
-from indico.core.plugins import IndicoPlugin, url_for_plugin, IndicoPluginBlueprint, wrap_cli_manager
+from indico.core.plugins import IndicoPlugin, url_for_plugin, wrap_cli_manager
from indico.core import signals
from indico.modules.vc.exceptions import VCRoomError, VCRoomNotFoundError
from indico.modules.vc import VCPluginSettingsFormBase, VCPluginMixin
@@ -36,6 +36,7 @@ from indico.web.forms.widgets import CKEditorWidget
from indico_vc_vidyo import _
from indico_vc_vidyo.api import AdminClient, APIException, RoomNotFoundAPIException
+from indico_vc_vidyo.blueprint import blueprint
from indico_vc_vidyo.cli import cli_manager
from indico_vc_vidyo.forms import VCRoomForm, VCRoomAttachForm
from indico_vc_vidyo.util import iter_user_identities, iter_extensions, update_room_from_obj
@@ -298,7 +299,7 @@ class VidyoPlugin(VCPluginMixin, IndicoPlugin):
return client.get_room(vc_room.data['vidyo_id'])
def get_blueprints(self):
- return IndicoPluginBlueprint('vc_vidyo', __name__)
+ return blueprint
def register_assets(self):
self.register_js_bundle('vc_vidyo_js', 'js/vc_vidyo.js')
diff --git a/vc_vidyo/indico_vc_vidyo/static/js/vc_vidyo.js b/vc_vidyo/indico_vc_vidyo/static/js/vc_vidyo.js
index fd04e49..6fd733f 100644
--- a/vc_vidyo/indico_vc_vidyo/static/js/vc_vidyo.js
+++ b/vc_vidyo/indico_vc_vidyo/static/js/vc_vidyo.js
@@ -11,13 +11,7 @@ $(function() {
$.ajax({
url: $this.data('href'),
method: 'POST',
- complete: IndicoUI.Dialogs.Util.progress(),
- contentType: 'application/json',
- data: JSON.stringify({
- data: {
- owner: ['User', $('body').data('userId')]
- }
- })
+ complete: IndicoUI.Dialogs.Util.progress()
}).done(function(result) {
if (handleAjaxError(result)) {
return;
diff --git a/vc_vidyo/indico_vc_vidyo/templates/buttons.html b/vc_vidyo/indico_vc_vidyo/templates/buttons.html
index 57268f5..6bfbdc0 100644
--- a/vc_vidyo/indico_vc_vidyo/templates/buttons.html
+++ b/vc_vidyo/indico_vc_vidyo/templates/buttons.html
@@ -1,11 +1,11 @@
-{% macro render_make_me_moderator(event, vc_room, event_vc_room, extra_classes='') %}
+{% macro render_make_me_owner(event, vc_room, event_vc_room, extra_classes='') %}
{% if session.user != vc_room.vidyo_extension.owned_by_user and event.canModify(session.user) %}
-
+ class="action-make-owner" data-href="{{ url_for_plugin('vc_vidyo.set_room_owner', event_vc_room) }}">
{% trans %}Make me owner{% endtrans %}
diff --git a/vc_vidyo/indico_vc_vidyo/templates/event_buttons.html b/vc_vidyo/indico_vc_vidyo/templates/event_buttons.html
index 419c358..cf4e2f1 100644
--- a/vc_vidyo/indico_vc_vidyo/templates/event_buttons.html
+++ b/vc_vidyo/indico_vc_vidyo/templates/event_buttons.html
@@ -1,7 +1,7 @@
{% extends 'vc/event_buttons.html' %}
-{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_moderator %}
+{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_owner %}
{% block buttons %}
{{ render_join_button(vc_room, "i-button-small event-service-right-button join-button") }}
- {{ render_make_me_moderator(event, vc_room, event_vc_room, extra_classes="i-button-small") }}
+ {{ render_make_me_owner(event, vc_room, event_vc_room, extra_classes="i-button-small") }}
{% endblock %}
diff --git a/vc_vidyo/indico_vc_vidyo/templates/info_box.html b/vc_vidyo/indico_vc_vidyo/templates/info_box.html
index 0bb4a24..59590f7 100644
--- a/vc_vidyo/indico_vc_vidyo/templates/info_box.html
+++ b/vc_vidyo/indico_vc_vidyo/templates/info_box.html
@@ -11,7 +11,7 @@
- {{ vc_room.vidyo_extension.extension }}
{% endif %}
{% if owner %}
- - {% trans %}Moderator{% endtrans %}
+ - {% trans %}Owner{% endtrans %}
- {{ owner.full_name }}
{% endif %}
{% if event_vc_room.data.show_pin %}
diff --git a/vc_vidyo/indico_vc_vidyo/templates/manage_event_info_box.html b/vc_vidyo/indico_vc_vidyo/templates/manage_event_info_box.html
index 9a5c36e..41a663c 100644
--- a/vc_vidyo/indico_vc_vidyo/templates/manage_event_info_box.html
+++ b/vc_vidyo/indico_vc_vidyo/templates/manage_event_info_box.html
@@ -7,7 +7,7 @@
- {{ vc_room.data.description }}
- {% trans %}Extension{% endtrans %}
- {{ vc_room.vidyo_extension.extension }}
- - {% trans %}Moderator{% endtrans %}
+ - {% trans %}Owner{% endtrans %}
-
{% if owner %}
{{ owner.full_name }}
diff --git a/vc_vidyo/indico_vc_vidyo/templates/management_buttons.html b/vc_vidyo/indico_vc_vidyo/templates/management_buttons.html
index b468d0b..cfd9cf0 100644
--- a/vc_vidyo/indico_vc_vidyo/templates/management_buttons.html
+++ b/vc_vidyo/indico_vc_vidyo/templates/management_buttons.html
@@ -1,7 +1,7 @@
{% extends 'vc/management_buttons.html' %}
-{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_moderator %}
+{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_owner %}
{% block buttons %}
{{ render_join_button(vc_room, extra_classes="icon-play") }}
- {{ render_make_me_moderator(event_vc_room.event, vc_room, event_vc_room) }}
+ {{ render_make_me_owner(event_vc_room.event, vc_room, event_vc_room) }}
{% endblock %}
diff --git a/vc_vidyo/indico_vc_vidyo/templates/vc_room_timetable_buttons.html b/vc_vidyo/indico_vc_vidyo/templates/vc_room_timetable_buttons.html
index bf94d61..83070a9 100644
--- a/vc_vidyo/indico_vc_vidyo/templates/vc_room_timetable_buttons.html
+++ b/vc_vidyo/indico_vc_vidyo/templates/vc_room_timetable_buttons.html
@@ -1,8 +1,8 @@
{% extends 'vc/vc_room_timetable_buttons.html' %}
-{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_moderator %}
+{% from 'vc_vidyo:buttons.html' import render_join_button, render_make_me_owner %}
{% set vc_room = event_vc_room.vc_room %}
{% block buttons %}
{{ render_join_button(vc_room, "i-button-small event-service-right-button join-button") }}
- {{ render_make_me_moderator(event, vc_room, event_vc_room, extra_classes="i-button-small") }}
+ {{ render_make_me_owner(event, vc_room, event_vc_room, extra_classes="i-button-small") }}
{% endblock %}