Added Admin Overview
This commit is contained in:
parent
5cd7f237a3
commit
ea2a790bad
@ -1,6 +1,6 @@
|
||||
package Assets
|
||||
|
||||
var CSSLog string = `
|
||||
var CSSAdmin string = `
|
||||
body {
|
||||
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
|
||||
color: #333;
|
||||
@ -75,6 +75,26 @@ p {
|
||||
.button.optionbuttons.applyfilters {
|
||||
margin-left: 0px;
|
||||
}
|
||||
.button.optionbuttons.currentoption {
|
||||
background-color: #00aeff;
|
||||
}
|
||||
.button.adminbutton {
|
||||
width: 222px;
|
||||
height: 50px;
|
||||
max-height: 50px;
|
||||
max-width: 222px;
|
||||
min-height: 50px;
|
||||
min-width: 222px;
|
||||
padding-top: 15px;
|
||||
background-color: #cfcfcf;
|
||||
color: black;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.button.adminbutton:hover {
|
||||
background-color: #00aeff;
|
||||
color: white;
|
||||
}
|
||||
.headercontainer {
|
||||
height: 50px;
|
||||
margin-top: -19px;
|
||||
@ -226,6 +246,19 @@ p {
|
||||
.labels {
|
||||
display: block;
|
||||
}
|
||||
.adminsection {
|
||||
margin-top: 30px;
|
||||
}
|
||||
.adminitem {
|
||||
min-height: 50px;
|
||||
background-color: #cfcfcf;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
}
|
||||
.adminitemlog {
|
||||
padding-top: 14px;
|
||||
}
|
||||
@media (max-width: 991px) {
|
||||
.icons.oneback {
|
||||
margin-left: 113px;
|
@ -1,54 +1,7 @@
|
||||
package Assets
|
||||
|
||||
var CSSNormalize string = `
|
||||
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
|
||||
/* ==========================================================================
|
||||
HTML5 display definitions
|
||||
========================================================================== */
|
||||
/**
|
||||
* Correct "block" display not defined in IE 8/9.
|
||||
*/
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
nav,
|
||||
section,
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
/**
|
||||
* Correct "inline-block" display not defined in IE 8/9.
|
||||
*/
|
||||
audio,
|
||||
canvas,
|
||||
video {
|
||||
display: inline-block;
|
||||
}
|
||||
/**
|
||||
* Prevent modern browsers from displaying "audio" without controls.
|
||||
* Remove excess height in iOS 5 devices.
|
||||
*/
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
/**
|
||||
* Address "[hidden]" styling not present in IE 8/9.
|
||||
* Hide the "template" element in IE, Safari, and Firefox < 22.
|
||||
*/
|
||||
[hidden],
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
/* ==========================================================================
|
||||
Base
|
||||
========================================================================== */
|
||||
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
|
||||
/**
|
||||
* 1. Set default font family to sans-serif.
|
||||
* 2. Prevent iOS text size adjust after orientation change, without disabling
|
||||
@ -68,20 +21,65 @@ html {
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
/* ==========================================================================
|
||||
Links
|
||||
/* HTML5 display definitions
|
||||
========================================================================== */
|
||||
/**
|
||||
* Correct 'block' display not defined for any HTML5 element in IE 8/9.
|
||||
* Correct 'block' display not defined for 'details' or 'summary' in IE 10/11
|
||||
* and Firefox.
|
||||
* Correct 'block' display not defined for 'main' in IE 11.
|
||||
*/
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
menu,
|
||||
nav,
|
||||
section,
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
/**
|
||||
* 1. Correct 'inline-block' display not defined in IE 8/9.
|
||||
* 2. Normalize vertical alignment of 'progress' in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
audio,
|
||||
canvas,
|
||||
progress,
|
||||
video {
|
||||
display: inline-block;
|
||||
/* 1 */
|
||||
vertical-align: baseline;
|
||||
/* 2 */
|
||||
}
|
||||
/**
|
||||
* Prevent modern browsers from displaying 'audio' without controls.
|
||||
* Remove excess height in iOS 5 devices.
|
||||
*/
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
/**
|
||||
* Address '[hidden]' styling not present in IE 8/9/10.
|
||||
* Hide the 'template' element in IE 8/9/11, Safari, and Firefox < 22.
|
||||
*/
|
||||
[hidden],
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
/* Links
|
||||
========================================================================== */
|
||||
/**
|
||||
* Remove the gray background color from active links in IE 10.
|
||||
*/
|
||||
a {
|
||||
background: transparent;
|
||||
}
|
||||
/**
|
||||
* Address "outline" inconsistency between Chrome and other browsers.
|
||||
*/
|
||||
a:focus {
|
||||
outline: thin dotted;
|
||||
background-color: transparent;
|
||||
}
|
||||
/**
|
||||
* Improve readability when focused and also mouse hovered in all browsers.
|
||||
@ -90,43 +88,34 @@ a:active,
|
||||
a:hover {
|
||||
outline: 0;
|
||||
}
|
||||
/* ==========================================================================
|
||||
Typography
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
/**
|
||||
* Address variable "h1" font-size and margin within "section" and "article"
|
||||
* contexts in Firefox 4+, Safari 5, and Chrome.
|
||||
*/
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
/**
|
||||
* Address styling not present in IE 8/9, Safari 5, and Chrome.
|
||||
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
|
||||
*/
|
||||
abbr[title] {
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
/**
|
||||
* Address style set to "bolder" in Firefox 4+, Safari 5, and Chrome.
|
||||
* Address style set to 'bolder' in Firefox 4+, Safari, and Chrome.
|
||||
*/
|
||||
b,
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
/**
|
||||
* Address styling not present in Safari 5 and Chrome.
|
||||
* Address styling not present in Safari and Chrome.
|
||||
*/
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
/**
|
||||
* Address differences between Firefox and other browsers.
|
||||
* Address variable 'h1' font-size and margin within 'section' and 'article'
|
||||
* contexts in Firefox 4+, Safari, and Chrome.
|
||||
*/
|
||||
hr {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
/**
|
||||
* Address styling not present in IE 8/9.
|
||||
@ -135,28 +124,6 @@ mark {
|
||||
background: #ff0;
|
||||
color: #000;
|
||||
}
|
||||
/**
|
||||
* Correct font family set oddly in Safari 5 and Chrome.
|
||||
*/
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
/**
|
||||
* Improve readability of pre-formatted text in all browsers.
|
||||
*/
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
/**
|
||||
* Set consistent quote types.
|
||||
*/
|
||||
q {
|
||||
quotes: "\201C" "\201D" "\2018" "\2019";
|
||||
}
|
||||
/**
|
||||
* Address inconsistent and variable font size in all browsers.
|
||||
*/
|
||||
@ -164,7 +131,7 @@ small {
|
||||
font-size: 80%;
|
||||
}
|
||||
/**
|
||||
* Prevent "sub" and "sup" affecting "line-height" in all browsers.
|
||||
* Prevent 'sub' and 'sup' affecting 'line-height' in all browsers.
|
||||
*/
|
||||
sub,
|
||||
sup {
|
||||
@ -179,91 +146,98 @@ sup {
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
/* ==========================================================================
|
||||
Embedded content
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
/**
|
||||
* Remove border when inside "a" element in IE 8/9.
|
||||
* Remove border when inside 'a' element in IE 8/9/10.
|
||||
*/
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
/**
|
||||
* Correct overflow displayed oddly in IE 9.
|
||||
* Correct overflow not hidden in IE 9/10/11.
|
||||
*/
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
/* ==========================================================================
|
||||
Figures
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
/**
|
||||
* Address margin not present in IE 8/9 and Safari 5.
|
||||
* Address margin not present in IE 8/9 and Safari.
|
||||
*/
|
||||
figure {
|
||||
margin: 0;
|
||||
margin: 1em 40px;
|
||||
}
|
||||
/* ==========================================================================
|
||||
Forms
|
||||
/**
|
||||
* Address differences between Firefox and other browsers.
|
||||
*/
|
||||
hr {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
}
|
||||
/**
|
||||
* Contain overflow in all browsers.
|
||||
*/
|
||||
pre {
|
||||
overflow: auto;
|
||||
}
|
||||
/**
|
||||
* Address odd 'em'-unit font size rendering in all browsers.
|
||||
*/
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
/**
|
||||
* Define consistent border, margin, and padding.
|
||||
* Known limitation: by default, Chrome and Safari on OS X allow very limited
|
||||
* styling of 'select', unless a 'border' property is set.
|
||||
*/
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
/**
|
||||
* 1. Correct "color" not being inherited in IE 8/9.
|
||||
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
|
||||
*/
|
||||
legend {
|
||||
border: 0;
|
||||
/* 1 */
|
||||
padding: 0;
|
||||
/* 2 */
|
||||
}
|
||||
/**
|
||||
* 1. Correct font family not being inherited in all browsers.
|
||||
* 2. Correct font size not being inherited in all browsers.
|
||||
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
|
||||
* 1. Correct color not being inherited.
|
||||
* Known issue: affects color of disabled elements.
|
||||
* 2. Correct font properties not being inherited.
|
||||
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
|
||||
*/
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
color: inherit;
|
||||
/* 1 */
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
/* 2 */
|
||||
margin: 0;
|
||||
/* 3 */
|
||||
}
|
||||
/**
|
||||
* Address Firefox 4+ setting "line-height" on "input" using "!important" in
|
||||
* the UA stylesheet.
|
||||
* Address 'overflow' set to 'hidden' in IE 8/9/10/11.
|
||||
*/
|
||||
button,
|
||||
input {
|
||||
line-height: normal;
|
||||
button {
|
||||
overflow: visible;
|
||||
}
|
||||
/**
|
||||
* Address inconsistent "text-transform" inheritance for "button" and "select".
|
||||
* All other form control elements do not inherit "text-transform" values.
|
||||
* Correct "button" style inheritance in Chrome, Safari 5+, and IE 8+.
|
||||
* Correct "select" style inheritance in Firefox 4+ and Opera.
|
||||
* Address inconsistent 'text-transform' inheritance for 'button' and 'select'.
|
||||
* All other form control elements do not inherit 'text-transform' values.
|
||||
* Correct 'button' style inheritance in Firefox, IE 8/9/10/11, and Opera.
|
||||
* Correct 'select' style inheritance in Firefox.
|
||||
*/
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
/**
|
||||
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native "audio"
|
||||
* and "video" controls.
|
||||
* 2. Correct inability to style clickable "input" types in iOS.
|
||||
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native 'audio'
|
||||
* and 'video' controls.
|
||||
* 2. Correct inability to style clickable 'input' types in iOS.
|
||||
* 3. Improve usability and consistency of cursor style between image-type
|
||||
* "input" and others.
|
||||
* 'input' and others.
|
||||
*/
|
||||
button,
|
||||
html input[type="button"],
|
||||
@ -282,7 +256,25 @@ html input[disabled] {
|
||||
cursor: default;
|
||||
}
|
||||
/**
|
||||
* 1. Address box sizing set to "content-box" in IE 8/9/10.
|
||||
* Remove inner padding and border in Firefox 4+.
|
||||
*/
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
/**
|
||||
* Address Firefox 4+ setting 'line-height' on 'input' using '!important' in
|
||||
* the UA stylesheet.
|
||||
*/
|
||||
input {
|
||||
line-height: normal;
|
||||
}
|
||||
/**
|
||||
* It's recommended that you don't attempt to style these elements.
|
||||
* Firefox's implementation doesn't respect box-sizing, padding, or width.
|
||||
*
|
||||
* 1. Address box sizing set to 'content-box' in IE 8/9/10.
|
||||
* 2. Remove excess padding in IE 8/9/10.
|
||||
*/
|
||||
input[type="checkbox"],
|
||||
@ -293,9 +285,18 @@ input[type="radio"] {
|
||||
/* 2 */
|
||||
}
|
||||
/**
|
||||
* 1. Address "appearance" set to "searchfield" in Safari 5 and Chrome.
|
||||
* 2. Address "box-sizing" set to "border-box" in Safari 5 and Chrome
|
||||
* (include "-moz" to future-proof).
|
||||
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
|
||||
* 'font-size' values of the 'input', it causes the cursor style of the
|
||||
* decrement button to change from 'default' to 'text'.
|
||||
*/
|
||||
input[type="number"]::-webkit-inner-spin-button,
|
||||
input[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
/**
|
||||
* 1. Address 'appearance' set to 'searchfield' in Safari and Chrome.
|
||||
* 2. Address 'box-sizing' set to 'border-box' in Safari and Chrome
|
||||
* (include '-moz' to future-proof).
|
||||
*/
|
||||
input[type="search"] {
|
||||
-webkit-appearance: textfield;
|
||||
@ -306,33 +307,46 @@ input[type="search"] {
|
||||
box-sizing: content-box;
|
||||
}
|
||||
/**
|
||||
* Remove inner padding and search cancel button in Safari 5 and Chrome
|
||||
* on OS X.
|
||||
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
|
||||
* Safari (but not Chrome) clips the cancel button when the search input has
|
||||
* padding (and 'textfield' appearance).
|
||||
*/
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
/**
|
||||
* Remove inner padding and border in Firefox 4+.
|
||||
* Define consistent border, margin, and padding.
|
||||
*/
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
/**
|
||||
* 1. Remove default vertical scrollbar in IE 8/9.
|
||||
* 2. Improve readability and alignment in all browsers.
|
||||
* 1. Correct 'color' not being inherited in IE 8/9/10/11.
|
||||
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
|
||||
*/
|
||||
legend {
|
||||
border: 0;
|
||||
/* 1 */
|
||||
padding: 0;
|
||||
/* 2 */
|
||||
}
|
||||
/**
|
||||
* Remove default vertical scrollbar in IE 8/9/10/11.
|
||||
*/
|
||||
textarea {
|
||||
overflow: auto;
|
||||
/* 1 */
|
||||
vertical-align: top;
|
||||
/* 2 */
|
||||
}
|
||||
/* ==========================================================================
|
||||
Tables
|
||||
/**
|
||||
* Don't inherit the 'font-weight' (applied by a rule above).
|
||||
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
|
||||
*/
|
||||
optgroup {
|
||||
font-weight: bold;
|
||||
}
|
||||
/* Tables
|
||||
========================================================================== */
|
||||
/**
|
||||
* Remove most spacing between table cells.
|
||||
@ -340,4 +354,8 @@ textarea {
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
td,
|
||||
th {
|
||||
padding: 0;
|
||||
}`
|
@ -75,7 +75,7 @@ a:focus {
|
||||
.w-hidden {
|
||||
display: none;
|
||||
}
|
||||
html[w-dynpage] [w-cloak] {
|
||||
html[data-w-dynpage] [data-w-cloak] {
|
||||
color: transparent !important;
|
||||
}
|
||||
h1,
|
||||
@ -1319,7 +1319,7 @@ textarea.w-select {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
/*
|
||||
* 1. We use content-box to avoid having to do "width: calc(10vh + 2vw)"
|
||||
* 1. We use content-box to avoid having to do 'width: calc(10vh + 2vw)'
|
||||
* which doesn’t work in Safari anyway.
|
||||
* 2. Chrome renders images pixelated when switching to GPU. Making sure
|
||||
* the parent is also rendered on the GPU (by setting translate3d for
|
||||
@ -1646,10 +1646,6 @@ textarea.w-select {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
.w-dyn-loading {
|
||||
display: block;
|
||||
padding: 10px;
|
||||
}
|
||||
.w-dyn-items {
|
||||
display: none;
|
||||
}
|
||||
@ -1657,6 +1653,7 @@ textarea.w-select {
|
||||
display: block;
|
||||
}
|
||||
.w-dyn-empty {
|
||||
display: none;
|
||||
padding: 10px;
|
||||
background-color: #dddddd;
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package Web
|
||||
package Admin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/SommerEngineering/Ocean/Log/Web/Assets"
|
||||
"github.com/SommerEngineering/Ocean/Admin/Assets"
|
||||
"github.com/SommerEngineering/Ocean/MimeTypes"
|
||||
"github.com/SommerEngineering/Ocean/Shutdown"
|
||||
"net/http"
|
||||
@ -33,7 +33,7 @@ func HandlerCSSWebflow(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
// Handler for some CSS data for the web logger.
|
||||
func HandlerCSSLog(response http.ResponseWriter, request *http.Request) {
|
||||
func HandlerCSSAdmin(response http.ResponseWriter, request *http.Request) {
|
||||
|
||||
if Shutdown.IsDown() {
|
||||
http.NotFound(response, request)
|
||||
@ -41,7 +41,7 @@ func HandlerCSSLog(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
MimeTypes.Write2HTTP(response, MimeTypes.TypeWebCSS)
|
||||
fmt.Fprint(response, Assets.CSSLog)
|
||||
fmt.Fprint(response, Assets.CSSAdmin)
|
||||
}
|
||||
|
||||
// Handler for some JS for the web logger.
|
25
Admin/HandlerOverview.go
Normal file
25
Admin/HandlerOverview.go
Normal file
@ -0,0 +1,25 @@
|
||||
package Admin
|
||||
|
||||
import (
|
||||
"github.com/SommerEngineering/Ocean/Log"
|
||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
"github.com/SommerEngineering/Ocean/MimeTypes"
|
||||
"github.com/SommerEngineering/Ocean/Shutdown"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Handler for accessing the admin's overview.
|
||||
func HandlerOverview(response http.ResponseWriter, request *http.Request) {
|
||||
|
||||
// Case: The system goes down now.
|
||||
if Shutdown.IsDown() {
|
||||
http.NotFound(response, request)
|
||||
return
|
||||
}
|
||||
|
||||
// Write the MIME type and execute the template:
|
||||
MimeTypes.Write2HTTP(response, MimeTypes.TypeWebHTML)
|
||||
if executeError := AdminTemplates.ExecuteTemplate(response, `Overview`, nil); executeError != nil {
|
||||
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactCritical, LM.MessageNameEXECUTE, `Was not able to execute the admin's overview template.`, executeError.Error())
|
||||
}
|
||||
}
|
25
Admin/Init.go
Normal file
25
Admin/Init.go
Normal file
@ -0,0 +1,25 @@
|
||||
package Admin
|
||||
|
||||
import (
|
||||
"github.com/SommerEngineering/Ocean/Admin/Templates"
|
||||
"github.com/SommerEngineering/Ocean/Log"
|
||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
"html/template"
|
||||
)
|
||||
|
||||
// The init function for this package.
|
||||
func init() {
|
||||
|
||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Init the admin area.`)
|
||||
defer Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Init the admin area done.`)
|
||||
|
||||
// Create the cache of all admin templates:
|
||||
AdminTemplates = template.New(`root`)
|
||||
if _, err := AdminTemplates.Parse(Templates.LoggingViewer); err != nil {
|
||||
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactUnknown, LM.MessageNamePARSE, `Was not able to parse the template for the web log viewer.`, err.Error())
|
||||
}
|
||||
|
||||
if _, err := AdminTemplates.Parse(Templates.Overview); err != nil {
|
||||
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactUnknown, LM.MessageNamePARSE, `Was not able to parse the template for the admin overview.`, err.Error())
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package Templates
|
||||
|
||||
// The template for the web log viewer:
|
||||
var Viewer string = `
|
||||
var LoggingViewer string = `
|
||||
{{define "WebLog"}}
|
||||
<!DOCTYPE html>
|
||||
<!-- This site was created in Webflow. http://www.webflow.com-->
|
||||
@ -15,14 +15,14 @@ var Viewer string = `
|
||||
{{end}}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="generator" content="Webflow">
|
||||
<link rel="stylesheet" type="text/css" href="/log/css/normalize.css">
|
||||
<link rel="stylesheet" type="text/css" href="/log/css/webflow.css">
|
||||
<link rel="stylesheet" type="text/css" href="/log/css/log.css">
|
||||
<script type="text/javascript" src="/log/js/modernizr.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/admin/css/normalize.css">
|
||||
<link rel="stylesheet" type="text/css" href="/admin/css/webflow.css">
|
||||
<link rel="stylesheet" type="text/css" href="/admin/css/admin.css">
|
||||
<script type="text/javascript" src="/admin/js/modernizr.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="headercontainer">
|
||||
<h1>Logbook</h1>
|
||||
<h1>Logging Viewer</h1>
|
||||
</div>
|
||||
<div class="controlsection">
|
||||
<div class="w-row">
|
||||
@ -131,8 +131,8 @@ var Viewer string = `
|
||||
</div>
|
||||
<div class="w-hidden-main w-hidden-medium newlineblock"></div><a class="button changepagebutton" href="#">+1</a><a class="button changepagebutton" href="#">Last</a>
|
||||
</div>
|
||||
<script type="text/javascript" src="/log/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/log/js/webflow.js"></script>
|
||||
<script type="text/javascript" src="/admin/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/admin/js/webflow.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}`
|
36
Admin/Templates/Overview.go
Normal file
36
Admin/Templates/Overview.go
Normal file
@ -0,0 +1,36 @@
|
||||
package Templates
|
||||
|
||||
var Overview = `
|
||||
{{define "Overview"}}
|
||||
<!DOCTYPE html>
|
||||
<!-- This site was created in Webflow. http://www.webflow.com-->
|
||||
<!-- Last Published: Mon Jun 22 2015 10:36:36 GMT+0000 (UTC) -->
|
||||
<html data-wf-site="547b44aa3e9ac2216ec5d048" data-wf-page="5587d2abbf862f2179c4373b">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Overview</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="generator" content="Webflow">
|
||||
<link rel="stylesheet" type="text/css" href="/admin/css/normalize.css">
|
||||
<link rel="stylesheet" type="text/css" href="/admin/css/webflow.css">
|
||||
<link rel="stylesheet" type="text/css" href="/admin/css/admin.css">
|
||||
<script type="text/javascript" src="/admin/js/modernizr.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="w-section headercontainer">
|
||||
<h1>Administration</h1>
|
||||
</div>
|
||||
<div class="w-container adminsection">
|
||||
<div class="w-row">
|
||||
<div class="w-col w-col-4"><a class="button adminbutton" href="/log">Logging Viewer</a>
|
||||
</div>
|
||||
<div class="w-col w-col-4"></div>
|
||||
<div class="w-col w-col-4"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="/admin/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/admin/js/webflow.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
`
|
11
Admin/Variables.go
Normal file
11
Admin/Variables.go
Normal file
@ -0,0 +1,11 @@
|
||||
package Admin
|
||||
|
||||
import (
|
||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
"html/template"
|
||||
)
|
||||
|
||||
var (
|
||||
AdminTemplates *template.Template = nil // The admin templates
|
||||
senderName LM.Sender = `System::Admin` // This is the name for logging event from this package
|
||||
)
|
@ -1,10 +1,11 @@
|
||||
package Web
|
||||
|
||||
import (
|
||||
"github.com/SommerEngineering/Ocean/Admin"
|
||||
"github.com/SommerEngineering/Ocean/Admin/Scheme"
|
||||
"github.com/SommerEngineering/Ocean/Log"
|
||||
"github.com/SommerEngineering/Ocean/Log/DeviceDatabase"
|
||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
"github.com/SommerEngineering/Ocean/Log/Web/Scheme"
|
||||
"github.com/SommerEngineering/Ocean/MimeTypes"
|
||||
"github.com/SommerEngineering/Ocean/Shutdown"
|
||||
"net/http"
|
||||
@ -26,7 +27,7 @@ func HandlerWebLog(response http.ResponseWriter, request *http.Request) {
|
||||
|
||||
// Setup the data for the HTML template:
|
||||
data := Scheme.Viewer{}
|
||||
data.Title = `Web Log Viewer`
|
||||
data.Title = `Logging Viewer`
|
||||
data.Sender = DeviceDatabase.ReadSenderNames()
|
||||
data.MessageNames = DeviceDatabase.ReadMessageNames()
|
||||
|
||||
@ -99,7 +100,7 @@ func HandlerWebLog(response http.ResponseWriter, request *http.Request) {
|
||||
|
||||
// Write the MIME type and execute the template:
|
||||
MimeTypes.Write2HTTP(response, MimeTypes.TypeWebHTML)
|
||||
if executeError := templates.ExecuteTemplate(response, `WebLog`, data); executeError != nil {
|
||||
if executeError := Admin.AdminTemplates.ExecuteTemplate(response, `WebLog`, data); executeError != nil {
|
||||
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactCritical, LM.MessageNameEXECUTE, `Was not able to execute the web log viewer template.`, executeError.Error())
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,6 @@ package Web
|
||||
import (
|
||||
"github.com/SommerEngineering/Ocean/Log"
|
||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
WebTemp "github.com/SommerEngineering/Ocean/Log/Web/Templates"
|
||||
"html/template"
|
||||
)
|
||||
|
||||
// The init function for this package.
|
||||
@ -12,10 +10,4 @@ func init() {
|
||||
|
||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Init the web log.`)
|
||||
defer Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Init the web log done.`)
|
||||
|
||||
// Create the cache of all web logging templates:
|
||||
templates = template.New(`root`)
|
||||
if _, err := templates.Parse(WebTemp.Viewer); err != nil {
|
||||
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactUnknown, LM.MessageNamePARSE, `Was not able to parse the template for the web log viewer.`, err.Error())
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package Web
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/SommerEngineering/Ocean/Admin/Scheme"
|
||||
"github.com/SommerEngineering/Ocean/Log/DeviceDatabase"
|
||||
"github.com/SommerEngineering/Ocean/Log/Web/Scheme"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -2,8 +2,8 @@ package Web
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/SommerEngineering/Ocean/Admin/Scheme"
|
||||
"github.com/SommerEngineering/Ocean/Log/DeviceDatabase"
|
||||
"github.com/SommerEngineering/Ocean/Log/Web/Scheme"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -2,10 +2,8 @@ package Web
|
||||
|
||||
import (
|
||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||
"html/template"
|
||||
)
|
||||
|
||||
var (
|
||||
templates *template.Template = nil // The web logging templates
|
||||
senderName LM.Sender = `System::WebLog` // This is the name for logging event from this package
|
||||
senderName LM.Sender = `System::WebLog` // This is the name for logging event from this package
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package System
|
||||
|
||||
import (
|
||||
"github.com/SommerEngineering/Ocean/Admin"
|
||||
"github.com/SommerEngineering/Ocean/BinaryAssets"
|
||||
"github.com/SommerEngineering/Ocean/ConfigurationDB"
|
||||
"github.com/SommerEngineering/Ocean/Handlers"
|
||||
@ -51,17 +52,20 @@ func InitHandlers() {
|
||||
// Handler for binary assets, used for the admin pages:
|
||||
Handlers.AddAdminHandler(`/binaryAssets/`, BinaryAssets.HandlerBinaryAssets)
|
||||
|
||||
// Handler for the admin's overview:
|
||||
Handlers.AddAdminHandler(`/`, Admin.HandlerOverview)
|
||||
|
||||
// Handler for the web logging:
|
||||
Handlers.AddAdminHandler(`/log`, Web.HandlerWebLog)
|
||||
|
||||
// Handler for the web logging's CSS and JS:
|
||||
Handlers.AddAdminHandler(`/log/css/normalize.css`, Web.HandlerCSSNormalize)
|
||||
Handlers.AddAdminHandler(`/log/css/webflow.css`, Web.HandlerCSSWebflow)
|
||||
Handlers.AddAdminHandler(`/log/css/log.css`, Web.HandlerCSSLog)
|
||||
Handlers.AddAdminHandler(`/log/js/modernizr.js`, Web.HandlerJSModernizr)
|
||||
Handlers.AddAdminHandler(`/log/js/jquery.min.js`, Web.HandlerJSjQuery)
|
||||
Handlers.AddAdminHandler(`/log/js/jquery.min.map`, Web.HandlerJSjQueryMap)
|
||||
Handlers.AddAdminHandler(`/log/js/webflow.js`, Web.HandlerJSWebflow)
|
||||
Handlers.AddAdminHandler(`/admin/css/normalize.css`, Admin.HandlerCSSNormalize)
|
||||
Handlers.AddAdminHandler(`/admin/css/webflow.css`, Admin.HandlerCSSWebflow)
|
||||
Handlers.AddAdminHandler(`/admin/css/admin.css`, Admin.HandlerCSSAdmin)
|
||||
Handlers.AddAdminHandler(`/admin/js/modernizr.js`, Admin.HandlerJSModernizr)
|
||||
Handlers.AddAdminHandler(`/admin/js/jquery.min.js`, Admin.HandlerJSjQuery)
|
||||
Handlers.AddAdminHandler(`/admin/js/jquery.min.map`, Admin.HandlerJSjQueryMap)
|
||||
Handlers.AddAdminHandler(`/admin/js/webflow.js`, Admin.HandlerJSWebflow)
|
||||
|
||||
// Are the static files mapped to the public?
|
||||
if ConfigurationDB.Read(`MapStaticFiles2Root`) == "true" {
|
||||
|
Loading…
Reference in New Issue
Block a user