2013-03-24 15:44:44 +00:00
function HandleRequest_ManageServer ( Request )
local Content = ""
if ( Request.PostParams [ "RestartServer" ] ~= nil ) then
2013-05-06 13:35:04 +00:00
cRoot : Get (): ExecuteConsoleCommand ( "restart" )
2013-03-24 15:44:44 +00:00
elseif ( Request.PostParams [ "ReloadServer" ] ~= nil ) then
cRoot : Get (): GetPluginManager (): ReloadPlugins ()
elseif ( Request.PostParams [ "StopServer" ] ~= nil ) then
2013-05-06 13:35:04 +00:00
cRoot : Get (): ExecuteConsoleCommand ( "stop" )
2013-06-13 17:05:53 +00:00
elseif ( Request.PostParams [ "WorldSaveAllChunks" ] ~= nil ) then
cRoot : Get (): GetWorld ( Request.PostParams [ "WorldSaveAllChunks" ]): SaveAllChunks ()
2013-03-24 15:44:44 +00:00
end
Content = Content .. [[
2013-06-13 17:05:53 +00:00
<form method="POST">
<table>
<th colspan="2">Manage Server</th>
<tr><td><input type="submit" value="Restart Server" name="RestartServer"> restart the server</td></tr> <br />
<tr><td><input type="submit" value="Reload Server" name="ReloadServer"> reload the server</td></tr> <br />
<tr><td><input type="submit" value="Stop Server" name="StopServer"> stop the server</td></tr> <br />
</th>
2013-03-24 15:44:44 +00:00
</table>
2013-06-13 17:05:53 +00:00
<table>
<th colspan="2">Manage Worlds</th>
2013-03-24 15:44:44 +00:00
]]
2013-06-13 17:05:53 +00:00
local LoopWorlds = function ( World )
Content = Content .. [[
<tr><td><input type="submit" value="]] .. World : GetName () .. [[" name="WorldSaveAllChunks"> Save all the chunks of world ]] .. World : GetName () .. [[</td></tr> <br />
]]
end
cRoot : Get (): ForEachWorld ( LoopWorlds )
Content = Content .. "</th></table>"
2013-03-24 15:44:44 +00:00
return Content
end