force sync from /var/www/html/panel: 2025-09-08T20:36:30Z
This commit is contained in:
commit
4f717c9ee8
18119 changed files with 2566034 additions and 0 deletions
5
ControlPanel/js/modules/addonsmanager.js
Executable file
5
ControlPanel/js/modules/addonsmanager.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
$(function() {
|
||||
// Tooltips are annoying
|
||||
// Use title attribute instead
|
||||
// $( 'input,textarea' ).tooltip();
|
||||
});
|
||||
45
ControlPanel/js/modules/administration.js
Executable file
45
ControlPanel/js/modules/administration.js
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
function GetURLParameter(sParam)
|
||||
{
|
||||
var sPageURL = window.location.search.substring(1);
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
for (var i = 0; i < sURLVariables.length; i++)
|
||||
{
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == sParam)
|
||||
{
|
||||
return sParameterName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var p = GetURLParameter('p');
|
||||
|
||||
if(p == 'banlist')
|
||||
{
|
||||
$(document).ready(function(){
|
||||
$('span#check').css({'cursor':'pointer','color':'blue'});
|
||||
$('span#check').click(function(){
|
||||
$('input[type=checkbox]').each(function( ){
|
||||
if( this.checked )
|
||||
{
|
||||
$(this).attr('checked', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).attr('checked', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
else if(p == 'watch_logger')
|
||||
{
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('input#search').quicksearch('table#servermonitor tbody tr.maintr');
|
||||
$("#servermonitor")
|
||||
.collapsible("td.collapsible", {collapse: true})
|
||||
.tablesorter({sortList: [[1,1]] , widgets: ['zebra','repeatHeaders']});
|
||||
}
|
||||
);
|
||||
}
|
||||
119
ControlPanel/js/modules/circular.js
Executable file
119
ControlPanel/js/modules/circular.js
Executable file
|
|
@ -0,0 +1,119 @@
|
|||
$('document').ready(function(){
|
||||
editor = document.getElementById('editor');
|
||||
if(editor)
|
||||
{
|
||||
var quill = new Quill('#editor', {
|
||||
theme: 'snow'
|
||||
});
|
||||
$.getJSON("home.php?m=circular&get_circulars=true&type=cleared", function(data){
|
||||
if(data.length > 0)
|
||||
{
|
||||
$("head").append('<link rel="stylesheet" href="modules/circular/admin_notification.css">');
|
||||
$("h2").append('<i>There are ' + data.length + ' notifications <a href="?m=circular&list=true" >Manage Notifications</a></i>');
|
||||
}
|
||||
}).fail(function(){
|
||||
console.log('Failed reading JSON for circulars');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function remove_circulars()
|
||||
{
|
||||
checkboxes = document.getElementsByClassName('circular_checkbox');
|
||||
var ids = [];
|
||||
for(var i = 0; i < checkboxes.length; i++)
|
||||
{
|
||||
if(checkboxes[i].checked)
|
||||
{
|
||||
ids.push(checkboxes[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
if(ids.length > 0)
|
||||
{
|
||||
var addpost = {};
|
||||
addpost["remove_circulars"] = "true";
|
||||
addpost["circulars_ids"] = ids;
|
||||
var destURL = "home.php?m=circular&list=true";
|
||||
var destURLCleared = destURL + "&type=cleared";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: destURLCleared,
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
location.href = destURL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function swap_all_checkboxes(obj)
|
||||
{
|
||||
checkboxes = document.getElementsByClassName('circular_checkbox');
|
||||
for(var i = 0; i < checkboxes.length; i++)
|
||||
{
|
||||
checkboxes[i].checked = obj.checked;
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_all(obj, selectBox)
|
||||
{
|
||||
if(typeof selectBox == "string")
|
||||
{
|
||||
selectBox = document.getElementById(selectBox);
|
||||
if(selectBox.type == "select-multiple")
|
||||
{
|
||||
for(var i = 0; i < selectBox.options.length; i++)
|
||||
{
|
||||
selectBox.options[i].selected = obj.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function send_circular()
|
||||
{
|
||||
var addpost = {};
|
||||
addpost['admins'] = $('#select_admins').val(),
|
||||
addpost['users'] = $('#select_users').val(),
|
||||
addpost['groups'] = $('#select_groups').val(),
|
||||
addpost['subusers_of_users'] = $('#select_subusers_of_users').val(),
|
||||
addpost['subject'] = $('#subject').val().trim(),
|
||||
addpost['message'] = document.getElementById("editor").getElementsByClassName("ql-editor")[0].innerHTML,
|
||||
addpost['send_circular'] = "send";
|
||||
|
||||
if(addpost['admins'] == null && addpost['users'] == null && addpost['groups'] == null && addpost['subusers_of_users'] == null)
|
||||
{
|
||||
alert('Select at least one recipient (Send To).');
|
||||
return;
|
||||
}
|
||||
|
||||
if(addpost['subject'] == null || addpost['subject'] == "")
|
||||
{
|
||||
alert('Introduce a subject.');
|
||||
return;
|
||||
}
|
||||
|
||||
if(addpost['message'] == "<p><br></p>")
|
||||
{
|
||||
alert('Introduce a Message.');
|
||||
return;
|
||||
}
|
||||
|
||||
var destURL = "home.php?m=circular";
|
||||
var destURLCleared = destURL + "&type=cleared";
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: destURLCleared,
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
alert(data);
|
||||
location.href = destURL;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
11
ControlPanel/js/modules/circular_global.js
Executable file
11
ControlPanel/js/modules/circular_global.js
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
$('document').ready(function(){
|
||||
$.getJSON("home.php?m=circular&p=show_circular&type=cleared", function(data){
|
||||
if(data.length > 0)
|
||||
{
|
||||
$("head").append('<link rel="stylesheet" href="modules/circular/notification.css">');
|
||||
$("body").append('<div id="notification">You have ' + data.length + ' pending notifications.<br><a href="?m=circular&p=show_circular&list=true" >Read Notifications</a></div>');
|
||||
}
|
||||
}).fail(function(){
|
||||
console.log('Failed reading JSON for circulars');
|
||||
});
|
||||
});
|
||||
68
ControlPanel/js/modules/dashboard.js
Executable file
68
ControlPanel/js/modules/dashboard.js
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
$(document).ready(
|
||||
function(){
|
||||
$('.dragbox')
|
||||
.each(function(){
|
||||
$(this).hover(function(){
|
||||
$(this).find('h4').addClass('collapse');
|
||||
}, function(){
|
||||
$(this).find('h4').removeClass('collapse');
|
||||
})
|
||||
.find('h4').hover(function(){
|
||||
$(this).find('.configure').css('visibility', 'visible');
|
||||
}, function(){
|
||||
$(this).find('.configure').css('visibility', 'hidden');
|
||||
})
|
||||
.click(function(){
|
||||
$(this).siblings('.dragbox-content').toggle();
|
||||
//Save state on change of collapse state of panel
|
||||
updateWidgetData();
|
||||
})
|
||||
.end()
|
||||
.find('.configure').css('visibility', 'hidden');
|
||||
});
|
||||
|
||||
$('.column').sortable({
|
||||
connectWith: '.column',
|
||||
handle: 'h4',
|
||||
cursor: 'move',
|
||||
placeholder: 'placeholder',
|
||||
forcePlaceholderSize: true,
|
||||
opacity: 0.4,
|
||||
start: function(event, ui){
|
||||
$(ui.item).find('.dragbox-content').toggle();
|
||||
},
|
||||
stop: function(){
|
||||
updateWidgetData();
|
||||
}
|
||||
})
|
||||
.disableSelection();
|
||||
}
|
||||
);
|
||||
function updateWidgetData(){
|
||||
var items=[];
|
||||
$('.column').each(function(){
|
||||
var columnId=$(this).attr('id');
|
||||
$('.dragbox', this).each(function(i){
|
||||
var collapsed=0;
|
||||
if($(this).find('.dragbox-content').css('display')=="none")
|
||||
collapsed=1;
|
||||
//Create Item object for current panel
|
||||
var item={
|
||||
id: $(this).attr('id'),
|
||||
collapsed: collapsed,
|
||||
order : i,
|
||||
column: columnId
|
||||
};
|
||||
//Push item object into items array
|
||||
items.push(item);
|
||||
});
|
||||
});
|
||||
//Assign items array to sortorder JSON variable
|
||||
var sortorder={ items: items };
|
||||
//Pass sortorder variable to server using ajax to save state
|
||||
$.post('home.php?m=dashboard&p=updateWidgets', 'data='+$.toJSON(sortorder), function(response){
|
||||
if(response.indexOf("success") < 0){
|
||||
$("#console").html('<h0><div class="Failed">Failed to update widget order.</div></h0>').hide().fadeIn(1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
137
ControlPanel/js/modules/extras.js
Executable file
137
ControlPanel/js/modules/extras.js
Executable file
|
|
@ -0,0 +1,137 @@
|
|||
$(document).ready(function(){
|
||||
|
||||
var uninstalling_module_dataloss = $('#dialog').attr('data-uninstalling_module_dataloss');
|
||||
var are_you_sure = $('#dialog').attr('data-are_you_sure');
|
||||
var remove_files_for = $('#dialog').attr('data-remove_files_for');
|
||||
var confirm = $('#dialog').attr('data-confirm');
|
||||
var cancel = $('#dialog').attr('data-cancel');
|
||||
|
||||
$('.install').click(function(){
|
||||
var addpost = {};
|
||||
var folder = $(this).attr('data-module-folder');
|
||||
addpost[ 'm' ] = 'modulemanager';
|
||||
addpost[ 'p' ] = 'add';
|
||||
addpost[ 'module' ] = folder;
|
||||
|
||||
$('#loading.'+folder).html('<img style="height:10px;" src="images/loading.gif" />');
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "home.php",
|
||||
data: addpost,
|
||||
complete: function(){
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.uninstall').click(function(){
|
||||
var addpost = {};
|
||||
var folder = $(this).attr('data-module-folder');
|
||||
var id = $(this).attr('data-module-id');
|
||||
addpost[ 'm' ] = 'modulemanager';
|
||||
addpost[ 'p' ] = 'del';
|
||||
addpost[ 'id' ] = id;
|
||||
addpost[ 'module' ] = folder;
|
||||
$( "#dialog" ).attr('title', are_you_sure+'?').html('<p>'+uninstalling_module_dataloss+'</p>');
|
||||
$( "#dialog" ).dialog({
|
||||
resizable: false,
|
||||
height:150,
|
||||
modal: true,
|
||||
buttons:
|
||||
[{ text: confirm, click: function(){
|
||||
$( this ).dialog( "close" );
|
||||
$('#loading.'+folder).html('<img style="height:10px;" src="images/loading.gif" />');
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "home.php",
|
||||
data: addpost,
|
||||
complete: function(){
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
},{ text: cancel, click: function(){
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
$('.remove').click(function(){
|
||||
var addpost = {};
|
||||
var folder = $(this).attr('data-module-folder');
|
||||
var mode = $(this).attr('data-remove-mode');
|
||||
addpost[ 'remove' ] = mode;
|
||||
addpost[ 'folder' ] = folder;
|
||||
|
||||
$( "#dialog" ).attr('title', are_you_sure+'?').html('<p>'+remove_files_for+' '+folder+'?</p>');
|
||||
$( "#dialog" ).dialog({
|
||||
resizable: false,
|
||||
height:150,
|
||||
modal: true,
|
||||
buttons:
|
||||
[{ text: confirm, click: function(){
|
||||
$( this ).dialog( "close" );
|
||||
$('#loading.'+folder).html('<img style="height:10px;" src="images/loading.gif" />');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "home.php?m=extras&type=cleared",
|
||||
data: addpost,
|
||||
complete: function(){
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
},{ text: cancel, click: function(){
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
$('button[name=update]').click(function(){
|
||||
$('#updateButton').html('<img style="height:20px;" src="images/loading.gif" />');
|
||||
var addpost = {};
|
||||
addpost.theme = [];
|
||||
addpost.module = [];
|
||||
addpost.update = '';
|
||||
var name = '';
|
||||
var value = '';
|
||||
$('input[type=checkbox]:checked').each(function(){
|
||||
name = $(this).attr('name');
|
||||
value = $(this).attr('value');
|
||||
if(name == 'theme')
|
||||
{
|
||||
addpost.theme.push(value);
|
||||
}
|
||||
if(name == 'module')
|
||||
{
|
||||
addpost.module.push(value);
|
||||
}
|
||||
return addpost;
|
||||
});
|
||||
var mirror = $('#mirror').val();
|
||||
if(typeof mirror != "undefined")
|
||||
{
|
||||
addpost.mirror = mirror;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "home.php?m=extras&type=cleared",
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
var message = data.replace(/(<([^>]+)>)/ig,"");
|
||||
message = message.trim();
|
||||
if(message != '')
|
||||
{
|
||||
alert(message);
|
||||
}
|
||||
},
|
||||
complete: function(){
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
17
ControlPanel/js/modules/ftp.js
Executable file
17
ControlPanel/js/modules/ftp.js
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
$(document).ready(
|
||||
function (){
|
||||
$(".tablesorter").collapsible("td.collapsible", {collapse: true})
|
||||
.tablesorter({
|
||||
// set default sort column
|
||||
sortList: [[4,0]],
|
||||
// don't sort by first column
|
||||
headers: {0: {sorter: false}}
|
||||
// set the widgets being used - zebra stripping
|
||||
, widgets: ['zebra']
|
||||
, onRenderHeader: function (){
|
||||
this.wrapInner("<span></span>");
|
||||
}
|
||||
, debug: false
|
||||
});
|
||||
}
|
||||
);
|
||||
224
ControlPanel/js/modules/gamemanager.js
Executable file
224
ControlPanel/js/modules/gamemanager.js
Executable file
|
|
@ -0,0 +1,224 @@
|
|||
function uploadMapImg(button) {
|
||||
var home_id = $(button).attr('id');
|
||||
var mod_id = $(button).attr('data-mod_id');
|
||||
var map = $(button).attr('data-map');
|
||||
|
||||
var title = $('#translation').attr('data-title');
|
||||
var upload_button = $('#translation').attr('data-upload_button');
|
||||
var bad_file = $('#translation').attr('data-bad_file');
|
||||
var upload_failure = $('#translation').attr('data-upload_failure');
|
||||
|
||||
$('div.main-content').append('<div class="dialog-form'+home_id+'" title="'+title+'" >\
|
||||
<form class="upload-mapImage-form'+home_id+'" enctype="multipart/form-data" >\
|
||||
<input type="hidden" name="map" value="'+map+'" />\
|
||||
<input type="file" name="map-image" class="'+home_id+'" value="" />\
|
||||
<input type="hidden" name="home_id" value="'+home_id+'" />\
|
||||
<input type="hidden" name="mod_id" value="'+mod_id+'" />\
|
||||
</form>\
|
||||
</div>');
|
||||
|
||||
$( ".dialog-form"+home_id ).dialog({
|
||||
autoOpen: true,
|
||||
height: 145,
|
||||
width: 350,
|
||||
modal: true,
|
||||
buttons: [{ text: upload_button, click: function(){
|
||||
var filename = $('input[name=map-image].'+home_id).val().split('\\').pop(),
|
||||
extension = filename.split('.').pop();
|
||||
|
||||
if(extension.match(/png|jpg|gif/) != null)
|
||||
{
|
||||
filesize = $('input[name=map-image].'+home_id)[0].files[0].fileSize;
|
||||
if(filesize > 1048576)
|
||||
{
|
||||
alert(bad_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(".upload-mapImage-form"+home_id).append('<input type="hidden" name="extension" value="'+extension+'" />');
|
||||
$('.status'+home_id).remove();
|
||||
$( ".dialog-form"+home_id ).append('<center class="status'+home_id+'" ><img style="height:10px;" src="images/loading.gif" /></center>');
|
||||
data = new FormData($(".upload-mapImage-form"+home_id)[0]);
|
||||
console.log('Submitting');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'home.php?m=gamemanager&p=upload_map_image&type=cleared',
|
||||
data: data,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false
|
||||
}).done(function(data) {
|
||||
$('.status'+home_id).remove();
|
||||
$( ".dialog-form"+home_id ).append('<center class="status'+home_id+'" >'+$.trim(data)+'</center>');
|
||||
}).fail(function(jqXHR,status, errorThrown) {
|
||||
$('.status'+home_id).remove();
|
||||
$( ".dialog-form"+home_id ).append('<center class="status'+home_id+'" >'+upload_failure+'</center>');
|
||||
console.log(errorThrown);
|
||||
console.log(jqXHR.responseText);
|
||||
console.log(jqXHR.status);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(bad_file);
|
||||
}
|
||||
}
|
||||
}],
|
||||
close: function() {
|
||||
$( ".dialog-form"+home_id ).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('input#search').quicksearch('table#servermonitor tbody tr.maintr');
|
||||
$("#servermonitor")
|
||||
.collapsible("td.collapsible", {collapse: true})
|
||||
.tablesorter({sortList: [[0,0], [1,0]] , widgets: ['zebra']});
|
||||
|
||||
|
||||
$("div#server_icon").click(function(){
|
||||
var id = $(this).attr('class');
|
||||
if($("input[type=radio]."+id).attr('checked'))
|
||||
{
|
||||
$("input[type=radio]."+id).attr('checked', false).prop('checked', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$("input[type=radio]."+id).attr('checked', true).prop('checked', true);
|
||||
}
|
||||
});
|
||||
|
||||
$('.size').click(function(){
|
||||
var id = $(this).attr('data-home_id');
|
||||
$.post( "home.php?m=user_games&type=cleared&p=get_size&home_id="+id, function( data ) {
|
||||
$('.size[data-home_id='+id+']').text( data ).removeClass('sizeText').addClass('sizeText');
|
||||
});
|
||||
});
|
||||
|
||||
$('#execute_operations').click(function(){
|
||||
var addpost = {};
|
||||
$('input[type=radio]:checked').each(function( ){
|
||||
var name = $(this).attr('name');
|
||||
var value = $(this).val();
|
||||
addpost[ name ] = value;
|
||||
});
|
||||
|
||||
$('.right.bloc').html('<img src="images/loading.gif" />');
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "home.php?m=gamemanager&p=game_monitor",
|
||||
data: addpost,
|
||||
complete: function(){
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('img#action-stop').click(function(){
|
||||
$('input[type=radio]#action-stop').each(function( ){
|
||||
if( this.checked )
|
||||
{
|
||||
$(this).attr('checked', false).prop('checked', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).attr('checked', true).prop('checked', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('img#action-restart').click(function(){
|
||||
$('input[type=radio]#action-restart').each(function( ){
|
||||
if( this.checked )
|
||||
{
|
||||
$(this).attr('checked', false).prop('checked', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).attr('checked', true).prop('checked', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('img#action-start').click(function(){
|
||||
$('input[type=radio]#action-start').each(function( ){
|
||||
if( this.checked )
|
||||
{
|
||||
$(this).attr('checked', false).prop('checked', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).attr('checked', true).prop('checked', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Allow admin users to set game server order
|
||||
handleOrderingGameServers();
|
||||
});
|
||||
|
||||
|
||||
function handleOrderingGameServers(){
|
||||
var elemBeingDragged = null;
|
||||
var childExpanderRow = null;
|
||||
var helperItemBeingDragged = null;
|
||||
if($('h2.isAdminUser').length){
|
||||
$('table#servermonitor tbody').sortable({
|
||||
handle: '.sortHandle', // https://stackoverflow.com/questions/15554951/sortable-rows-only-when-a-specific-column-is-dragged#answer-16753297
|
||||
delay: 250, // https://stackoverflow.com/questions/22913592/jquery-ui-sortable-any-event-to-trigger-once-delay-completed
|
||||
start: function( event, ui ) {
|
||||
$('.expand-child td').css('display', 'none');
|
||||
$('td', ui.item).removeClass('expanded');
|
||||
ui.helper.css('cursor', 'move');
|
||||
elemBeingDragged = ui.item;
|
||||
childExpanderRow = elemBeingDragged.nextAll('tr.expand-child').first();
|
||||
helperItemBeingDragged = ui.helper;
|
||||
},
|
||||
stop: function( event, ui ) {
|
||||
if(childExpanderRow && childExpanderRow.length && elemBeingDragged && elemBeingDragged.length){
|
||||
elemBeingDragged.after(childExpanderRow.detach());
|
||||
if(childExpanderRow.next('tr.expand-child').length){
|
||||
elemBeingDragged.before(childExpanderRow.next('tr.expand-child').detach());
|
||||
}
|
||||
}
|
||||
if(helperItemBeingDragged.length){
|
||||
helperItemBeingDragged.css('cursor', '');
|
||||
}
|
||||
},
|
||||
update: function(event, ui){
|
||||
saveGameServerOrder();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function saveGameServerOrder(){
|
||||
var i = 0;
|
||||
var postData = {order: new Array()};
|
||||
var homeId = null;
|
||||
|
||||
if(userAPIKey){
|
||||
|
||||
// Build the data
|
||||
$('table#servermonitor tbody .maintr:visible').each(function(e){
|
||||
homeId = $('td.serverId', $(this)).text();
|
||||
if(homeId){
|
||||
postData.order.push({home_id: homeId, order: i});
|
||||
i++;
|
||||
}
|
||||
});
|
||||
|
||||
// Make the call
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ogp_api.php?gamemanager_admin/reorder&token=" + userAPIKey,
|
||||
data: JSON.stringify(postData),
|
||||
success: function(e){
|
||||
logToConsole("Game server order successfully saved!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
50
ControlPanel/js/modules/gamemanager_update.js
Executable file
50
ControlPanel/js/modules/gamemanager_update.js
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
function GetURLParameter(sParam)
|
||||
{
|
||||
var sPageURL = window.location.search.substring(1);
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
for (var i = 0; i < sURLVariables.length; i++)
|
||||
{
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == sParam)
|
||||
{
|
||||
return sParameterName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
if( GetURLParameter('get_sgc') == 'show' )
|
||||
{
|
||||
var home_id = GetURLParameter('home_id');
|
||||
var mod_id = GetURLParameter('mod_id');
|
||||
var returnUrl = "home.php?m=gamemanager&p=update&update=refresh&home_id="+home_id+"&mod_id="+mod_id
|
||||
var addpost = {};
|
||||
addpost.sgc = '';
|
||||
$('#dialog').html("<label for='SteamGuardCode'>Steam Guard:</label>\n"+
|
||||
"<input class='SteamGuardCode' type=text style='width:99%;' name='sgc'>");
|
||||
$('#dialog').dialog({
|
||||
autoOpen: true,
|
||||
width: 450,
|
||||
modal: true,
|
||||
buttons: [{ text: "Send Code", click: function(){
|
||||
addpost.sgc = $('input[class="SteamGuardCode"]').val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: returnUrl,
|
||||
data: addpost,
|
||||
async: false,
|
||||
success: function(data){
|
||||
$('#dialog').html("<div class=\"loader\"></div>");
|
||||
setTimeout(function(){
|
||||
window.location.href = returnUrl;
|
||||
}, 10000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}],
|
||||
close: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
1098
ControlPanel/js/modules/litefm.js
Executable file
1098
ControlPanel/js/modules/litefm.js
Executable file
File diff suppressed because it is too large
Load diff
55
ControlPanel/js/modules/server.js
Executable file
55
ControlPanel/js/modules/server.js
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
function GetURLParameter(sParam)
|
||||
{
|
||||
var sPageURL = window.location.search.substring(1);
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
for (var i = 0; i < sURLVariables.length; i++)
|
||||
{
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == sParam)
|
||||
{
|
||||
return sParameterName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var p = GetURLParameter('p');
|
||||
|
||||
if(typeof p === 'undefined')
|
||||
{
|
||||
$(document).ready(function(){
|
||||
$('input[name=remote_host]').change(function() {
|
||||
$('#remote_host_ftp_ip').val(this.value);
|
||||
});
|
||||
$("#servermonitor")
|
||||
.collapsible("td.collapsible", {collapse: true});
|
||||
});
|
||||
$(document).tooltip({
|
||||
items: "img.center",
|
||||
position: {
|
||||
my: "left+5 centre",
|
||||
at: "right top-290"
|
||||
},
|
||||
content: function() {
|
||||
var url = $( this ).attr("data-url");
|
||||
return "<img src='" + url + "'>";
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(p == 'arrange_ports')
|
||||
{
|
||||
$(document).ready(function(){
|
||||
$("input[type=text]").each(function(){
|
||||
$(this).numeric();
|
||||
});
|
||||
$('input#start_port.add').on('input', function() {
|
||||
$('input#end_port.add').val( Number($(this).val()) );
|
||||
$('span#total_assignable_ports.add').html( parseInt( ( Number( $('input#end_port.add').val() ) - Number( $(this).val() ) ) / Number( $('input#port_increment.add').val() ) ) + 1 );
|
||||
});
|
||||
$('input#end_port.add').on('input', function() {
|
||||
$('span#total_assignable_ports.add').html( parseInt( ( Number( $(this).val() ) - Number( $('input#start_port.add').val() ) ) / Number( $('input#port_increment.add').val() ) ) + 1 );
|
||||
});
|
||||
$('input#port_increment.add').on('input', function() {
|
||||
$('span#total_assignable_ports.add').html( parseInt( ( Number( $('input#end_port.add').val() ) - Number( $('input#start_port.add').val() ) ) / Number( $(this).val() ) ) + 1 );
|
||||
});
|
||||
});
|
||||
}
|
||||
78
ControlPanel/js/modules/show_users.js
Executable file
78
ControlPanel/js/modules/show_users.js
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
$(document).ready(function() {
|
||||
styleRows();
|
||||
removeAbilityToShowSubUsersIfNone();
|
||||
$("tr.subusersShowHide").click(function(e){
|
||||
// Get UID
|
||||
var td = $(this).find('td.subUserShowHideTextTd');
|
||||
var showText = $(td).attr('showtext');
|
||||
var hideText = $(td).attr('hidetext');
|
||||
var tr = $(this);
|
||||
var uid = $(tr).attr('uid');
|
||||
if(typeof uid != typeof undefined && uid != null && uid !== false && uid != ""){
|
||||
if(td.hasClass('expand')){
|
||||
moveSubuserRowsAndShow(td, tr, uid);
|
||||
styleSubUserRows(td, tr, uid);
|
||||
td.removeClass('expand').addClass('collapse');
|
||||
td.html(hideText + "↑");
|
||||
}else if(td.hasClass('collapse')){
|
||||
hideSubuserRows(td, tr, uid);
|
||||
td.removeClass('collapse').addClass('expand');
|
||||
td.html(showText + "↓");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('td.actions').click(function(e){
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
// Trigger click on all subuser sections twice due to new search functionality which I do not like.
|
||||
$(".subusersShowHide").trigger("click").trigger("click");
|
||||
});
|
||||
|
||||
function moveSubuserRowsAndShow(td, tr, uid){
|
||||
var subuserRowsOwnedByUid = $("tr[ownedby='" + uid + "']");
|
||||
var subuserRow = null;
|
||||
if(subuserRowsOwnedByUid.length){
|
||||
subuserRowsOwnedByUid.each(function(e){
|
||||
subuserRow = $(this).detach();
|
||||
$(tr).after(subuserRow);
|
||||
$(this).removeClass('hide');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function hideSubuserRows(td, tr, uid){
|
||||
var subuserRowsOwnedByUid = $("tr[ownedby='" + uid + "']");
|
||||
if(subuserRowsOwnedByUid.length){
|
||||
$(subuserRowsOwnedByUid).addClass('hide');
|
||||
}
|
||||
}
|
||||
|
||||
function styleRows(){
|
||||
$("tr:not(.subuser):odd").css('background-color', '#ededed');
|
||||
$("tr:not(.subuser):even").css('background-color', '#FFF');
|
||||
}
|
||||
|
||||
function styleSubUserRows(){
|
||||
$("tr:not(.subuser)").each(function(e){
|
||||
var childrenSubUsers
|
||||
});
|
||||
}
|
||||
|
||||
function styleSubUserRows(td, tr, uid){
|
||||
$("tr[ownedby='" + uid + "']:even").css('background-color', '#e5ffff');
|
||||
$("tr[ownedby='" + uid + "']:odd").css('background-color', '#dbf3ff');
|
||||
}
|
||||
|
||||
function removeAbilityToShowSubUsersIfNone(){
|
||||
$("tr.subusersShowHide").each(function(e){
|
||||
var uid = $(this).attr('uid');
|
||||
if(typeof uid != typeof undefined && uid != null && uid !== false && uid != ""){
|
||||
if(!$("tr[ownedby='" + uid + "']").length){
|
||||
$(this).removeClass('subusersShowHide');
|
||||
$(this).find('td.subUserShowHideTextTd').html('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
83
ControlPanel/js/modules/steam_workshop.js
Executable file
83
ControlPanel/js/modules/steam_workshop.js
Executable file
|
|
@ -0,0 +1,83 @@
|
|||
function GetURLParameter(sParam)
|
||||
{
|
||||
var sPageURL = window.location.search.substring(1);
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
for (var i = 0; i < sURLVariables.length; i++)
|
||||
{
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == sParam)
|
||||
{
|
||||
return sParameterName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isValidForm(currentForm)
|
||||
{
|
||||
currentForm
|
||||
var inputs = currentForm.getElementsByTagName("input");
|
||||
for(var i = 0; i < inputs.length; i++) {
|
||||
if(inputs[i].type == "checkbox") {
|
||||
if(inputs[i].checked)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(inputs[i].type == "text") {
|
||||
if(inputs[i].value.match(/^([0-9]+,?)+$/g))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
window.alert(currentForm.getAttribute('data-form-error'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
if( document.getElementById("dialog") && GetURLParameter('get_sgc') == 'show' )
|
||||
{
|
||||
var hmip = GetURLParameter('home_id-mod_id-ip-port');
|
||||
var returnUrl = "home.php?m=steam_workshop&p=main&home_id-mod_id-ip-port="+hmip+"&show_log"
|
||||
var addpost = {};
|
||||
addpost.sgc = '';
|
||||
$('#dialog').html("<label for='SteamGuardCode'>Steam Guard:</label>\n"+
|
||||
"<input class='SteamGuardCode' type=text style='width:99%;' name='sgc'>");
|
||||
$('#dialog').dialog({
|
||||
autoOpen: true,
|
||||
width: 450,
|
||||
modal: true,
|
||||
buttons: [{ text: "Send Code", click: function(){
|
||||
addpost.sgc = $('input[class="SteamGuardCode"]').val();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: returnUrl,
|
||||
data: addpost,
|
||||
async: false,
|
||||
success: function(data){
|
||||
$('#dialog').html("<div class=\"loader\"></div>");
|
||||
setTimeout(function(){
|
||||
window.location.href = returnUrl;
|
||||
}, 10000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}],
|
||||
close: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
});
|
||||
}
|
||||
bbcode_containers = document.getElementsByClassName("bbcode_container")
|
||||
if(bbcode_containers.length > 0)
|
||||
{
|
||||
for(var i = 0; i < bbcode_containers.length; i++) {
|
||||
var result = XBBCODE.process({
|
||||
text: bbcode_containers[i].innerText,
|
||||
removeMisalignedTags: true,
|
||||
addInLineBreaks: true
|
||||
});
|
||||
bbcode_containers[i].innerHTML = result.html;
|
||||
}
|
||||
}
|
||||
});
|
||||
8
ControlPanel/js/modules/tickets_global.js
Executable file
8
ControlPanel/js/modules/tickets_global.js
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
$(function() {
|
||||
$.getJSON("home.php?m=tickets&p=notifications&type=cleared", function(data) {
|
||||
if (data['notificationCount'] > 0) {
|
||||
var menutickets = document.getElementsByClassName('tickets');
|
||||
menutickets[0].innerHTML += "<text style='background:#aa0000;color:white;border-radius:20px;border:1px solid white;margin-left:5px'> <b>" + data['notificationCount'] + "</b> </text>";
|
||||
}
|
||||
});
|
||||
});
|
||||
5
ControlPanel/js/modules/update.js
Executable file
5
ControlPanel/js/modules/update.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
function toggleChecked(status) {
|
||||
$("input[type=checkbox]").each( function() {
|
||||
$(this).attr('checked', status).prop('checked', status);
|
||||
});
|
||||
}
|
||||
73
ControlPanel/js/modules/user_games-assign.js
Executable file
73
ControlPanel/js/modules/user_games-assign.js
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
$('document').ready(function(){
|
||||
$('#change_access_rights_submit').prop('disabled', true);
|
||||
$(".change_access_rights").each( function( index, element ){
|
||||
$(element).on('change', function(){
|
||||
if($(".change_access_rights:checked").length > 0)
|
||||
{
|
||||
$('#change_access_rights_submit').prop('disabled', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#change_access_rights_submit').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function change_access_rights(id_type, assign_id)
|
||||
{
|
||||
var rights = $("#dialog").data();
|
||||
var home_ids = [];
|
||||
|
||||
$(".change_access_rights:checked").each( function( index, element ){
|
||||
home_ids[index] = $(element).data("home_id");
|
||||
});
|
||||
|
||||
var check_access_rights = '<table>';
|
||||
|
||||
$.each(rights, function( index, value ) {
|
||||
if(index == 'uiDialog')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
check_access_rights += "<tr><td align='right'><label for='" + value + "'>" + langConsts['OGP_LANG_' + value] + ":</label></td>" +
|
||||
"<td align='left'><input class='ar_flag' id='" + value + "' type='checkbox' name='" + value + "' value='" + index + "' checked='checked' /></td></tr>" +
|
||||
"<tr><td colspan='2' class='info'>" + langConsts['OGP_LANG_' + value + '_info'] + "</td></tr>";
|
||||
});
|
||||
|
||||
check_access_rights += '</table>';
|
||||
|
||||
var addpost = {};
|
||||
addpost[ 'home_ids' ] = home_ids;
|
||||
addpost[ 'assign_id' ] = assign_id;
|
||||
addpost[ 'id_type' ] = id_type;
|
||||
addpost[ 'change_access_rights' ] = 'true';
|
||||
addpost.flags = [];
|
||||
var destURL = "home.php?m=user_games&p=assign&" + id_type + "_id=" + assign_id;
|
||||
var destURLCleared = destURL + "&type=cleared";
|
||||
$('#dialog').html(check_access_rights);
|
||||
$('#dialog').dialog({
|
||||
autoOpen: true,
|
||||
width: 450,
|
||||
modal: true,
|
||||
buttons: [{ text: "Set Access Rights", click: function(){
|
||||
$('input[class="ar_flag"]:checked').each(function(){
|
||||
var flag = $(this).val();
|
||||
addpost.flags.push(flag);
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: destURLCleared,
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
location.href = destURL;
|
||||
}
|
||||
});
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}],
|
||||
close: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
});
|
||||
}
|
||||
44
ControlPanel/js/modules/user_games-mods.js
Executable file
44
ControlPanel/js/modules/user_games-mods.js
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
$("#mods select, #mods input").change(function(){
|
||||
$(this).css("background", "#fe9cb1");
|
||||
});
|
||||
|
||||
$('.set_options').click(function(){
|
||||
var instance = $(this);
|
||||
var mod_cfg_id = $(this).attr('id');
|
||||
var modtr = $('#mod_cfg_id_'+mod_cfg_id);
|
||||
var addpost = {};
|
||||
|
||||
var cpus = [];
|
||||
|
||||
$("#cpu_select").find('.cpus:checked').each(function(i, e) {
|
||||
cpus.push($(this).val());
|
||||
addpost['cpus'] = cpus.join();
|
||||
});
|
||||
|
||||
addpost[ 'set_options' ] = 1;
|
||||
addpost[ 'cliopts' ] = modtr.find('#cliopts').val();
|
||||
|
||||
addpost[ 'nice' ] = modtr.find('#nice').val();
|
||||
addpost[ 'mod_cfg_id' ] = mod_cfg_id;
|
||||
if( modtr.find('#maxplayers').get(0) )
|
||||
{
|
||||
addpost[ 'maxplayers' ] = modtr.find('#maxplayers').val();
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "home.php?m=user_games&p=edit&type=cleared&data_type=json&home_id="+GetURLParameter('home_id'),
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
if(data.result == 'success')
|
||||
{
|
||||
if(instance.is('.set_affinity_button')){
|
||||
$("#cpu_select").css("background", "#bdf2a2");
|
||||
}else{
|
||||
modtr.find("select, input[type='text']").css("background", "#bdf2a2");
|
||||
}
|
||||
}
|
||||
$("#result").html('<p class="'+data.result+'">'+data.info+'</p>');
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
});
|
||||
236
ControlPanel/js/modules/user_games.js
Executable file
236
ControlPanel/js/modules/user_games.js
Executable file
|
|
@ -0,0 +1,236 @@
|
|||
// EDIT HOME
|
||||
function GetURLParameter(sParam)
|
||||
{
|
||||
var sPageURL = window.location.search.substring(1);
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
for (var i = 0; i < sURLVariables.length; i++)
|
||||
{
|
||||
var sParameterName = sURLVariables[i].split('=');
|
||||
if (sParameterName[0] == sParam)
|
||||
{
|
||||
return sParameterName[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadMods() {
|
||||
if( $('#mods').get(0) )
|
||||
{
|
||||
var addpost = {};
|
||||
addpost[ 'm' ] = 'user_games';
|
||||
addpost[ 'p' ] = 'mods';
|
||||
addpost[ 'type' ] = 'cleared';
|
||||
addpost[ 'home_id' ] = GetURLParameter('home_id');
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "home.php",
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
$( "#mods" ).html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
loadMods();
|
||||
var select_home_path = $('#dialog').attr('data-select_home_path');
|
||||
var set_this_path = $('#dialog').attr('data-set_this_path');
|
||||
var cancel = $('#dialog').attr('data-cancel');
|
||||
// Open folder browser
|
||||
$('#browse').unbind().click(function(event){
|
||||
var addpost = {};
|
||||
addpost[ 'm' ] = 'user_games';
|
||||
addpost[ 'p' ] = 'browser';
|
||||
addpost[ 'home_id' ] = $(this).attr('data-home-id');
|
||||
addpost[ 'folder' ] = $(this).attr('data-path');
|
||||
addpost[ 'type' ] = 'cleared';
|
||||
addpost[ 'all_fs' ] = 'yes';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "home.php",
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
$( "#dialog" ).attr('title', select_home_path).html(data);
|
||||
$( "#dialog" ).dialog({
|
||||
resizable: true,
|
||||
width: 460,
|
||||
modal: true,
|
||||
buttons:
|
||||
[{ text: set_this_path, click: function(){
|
||||
var selected_path = $('#selected_path').text();
|
||||
$('input[name="home_path"]').val(selected_path);
|
||||
$( "#change_home_path" ).click();
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},{ text: cancel, click: function(){
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
// Enter folder
|
||||
$('.folder').each(function(){
|
||||
$(this).click(function(){
|
||||
var addpost = {};
|
||||
addpost[ 'm' ] = 'user_games';
|
||||
addpost[ 'p' ] = 'browser';
|
||||
addpost[ 'home_id' ] = $('.levelup').attr('data-home-id');
|
||||
addpost[ 'item' ] = $(this).attr('data-item');
|
||||
addpost[ 'type' ] = 'cleared';
|
||||
addpost[ 'all_fs' ] = 'yes';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "home.php",
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
$( "#dialog" ).html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
// Back to previous folder
|
||||
$('.levelup').click(function(){
|
||||
var addpost = {};
|
||||
addpost[ 'm' ] = 'user_games';
|
||||
addpost[ 'p' ] = 'browser';
|
||||
addpost[ 'home_id' ] = $(this).attr('data-home-id');
|
||||
addpost[ 'back' ] = 'back';
|
||||
addpost[ 'type' ] = 'cleared';
|
||||
addpost[ 'all_fs' ] = 'yes';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "home.php",
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
$( "#dialog" ).html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
// Create new folder
|
||||
$('#addfolder').click(function(){
|
||||
var addpost = {};
|
||||
addpost[ 'm' ] = 'user_games';
|
||||
addpost[ 'p' ] = 'browser';
|
||||
addpost[ 'home_id' ] = $('.levelup').attr('data-home-id');
|
||||
addpost[ 'create_folder' ] = 'create_folder';
|
||||
addpost[ 'folder_name' ] = $('input[name=dirname]').val();
|
||||
addpost[ 'type' ] = 'cleared';
|
||||
addpost[ 'all_fs' ] = 'yes';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "home.php",
|
||||
data: addpost,
|
||||
success: function(data){
|
||||
$( "#dialog" ).html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#main_settings select, #main_settings input").change(function(){
|
||||
$(this).css("background", "#fe9cb1");
|
||||
});
|
||||
|
||||
$('#main_settings input:submit').unbind().click(function(e){
|
||||
var submitName = $(this).attr('name');
|
||||
if(submitName != 'delete_ftp' && submitName != 'create_ftp' && submitName != 'master_server')
|
||||
{
|
||||
e.preventDefault();
|
||||
var thisForm = $(this).closest('form');
|
||||
var formData = thisForm.serializeArray();
|
||||
formData.push({ name: submitName });
|
||||
if(submitName == 'change_home')
|
||||
{
|
||||
$.each( formData, function( i, field ) {
|
||||
if( field.name == "home_path" )
|
||||
{
|
||||
formData[i]['value'] = formData[i]['value'].replace(/\\/g,'');
|
||||
thisForm.find('input[name="home_path"]').val(formData[i]['value']);
|
||||
}
|
||||
});
|
||||
}
|
||||
$.post(window.location + "&type=cleared", formData, function(data) {
|
||||
if(data.result == 'success')
|
||||
{
|
||||
thisForm.find("select, input[type='text']").css("background", "#bdf2a2");
|
||||
if(submitName == 'change_home_cfg_id')
|
||||
{
|
||||
loadMods();
|
||||
}
|
||||
}
|
||||
$("#result").html('<p class="'+data.result+'">'+data.info+'</p>');
|
||||
if(data.result == "success"){
|
||||
$("p.warning").remove();
|
||||
}
|
||||
|
||||
if(data.hasOwnProperty("warning_info") && data.warning_info){
|
||||
$("#result").html($("#result").html() + '<p class="warning">'+data.warning_info+'</p>');
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
|
||||
var datePickerInput = $("input[name=expiration_date]");
|
||||
if(datePickerInput)
|
||||
{
|
||||
var now_str = datePickerInput.attr('data-today').split(' '),
|
||||
date = now_str[0].split('/'),
|
||||
time = now_str[1].split(':'),
|
||||
now = new Date(date[2], date[1]-1, date[0], time[0], time[1], time[2], 0);
|
||||
$('#datetimepicker').datetimepicker({
|
||||
format: 'd/m/Y H:i:s',
|
||||
startDate: now,
|
||||
onChangeDateTime: function(e, obj) {
|
||||
if(e == null)
|
||||
{
|
||||
datePickerInput.val("X");
|
||||
}
|
||||
else
|
||||
{
|
||||
var now_str = $( "input[name=expiration_date]" ).attr('data-today').split(' '),
|
||||
date = now_str[0].split('/'),
|
||||
time = now_str[1].split(':'),
|
||||
now = new Date(date[2], date[1]-1, date[0], time[0], time[1], time[2], 0);
|
||||
var selected = new Date(e);
|
||||
if( selected <= now )
|
||||
{
|
||||
alert('The selected date has already passed.');
|
||||
datePickerInput.val("X");
|
||||
}
|
||||
else
|
||||
{
|
||||
datePickerInput.val(obj.val());
|
||||
}
|
||||
}
|
||||
if("edit" == GetURLParameter('p'))
|
||||
{
|
||||
datePickerInput.css("background", "#fe9cb1");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
datePickerInput.on('change', function() {
|
||||
if(this.value.match(/^\d{1,2}\/\d{1,2}\/\d{4}\s\d{1,2}:\d{1,2}:\d{1,2}$/g) == null || this.value == "X")
|
||||
{
|
||||
this.value = "X";
|
||||
}
|
||||
else
|
||||
{
|
||||
var sel_str = this.value.split(' '),
|
||||
date = sel_str[0].split('/'),
|
||||
time = sel_str[1].split(':'),
|
||||
selected = new Date(date[2], date[1]-1, date[0], time[0], time[1], time[2], 0);
|
||||
if( selected <= now )
|
||||
{
|
||||
alert('The selected date has already passed.');
|
||||
this.value = "X";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
363
ControlPanel/js/modules/util.js
Executable file
363
ControlPanel/js/modules/util.js
Executable file
|
|
@ -0,0 +1,363 @@
|
|||
$(function(){
|
||||
$("#tabs").tabs();
|
||||
$("#loading").removeClass('hide').addClass('show');
|
||||
var select_agent = $('#translation').attr('data-select_agent'),
|
||||
target_empty = $('#translation').attr('data-target_empty'),
|
||||
command_empty = $('#translation').attr('data-command_empty'),
|
||||
agent_invalid = $('#translation').attr('data-agent_invalid'),
|
||||
post_failed = $('#translation').attr('data-post_failed'),
|
||||
select_server = $('#translation').attr('data-select_server'),
|
||||
select_server_option = $('#translation').attr('data-select_server_option');
|
||||
|
||||
// Load the agents via an external script so the user isn't waiting an eternity if they have several agents and multiple are offline
|
||||
$.getJSON("home.php?m=util&p=agents&type=cleared", function(data){
|
||||
var agents = "";
|
||||
var agentsOnline = 0;
|
||||
|
||||
$("#loading_agents").removeClass('show').addClass('hide');
|
||||
$("#loading").removeClass('show').addClass('hide');
|
||||
$("#options").removeClass('hide').addClass('show');
|
||||
|
||||
agents += "<label for=\"agent\">" + select_agent + "</label>\r\n"
|
||||
agents += "<select id=\"agent\" name=\"agent\">\r\n"
|
||||
|
||||
for(var i = 0; i<data.length; ++i){
|
||||
agents += "\t<option value=\"" + data[i]['id'] + "\"" + (data[i]['status']===0?" disabled":"") + ">" + data[i]['name'] +"</option>\r\n";
|
||||
|
||||
if(data[i]['status'] == 1){
|
||||
++agentsOnline;
|
||||
}
|
||||
}
|
||||
|
||||
agents += "</select>";
|
||||
|
||||
if(agentsOnline == 0){
|
||||
$("#options").removeClass('show').addClass('hide');
|
||||
$("#agents_offline").removeClass('hide').addClass('show');
|
||||
|
||||
// Hide the sourcemod add admin form if all agents are offline.
|
||||
$("#addadmin_form").addClass('hide');
|
||||
$("#all_servers_offline").removeClass('hide').addClass('show');
|
||||
}else if($("#command option").length == 0){
|
||||
$("#options").removeClass('show').addClass('hide');
|
||||
$("#no_commands").removeClass('hide').addClass('show');
|
||||
}else{
|
||||
$("#select_agent").html(agents);
|
||||
}
|
||||
}).fail(function(){
|
||||
$("#loading_agents").removeClass('show').addClass('hide');
|
||||
$("#loading").removeClass('show').addClass('hide');
|
||||
$("#loading_failed").removeClass('hide').addClass('show');
|
||||
});
|
||||
|
||||
// Handle the network_tools form.
|
||||
$("#network_tools").on("submit", function(e){
|
||||
var target = $("#remote_target").val();
|
||||
var agent = $("#agent").val();
|
||||
var command = $("#command").val();
|
||||
|
||||
// Some validation browser-side. Still need to do the same server-side.
|
||||
if(target.length === 0){
|
||||
// target input is empty.
|
||||
$("#output").removeClass('hide').addClass('show').html("<pre>" + target_empty + "</pre>");
|
||||
}else if(agent.length === 0){
|
||||
// We'll only get to this point if there's no agents, or all agents are offline but the form was still submitted.
|
||||
$("#output").removeClass('hide').addClass('show').html("<pre>" + agent_invalid + "</pre>");
|
||||
}else if(command.length === 0){
|
||||
// We'll only get to this point if there's no command specified.
|
||||
$("#output").removeClass('hide').addClass('show').html("<pre>" + command_empty + "</pre>");
|
||||
}else{
|
||||
$("#loading").removeClass('hide').addClass('show');
|
||||
$("#output").removeClass('show').addClass('hide');
|
||||
|
||||
$("#network_tools button").prop({disabled:true}); // Disable the submit button if we're about to post - preventing stuff being ran several times via spamming the button and/or enter.
|
||||
$.post("home.php?m=util&p=network_tools&type=cleared", $("#network_tools").serialize(), function(postCommand){
|
||||
$("#loading").removeClass('show').addClass('hide');
|
||||
$("#output").removeClass('hide').addClass('show').html("<pre>" + postCommand + "</pre>");
|
||||
|
||||
$("#network_tools button").prop({disabled:false});
|
||||
}).fail(function(){
|
||||
$("#loading").removeClass('show').addClass('hide');
|
||||
$("#output").removeClass('hide').addClass('show').html("<pre>" + post_failed + "</pre>");
|
||||
|
||||
$("#network_tools button").prop({disabled:false});
|
||||
});
|
||||
}
|
||||
e.preventDefault();
|
||||
});// ./end network_tools form handling.
|
||||
|
||||
// ----- Sourcemod Admins -----
|
||||
$.getJSON("home.php?m=util&p=addadmin_helper&type=cleared", function(gs){
|
||||
if(gs.length === 0){
|
||||
$("#no_servers").removeClass('hide').addClass('show');
|
||||
}else{
|
||||
var games = "";
|
||||
$("#add_admin").removeClass('hide').addClass('show');
|
||||
|
||||
games += "<label for=\"gameserver_id\">" + select_server + "</label>\r\n"
|
||||
games += "<select id=\"gameserver_id\" name=\"gameserver_id\">\r\n"
|
||||
games += "<option value=\"0\" selected>" + select_server_option + "</option>\r\n"
|
||||
|
||||
for(var i = 0; i<gs.length; ++i){
|
||||
games += "\t<option value=\"" + gs[i]['home_id'] + "\">" + gs[i]['home_name'] +"</option>\r\n";
|
||||
}
|
||||
|
||||
games += "</select>";
|
||||
$("#games").html(games);
|
||||
|
||||
$("#gameserver_id").change(function(){
|
||||
var home = $("#gameserver_id").val();
|
||||
var gameserver_id = $("#gameserver_id").val();
|
||||
|
||||
// although the disabled attribute is put on the option, set all the values to 0 if it's somehow chosen again via the form being edited
|
||||
if(gameserver_id == 0){
|
||||
$("#remote_server_id").val(0);
|
||||
$("#gameserver_name").val(0);
|
||||
$("#gameserver_ip").val(0);
|
||||
$("#gameserver_port").val(0);
|
||||
}else{
|
||||
for(var i = 0; i<gs.length; ++i){
|
||||
if(home === gs[i]['home_id']){
|
||||
$("option[value='0']").attr("disabled", "disabled");
|
||||
$("#remote_server_id").val(gs[i]['remote_server_id']);
|
||||
$("#gameserver_name").val(gs[i]['game_name']);
|
||||
$("#gameserver_ip").val(gs[i]['ip']);
|
||||
$("#gameserver_port").val(gs[i]['port']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // ./end Sourcemod Admins
|
||||
|
||||
$("#sourcemod_perms").change(function(){
|
||||
var sourcemod_perms = $("#sourcemod_perms").val();
|
||||
|
||||
if(sourcemod_perms === 'root'){
|
||||
$("#sourcemod_flagList").removeClass('show').addClass('hide');
|
||||
$('.item input[type="checkbox"]').prop('checked', false);
|
||||
}else{
|
||||
$("#sourcemod_flagList").removeClass('hide').addClass('show');
|
||||
}
|
||||
});
|
||||
|
||||
// Process the sourcemod admin form on submission.
|
||||
$("#addadmin_form").on("submit", function(e){
|
||||
$("#addadmin_form button").prop({disabled:true});
|
||||
|
||||
var errors = 0;
|
||||
var remoteId = $("#remote_server_id").val();
|
||||
var gameName = $("#gameserver_name").val();
|
||||
var gameIp = $("#gameserver_ip").val();
|
||||
var gamePort = $("#gameserver_port").val();
|
||||
var addSteamid = $("#addSteamid").val();
|
||||
var immunity = $("#immunity").val();
|
||||
|
||||
// Set the message divs back to defaults.
|
||||
$("#invalid_server").removeClass('show').addClass('hide');
|
||||
$("#invalid_steamid_admin").removeClass('show').addClass('hide');
|
||||
$("#invalid_response_admin").removeClass('show').addClass('hide');
|
||||
$("#invalid_immunity").removeClass('show').addClass('hide');
|
||||
$("#addadmin_response").removeClass('show').addClass('hide');
|
||||
|
||||
if(remoteId.length === 0 || gameName.length === 0 || gameIp.length === 0 || gamePort.length === 0){
|
||||
$("#invalid_server").removeClass('hide').addClass('show');
|
||||
++errors;
|
||||
}
|
||||
|
||||
if(!(addSteamid.match(/^STEAM_[01]:[01]:\d+$/))){
|
||||
$("#invalid_steamid_admin").removeClass('hide').addClass('show');
|
||||
++errors;
|
||||
}
|
||||
|
||||
if(immunity.length > 2 || isNaN(immunity)){
|
||||
$("#invalid_immunity").removeClass('hide').addClass('show');
|
||||
++errors;
|
||||
}
|
||||
|
||||
if(errors === 0){
|
||||
$.post("home.php?m=util&p=addadmin_helper&type=cleared", $("#addadmin_form").serialize(), function(postCommand){
|
||||
$("#addadmin_response").removeClass('hide').addClass('show').html(postCommand);
|
||||
$("#addadmin_form button").prop({disabled:false});
|
||||
}).fail(function(){
|
||||
$("#invalid_response_admin").removeClass('hide').addClass('show');
|
||||
$("#addadmin_form button").prop({disabled:false});
|
||||
});
|
||||
}else{
|
||||
$("#addadmin_form button").prop({disabled:false});
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
}); // add_admin form handling
|
||||
|
||||
// ----- AMX mod Admins -----
|
||||
$.getJSON("home.php?m=util&p=amx_addadmin_helper&type=cleared", function(gs){
|
||||
if(gs.length === 0){
|
||||
$("#amx_no_servers").removeClass('hide').addClass('show');
|
||||
}else{
|
||||
var games = "";
|
||||
$("#amx_add_admin").removeClass('hide').addClass('show');
|
||||
|
||||
games += "<label for=\"amx_gameserver_id\">" + select_server + "</label>\r\n"
|
||||
games += "<select id=\"amx_gameserver_id\" name=\"amx_gameserver_id\">\r\n"
|
||||
games += "<option value=\"0\" selected>" + select_server_option + "</option>\r\n"
|
||||
|
||||
for(var i = 0; i<gs.length; ++i){
|
||||
games += "\t<option value=\"" + gs[i]['home_id'] + "\">" + gs[i]['home_name'] +"</option>\r\n";
|
||||
}
|
||||
|
||||
games += "</select>";
|
||||
$("#amx_games").html(games);
|
||||
|
||||
$("#amx_gameserver_id").change(function(){
|
||||
var home = $("#amx_gameserver_id").val();
|
||||
var gameserver_id = $("#amx_gameserver_id").val();
|
||||
|
||||
// although the disabled attribute is put on the option, set all the values to 0 if it's somehow chosen again via the form being edited
|
||||
if(gameserver_id == 0){
|
||||
$("#amx_remote_server_id").val(0);
|
||||
$("#amx_gameserver_name").val(0);
|
||||
$("#amx_gameserver_ip").val(0);
|
||||
$("#amx_gameserver_port").val(0);
|
||||
}else{
|
||||
for(var i = 0; i<gs.length; ++i){
|
||||
if(home === gs[i]['home_id']){
|
||||
$("option[value='0']").attr("disabled", "disabled");
|
||||
$("#amx_remote_server_id").val(gs[i]['remote_server_id']);
|
||||
$("#amx_gameserver_name").val(gs[i]['game_name']);
|
||||
$("#amx_gameserver_ip").val(gs[i]['ip']);
|
||||
$("#amx_gameserver_port").val(gs[i]['port']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}); // ./end AMX mod Admins
|
||||
|
||||
$("#amx_mod_perms").change(function(){
|
||||
var amx_mod_perms = $("#amx_mod_perms").val();
|
||||
|
||||
if(amx_mod_perms === 'root'){
|
||||
$("#amx_mod_flagList").removeClass('show').addClass('hide');
|
||||
$('.amx_item input[type="checkbox"]').prop('checked', false);
|
||||
}else{
|
||||
$("#amx_mod_flagList").removeClass('hide').addClass('show');
|
||||
}
|
||||
});
|
||||
|
||||
$("#amx_login_type").change(function(){
|
||||
var amx_login_type = $("#amx_login_type").val();
|
||||
|
||||
if(amx_login_type === 'amx_login_steamid'){
|
||||
$("#amx_login_nick_pass").removeClass('show').addClass('hide');
|
||||
$("#amx_Nickname").prop('required',false);
|
||||
$("#amx_Password").prop('required',false);
|
||||
$("#amx_Steamid").prop('required',true);
|
||||
$("#amx_login_steamid").removeClass('hide').addClass('show');
|
||||
}else{
|
||||
$("#amx_login_steamid").removeClass('show').addClass('hide');
|
||||
$("#amx_Nickname").prop('required',true);
|
||||
$("#amx_Password").prop('required',true);
|
||||
$("#amx_Steamid").prop('required',false);
|
||||
$("#amx_login_nick_pass").removeClass('hide').addClass('show');
|
||||
}
|
||||
});
|
||||
|
||||
// Process the amx mod admin form on submission.
|
||||
$("#amx_addadmin_form").on("submit", function(e){
|
||||
$("#amx_addadmin_form button").prop({disabled:true});
|
||||
|
||||
var errors = 0;
|
||||
var remoteId = $("#amx_remote_server_id").val();
|
||||
var gameName = $("#amx_gameserver_name").val();
|
||||
var gameIp = $("#amx_gameserver_ip").val();
|
||||
var gamePort = $("#amx_gameserver_port").val();
|
||||
var login_type = $("#amx_login_type").val();
|
||||
|
||||
// Set the message divs back to defaults.
|
||||
$("#amx_invalid_server").removeClass('show').addClass('hide');
|
||||
$("#amx_invalid_nickname_admin").removeClass('show').addClass('hide');
|
||||
$("#amx_invalid_password_admin").removeClass('show').addClass('hide');
|
||||
$("#amx_invalid_steamid_admin").removeClass('show').addClass('hide');
|
||||
$("#amx_invalid_response_admin").removeClass('show').addClass('hide');
|
||||
$("#amx_addadmin_response").removeClass('show').addClass('hide');
|
||||
|
||||
if(login_type == 'amx_login_steamid')
|
||||
{
|
||||
var Steamid = $("#amx_Steamid").val();
|
||||
if(!(Steamid.match(/^STEAM_[01]:[01]:\d+$/))){
|
||||
$("#amx_invalid_steamid_admin").removeClass('hide').addClass('show');
|
||||
++errors;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var Nickname = $("#amx_Nickname").val();
|
||||
var Password = $("#amx_Password").val();
|
||||
if(!(Nickname.match(/^[^\s][A-zÀ-ÿ0-9 !@)(,}/|\.:?;{#$%&*+=-]{1,28}[^\s]$/))){
|
||||
$("#amx_invalid_nickname_admin").removeClass('hide').addClass('show');
|
||||
++errors;
|
||||
}
|
||||
if(!(Password.match(/^[^\s][A-zÀ-ÿ0-9 !@)(,}/|\.:?;{#$%&*+=-]{1,28}[^\s]$/))){
|
||||
$("#amx_invalid_password_admin").removeClass('hide').addClass('show');
|
||||
++errors;
|
||||
}
|
||||
}
|
||||
|
||||
if(remoteId.length === 0 || gameName.length === 0 || gameIp.length === 0 || gamePort.length === 0){
|
||||
$("#amx_invalid_server").removeClass('hide').addClass('show');
|
||||
++errors;
|
||||
}
|
||||
|
||||
if(errors === 0){
|
||||
$.post("home.php?m=util&p=amx_addadmin_helper&type=cleared", $("#amx_addadmin_form").serialize(), function(postCommand){
|
||||
$("#amx_addadmin_response").removeClass('hide').addClass('show').html(postCommand);
|
||||
$("#amx_addadmin_form button").prop({disabled:false});
|
||||
}).fail(function(){
|
||||
$("#amx_invalid_response_admin").removeClass('hide').addClass('show');
|
||||
$("#amx_addadmin_form button").prop({disabled:false});
|
||||
});
|
||||
}else{
|
||||
$("#amx_addadmin_form button").prop({disabled:false});
|
||||
}
|
||||
e.preventDefault();
|
||||
}); // add_admin form handling
|
||||
|
||||
// ----- Steam Converter -----
|
||||
$("#steam_converter").on("submit", function(e){
|
||||
$("#steam_converter button").prop({disabled:true});
|
||||
$.post("home.php?m=util&p=steamid_converter&type=cleared", $("#steam_converter").serialize(), function(steam_data){
|
||||
var json = $.parseJSON(steam_data);
|
||||
|
||||
if(json.length === 0){
|
||||
$("#steam_info").removeClass('show').addClass('hide');
|
||||
$("#invalid_steamid").removeClass('hide').addClass('show');
|
||||
$("#invalid_response").removeClass('show').addClass('hide');
|
||||
|
||||
$("#steam_converter button").prop({disabled:false});
|
||||
}else{
|
||||
$("#steam_info").removeClass('hide').addClass('show');
|
||||
$("#invalid_steamid").removeClass('show').addClass('hide');
|
||||
$("#invalid_response").removeClass('show').addClass('hide');
|
||||
|
||||
$("#steamLink").html('<b>Profile Link:</b> ' + json.steamProfile);
|
||||
$("#steamId").html('<b>Legacy ID:</b> ' + json.steamId);
|
||||
$("#steamId3").html('<b>SteamID3:</b> ' + json.steamId3);
|
||||
$("#steamId64").html('<b>SteamID64:</b> ' + json.communityId);
|
||||
|
||||
$("#steam_converter button").prop({disabled:false});
|
||||
}
|
||||
}).fail(function(){
|
||||
$("#invalid_steamid").removeClass('show').addClass('hide');
|
||||
$("#steam_info").removeClass('show').addClass('hide');
|
||||
$("#invalid_response").removeClass('hide').addClass('show');
|
||||
});
|
||||
e.preventDefault();
|
||||
}); // ./end steam_converter form handling.
|
||||
|
||||
$("#your-address").click(function(){
|
||||
$("#remote_target").val($("#your-address").text());
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue