Commit 6b44b1e62cb39c5582d7ec7ef82eaaf336dff05f

Authored by Jailson Dias
1 parent 73bbb444

Ajustes na tela de web confenrencia

webconference/templates/webconference/jitsi.html
1   -<!DOCTYPE html>
2   -{% load static i18n %}
3   -<html>
4   - <head>
5   - <meta charset="utf-8">
6   - <title>{% trans "Web Conference" %}</title>
7   - <script type="text/javascript" src="{% static 'js/jquery-3.1.0.min.js' %}"></script>
8   - <!-- <script src="https://meet.jit.si/external_api.js"></script> -->
  1 +{% extends "webconference/view.html" %}
  2 +
  3 +{% load static i18n pagination permissions_tags subject_counter access_conference %}
  4 +{% load django_bootstrap_breadcrumbs %}
  5 +
  6 +{% block javascript%}
  7 + {{ block.super }}
9 8 <script src="{% static 'js/jitsi.js' %}"></script>
10 9 <style>
11   - body, html, #jitsi, iframe{
  10 + #jitsi, iframe{
12 11 margin-left: -1px;
13 12 margin-right: 0px;
14 13 margin-top: -2px;
... ... @@ -19,57 +18,60 @@
19 18 height: 100%;
20 19 }
21 20 </style>
22   - </head>
23   - <body>
24   - <div id="jitsi">
  21 +{% endblock%}
25 22  
26   - </div>
  23 +{% block breadcrumbs %}
  24 + {{ block.super }}
  25 +{% endblock %}
27 26  
28   - <script>
29   - // code to start jitsi api
30   - var domain = "{{domain}}"; // domain that jitsi will itself connect
31   - var room = "{{name_room}}"; // name of the room to be created
32   - var width = $("body").width(); // width of the window to be created
33   - var height = $("body").height(); // height of the window to be created
34   - var html = document.getElementById("jitsi");
35   - var api = new JitsiMeetExternalAPI(domain, room, width, height,html);
36   - // window.onload = initpage;
37   - window.onload = initpage;
38   - function initpage(){
39   - api.executeCommand('displayName', '{{user}}');
40   - api.executeCommand('email', '{{user.email}}');
41   - api.executeCommand('avatarUrl', '{{user_image}}');
42   - api.addEventListener('videoConferenceLeft', function(res){
43   - $.ajax({
44   - method: "GET",
45   - url: "{% url 'webconferences:exit'%}",
46   - dataType: 'json',
47   - data: res,
48   - success: function(response) {
49   - window.location.replace(response['url']);
50   - console.log(response);
51   - },
52   - error: function(response) {
53   - console.log(response);
54   - }
55   - });
56   - });
57   - var repeater = setInterval(function () {
58   - $.ajax({
59   - method: "GET",
60   - url: "{% url 'webconferences:online'%}",
61   - dataType: 'json',
62   - data: {'slug':'{{name_room}}'},
63   - success: function(response) {
64   - console.log(response);
65   - },
66   - error: function(response) {
67   - console.log(response);
68   - }
69   - });
70   - }, 60*1000);
71   - }
72   - </script>
  27 +{% block content %}
  28 +<div id="jitsi">
  29 +
  30 +</div>
  31 +<script>
  32 +// code to start jitsi api
  33 + var domain = "{{domain}}"; // domain that jitsi will itself connect
  34 + var room = "{{name_room}}"; // name of the room to be created
  35 + var height = $(document).height(); // height of the window to be created
  36 + var html = document.getElementById("jitsi");
  37 + $('#jitsi').css({'height':height});
  38 + var api = new JitsiMeetExternalAPI(domain, room, 0, 0,html);
  39 + // window.onload = initpage;
  40 + window.onload = initpage;
  41 + function initpage(){
  42 + api.executeCommand('displayName', '{{user}}');
  43 + api.executeCommand('email', '{{user.email}}');
  44 + api.executeCommand('avatarUrl', '{{user_image}}');
  45 + api.addEventListener('videoConferenceLeft', function(res){
  46 + $.ajax({
  47 + method: "GET",
  48 + url: "{% url 'webconferences:exit'%}",
  49 + dataType: 'json',
  50 + data: res,
  51 + success: function(response) {
  52 + window.location.replace(response['url']);
  53 + console.log(response);
  54 + },
  55 + error: function(response) {
  56 + console.log(response);
  57 + }
  58 + });
  59 + });
  60 + var repeater = setInterval(function () {
  61 + $.ajax({
  62 + method: "GET",
  63 + url: "{% url 'webconferences:participando'%}",
  64 + dataType: 'json',
  65 + data: {'slug':'{{name_room}}'},
  66 + success: function(response) {
  67 + console.log(response);
  68 + },
  69 + error: function(response) {
  70 + console.log(response);
  71 + }
  72 + });
  73 + }, 60*1000);
  74 + }
  75 +</script>
73 76  
74   - </body>
75   -</html>
  77 +{% endblock %}
... ...
webconference/urls.py
... ... @@ -12,6 +12,6 @@ urlpatterns = [
12 12 url(r'^view/(?P<slug>[\w_-]+)/$', views.InsideView.as_view(), name = 'view'),
13 13 url(r'^conference/(?P<slug>[\w_-]+)/$',views.Conference.as_view(), name = 'conference'),
14 14 url(r'^finish/$',views.finish, name = 'exit'),
15   - url(r'^online/$',views.online, name = 'online'),
  15 + url(r'^participando/$',views.participando, name = 'participando'),
16 16 url(r'^settings/$', views.ConferenceSettings.as_view(), name = 'settings'),
17 17 ]
... ...
webconference/views.py
... ... @@ -89,6 +89,11 @@ class Conference(LoginRequiredMixin,LogMixin,generic.TemplateView):
89 89  
90 90 def get_context_data(self, **kwargs):
91 91 context = super(Conference, self).get_context_data(**kwargs)
  92 + conference = get_object_or_404(Webconference, slug = kwargs.get('slug'))
  93 + context['title'] = _("%s - Web Conference")%(conference)
  94 + context['webconference'] = conference
  95 + context['topic'] = conference.topic
  96 + context['subject'] = conference.topic.subject
92 97 context['name_room'] = kwargs.get('slug')
93 98 context['user_image'] = 'http://localhost:8000'+str(self.request.user.image.url)
94 99 try:
... ... @@ -96,7 +101,7 @@ class Conference(LoginRequiredMixin,LogMixin,generic.TemplateView):
96 101 except AttributeError:
97 102 context['domain'] = 'meet.jit.si'
98 103  
99   - conference = get_object_or_404(Webconference, slug = kwargs.get('slug'))
  104 +
100 105 self.log_context['category_id'] = conference.topic.subject.category.id
101 106 self.log_context['category_name'] = conference.topic.subject.category.name
102 107 self.log_context['category_slug'] = conference.topic.subject.category.slug
... ... @@ -115,8 +120,8 @@ class Conference(LoginRequiredMixin,LogMixin,generic.TemplateView):
115 120  
116 121 return context
117 122  
118   -@log_decorator('resources', 'online', 'webconference')
119   -def online(request):
  123 +@log_decorator('resources', 'participando', 'webconference')
  124 +def participando(request):
120 125 webconference = get_object_or_404(Webconference, slug = request.GET['slug'])
121 126 log_context = {}
122 127 log_context['category_id'] = webconference.topic.subject.category.id
... ...