Basic placeholder webui

Adds the bare minimum files to have a functional web interface with
placeholder sidebar, home and admin pages.
This commit is contained in:
2011-12-16 02:17:32 +00:00
parent 5e04f99429
commit 35119be9a0
15 changed files with 340 additions and 0 deletions

16
private/htaccess.dist Normal file
View File

@@ -0,0 +1,16 @@
SetEnv STATUSBOARD_CONFIG /etc/status-board/config.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(ajax/.*)$ a.php?l=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?l=$1
</IfModule>

1
public/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.htaccess

16
public/_inc.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
if (isset($_SERVER['STATUSBOARD_CONFIG']) &&
file_exists($_SERVER['STATUSBOARD_CONFIG']) &&
is_readable($_SERVER['STATUSBOARD_CONFIG'])) {
require_once($_SERVER['STATUSBOARD_CONFIG']);
} else {
require_once '/etc/status-board/config.php';
}
require_once SihnonFramework_Lib . 'SihnonFramework/Main.class.php';
SihnonFramework_Main::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib,
'StatusBoard', StatusBoard_Lib);
?>

0
public/images/.gitignore vendored Normal file
View File

21
public/index.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
define('StatusBoard_File', 'index');
require '_inc.php';
try {
$main = StatusBoard_Main::instance();
StatusBoard_LogEntry::setLocalProgname('webui');
$smarty = $main->smarty();
$page = new StatusBoard_Page($smarty, $main->request());
if ($page->evaluate()) {
$smarty->display('index.tpl');
}
} catch (StatusBoard_Exception $e) {
die("Uncaught Exception: " . $e->getMessage());
}
?>

5
public/scripts/main.js Normal file
View File

@@ -0,0 +1,5 @@
/**
* StatusBoard main script file
*
*
*/

92
public/styles/normal.css Normal file
View File

@@ -0,0 +1,92 @@
/**
* StatusBoard normal stylesheet
*
*/
@CHARSET "UTF-8";
body {
margin: 0em;
padding: 0em;
font-family: verdana, helvetica, sans-serif;
}
a {
color: gray;
}
label {
margin-left: 1em;
margin-right: 1em;
}
#container {
width: 75%;
min-width: 75em;
margin: auto;
}
#banner {
margin: 0em;
padding: 0em;
}
#banner h1 {
padding: 0.5em;
}
#navigation {
margin-top: 0em;
margin-bottom: 1em;
padding: 0.2em;
}
#navigation ul {
margin: 0em;
padding: 0em 5em;;
list-style: none;
}
#navigation li {
margin: 1em;
padding: 0em;
display: inline;
}
#page-container {
margin: 0em;
padding: 0em;
}
#sidebar {
float: left;
width: 20em;
margin-bottom: 1em;
}
#page {
margin-left: 21em;
margin-bottom: 1em;
padding: 0.5em;
}
#footer {
clear: both;
padding: 2em;
font-size: smaller;
font-style: italic;
color: #333333;
}
#errors {
background: peachpuff;
color: darkred;
margin: 1em;
}
#messages {
background: lightcyan;
color: darkblue;
margin: 1em;
}

View File

