From db3632c30e9262adbe7a35be404ace0436a20271 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Thu, 26 May 2011 23:19:15 +0200 Subject: Keep track of number of hosts and show the launch page until there is at least one host --- src/meetingtools/apps/room/models.py | 7 +++++++ src/meetingtools/apps/room/views.py | 4 ++++ src/templates/apps/room/launch.html | 11 +++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/meetingtools/apps/room/models.py b/src/meetingtools/apps/room/models.py index b49925a..82aae6a 100644 --- a/src/meetingtools/apps/room/models.py +++ b/src/meetingtools/apps/room/models.py @@ -27,6 +27,7 @@ class Room(models.Model): folder_sco_id = IntegerField(verbose_name="Adobe Connect Room Folder",editable=False) description = TextField(blank=True,null=True) user_count = IntegerField(verbose_name="User Count At Last Visit",editable=False,blank=True,null=True) + host_count = IntegerField(verbose_name="Host Count At Last Visit",editable=False,blank=True,null=True) timecreated = models.DateTimeField(auto_now_add=True) lastupdated = models.DateTimeField(auto_now=True) lastvisited = models.DateTimeField(blank=True,null=True) @@ -61,6 +62,12 @@ class Room(models.Model): else: return self.user_count + def nhosts(self): + if self.host_count == None: + return "unknown many" + else: + return self.host_count + tagging.register(Room) def _magic_tags(sender,**kwargs): diff --git a/src/meetingtools/apps/room/views.py b/src/meetingtools/apps/room/views.py index 1639ca2..6c22c14 100644 --- a/src/meetingtools/apps/room/views.py +++ b/src/meetingtools/apps/room/views.py @@ -347,8 +347,10 @@ def _goto(request,room,clean=True,promote=False): if clean: userlist = api.request('meeting-usermanager-user-list',{'sco-id': room.sco_id},False) room.user_count = 0 + room.host_count = 0 if userlist.status_code() == 'ok': room.user_count = int(userlist.et.xpath("count(.//userdetails)")) + room.host_count = int(userlist.et.xpath("count(.//userdetails/role[text() = 'host'])")) #session_info = api.request('report-meeting-sessions',{'sco-id':room.sco_id}) #room.user_count = _nusers(session_info) @@ -357,6 +359,8 @@ def _goto(request,room,clean=True,promote=False): if room.self_cleaning: if (room.user_count == 0) and (abs(lastvisit - now) > GRACE): room = _clean(request,room) + + if room.host_count == 0: return respond_to(request, {"text/html": "apps/room/launch.html"}, {'room': room}) else: room.save() diff --git a/src/templates/apps/room/launch.html b/src/templates/apps/room/launch.html index 21dff15..145d475 100644 --- a/src/templates/apps/room/launch.html +++ b/src/templates/apps/room/launch.html @@ -10,17 +10,20 @@

Note You are about to enter the meeting room '{{room.name}}'. - {%if room.nusers == 0 %}You are the first user to enter the room. If you are hosting this meeting and are comfortable with - the Adobe Connect software you may press 'Enter as Host' below. + {%if room.nusers == 0 %} + You are the first user to enter the room. {%else%} - There are {{room.nusers}} other participants in the room. + There are {{room.nusers}} other participants in the room right now. + {% endif %} + {%if room.nhosts == 0 %} There are no hosts in the room right now. This means that the participants in the room may not be able to make full use of the room. + If you are hosting this meeting and are comfortable with the Adobe Connect software you may press 'Enter as Host' below to become the first host. {% endif %}