2015-06-22 12:08:29 +00:00
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"
2015-07-10 14:20:10 +00:00
"github.com/SommerEngineering/Ocean/System/Version"
2015-06-22 12:08:29 +00:00
"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
}
2015-07-10 14:20:10 +00:00
// Get the data ready:
data := AdminWebOverview { }
data . Version = Version . GetVersion ( )
2015-06-22 12:08:29 +00:00
// Write the MIME type and execute the template:
MimeTypes . Write2HTTP ( response , MimeTypes . TypeWebHTML )
2015-07-10 14:20:10 +00:00
if executeError := AdminTemplates . ExecuteTemplate ( response , ` Overview ` , data ) ; executeError != nil {
2015-06-22 12:08:29 +00:00
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 ( ) )
}
}