@@ -0,0 +1,65 @@
<?php
require 'smarty/Smarty.class.php';
class StatusBoard_Main extends SihnonFramework_Main {
const TEMPLATE_DIR = '../source/webui/templates/';
protected static $instance;
protected $smarty;
protected $request;
protected function __construct() {
parent::__construct();
}
protected function init() {
parent::init();
$request_string = isset($_GET['l']) ? $_GET['l'] : '';
$this->request = new StatusBoard_RequestParser($request_string, self::TEMPLATE_DIR);
switch (StatusBoard_File) {
case 'ajax':
case 'index': {
$smarty_tmp = $this->config->get('templates.tmp_path');
$this->smarty = new Smarty();
$this->smarty->template_dir = static::makeAbsolutePath(self::TEMPLATE_DIR);
$this->smarty->compile_dir = static::makeAbsolutePath($smarty_tmp . '/templates');
$this->smarty->cache_dir = static::makeAbsolutePath($smarty_tmp . '/cache');
$this->smarty->config_dir = static::makeAbsolutePath($smarty_tmp . '/config');
$this->smarty->plugins_dir[]= static::makeAbsolutePath('../source/webui/smarty/plugins');
$this->smarty->registerPlugin('modifier', 'formatDuration', array('StatusBoard_Main', 'formatDuration'));
$this->smarty->registerPlugin('modifier', 'formatFilesize', array('StatusBoard_Main', 'formatFilesize'));
$this->smarty->assign('version', '0.1.0');
$this->smarty->assign('messages', array());
$this->smarty->assign('base_uri', $this->base_uri);
$this->smarty->assign('base_url', static::absoluteUrl(''));
} break;
}
}
public function smarty() {
return $this->smarty;
}
/**
*
* @return StatusBoard_RequestParser
*/
public function request() {
return $this->request;
}
}
?>

View File

@@ -0,0 +1 @@
TODO

View File

@@ -0,0 +1,6 @@
<h2>The requested page could not be found</h2>
<p>
The file you requested ({$requested_page}) could not be found.
If you typed in the address manually, check that you have spelled it correctly,
or if you followed a link, let us know and we'll look into it.
</p>

View File

@@ -0,0 +1,46 @@
<h2>An unhandled error has occurred</h2>
<p>
There was a problem trying to complete the requested action. Please try again and if the problem persists, let us know.
</p>
{if $display_exceptions}
<p>
An unhandled exception was caught during the page template processing. The full details are shown below:
</p>
<table class="exception-details">
<colgroup id="header">
<col />
</colgroup>
<colgroup>
<col />
</colgroup>
<tbody>
<tr>
<th>Exception</th>
<td>{$exception_type}</td>
</tr>
<tr>
<th>File</th>
<td>{$exception->getFile()}</td>
</tr>
<tr>
<th>Line</th>
<td>{$exception->getLine()}</td>
</tr>
<tr>
<th>Message</th>
<td>{$exception->getMessage()}</td>
</tr>
<tr>
<th>Stack Trace</th>
<td><pre>{$exception->getTrace()|print_r}</pre></td>
</tr>
</tbody>
</table>
<p>
<em>Note:</em> Exception details should not be displayed on production systems.
Disable the <a href="{$base_uri}admin/settings/key/debug.show_exceptions/"><code>debug.show_exceptions</code></a>
setting to omit the exception details from this page.
</p>
{/if}

View File

@@ -0,0 +1 @@
TODO

View File

@@ -0,0 +1,60 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Status Board</title>
<script lang="javascript">
</script>
<link rel="stylesheet" type="text/css" href="{$base_uri}styles/normal.css" />
<script type="text/javascript">
var base_uri = "{$base_uri|escape:'quote'}";
var base_url = "{$base_url|escape:'quote'}";
</script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css" rel="Stylesheet" />
<link type="text/css" href="{$base_uri}styles/3rdparty/jquery.asmselect.css" rel="Stylesheet" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="{$base_uri}scripts/main.js"></script>
</head>
<body>
<div id="container">
<div id="banner">
<h1>StatusBoard</h1>
</div>
<div id="navigation">
{include file="navigation.tpl"}
</div>
<div id="page-container">
<div id="sidebar">
{include file="sidebar.tpl"}
</div>
<div id="page">
{if $messages}
<div id="messages">
{foreach from=$messages item=message}
{$message}
{/foreach}
</div>
{/if}
{$page_content}
</div>
</div>
<div id="footer">
Powered by StatusBoard {$version}. Written by Ben Roberts and Nathan Booth.
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,4 @@
<ul>
<li><a href="{$base_uri}home/" title="Home">Home</a></li>
<li><a href="{$base_uri}admin/" title="Admin">Admin</a></li>
</ul>

View File

@@ -0,0 +1,6 @@
<div id="services">
<h2>Services</h2>
<ul>
<li>TODO</li>
</ul>
</div>