changeset 596:84ef153f8363

bbb: session close url to parser as action call added
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 13 Jun 2012 09:11:54 +0200
parents 51287eec8dcf
children 0b31dafef3cf
files data/plugin/action/submit_bbb_close_meeting.py data/plugin/parser/bbb_create.py
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/submit_bbb_close_meeting.py	Wed Jun 13 08:37:58 2012 +0200
+++ b/data/plugin/action/submit_bbb_close_meeting.py	Wed Jun 13 09:11:54 2012 +0200
@@ -41,8 +41,18 @@
 
     if request.user.valid and username in bbb_admin_group:
         meeting = Meeting(bbb_settings.BBB_API_URL, bbb_settings.SALT)
-        msg = meeting.end_meeting(request.form["meeting_id"], request.form["password"])
+        msg, state = ("Can't close this meeting", "err")
+        if request.args and request.args["action"] == u'submit_bbb_close_meeting':
+            meeting_id = request.args["meeting_id"]
+            password = request.args["password"]
+        else:
+            meeting_id = request.form["meeting_id"]
+            password = request.form["password"]
 
-        request.theme.add_msg('OK', 'info')
+        status = meeting.end_meeting(meeting_id, password)            
+        if status:
+            msg, state = ('Meeting %s closed' % meeting_id, 'info')
+
+        request.theme.add_msg(msg, state)
         Page(request, pagename).send_page()
 
--- a/data/plugin/parser/bbb_create.py	Wed Jun 13 08:37:58 2012 +0200
+++ b/data/plugin/parser/bbb_create.py	Wed Jun 13 09:11:54 2012 +0200
@@ -106,7 +106,9 @@
                     msg += "\n\n(!) Someone else is already attending this meeting"
                 actions.append(u' . [[%(moderator_url)s|Join as moderator (%(username)s)]]' % {"moderator_url": meeting.join_url(meeting_id, request.user.name, moderator_password),
                                                                                              "username": username})
-                actions.append(u' . <<Action(edit, text="edit meeting")>>')
+                actions.append(u' . <<Action(submit_bbb_close_meeting, text="Close this meeting", meeting_id=%(meeting_id)s, password=%(password)s)>>' % {"meeting_id": meeting_id,
+                                                                                                                                                  "password": moderator_password
+                                                                                                                                                  })
             if request.user.may.delete(pagename):
                 actions.append(u' . <<Action(DeletePage, text="remove meeting permanently")>>')
         else: