forked from External/greenlight
		
	previously joined sessions
This commit is contained in:
		@@ -35,7 +35,7 @@
 | 
				
			|||||||
    $('.center-panel-wrapper').on ('click', '.meeting-join', function (event) {
 | 
					    $('.center-panel-wrapper').on ('click', '.meeting-join', function (event) {
 | 
				
			||||||
      var name = $('.meeting-user-name').val();
 | 
					      var name = $('.meeting-user-name').val();
 | 
				
			||||||
      Meeting.getInstance().setName(name);
 | 
					      Meeting.getInstance().setName(name);
 | 
				
			||||||
      Meeting.getInstance().setURL(Meeting.buildMeetingURL());
 | 
					      Meeting.getInstance().setId($(".page-wrapper").data('id'));
 | 
				
			||||||
      var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
 | 
					      var jqxhr = Meeting.getInstance().getJoinMeetingResponse();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      jqxhr.done(function(data) {
 | 
					      jqxhr.done(function(data) {
 | 
				
			||||||
@@ -136,11 +136,18 @@
 | 
				
			|||||||
    $('.generate-link').click (function (e) {
 | 
					    $('.generate-link').click (function (e) {
 | 
				
			||||||
      e.preventDefault();
 | 
					      e.preventDefault();
 | 
				
			||||||
      var newId = Math.trunc(Math.random() * 1000000000);
 | 
					      var newId = Math.trunc(Math.random() * 1000000000);
 | 
				
			||||||
 | 
					      Meeting.getInstance().setId(newId);
 | 
				
			||||||
      $(".page-wrapper.meetings").data('id', newId);
 | 
					      $(".page-wrapper.meetings").data('id', newId);
 | 
				
			||||||
      $('.meeting-url').val(Meeting.buildMeetingURL());
 | 
					      $('.meeting-url').val(Meeting.getInstance().getURL());
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $('.generate-link').click();
 | 
					    $('.generate-link').click();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $('ul.previously-joined').empty();
 | 
				
			||||||
 | 
					    var joinedMeetings = localStorage.getItem('joinedMeetings').split(',');
 | 
				
			||||||
 | 
					    for (var id in joinedMeetings) {
 | 
				
			||||||
 | 
					      $('ul.previously-joined').append('<li><a href="/meetings/'+joinedMeetings[id]+'">'+joinedMeetings[id]+'</a></li>');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  var initMeetings = function() {
 | 
					  var initMeetings = function() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,26 +19,24 @@
 | 
				
			|||||||
_meetingInstance = null
 | 
					_meetingInstance = null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class @Meeting
 | 
					class @Meeting
 | 
				
			||||||
  constructor: (@id, @url, @name) ->
 | 
					  constructor: (@id, @type, @name) ->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Gets the current instance or creates a new one
 | 
					  # Gets the current instance or creates a new one
 | 
				
			||||||
  @getInstance: ->
 | 
					  @getInstance: ->
 | 
				
			||||||
    if _meetingInstance
 | 
					    if _meetingInstance
 | 
				
			||||||
      return _meetingInstance
 | 
					      return _meetingInstance
 | 
				
			||||||
    id = $(".page-wrapper").data('id')
 | 
					    id = $(".page-wrapper").data('id')
 | 
				
			||||||
    url = @buildMeetingURL()
 | 
					    if (type = location.pathname.split('/')[1]) != 'rooms'
 | 
				
			||||||
 | 
					      type = 'meetings'
 | 
				
			||||||
    name = $('.meeting-user-name').val()
 | 
					    name = $('.meeting-user-name').val()
 | 
				
			||||||
    _meetingInstance = new Meeting(id, url, name)
 | 
					    _meetingInstance = new Meeting(id, type, name)
 | 
				
			||||||
    return _meetingInstance
 | 
					    return _meetingInstance
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @clear: ->
 | 
					  @clear: ->
 | 
				
			||||||
    _meetingInstance = null
 | 
					    _meetingInstance = null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @buildMeetingURL: (id) ->
 | 
					  @buildMeetingURL: (id, type) ->
 | 
				
			||||||
    if (resource = location.pathname.split('/')[1]) != 'rooms'
 | 
					    return @buildFullDomainURL() + '/' + type + '/' + id
 | 
				
			||||||
      resource = 'meetings'
 | 
					 | 
				
			||||||
    id ||= $(".page-wrapper").data('id')
 | 
					 | 
				
			||||||
    return @buildFullDomainURL() + '/' + resource + '/' + id
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @buildFullDomainURL: ->
 | 
					  @buildFullDomainURL: ->
 | 
				
			||||||
    url = location.protocol + '//' + location.hostname
 | 
					    url = location.protocol + '//' + location.hostname
 | 
				
			||||||
@@ -50,7 +48,7 @@ class @Meeting
 | 
				
			|||||||
  # Returns a response object
 | 
					  # Returns a response object
 | 
				
			||||||
  endMeeting: ->
 | 
					  endMeeting: ->
 | 
				
			||||||
    return $.ajax({
 | 
					    return $.ajax({
 | 
				
			||||||
      url: @url + "/end",
 | 
					      url: @getURL() + "/end",
 | 
				
			||||||
      type: 'DELETE'
 | 
					      type: 'DELETE'
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,35 +56,53 @@ class @Meeting
 | 
				
			|||||||
  # Returns a response object
 | 
					  # Returns a response object
 | 
				
			||||||
  #    The response object contains the URL to join the meeting
 | 
					  #    The response object contains the URL to join the meeting
 | 
				
			||||||
  getJoinMeetingResponse: ->
 | 
					  getJoinMeetingResponse: ->
 | 
				
			||||||
    return $.get @url + "/join?name=" + @name, ->
 | 
					    return $.get @getURL() + "/join?name=" + @name, (data) =>
 | 
				
			||||||
 | 
					      if data.messageKey == 'ok' && @type == 'meetings'
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					          joinedMeetings = localStorage.getItem('joinedMeetings') || ''
 | 
				
			||||||
 | 
					          joinedMeetings = joinedMeetings.split(',')
 | 
				
			||||||
 | 
					          joinedMeetings = joinedMeetings.filter (item) => item != @id.toString()
 | 
				
			||||||
 | 
					          if joinedMeetings.length >= 5
 | 
				
			||||||
 | 
					            joinedMeetings.splice(0, 1)
 | 
				
			||||||
 | 
					          joinedMeetings.push(@id)
 | 
				
			||||||
 | 
					          localStorage.setItem('joinedMeetings', joinedMeetings.join(','))
 | 
				
			||||||
 | 
					        catch err
 | 
				
			||||||
 | 
					          localStorage.setItem('joinedMeetings', @id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getId: ->
 | 
					  getId: ->
 | 
				
			||||||
    return @id
 | 
					    return @id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setId: (id) ->
 | 
					  setId: (id) ->
 | 
				
			||||||
    @id = id
 | 
					    @id = id
 | 
				
			||||||
 | 
					    return this
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  getType: ->
 | 
				
			||||||
 | 
					    return @type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  setType: (type) ->
 | 
				
			||||||
 | 
					    @type = type
 | 
				
			||||||
 | 
					    return this
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getURL: ->
 | 
					  getURL: ->
 | 
				
			||||||
    return @url
 | 
					    return Meeting.buildMeetingURL(@id, @type)
 | 
				
			||||||
 | 
					 | 
				
			||||||
  setURL: (url) ->
 | 
					 | 
				
			||||||
    @url = url
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getName: ->
 | 
					  getName: ->
 | 
				
			||||||
    return @name
 | 
					    return @name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setName: (name) ->
 | 
					  setName: (name) ->
 | 
				
			||||||
    @name = name
 | 
					    @name = name
 | 
				
			||||||
 | 
					    return this
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getModJoined: ->
 | 
					  getModJoined: ->
 | 
				
			||||||
    return @modJoined
 | 
					    return @modJoined
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setModJoined: (modJoined) ->
 | 
					  setModJoined: (modJoined) ->
 | 
				
			||||||
    @modJoined = modJoined
 | 
					    @modJoined = modJoined
 | 
				
			||||||
 | 
					    return this
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getWaitingForMod: ->
 | 
					  getWaitingForMod: ->
 | 
				
			||||||
    return @waitingForMod
 | 
					    return @waitingForMod
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setWaitingForMod: (wMod) ->
 | 
					  setWaitingForMod: (wMod) ->
 | 
				
			||||||
    @waitingForMod = wMod
 | 
					    @waitingForMod = wMod
 | 
				
			||||||
 | 
					    return this
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,15 @@
 | 
				
			|||||||
// You should have received a copy of the GNU Lesser General Public License along
 | 
					// You should have received a copy of the GNU Lesser General Public License along
 | 
				
			||||||
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
 | 
					// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.meetings {
 | 
				
			||||||
 | 
					  .previously-joined {
 | 
				
			||||||
 | 
					    list-style-type: none;
 | 
				
			||||||
 | 
					    margin:auto;
 | 
				
			||||||
 | 
					    width: 200px;
 | 
				
			||||||
 | 
					    padding: 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.rooms {
 | 
					.rooms {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  .table-wrapper {
 | 
					  .table-wrapper {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,7 +74,6 @@ html, body {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  .panel-footer {
 | 
					  .panel-footer {
 | 
				
			||||||
    padding: 35px;
 | 
					 | 
				
			||||||
    background-color: white;
 | 
					    background-color: white;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
<% end %>
 | 
					<% end %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<% content_for :footer do %>
 | 
				
			||||||
 | 
					  <div class="panel-footer">
 | 
				
			||||||
 | 
					    <div class="list-group text-center">
 | 
				
			||||||
 | 
					      <h4><%= t('previously_joined_meetings') %></h4>
 | 
				
			||||||
 | 
					      <ul class="previously-joined"></ul>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					<% end %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="page-wrapper meetings">
 | 
					<div class="page-wrapper meetings">
 | 
				
			||||||
  <div class="container-fluid">
 | 
					  <div class="container-fluid">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,6 +72,7 @@ en-US:
 | 
				
			|||||||
  past_recordings: Past Recordings
 | 
					  past_recordings: Past Recordings
 | 
				
			||||||
  powered_bigbluebutton_html: Powered by %{link}
 | 
					  powered_bigbluebutton_html: Powered by %{link}
 | 
				
			||||||
  presentation: Presentation
 | 
					  presentation: Presentation
 | 
				
			||||||
 | 
					  previously_joined_meetings: Previously Joined Sessions
 | 
				
			||||||
  return_to_room: Return to your personal room
 | 
					  return_to_room: Return to your personal room
 | 
				
			||||||
  session_url_explanation: The session will be taking place using the following URL
 | 
					  session_url_explanation: The session will be taking place using the following URL
 | 
				
			||||||
  start: Start
 | 
					  start: Start
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user