summaryrefslogtreecommitdiffstats
path: root/MCServer/webadmin
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-19 19:53:14 +0200
committerMattes D <github@xoft.cz>2015-04-19 19:53:14 +0200
commitba6f5aea4c088b92365b6636d96873a82706c8c8 (patch)
treed8c6f3a3eda7c0ed1f70bc5a01b97b90d940eab4 /MCServer/webadmin
parentClientHandle: Fixed re-sending refused right-clicks. (diff)
parentRefresh plugin list before trying to load. (diff)
downloadcuberite-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 '')
-rw-r--r--MCServer/webadmin/(original).html375
-rw-r--r--MCServer/webadmin/template.lua20
-rw-r--r--MCServer/webadmin/template_orig.lua137
3 files changed, 11 insertions, 521 deletions
diff --git a/MCServer/webadmin/(original).html b/MCServer/webadmin/(original).html
deleted file mode 100644
index 673a93ada..000000000
--- a/MCServer/webadmin/(original).html
+++ /dev/null
@@ -1,375 +0,0 @@
-<!DOCTYPE html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="icon" href="files/favicon.ico">
-<title>{TITLE}</title>
-
-<style type="text/css" media="screen">
-
- /* reset CSS */
-
- html, body, div, span, applet, object, iframe,
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
- a, abbr, acronym, address, big, cite, code,
- del, dfn, em, font, img, ins, kbd, q, s, samp,
- small, strike, strong, sub, sup, tt, var,
- b, u, i, center,
- dl, dt, dd, ol, ul, li,
- fieldset, form, label, legend,
- table, caption, tbody, tfoot, thead, tr, th, td {
- margin: 0;
- padding: 0;
- border: 0;
- outline: 0;
- font-size: 100%;
- vertical-align: baseline;
- background: transparent;
- }
- body {
- line-height: 1;
- }
- ol, ul {
- list-style: none;
- }
- blockquote, q {
- quotes: none;
- }
-
- /* remember to define focus styles! */
- :focus {
- outline: 0;
- }
-
- /* remove textarea resize at Safari */
- textarea {
- resize: none;
- }
-
- /* remember to highlight inserts somehow! */
- ins {
- text-decoration: none;
- }
- del {
- text-decoration: line-through;
- }
-
- /* tables still need 'cellspacing="0"' in the markup */
- table {
- border-collapse: collapse;
- border-spacing: 0;
- }
-
-
- /*
- Origional from http://www.perspectived.com/
- Modified by Ben Phelps
- Made for FakeTruth - MCServer
- */
-
- /* Basic ---------------------------------------- */
-
- .clear { clear: both; }
-
- body {
- background: white;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 12px;
- color: #646464;
- text-align: center;
- }
-
- #wrapper {
- text-align: left;
- width: 930px;
- margin: 0 auto;
- }
-
- /* Logo ---------------------------------------- */
-
- h1 {
- margin: 15px 0 10px 5px;
- width: 180px;
- height: 36px;
- background: url(files/logo.png) no-repeat left top;
- }
-
- h1 a {
- display: block;
- width: 225px;
- height: 28px;
- }
-
- h1 span { display: none; }
-
- a {
- color: #646464;
- }
-
- /* Container ---------------------------------------- */
-
- #containerHolder {
- background: #eee;
- padding: 5px;
- }
-
-
- #container {
- background: #fff url(files/background.gif) repeat-y left top;
- border: 1px solid #ddd;
- width: 918px;
-
- }
-
- #connectHolder {
- background: #eee;
- padding: 5px;
- margin-bottom:8px;
- }
-
-
- #connect {
- border: 1px solid #ddd;
- background-color: #fff;
- padding:5px;
- width: 908px;
- }
-
- .pics {
- height: 375px;
- width: 600px;
- }
-
- .pics img {
- padding: 5px;
- border: 1px solid #ddd;
- background-color: #eee;
- width: 600px;
- height: 375px;
- margin-left: 15px;
- }
-
- /* Login -------------------------------------- */
-
- #loginLogo {
- margin: 0 auto;
- margin-top:100px;
- width: 180px;
- height: 36px;
- background-image: url(files/logo.png);
- }
-
- #loginHolder {
- background: #eee;
- padding: 5px;
- width: 310px;
- margin: 0 auto;
- height: 90px;
- margin-top:20px;
- }
-
- #login {
- padding:10px;
- width: 288px;
- height: 68px;
- border: 1px solid #ddd;
- background:#fff;
- text-align: left;
- }
-
-
- /* Sidebar ---------------------------------------- */
-
- #sidebar {
- width: 179px;
- float: left;
- }
-
- #sidebar .sideNav { width: 179px; }
-
- #sidebar .sideNav li { border-bottom: 1px solid #ddd; width: 179px; }
-
- #sidebar .sideNav li a {
- display: block;
- color: #646464;
- background: #f6f6f6;
- text-decoration: none;
- height: 29px;
- line-height: 29px;
- padding: 0 19px;
- width: 141px;
- }
-
- #sidebar .sideNav li a:hover { background: #fdfcf6; }
-
- #sidebar .sideNav li a.active, #sidebar .sideNav li a.active:hover {
- background: #f0f7fa;
- color: #c66653;
- }
-
- /* Breadcrumb ---------------------------------------- */
-
- h2 {
- width: 718px;
- float: right;
- color: #646464;
- font-size: 16px;
- line-height: 16px;
- font-weight: bold;
- margin: 20px 0 0 0;
- padding: 0 0 10px 0;
- border-bottom: 1px solid #ddd;
- }
-
- h2 a {
- color: #646464;
- text-decoration: none;
- }
-
- h2 a.active { color: #c66653; }
-
- h2 a:hover { text-decoration: underline; }
-
- /* Content ---------------------------------------- */
-
- #main {
- width: 700px;
- float: right;
- padding: 0 19px 0 0;
- }
-
- #main p {
-
- padding: 10px;
-
- }
-
- h3 {
- font-size: 14px;
- line-height: 14px;
- font-weight: bold;
- color: #5494af;
- padding: 0 0 0 10px;
- margin: 20px 0 10px;
- }
-
- h4 {
- padding: 0 0 0 10px;
- margin: 20px 0 10px;
- }
-
- #main ul {
- padding: 0 0 0 10px;
- list-style-type: circle;
- list-style-position: inside;
- }
-
- #main table {
- border-top: 1px solid #ddd;
- width: 700px;
- }
-
- #main table tr th {
- text-align: left;
- background: #f6f6f6;
- padding: 0px 20px;
- height: 20px;
- line-height: 20px;
- border-bottom: 1px solid #ddd;
- }
-
- #main table tr td {
- background: #f6f6f6;
- padding: 0px 20px;
- height: 29px;
- line-height: 29px;
- border-bottom: 1px solid #ddd;
- }
-
- #main table tr.odd td {
- background: #fbfbfb;
- }
-
- #main table tr:hover td { background: #fdfcf6; }
-
- #main table .action {
- text-align: right;
- padding: 0 20px 0 10px;
- }
-
- #main table tr .action a { margin: 0 0 0 10px; text-decoration: none; color: #9b9b9b; }
- #main table tr:hover .action .edit { color: #c5a059; }
- #main table tr:hover .action .delete { color: #a02b2b; }
- #main table tr:hover .action .view { color: #55a34a; }
-
- #main table tr:hover .action a:hover { text-decoration: underline; }
-
- fieldset {
- border: 1px solid #ddd;
- padding: 19px;
- margin: 0 0 20px 0;
- background: #fbfbfb;
- }
-
- form p { margin: 0 0 14px 0; float: left; width: 100%; }
-
- label {
- display: block;
- width: 100%;
- margin: 0 0 7px 0;
- line-height: 12px;
- }
-
- /* Footer ---------------------------------------- */
-
- #footer {
- margin: 10px 0 30px 0;
- font-size: 11px;
- line-height: 11px;
- color: #9B9B9B;
- padding: 0 0 0 5px;
- }
-
- #footer a { color: #9B9B9B; }
-
- #footer a:hover { text-decoration: none; }
-</style>
-
-</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="./"><span>{TITLE}</span></a></h1>
-
- <div id="containerHolder">
- <div id="container">
- <div id="sidebar">
- <ul class="sideNav">
- {MENU}
- </ul>
- <!-- // .sideNav -->
- </div>
- <!-- // #sidebar -->
-
- <!-- h2 stays for breadcrumbs -->
- <h2>Welcome {USERNAME}</h2>
-
- <div id="main">
- <h3>{PLUGIN_NAME}</h3>
-
- {CONTENT}
-
- </div>
- <!-- // #main -->
-
- <div class="clear"></div>
- </div>
- <!-- // #container -->
- </div>
- <!-- // #containerHolder -->
-
- <p id="footer">MCServer is using: {MEM}MB of memory; Current chunk count: {NUMCHUNKS} </p>
- </div>
- <!-- // #wrapper -->
-</body>
-</html>
diff --git a/MCServer/webadmin/template.lua b/MCServer/webadmin/template.lua
index 6ea7b69bc..9d0f860db 100644
--- a/MCServer/webadmin/template.lua
+++ b/MCServer/webadmin/template.lua
@@ -30,20 +30,22 @@ function GetDefaultPage()
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 .. " (version " .. value:GetVersion() .. ")</li>"
+ PM:ForEachPlugin(
+ function (a_CBPlugin)
+ if (a_CBPlugin:IsLoaded()) then
+ Content = Content .. "<li>" .. a_CBPlugin:GetName() .. " (version " .. a_CBPlugin:GetVersion() .. ")</li>"
+ end
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 )
+ cRoot:Get():ForEachPlayer(
+ function(a_CBPlayer)
+ Content = Content .. "<li>" .. Player:GetName() .. "</li>"
+ end
+ )
Content = Content .. "</ul><br>";
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