From 017ba1c32a8f5f43dcf769692ad2ffea497aee5e Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Sun, 5 Oct 2014 11:08:10 +0200 Subject: [PATCH 1/5] Made WebAdmin design more modern --- MCServer/webadmin/files/style.css | 582 +++++++++++++++------------- MCServer/webadmin/template.lua | 65 ++-- MCServer/webadmin/template_orig.lua | 137 +++++++ 3 files changed, 475 insertions(+), 309 deletions(-) create mode 100644 MCServer/webadmin/template_orig.lua diff --git a/MCServer/webadmin/files/style.css b/MCServer/webadmin/files/style.css index e7ffe3999..a1d9993de 100644 --- a/MCServer/webadmin/files/style.css +++ b/MCServer/webadmin/files/style.css @@ -1,326 +1,354 @@ -/* reset CSS */ +body, html +{ + font-family: "Open Sans"; + padding: 0; + margin: 0; + font-weight: 400; + background-color: #fbe9e7; + color: rgba(0, 0, 0, 0.87); +} -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 { +.light { font-weight: 300; } +.bold { font-weight: 600; } + +#wrapper +{ + background-color: #ff5722; + margin: 40px auto; + width: 99%; + max-width: 1200px; + box-sizing: border-box; + -moz-box-sizing: border-box; + box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.15); + color: rgba(0, 0, 0, 0.87); +} + +.title +{ + font-size: 30pt; + padding: 10px 40px; + text-decoration: none; + color: white; + text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3); + display: block; +} + +#sidebar +{ + float: left; + width: 20%; +} + +.sideNav +{ + list-style: none; + background-color: #fafafa; + margin: 20px 0; + padding: 5px 0; + width: 100%; + box-shadow: 1px 0px 10px rgba(0, 0, 0, 0.2); +} + +.sideNav li +{ + padding: 10px; + color: rgba(0, 0, 0, 0.54); +} + +.sideNav li.link +{ + padding-left: 30px; +} + +.sideNav li.link a +{ + text-decoration: none; + color: rgba(0, 0, 0, 0.87); +} + +#container +{ 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; + overflow: hidden; + background-color: #f5f5f5; } -/* remember to define focus styles! */ -:focus { - outline: 0; +#main +{ + float: right; + width: 80%; + padding: 0 15px 20px 15px; + box-sizing: border-box; + -moz-box-sizing: border-box; } -/* remove textarea resize at Safari */ -textarea { - resize: none; +.clear +{ + clear: both; } -/* remember to highlight inserts somehow! */ -ins { - text-decoration: none; -} -del { - text-decoration: line-through; -} - -/* tables still need 'cellspacing="0"' in the markup */ -table { +table +{ + width: 100%; border-collapse: collapse; - border-spacing: 0; } +table td +{ + padding: 5px; +} -/* - 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; +table th +{ + border-bottom: 1px solid rgba(0, 0, 0, 0.12); + padding: 5px; text-align: center; } -#wrapper { - text-align: left; - width: 930px; - margin: 0 auto; +table tr:nth-child(odd) +{ + background-color: rgba(0, 0, 0, 0.015); } -/* Logo ---------------------------------------- */ - -h1 { - margin: 15px 0 10px 5px; - width: 180px; - height: 36px; - background: url(logo.png) no-repeat left top; +p +{ + margin: 8px 0; + padding: 8px 3px; } -h1 a { +a +{ + text-decoration: none; + color: #0277bd; + -webkit-transition: color 0.1s linear; + -moz-transition: color 0.1s linear; + transition: color 0.1s linear; +} + +a:hover +{ + color: #01579b; +} + +.welcome-msg +{ + color: rgba(0, 0, 0, 0.54); +} + +.username +{ + text-transform: capitalize; + color: rgba(0, 0, 0, 0.87); +} + +a:hover +{ + color: black; +} + +input, select +{ + padding: 8px; +} + +form +{ + padding: 4px; +} + +.info input[type="submit"], .info button, .info input[type="button"], +.warn input[type="submit"], .warn button, .warn input[type="button"], +.err input[type="submit"], .err button, .err input[type="button"] +{ + float: right; +} + +.err +{ + color: white; display: block; - width: 225px; - height: 28px; + background-color: #e51c23 !important; + padding: 15px; + line-height: 30px; + min-height: 30px; } -h1 span { display: none; } - -a { - color: #646464; +.err:before +{ + content: "ERROR: "; } -/* Container ---------------------------------------- */ - -#containerHolder { - background: #eee; - padding: 5px; +.warn +{ + color: white; + display: block; + background-color: #ff5722 !important; + padding: 15px; + line-height: 30px; + min-height: 30px; } - -#container { - background: #fff url(background.gif) repeat-y left top; - border: 1px solid #ddd; - width: 918px; - +.warn:before +{ + content: "WARNING: "; } -#connectHolder { - background: #eee; - padding: 5px; - margin-bottom:8px; +.info +{ + color: white; + display: block; + background-color: #5677fc !important; + padding: 15px; + line-height: 30px; + min-height: 30px; } - -#connect { - border: 1px solid #ddd; - background-color: #fff; - padding:5px; - width: 908px; +.info:before +{ + content: "INFORMATION: "; } -.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(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; +#footer .fleft +{ 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; +#footer .fright +{ 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; +#footer +{ + margin: 0; + padding: 10px; + font-size: 9pt; + color: rgba(255, 255, 255, 0.8); + box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.2) inset; } -form p { margin: 0 0 14px 0; float: left; width: 100%; } +#footer a +{ + text-transform: none; + color: white; +} -label { - display: block; +input[type="submit"], button, input[type="button"] +{ + background-color: #ffc107; + padding: 8px 15px 8px 15px; + margin: 0 2px; + display: inline-block; + text-align: center; + color: black; + box-shadow: 0px 2px 3px rgba(0,0,0,0.2); + border: none; + outline: none; + cursor: pointer; +} + +input[type="submit"]:hover, button:hover, input[type="button"]:hover +{ + background-color: #ffca28; +} + +input[type="submit"]:active, button:active, input[type="button"]:active +{ + background-color: #ffd54f; + -webkit-transform: translateY(1px); + -moz-transform: translateY(1px); + transform: translateY(1px); +} + +hr +{ + border: none; + height: 1px; + background-color: rgba(0, 0, 0, 0.12); +} + +h4 +{ + padding-bottom: 10px; + margin-bottom: 12px; + border-bottom: 1px solid rgba(0, 0, 0, 0.12); +} + + +/**** PAGE SPECIFIC CSS ****/ + +/* remove the * for disabling: */ + +.page-core-server-settings table td +{ + text-align: center; + width: 25%; +} + +.page-core-server-settings.no-param table td:nth-child(1) a, +.page-core-server-settings.param-tab-general table td:nth-child(1) a +{ + font-weight: 600; + color: rgba(0, 0, 0, 0.87); +} + +.page-core-server-settings.param-tab-monsters table td:nth-child(2) a +{ + font-weight: 600; + color: rgba(0, 0, 0, 0.87); +} + +.page-core-server-settings.param-tab-worlds table td:nth-child(3) a +{ + font-weight: 600; + color: rgba(0, 0, 0, 0.87); +} + +.page-core-server-settings.param-tab-world table td:nth-child(4) a +{ + font-weight: 600; + color: rgba(0, 0, 0, 0.87); +} + +.page-core-permissions form table tr, +.page-core-permissions form table td, +.page-core-permissions form table th +{ + border: none; + background-color: transparent; +} + +.page-core-permissions form table tr:nth-child(1) th +{ + width: 35%; +} + +.page-core-permissions form table tr:nth-child(1) td +{ + width: 65%; +} + +.page-core-permissions form table td input +{ width: 100%; - margin: 0 0 7px 0; - line-height: 12px; + box-sizing: border-box; + -moz-box-sizing: border-box; + margin: 0; } -/* Footer ---------------------------------------- */ - -#footer { - margin: 10px 0 30px 0; - font-size: 11px; - line-height: 11px; - color: #9B9B9B; - padding: 0 0 0 5px; +#ChatDiv +{ + margin-bottom: 10px; } -#footer a { color: #9B9B9B; } +#ChatMessage +{ + width: 100%; + box-sizing: border-box; + -moz-box-sizing: border-box; +} -#footer a:hover { text-decoration: none; } + +/**/ \ No newline at end of file diff --git a/MCServer/webadmin/template.lua b/MCServer/webadmin/template.lua index a7480f83e..84a50b055 100644 --- a/MCServer/webadmin/template.lua +++ b/MCServer/webadmin/template.lua @@ -70,25 +70,33 @@ function ShowPage(WebAdmin, TemplateRequest) PageContent, SubTitle = GetDefaultPage() end + local reqParamsClass = "" + + for key,value in pairs(TemplateRequest.Request.Params) do + reqParamsClass = reqParamsClass .. " param-" .. string.lower(string.gsub(key, "[^a-zA-Z0-9]+", "-") .. "-" .. string.gsub(value, "[^a-zA-Z0-9]+", "-")) + end + + if (string.gsub(reqParamsClass, "%s", "") == "") then + reqParamsClass = " no-param" + end + Output([[ ]] .. Title .. [[ - + + - -
- -

- MCServer -

-
-
- - + +
- ]]) +]]) return table.concat(SiteContent) end diff --git a/MCServer/webadmin/template_orig.lua b/MCServer/webadmin/template_orig.lua new file mode 100644 index 000000000..a7480f83e --- /dev/null +++ b/MCServer/webadmin/template_orig.lua @@ -0,0 +1,137 @@ +-- 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 .. "

