diff --git a/public/css/vroom.css b/public/css/vroom.css index d00e616..379a88a 100644 --- a/public/css/vroom.css +++ b/public/css/vroom.css @@ -79,6 +79,9 @@ #confMenu { min-width: 400px; } +.ownerEl { + display: none; +} #chatBox { max-height:300px; resize:none; diff --git a/public/js/vroom.js b/public/js/vroom.js index 1eaf01c..8ab1804 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -75,7 +75,8 @@ function initVroom(room) { micMuted: false, videoPaused: false, displayName: '', - color: chooseColor() + color: chooseColor(), + role: 'participant' } }; var mainVid = false, @@ -90,6 +91,24 @@ function initVroom(room) { dataType: 'json', }); + // get our role (participant or owner) + $.ajax({ + data: { + action: 'getRole', + room: roomName + }, + error: function(data) { + $.notify(locale.ERROR_OCCURED, 'error'); + }, + success: function(data) { + peers.local.role = data.msg; + // Enable owner reserved menu + if (data.msg == 'owner'){ + $('.ownerEl').show(); + } + } + }); + // Screen sharing is only suported on chrome > 26 if ( !$.browser.webkit || $.browser.versionNumber < 26 ) { $("#shareScreenLabel").addClass('disabled'); diff --git a/public/vroom.pl b/public/vroom.pl index e6a02e3..330cd58 100755 --- a/public/vroom.pl +++ b/public/vroom.pl @@ -428,7 +428,7 @@ post '/action' => sub { my $self = shift; my $action = $self->param('action'); my $room = $self->param('room') || ""; - if (!$self->session('name') || !$self->has_joined($self->session('name'), $room)){ + if (!$self->session('name') || !$self->has_joined($self->session('name'), $room) || !$self->session($room) || !$self->session($room)->{role}){ return $self->render( json => { msg => $self->l('ERROR_NOT_LOGGED_IN'), @@ -519,6 +519,14 @@ post '/action' => sub { ); } } + elsif ($action eq 'getRole'){ + return $self->render( + json => { + msg => $self->session($room)->{role}, + status => 'success' + }, + ); + } }; # Not found (404) diff --git a/templates/default/join.html.ep b/templates/default/join.html.ep index a442098..ec6783b 100644 --- a/templates/default/join.html.ep +++ b/templates/default/join.html.ep @@ -79,7 +79,9 @@ -