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