Server Name:

" + Content = Content .. "

" .. cRoot:Get():GetServer():GetServerID() .. "

" + + Content = Content .. "

Plugins:

    " + local AllPlugins = PM:GetAllPlugins() + for key,value in pairs(AllPlugins) do + if( value ~= nil and value ~= false ) then + Content = Content .. "
  • " .. key .. " V." .. value:GetVersion() .. "
  • " + end + end + + Content = Content .. "
" + Content = Content .. "

Players:

    " + + local AddPlayerToTable = function( Player ) + Content = Content .. "
  • " .. Player:GetName() .. "
  • " + end + cRoot:Get():ForEachPlayer( AddPlayerToTable ) + + Content = Content .. "

"; + + 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([[ + + + + +]] .. Title .. [[ + + + + +
+ +

+ MCServer +

+
+
+ + + +

Welcome ]] .. TemplateRequest.Request.Username .. [[

+
+

]] .. SubTitle .. [[

+ ]] .. PageContent .. [[ +
+ + +
+ +
+ +
+ + + +
+ + + + ]]) + + return table.concat(SiteContent) +end From 3baacce51e05ea4cc6d7352475b08a35ba8bc2a0 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Sun, 5 Oct 2014 11:14:16 +0200 Subject: [PATCH 2/5] Added license --- MCServer/webadmin/files/style.css | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/MCServer/webadmin/files/style.css b/MCServer/webadmin/files/style.css index a1d9993de..3c8c8750f 100644 --- a/MCServer/webadmin/files/style.css +++ b/MCServer/webadmin/files/style.css @@ -1,3 +1,19 @@ +/* + * Copyright 2014 WebFreak001 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + body, html { font-family: "Open Sans"; From 828ded593cad10018dce226541bf782e6f2f545e Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Sun, 5 Oct 2014 11:24:54 +0200 Subject: [PATCH 3/5] Added newline --- MCServer/webadmin/files/style.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MCServer/webadmin/files/style.css b/MCServer/webadmin/files/style.css index 3c8c8750f..5860c00e1 100644 --- a/MCServer/webadmin/files/style.css +++ b/MCServer/webadmin/files/style.css @@ -366,5 +366,4 @@ h4 -moz-box-sizing: border-box; } - -/**/ \ No newline at end of file +/**/ From cea0707ad5144e698fec6bf6a02174c7f1fd58cd Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Sun, 5 Oct 2014 11:35:29 +0200 Subject: [PATCH 4/5] Removed my license, added me to CONTRIBUTORS --- CONTRIBUTORS | 1 + MCServer/webadmin/files/style.css | 16 ---------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2d911a11d..e65239218 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -30,5 +30,6 @@ xoft Yeeeeezus (Donated AlchemistVillage prefabs) Howaner Masy98 +WebFreak001 Please add yourself to this list if you contribute to MCServer. diff --git a/MCServer/webadmin/files/style.css b/MCServer/webadmin/files/style.css index 5860c00e1..211f9f9a3 100644 --- a/MCServer/webadmin/files/style.css +++ b/MCServer/webadmin/files/style.css @@ -1,19 +1,3 @@ -/* - * Copyright 2014 WebFreak001 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - body, html { font-family: "Open Sans"; From 7aa81de2c67a3347720c9a5772832577b92a81d6 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Sun, 5 Oct 2014 11:48:44 +0200 Subject: [PATCH 5/5] added font callback --- MCServer/webadmin/files/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MCServer/webadmin/files/style.css b/MCServer/webadmin/files/style.css index 211f9f9a3..7f01b34b2 100644 --- a/MCServer/webadmin/files/style.css +++ b/MCServer/webadmin/files/style.css @@ -1,6 +1,6 @@ body, html { - font-family: "Open Sans"; + font-family: "Open Sans", Tahoma, sans-serif; padding: 0; margin: 0; font-weight: 400;