diff options
author | Mattes D <github@xoft.cz> | 2015-04-19 19:53:14 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-04-19 19:53:14 +0200 |
commit | ba6f5aea4c088b92365b6636d96873a82706c8c8 (patch) | |
tree | d8c6f3a3eda7c0ed1f70bc5a01b97b90d940eab4 /MCServer/webadmin/template_orig.lua | |
parent | ClientHandle: Fixed re-sending refused right-clicks. (diff) | |
parent | Refresh plugin list before trying to load. (diff) | |
download | cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.gz cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.bz2 cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.lz cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.xz cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.tar.zst cuberite-ba6f5aea4c088b92365b6636d96873a82706c8c8.zip |
Diffstat (limited to 'MCServer/webadmin/template_orig.lua')
-rw-r--r-- | MCServer/webadmin/template_orig.lua | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/MCServer/webadmin/template_orig.lua b/MCServer/webadmin/template_orig.lua deleted file mode 100644 index a7480f83e..000000000 --- a/MCServer/webadmin/template_orig.lua +++ /dev/null @@ -1,137 +0,0 @@ --- Use a table for fast concatenation of strings -local SiteContent = {} -function Output(String) - table.insert(SiteContent, String) -end - - - - - -function GetTableSize(Table) - local Size = 0 - for key,value in pairs(Table) do - Size = Size + 1 - end - return Size -end - - - - - -function GetDefaultPage() - local PM = cRoot:Get():GetPluginManager() - - local SubTitle = "Current Game" - local Content = "" - - Content = Content .. "<h4>Server Name:</h4>" - Content = Content .. "<p>" .. cRoot:Get():GetServer():GetServerID() .. "</p>" - - Content = Content .. "<h4>Plugins:</h4><ul>" - local AllPlugins = PM:GetAllPlugins() - for key,value in pairs(AllPlugins) do - if( value ~= nil and value ~= false ) then - Content = Content .. "<li>" .. key .. " V." .. value:GetVersion() .. "</li>" - end - end - - Content = Content .. "</ul>" - Content = Content .. "<h4>Players:</h4><ul>" - - local AddPlayerToTable = function( Player ) - Content = Content .. "<li>" .. Player:GetName() .. "</li>" - end - cRoot:Get():ForEachPlayer( AddPlayerToTable ) - - Content = Content .. "</ul><br>"; - - return Content, SubTitle -end - - - - - -function ShowPage(WebAdmin, TemplateRequest) - SiteContent = {} - local BaseURL = WebAdmin:GetBaseURL(TemplateRequest.Request.Path) - local Title = "MCServer WebAdmin" - local MemoryUsageKiB = cRoot:GetPhysicalRAMUsage() - local NumChunks = cRoot:Get():GetTotalChunkCount() - local PluginPage = WebAdmin:GetPage(TemplateRequest.Request) - local PageContent = PluginPage.Content - local SubTitle = PluginPage.PluginName - if (PluginPage.TabName ~= "") then - SubTitle = PluginPage.PluginName .. " - " .. PluginPage.TabName - end - if (PageContent == "") then - PageContent, SubTitle = GetDefaultPage() - end - - Output([[ -<!DOCTYPE html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<link rel="icon" href="/favicon.ico"> -<title>]] .. Title .. [[</title> -<link rel="stylesheet" type="text/css" media="screen" href="/style.css"> -</head> - -<body> - <div id="wrapper"> - <!-- h1 tag stays for the logo, you can use the a tag for linking the index page --> - <h1> - <a href="]] .. BaseURL .. [["><span>MCServer</span></a> - </h1> - <div id="containerHolder"> - <div id="container"> - <div id="sidebar"> - <ul class="sideNav"> - ]]) - - - local AllPlugins = WebAdmin:GetPlugins() - for key,value in pairs(AllPlugins) do - local PluginWebTitle = value:GetWebTitle() - local TabNames = value:GetTabNames() - if (GetTableSize(TabNames) > 0) then - Output("<li>"..PluginWebTitle.."</li>\n"); - - for webname,prettyname in pairs(TabNames) do - Output("<li><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "'>" .. prettyname .. "</a></li>\n") - end - end - end - - - Output([[ - </ul> - <!-- // .sideNav --> - </div> - <!-- // #sidebar --> - <!-- h2 stays for breadcrumbs --> - <h2>Welcome ]] .. TemplateRequest.Request.Username .. [[</h2> - <div id="main"> - <h3>]] .. SubTitle .. [[</h3> - ]] .. PageContent .. [[ - </div> - <!-- // #main --> - - <div class="clear"></div> - - </div> - <!-- // #container --> - </div> - <!-- // #containerHolder --> - - <p id="footer">MCServer is using: ]] .. MemoryUsageKiB / 1024 .. [[ MiB of memory; Current chunk count: ]] .. NumChunks .. [[ </p> - </div> - <!-- // #wrapper --> -</body> -</html> - ]]) - - return table.concat(SiteContent) -end |