view data/plugin/action/submit_bbb_join_meeting.py @ 628:819c4121f9a0

FormCreate/FormSubmit: change to LF-only line endings
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 19:48:31 +0100
parents 7909cd319ce8
children 127da830be6c
line wrap: on
line source
# -*- coding: utf-8 -*-
"""
    MoinMoin - Create Meeting for bigbluebutton (http://www.bigbluebutton.org/)

    @copyright: 2012 MoinMoin:ReimarBauer
    @license: GNU GPL, see COPYING for details.
"""
import urllib
from MoinMoin.Page import Page
# pip install bigbluebutton
try:
    from bigbluebutton import Meeting
except ImportError:
    Meeting = None
try:    
    import bbb_settings
except ImportError:
    bbb_settings = None


def execute(pagename, request):
    """
    Lets a user join a bigbluebutton meeting.  On same directory as wikiconfig.py you need
    a "bbb_settings.py" module with the SALT and the BBB_API_URL.

    Example Call by using http://moinmo.in/MacroMarket/FormCreate

    <<FormHeader(submit_bbb_join_meeting)>>
    || Meeting ID || <<FormText(meeting_id,maxlength=50)>> ||
    || Name: || <<FormText(name,maxlength=50)>> ||
    || Password: || <<FormText(password,maxlength=50)>> ||
    ||<-2:> <<FormSubmit(Send)>> ||
    <<FormFooter()>>
    """
    if Meeting is None or bbb_settings is None:
        msg, state = ("bigbluebutton module not installed or bbb_settings missing!", "error")
        request.theme.add_msg(msg, state)
        Page(request, pagename).send_page()
        return

    _ = request.getText
    meeting = Meeting(bbb_settings.BBB_API_URL, bbb_settings.SALT)
    url = meeting.join_url(request.form["meeting_id"], request.form["name"], request.form["password"])
    request.http_redirect(url)

    request.theme.add_msg('OK', 'info')
    Page(request, pagename).send_page()