Commit 2db42a81 authored by vogelor's avatar vogelor

The very first version of a dashboard (very very simple, just that we have some...)

parent 4f35a00a
......@@ -33,4 +33,5 @@ $wb['top_menu_tools'] = 'Tools';
$wb['top_menu_help'] = 'Support';
$wb['top_menu_billing'] = 'Billing';
$wb['top_menu_domain'] = 'Domänen';
$wb['top_menu_dashboard'] = 'Startseite';
?>
......@@ -33,5 +33,6 @@ $wb['top_menu_tools'] = 'Tools';
$wb['top_menu_help'] = 'Help';
$wb['top_menu_billing'] = 'Billing';
$wb['top_menu_domain'] = 'Domains';
$wb['top_menu_dashboard'] = 'Home';
$wb['toolsarea_head_txt'] = 'Tools';
?>
<?php
/*
Copyright (c) 2010 Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Check permissions for module
$app->auth->check_module_permissions('dashboard');
//* Loading Template
$app->uses('tpl');
$app->tpl->newTemplate("templates/dashboard.htm");
//* load language file
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
include($lng_file);
$app->tpl->setVar($wb);
//* set Default - Values
$app->tpl_defaults();
/*
* Let the user welcome
*/
$welcome = sprintf($wb['welcome_user_txt'], $_SESSION['s']['user']['username']);
$app->tpl->setVar('welcome_user', $welcome);
/*
* ToDo: Display errors, warnings and hints
*/
///*
// * If there is any error to display, do it...
//*/
//$error = array();
//
//$error[] = array('error_msg' => 'EClaus1');
//$error[] = array('error_msg' => 'EEClaus2');
//$error[] = array('error_msg' => 'EClaus3');
//$error[] = array('error_msg' => 'EClaus4');
//
//$app->tpl->setloop('error', $error);
//
///*
// * If there is any warning to display, do it...
//*/
//$warning = array();
//
//$warning[] = array('warning_msg' => 'WClaus1');
//$warning[] = array('warning_msg' => 'WWClaus2');
//$warning[] = array('warning_msg' => 'WClaus3');
//$warning[] = array('warning_msg' => 'WClaus4');
//
//$app->tpl->setloop('warning', $warning);
//
///*
// * If there is any information to display, do it...
//*/
//$info = array();
//
//$info[] = array('info_msg' => 'IClaus1');
//$info[] = array('info_msg' => 'IClaus2');
//$info[] = array('info_msg' => 'IClaus3');
//$info[] = array('info_msg' => 'IClaus4');
//
//$app->tpl->setloop('info', $info);
/*
* Show all modules, the user is allowed to use
*/
$modules = explode(',', $_SESSION['s']['user']['modules']);
$mod = array();
if(is_array($modules)) {
foreach($modules as $mt) {
if(is_file('../' . $mt . '/lib/module.conf.php')) {
if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
include_once('../' . $mt.'/lib/module.conf.php');
/* We don't want to show the dashboard */
if ($mt != 'dashboard') {
$mod[] = array( 'modules_title' => $app->lng($module['title']),
'modules_startpage' => $module['startpage'],
'modules_name' => $module['name']);
}
}
}
$app->tpl->setloop('modules', $mod);
}
//* Do Output
$app->tpl->pparse();
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2010 Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
?>
\ No newline at end of file
<?php
$wb['welcome_user_txt'] = "Herzlich Willkommen %s";
$wb['available_modules_txt'] = "Verfügbare Module";
?>
<?php
$wb['welcome_user_txt'] = "Welcome %s";
$wb['available_modules_txt'] = "Available Modules";
?>
<?php
/*
Copyright (c) 2010 Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
$module['name'] = 'dashboard';
$module['title'] = 'top_menu_dashboard';
$module['template'] = 'dashboard.tpl.htm';
$module['startpage'] = 'dashboard/dashboard.php';
$module['tab_width'] = '';
//$items = array();
//
//$items[] = array( 'title' => 'Dashboard 1',
// 'target' => 'content',
// 'link' => 'dashboard/dashboard.php');
//
//$module['nav'][] = array( 'title' => 'Dashboard 2',
// 'open' => 1,
// 'items' => $items);
?>
\ No newline at end of file
<h1><tmpl_var name="welcome_user"></h1>
<div class="panel panel_dashboard">
<div>
<tmpl_if name='error'>
<div class="systemmonitor-state state-error">
<tmpl_loop name="error">
<p>{tmpl_var name='error_msg'}</p>
</tmpl_loop>
</div>
</tmpl_if>
<tmpl_if name='warning'>
<div class="systemmonitor-state state-warning">
<tmpl_loop name="warning">
<p>{tmpl_var name='warning_msg'}</p>
</tmpl_loop>
</div>
</tmpl_if>
<tmpl_if name='info'>
<div class="systemmonitor-state state-info">
<tmpl_loop name="info">
<p>{tmpl_var name='info_msg'}</p>
</tmpl_loop>
</div>
</tmpl_if>
</div>
<p>&nbsp;</p>
<h2>{tmpl_var name='available_modules_txt'}</h2>
<tmpl_loop name='modules'>
<div class="dashboard-modules {tmpl_var name='modules_name'}">
<a href="#" onclick="capp('{tmpl_var name='modules_name'}')">
{tmpl_var name='modules_title'}
</a>
</div>
</tmpl_loop>
</div>
......@@ -35,13 +35,21 @@ $app->uses('tpl');
//** Top Naviation
if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
$app->tpl->newTemplate('topnav.tpl.htm');
//* Check User Login and current module
if(isset($_SESSION["s"]["user"]) && $_SESSION["s"]["user"]['active'] == 1 && is_array($_SESSION['s']['module'])) {
//* Loading modules of the user and building top navigation
$modules = explode(',', $_SESSION['s']['user']['modules']);
/*
* If the dashboard is in the list of modules it always has to be the first!
*/
if (in_array('dashboard', $modules)) {
$key = array_search('dashboard', $modules);
unset($modules[$key]);
$modules = array_merge(array('dashboard'), $modules);
}
if(is_array($modules)) {
foreach($modules as $mt) {
if(is_file($mt.'/lib/module.conf.php')) {
......@@ -49,8 +57,8 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
include_once($mt.'/lib/module.conf.php');
$active = ($module['name'] == $_SESSION['s']['module']['name']) ? 1 : 0;
$topnav[] = array( 'title' => $app->lng($module['title']),
'active' => $active,
'module' => $module['name']);
'active' => $active,
'module' => $module['name']);
}
}
}
......@@ -59,21 +67,21 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
include_once('login/lib/module.conf.php');
$_SESSION['s']['module'] = $module;
$topnav[] = array( 'title' => 'Login',
'active' => 1);
'active' => 1);
$module = null;
unset($module);
}
//* Topnavigation
$app->tpl->setLoop('nav_top',$topnav);
}
//** Side Naviation
if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
$app->tpl->newTemplate('sidenav.tpl.htm');
//* translating module navigation
$nav_translated = array();
if(isset($_SESSION['s']['module']['nav']) && is_array($_SESSION['s']['module']['nav'])) {
......@@ -93,7 +101,7 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
}
$app->tpl->setLoop('nav_left',$nav_translated);
}
$app->tpl_defaults();
......
......@@ -95,4 +95,8 @@
background-image: url('../../icons/x32/domain.png') !important;
}
.topnav-dashboard {
background-image: url('../../icons/x32/dashboard.png') !important;
}
}
\ No newline at end of file
......@@ -230,6 +230,36 @@
padding:0px 5px;
}
/* Dashboard */
.dashboard-modules {
float:left;
width:100px;
height: 20px;
border:1px dotted #888888;
background-color: #cccccc;
margin:10px;
padding:10px;
background-position: center 5px;
background-repeat: no-repeat;
padding-top: 70px;
text-align: center;
}
.dashboard-modules a{
color: Black;
font-weight: bold;
}
.dashboard-modules.admin { background-image: url('../../icons/x64/system.png') !important; }
.dashboard-modules.client { background-image: url('../../icons/x64/client.png') !important; }
.dashboard-modules.mail { background-image: url('../../icons/x64/email.png') !important; }
.dashboard-modules.monitor { background-image: url('../../icons/x64/monitor.png') !important; }
.dashboard-modules.dns { background-image: url('../../icons/x64/dns.png') !important; }
.dashboard-modules.tools { background-image: url('../../icons/x64/tools.png') !important; }
.dashboard-modules.help { background-image: url('../../icons/x64/help.png') !important; }
.dashboard-modules.domain { background-image: url('../../icons/x64/domain.png') !important; }
.dashboard-modules.sites { background-image: url('../../icons/x64/sites.png') !important; }
/* Image-Replacement */
.swap { background-repeat:no-repeat; }
.swap span { display:none; height:16px; }
......
......@@ -52,4 +52,9 @@
.topnav-domain {
background-image: url('../../icons/x64/domain.png') !important;
}
.topnav-dashboard {
background-image: url('../../icons/x64/dashboard.png') !important;
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment