|
|
|
@ -343,13 +343,15 @@ function initManage(){ |
|
|
|
|
|
|
|
|
|
var data = {}; |
|
|
|
|
|
|
|
|
|
function ajaxifySwitch(sw,data){ |
|
|
|
|
function sendAction(data,sw){ |
|
|
|
|
$.ajax({ |
|
|
|
|
url: rootUrl + 'admin/action', |
|
|
|
|
data: data, |
|
|
|
|
error: function(data) { |
|
|
|
|
$.notify(locale.ERROR_OCCURRED, 'error'); |
|
|
|
|
if (typeof(sw) == 'object'){ |
|
|
|
|
sw.bootstrapSwitch('toggleState', true); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
success: function(data) { |
|
|
|
|
if (data.status === 'success'){ |
|
|
|
@ -357,9 +359,11 @@ function initManage(){ |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
$.notify(data.msg, 'error'); |
|
|
|
|
if (typeof(sw) == 'object'){ |
|
|
|
|
sw.bootstrapSwitch('toggleState', true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -375,12 +379,12 @@ function initManage(){ |
|
|
|
|
data = {room: room}; |
|
|
|
|
if (param === 'lockSwitch'){ |
|
|
|
|
data.action = (state) ? 'lock' : 'unlock'; |
|
|
|
|
ajaxifySwitch(sw,data); |
|
|
|
|
sendAction(data,sw); |
|
|
|
|
} |
|
|
|
|
else if (param === 'askForNameSwitch'){ |
|
|
|
|
data.action = 'askForName'; |
|
|
|
|
data.type = (state) ? 'set' : 'unset'; |
|
|
|
|
ajaxifySwitch(sw,data); |
|
|
|
|
sendAction(data,sw); |
|
|
|
|
} |
|
|
|
|
else if (param === 'joinPassSwitch'){ |
|
|
|
|
if (state){ |
|
|
|
@ -391,7 +395,7 @@ function initManage(){ |
|
|
|
|
else{ |
|
|
|
|
data.action = 'setPassword'; |
|
|
|
|
data.type = 'join'; |
|
|
|
|
ajaxifySwitch(sw,data); |
|
|
|
|
sendAction(data,sw); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if (param === 'ownerPassSwitch'){ |
|
|
|
@ -402,7 +406,7 @@ function initManage(){ |
|
|
|
|
else{ |
|
|
|
|
data.action = 'setPassword'; |
|
|
|
|
data.type = 'owner'; |
|
|
|
|
ajaxifySwitch(sw,data); |
|
|
|
|
sendAction(data,sw); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// Something isn't implemented yet ?
|
|
|
|
@ -425,7 +429,7 @@ function initManage(){ |
|
|
|
|
data.action = 'setPassword'; |
|
|
|
|
data.type = 'join'; |
|
|
|
|
data.password = pass |
|
|
|
|
ajaxifySwitch($('#joinPassSwitch'), data); |
|
|
|
|
sendAction(data, $('#joinPassSwitch')); |
|
|
|
|
$('#joinPassSwitch').bootstrapSwitch('toggleState', true); |
|
|
|
|
$('#joinPassModal').modal('hide'); |
|
|
|
|
} |
|
|
|
@ -445,7 +449,7 @@ function initManage(){ |
|
|
|
|
data.action = 'setPassword'; |
|
|
|
|
data.type = 'owner'; |
|
|
|
|
data.password = pass |
|
|
|
|
ajaxifySwitch($('#ownerPassSwitch'), data); |
|
|
|
|
sendAction(data, $('#ownerPassSwitch')); |
|
|
|
|
$('#ownerPassSwitch').bootstrapSwitch('toggleState', true); |
|
|
|
|
$('#persistentModal').modal('hide'); |
|
|
|
|
} |
|
|
|
@ -454,6 +458,20 @@ function initManage(){ |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// Handle room deletion
|
|
|
|
|
$('#deleteRoomButton').click(function(){ |
|
|
|
|
$('#deleteRoomModal').modal('show'); |
|
|
|
|
data.room = $(this).data('room'); |
|
|
|
|
}); |
|
|
|
|
$('#confirmDeleteButton').click(function(){ |
|
|
|
|
data.action = 'deleteRoom'; |
|
|
|
|
sendAction(data); |
|
|
|
|
$('#deleteRoomModal').modal('hide'); |
|
|
|
|
setTimeout(function(){ |
|
|
|
|
window.location.assign(rootUrl + 'admin'); |
|
|
|
|
}, 2000); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// This is the main function called when you join a room
|
|
|
|
|