From ca3f2b5a7a1a8689e33b3406e221d506a0ca62c5 Mon Sep 17 00:00:00 2001 From: rylon Date: Mon, 30 Sep 2013 00:01:13 +0200 Subject: [PATCH] mojotrollz serverhandling mod for restart etc --- mojotrollz/path/PSAI.php | 5 ++ .../main.tpl | 4 +- .../saimod_mojotrollz_server_handling.js | 55 +++++++++++++++++++ .../saimod_mojotrollz_server_handling.php | 24 +++++++- 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 mojotrollz/path/PSAI.php create mode 100644 mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.js diff --git a/mojotrollz/path/PSAI.php b/mojotrollz/path/PSAI.php new file mode 100644 index 0000000..bb8c86c --- /dev/null +++ b/mojotrollz/path/PSAI.php @@ -0,0 +1,5 @@ +(re)start realm +Status: ${status_realm}

- \ No newline at end of file + +Status: ${status_world} \ No newline at end of file diff --git a/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.js b/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.js new file mode 100644 index 0000000..75f74cf --- /dev/null +++ b/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.js @@ -0,0 +1,55 @@ +function init_saimod_mojotrollz_server_handling(){ + $('#realm_start').click(function(){ + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: 'saimod_mojotrollz_server_handling', + action: 'realmstart' + }, + type: 'POST', + + }); + update_realmstatus(); + }); + $('#realm_stop').click(function(){ + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: 'saimod_mojotrollz_server_handling', + action: 'realmstop' + }, + type: 'POST', + + }); + update_realmstatus(); + }); + $('#world_start').click(function(){ + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: 'saimod_mojotrollz_server_handling', + action: 'worldstart' + }, + type: 'POST', + + }); + update_worldstatus(); + }); + $('#world_stop').click(function(){ + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: 'saimod_mojotrollz_server_handling', + action: 'worldstop' + }, + type: 'POST', + + }); + update_worldstatus(); + }); +} + +function update_realmstatus(){ + $('status_realm').load(SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_server_handling&action=realmstatus'); +} + +function update_worldstatus(){ + $('status_world').load(SAI_ENDPOINT+'sai_mod=saimod_mojotrollz_server_handling&action=world status'); +} + diff --git a/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php b/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php index db0a3b1..6811463 100644 --- a/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php +++ b/mojotrollz/sai/saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.php @@ -1,10 +1,30 @@ server handling
  • ';} public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} - public static function sai_mod_saimod_mojotrollz_server_handling_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array());} + public static function sai_mod_saimod_mojotrollz_server_handling_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array( + \SYSTEM\WEBPATH(new PSAI(),'saimod_mojotrollz_server_handling/saimod_mojotrollz_server_handling.js') + ));} public static function sai_mod_saimod_mojotrollz_server_handling_flag_css(){} + + public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstart(){ + return shell_exec('/home/mojotrolls/mojo_zero/realm start 2>&1');} + public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstop(){ + return shell_exec('/home/mojotrolls/mojo_zero/realm stop 2>&1');} + public static function sai_mod_saimod_mojotrollz_server_handling_action_realmstatus(){ + return shell_exec('/home/mojotrolls/mojo_zero/realm status 2>&1');} + public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstart(){ + return shell_exec('/home/mojotrolls/mojo_zero/world start 2>&1');} + public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstop(){ + return shell_exec('/home/mojotrolls/mojo_zero/world stop 2>&1');} + public static function sai_mod_saimod_mojotrollz_server_handling_action_worldstatus(){ + return shell_exec('/home/mojotrolls/mojo_zero/world status 2>&1');} + public static function sai_mod_saimod_mojotrollz_server_handling_action_compile(){ + return shell_exec('/home/mojotrolls/mojo_zero/compile 2>&1');} } \ No newline at end of file