Skip to content

Commit 2db42a8

Browse files
author
vogelor
committed
The very first version of a dashboard (very very simple, just that we have some...)
1 parent 4f35a00 commit 2db42a8

File tree

14 files changed

+296
-9
lines changed

14 files changed

+296
-9
lines changed

interface/lib/lang/de.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ $wb['top_menu_tools'] = 'Tools';
3333
$wb['top_menu_help'] = 'Support';
3434
$wb['top_menu_billing'] = 'Billing';
3535
$wb['top_menu_domain'] = 'Domänen';
36+
$wb['top_menu_dashboard'] = 'Startseite';
3637
?>

interface/lib/lang/en.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ $wb['top_menu_tools'] = 'Tools';
3333
$wb['top_menu_help'] = 'Help';
3434
$wb['top_menu_billing'] = 'Billing';
3535
$wb['top_menu_domain'] = 'Domains';
36+
$wb['top_menu_dashboard'] = 'Home';
3637
$wb['toolsarea_head_txt'] = 'Tools';
3738
?>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?php
2+
/*
3+
Copyright (c) 2010 Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
require_once('../../lib/config.inc.php');
31+
require_once('../../lib/app.inc.php');
32+
33+
//* Check permissions for module
34+
$app->auth->check_module_permissions('dashboard');
35+
36+
//* Loading Template
37+
$app->uses('tpl');
38+
$app->tpl->newTemplate("templates/dashboard.htm");
39+
40+
//* load language file
41+
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
42+
include($lng_file);
43+
$app->tpl->setVar($wb);
44+
45+
//* set Default - Values
46+
$app->tpl_defaults();
47+
48+
/*
49+
* Let the user welcome
50+
*/
51+
$welcome = sprintf($wb['welcome_user_txt'], $_SESSION['s']['user']['username']);
52+
$app->tpl->setVar('welcome_user', $welcome);
53+
54+
55+
/*
56+
* ToDo: Display errors, warnings and hints
57+
*/
58+
///*
59+
// * If there is any error to display, do it...
60+
//*/
61+
//$error = array();
62+
//
63+
//$error[] = array('error_msg' => 'EClaus1');
64+
//$error[] = array('error_msg' => 'EEClaus2');
65+
//$error[] = array('error_msg' => 'EClaus3');
66+
//$error[] = array('error_msg' => 'EClaus4');
67+
//
68+
//$app->tpl->setloop('error', $error);
69+
//
70+
///*
71+
// * If there is any warning to display, do it...
72+
//*/
73+
//$warning = array();
74+
//
75+
//$warning[] = array('warning_msg' => 'WClaus1');
76+
//$warning[] = array('warning_msg' => 'WWClaus2');
77+
//$warning[] = array('warning_msg' => 'WClaus3');
78+
//$warning[] = array('warning_msg' => 'WClaus4');
79+
//
80+
//$app->tpl->setloop('warning', $warning);
81+
//
82+
///*
83+
// * If there is any information to display, do it...
84+
//*/
85+
//$info = array();
86+
//
87+
//$info[] = array('info_msg' => 'IClaus1');
88+
//$info[] = array('info_msg' => 'IClaus2');
89+
//$info[] = array('info_msg' => 'IClaus3');
90+
//$info[] = array('info_msg' => 'IClaus4');
91+
//
92+
//$app->tpl->setloop('info', $info);
93+
94+
/*
95+
* Show all modules, the user is allowed to use
96+
*/
97+
$modules = explode(',', $_SESSION['s']['user']['modules']);
98+
$mod = array();
99+
if(is_array($modules)) {
100+
foreach($modules as $mt) {
101+
if(is_file('../' . $mt . '/lib/module.conf.php')) {
102+
if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
103+
include_once('../' . $mt.'/lib/module.conf.php');
104+
/* We don't want to show the dashboard */
105+
if ($mt != 'dashboard') {
106+
$mod[] = array( 'modules_title' => $app->lng($module['title']),
107+
'modules_startpage' => $module['startpage'],
108+
'modules_name' => $module['name']);
109+
}
110+
}
111+
}
112+
113+
$app->tpl->setloop('modules', $mod);
114+
}
115+
116+
//* Do Output
117+
$app->tpl->pparse();
118+
119+
?>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/*
3+
Copyright (c) 2010 Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
?>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
$wb['welcome_user_txt'] = "Herzlich Willkommen %s";
3+
$wb['available_modules_txt'] = "Verfügbare Module";
4+
?>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
$wb['welcome_user_txt'] = "Welcome %s";
3+
$wb['available_modules_txt'] = "Available Modules";
4+
?>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/*
3+
Copyright (c) 2010 Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without modification,
7+
are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice,
10+
this list of conditions and the following disclaimer.
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
* Neither the name of ISPConfig nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
$module['name'] = 'dashboard';
31+
$module['title'] = 'top_menu_dashboard';
32+
$module['template'] = 'dashboard.tpl.htm';
33+
$module['startpage'] = 'dashboard/dashboard.php';
34+
$module['tab_width'] = '';
35+
36+
//$items = array();
37+
//
38+
//$items[] = array( 'title' => 'Dashboard 1',
39+
// 'target' => 'content',
40+
// 'link' => 'dashboard/dashboard.php');
41+
//
42+
//$module['nav'][] = array( 'title' => 'Dashboard 2',
43+
// 'open' => 1,
44+
// 'items' => $items);
45+
46+
?>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<h1><tmpl_var name="welcome_user"></h1>
2+
3+
<div class="panel panel_dashboard">
4+
<div>
5+
<tmpl_if name='error'>
6+
<div class="systemmonitor-state state-error">
7+
<tmpl_loop name="error">
8+
<p>{tmpl_var name='error_msg'}</p>
9+
</tmpl_loop>
10+
</div>
11+
</tmpl_if>
12+
<tmpl_if name='warning'>
13+
<div class="systemmonitor-state state-warning">
14+
<tmpl_loop name="warning">
15+
<p>{tmpl_var name='warning_msg'}</p>
16+
</tmpl_loop>
17+
</div>
18+
</tmpl_if>
19+
<tmpl_if name='info'>
20+
<div class="systemmonitor-state state-info">
21+
<tmpl_loop name="info">
22+
<p>{tmpl_var name='info_msg'}</p>
23+
</tmpl_loop>
24+
</div>
25+
</tmpl_if>
26+
</div>
27+
<p>&nbsp;</p>
28+
<h2>{tmpl_var name='available_modules_txt'}</h2>
29+
<tmpl_loop name='modules'>
30+
<div class="dashboard-modules {tmpl_var name='modules_name'}">
31+
<a href="#" onclick="capp('{tmpl_var name='modules_name'}')">
32+
{tmpl_var name='modules_title'}
33+
</a>
34+
</div>
35+
</tmpl_loop>
36+
</div>

interface/web/nav.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,30 @@
3535

3636
//** Top Naviation
3737
if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
38-
38+
3939
$app->tpl->newTemplate('topnav.tpl.htm');
40-
40+
4141
//* Check User Login and current module
4242
if(isset($_SESSION["s"]["user"]) && $_SESSION["s"]["user"]['active'] == 1 && is_array($_SESSION['s']['module'])) {
4343
//* Loading modules of the user and building top navigation
4444
$modules = explode(',', $_SESSION['s']['user']['modules']);
45+
/*
46+
* If the dashboard is in the list of modules it always has to be the first!
47+
*/
48+
if (in_array('dashboard', $modules)) {
49+
$key = array_search('dashboard', $modules);
50+
unset($modules[$key]);
51+
$modules = array_merge(array('dashboard'), $modules);
52+
}
4553
if(is_array($modules)) {
4654
foreach($modules as $mt) {
4755
if(is_file($mt.'/lib/module.conf.php')) {
4856
if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
4957
include_once($mt.'/lib/module.conf.php');
5058
$active = ($module['name'] == $_SESSION['s']['module']['name']) ? 1 : 0;
5159
$topnav[] = array( 'title' => $app->lng($module['title']),
52-
'active' => $active,
53-
'module' => $module['name']);
60+
'active' => $active,
61+
'module' => $module['name']);
5462
}
5563
}
5664
}
@@ -59,21 +67,21 @@
5967
include_once('login/lib/module.conf.php');
6068
$_SESSION['s']['module'] = $module;
6169
$topnav[] = array( 'title' => 'Login',
62-
'active' => 1);
70+
'active' => 1);
6371
$module = null;
6472
unset($module);
6573
}
6674

6775
//* Topnavigation
6876
$app->tpl->setLoop('nav_top',$topnav);
69-
77+
7078
}
7179

7280
//** Side Naviation
7381
if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
74-
82+
7583
$app->tpl->newTemplate('sidenav.tpl.htm');
76-
84+
7785
//* translating module navigation
7886
$nav_translated = array();
7987
if(isset($_SESSION['s']['module']['nav']) && is_array($_SESSION['s']['module']['nav'])) {
@@ -93,7 +101,7 @@
93101
}
94102

95103
$app->tpl->setLoop('nav_left',$nav_translated);
96-
104+
97105
}
98106

99107
$app->tpl_defaults();

interface/web/themes/default/css/navigation/nav_top.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,8 @@
9595
background-image: url('../../icons/x32/domain.png') !important;
9696
}
9797

98+
.topnav-dashboard {
99+
background-image: url('../../icons/x32/dashboard.png') !important;
100+
}
101+
98102
}

0 commit comments

Comments
 (0)