Index: lams_learning/web/includes/javascript/kumalive.js =================================================================== diff -u -r9496ff3ffe5e98272f7939a2cf4e8c6dbb2901f7 -r876e644c066e81c2721ffa085fd12f386e2f3bb6 --- lams_learning/web/includes/javascript/kumalive.js (.../kumalive.js) (revision 9496ff3ffe5e98272f7939a2cf4e8c6dbb2901f7) +++ lams_learning/web/includes/javascript/kumalive.js (.../kumalive.js) (revision 876e644c066e81c2721ffa085fd12f386e2f3bb6) @@ -26,8 +26,92 @@ ANIMATION_DURATION = 1000, websocket = initWebsocket('kumalive' + orgId, LEARNING_URL.replace('http', 'ws') - + 'kumaliveWebsocket?organisationID=' + orgId + '&role=' + role); + + 'kumaliveWebsocket?organisationID=' + orgId + '&role=' + role, + function (e) { + // read JSON object + var message = JSON.parse(e.data), + type = message.type; + // check what is this message about + switch(type) { + case 'start' : { + // user tried to join a Kumalive which is not started yet + // try to start it, if user is a teacher + // otherwise just wait for a teacher + this.send(JSON.stringify({ + 'type' : 'start', + 'role' : role + })); + } + break; + case 'create' : { + // user is a teacher and will now create a new Kumalive + // hide splash screen + $('#initDiv').hide(); + // show name input + var createDiv = $('#createKumaliveDiv'), + rubricsDiv = $('#rubrics .panel-body', createDiv); + if (message.rubrics) { + $.each(message.rubrics, function(){ + if (this) { + var checkbox = $('
').addClass('checkbox').appendTo(rubricsDiv), + label = $('