bigbluebutton-Github/labs/meteor-client/app/client/main.coffee

193 lines
6.6 KiB
CoffeeScript
Raw Normal View History

# Helper to load javascript libraries from the BBB server
loadLib = (libname) ->
successCallback = ->
retryMessageCallback = (param) ->
2014-11-13 05:04:03 +08:00
#Meteor.log.info "Failed to load library", param
console.log "Failed to load library", param
Meteor.Loader.loadJs("http://#{window.location.hostname}/client/lib/#{libname}", successCallback, 10000).fail(retryMessageCallback)
recalculateLayout = ->
usersDisplayed = getInSession "display_usersList"
whiteboardDisplayed = getInSession "display_whiteboard"
chatDisplayed = getInSession "display_chatbar"
2014-12-03 06:52:03 +08:00
# If only one module is selected (presentation), it should take up
# the entire width of the screen. If it's two modules, each module
# should take up 50% of the screen. If it's 3 modules (25%, 50%, 25%)
2014-12-03 06:52:03 +08:00
console.log "recalculateLayout #{usersDisplayed} #{whiteboardDisplayed} #{chatDisplayed}"
# clear the default width
# $("#users").removeAttr('style')#.css("width","")
# $("#whiteboard").removeAttr('style')#.css("width","")
# $("#chat").removeAttr('style')#.css("width","")
if whiteboardDisplayed
if chatDisplayed and usersDisplayed
$("#users").removeClass("halfScreen").addClass("quarterScreen")
$("#whiteboard").removeClass("fullScreenPresentation").addClass("halfScreen")
$("#chat").removeClass("halfScreen").addClass("quarterScreen")
displaySlide @whiteboardPaperModel
else
2014-12-03 06:52:03 +08:00
if chatDisplayed or usersDisplayed
if chatDisplayed
$("#whiteboard").removeClass("fullScreenPresentation").addClass("halfScreen")
$("#chat").removeClass("quarterScreen").addClass("halfScreen")
if usersDisplayed
$("#whiteboard").removeClass("fullScreenPresentation").addClass("halfScreen")
$("#users").removeClass("quarterScreen").addClass("halfScreen")
else
2014-12-03 06:52:03 +08:00
console.log "fullscreen"
$("#whiteboard").removeClass("halfScreen").addClass("fullScreenPresentation")
else
if chatDisplayed
$("#chat").removeClass("quarterScreen").addClass("halfScreen")
return
if usersDisplayed
$("#users").removeClass("quarterScreen").addClass("halfScreen")
return
2014-06-14 02:20:36 +08:00
# These settings can just be stored locally in session, created at start up
Meteor.startup ->
# Load SIP libraries before the application starts
2014-11-18 06:02:17 +08:00
loadLib('sip.js')
loadLib('bbb_webrtc_bridge_sip.js')
2014-09-24 02:27:59 +08:00
@SessionAmplify = _.extend({}, Session,
keys: _.object(_.map(amplify.store(), (value, key) ->
[
key
JSON.stringify(value)
]
))
set: (key, value) ->
Session.set.apply this, arguments
amplify.store key, value
return
)
2014-07-18 03:45:26 +08:00
2014-08-09 03:30:28 +08:00
Template.footer.helpers
2014-09-24 02:27:59 +08:00
getFooterString: ->
# info = Meteor.call('getServerInfo')
dateOfBuild = getInSession 'dateOfBuild'
2014-09-24 02:27:59 +08:00
version = getInSession "bbbServerVersion"
copyrightYear = (new Date()).getFullYear()
link = "<a href='http://bigbluebutton.org/' target='_blank'>http://bigbluebutton.org</a>"
foot = "(c) #{copyrightYear} BigBlueButton Inc. [build #{version} - #{dateOfBuild}] - For more information visit #{link}"
2014-06-14 02:20:36 +08:00
Template.header.events
"click .audioFeedIcon": (event) ->
$(".tooltip").hide()
toggleVoiceCall @
2014-09-24 02:27:59 +08:00
"click .chatBarIcon": (event) ->
$(".tooltip").hide()
2014-09-24 02:27:59 +08:00
toggleChatbar()
#recalculateLayout()
"click .hideNavbarIcon": (event) ->
$(".tooltip").hide()
toggleNavbar()
"click .lowerHand": (event) ->
$(".tooltip").hide()
2014-11-22 01:36:21 +08:00
Meteor.call('userLowerHand', getInSession("meetingId"), getInSession("userId"), getInSession("userId"), getInSession("authToken"))
2014-09-24 02:27:59 +08:00
"click .muteIcon": (event) ->
$(".tooltip").hide()
2014-09-24 02:27:59 +08:00
toggleMic @
"click .raiseHand": (event) ->
2014-11-13 05:04:03 +08:00
#Meteor.log.info "navbar raise own hand from client"
console.log "navbar raise own hand from client"
$(".tooltip").hide()
2014-11-22 01:36:21 +08:00
Meteor.call('userRaiseHand', getInSession("meetingId"), getInSession("userId"), getInSession("userId"), getInSession("authToken"))
# "click .settingsIcon": (event) ->
# alert "settings"
2014-09-24 02:27:59 +08:00
"click .signOutIcon": (event) ->
2014-11-21 11:15:29 +08:00
$("#dialog").dialog("open")
2014-09-24 02:27:59 +08:00
"click .hideNavbarIcon": (event) ->
$(".tooltip").hide()
2014-09-24 02:27:59 +08:00
toggleNavbar()
# "click .settingsIcon": (event) ->
# alert "settings"
"click .usersListIcon": (event) ->
$(".tooltip").hide()
toggleUsersList()
#recalculateLayout()
"click .videoFeedIcon": (event) ->
$(".tooltip").hide()
toggleCam @
2014-09-24 02:27:59 +08:00
"click .whiteboardIcon": (event) ->
$(".tooltip").hide()
2014-09-24 02:27:59 +08:00
toggleWhiteBoard()
#recalculateLayout()
2014-09-24 02:27:59 +08:00
"mouseout #navbarMinimizedButton": (event) ->
$("#navbarMinimizedButton").removeClass("navbarMinimizedButtonLarge")
$("#navbarMinimizedButton").addClass("navbarMinimizedButtonSmall")
2014-07-31 04:22:23 +08:00
"mouseover #navbarMinimizedButton": (event) ->
$("#navbarMinimizedButton").removeClass("navbarMinimizedButtonSmall")
$("#navbarMinimizedButton").addClass("navbarMinimizedButtonLarge")
2014-09-05 01:06:36 +08:00
Template.main.helpers
setTitle: ->
2014-09-12 01:37:09 +08:00
document.title = "BigBlueButton #{window.getMeetingName() ? 'HTML5'}"
2014-09-05 01:06:36 +08:00
2014-11-21 11:15:29 +08:00
Template.main.rendered = ->
$("#dialog").dialog(
modal: true
draggable: false
resizable: false
autoOpen: false
height: 115
width: 270
dialogClass: 'no-close logout-dialog'
buttons: [
{
text: 'Yes'
click: () ->
userLogout getInSession("meetingId"), getInSession("userId"), true
$(this).dialog("close")
class: 'btn btn-xs btn-primary active'
}
{
text: 'No'
click: () ->
$(this).dialog("close")
$(".tooltip").hide()
class: 'btn btn-xs btn-default'
}
]
position:
my: 'right top'
at: 'right bottom'
of: '.signOutIcon'
)
2014-07-31 04:22:23 +08:00
Template.makeButton.rendered = ->
2014-09-24 02:27:59 +08:00
$('button[rel=tooltip]').tooltip()
Template.recordingStatus.rendered = ->
$('button[rel=tooltip]').tooltip()
2014-12-10 02:03:01 +08:00
Template.header.rendered = ->
$('.collapseButton').on 'click', () ->
if $('.collapseSection').css('display') is 'block'
$('.collapseSection').css({'display': 'none'})
$('.navbarTitle').css({ 'margin-left': 'auto', 'margin-right': 'auto', 'width': '80%' })
$('.collapseButton > i').removeClass('glyphicon-chevron-right')
$('.collapseButton > i').addClass('glyphicon-chevron-left')
else
$('.collapseSection').css({'display': 'block'})
$('.navbarTitle').css({ 'width': '30%' })
$('.collapseButton > i').removeClass('glyphicon-chevron-left')
$('.collapseButton > i').addClass('glyphicon-chevron-right')