From 2db42a8180b716de7fa83ed9cd96dbe9b59e9aff Mon Sep 17 00:00:00 2001
From: vogelor <vogelor@ispconfig3>
Date: Wed, 05 May 2010 15:57:13 -0400
Subject: [PATCH] The very first version of a dashboard (very very simple, just that we have some...)
---
interface/web/dashboard/templates/dashboard.htm | 36 ++++++
interface/web/nav.php | 26 ++-
interface/web/themes/default/css/navigation/nav_top.css | 4
interface/web/dashboard/dashboard.php | 119 +++++++++++++++++++
interface/web/dashboard/lib/lang/de.lng | 4
interface/web/dashboard/lib/admin.conf.php | 29 ++++
interface/web/dashboard/lib/module.conf.php | 46 +++++++
interface/web/themes/default_64_navimg/css/additional.css | 5
interface/web/dashboard/lib/lang/en.lng | 4
interface/web/themes/default/icons/x32/dashboard.png | 0
interface/lib/lang/en.lng | 1
interface/web/themes/default/css/screen/content_ispc.css | 30 +++++
interface/lib/lang/de.lng | 1
interface/web/themes/default/icons/x64/dashboard.png | 0
14 files changed, 296 insertions(+), 9 deletions(-)
diff --git a/interface/lib/lang/de.lng b/interface/lib/lang/de.lng
index 9d2a670..247e6a4 100644
--- a/interface/lib/lang/de.lng
+++ b/interface/lib/lang/de.lng
@@ -33,4 +33,5 @@
$wb['top_menu_help'] = 'Support';
$wb['top_menu_billing'] = 'Billing';
$wb['top_menu_domain'] = 'Domänen';
+$wb['top_menu_dashboard'] = 'Startseite';
?>
diff --git a/interface/lib/lang/en.lng b/interface/lib/lang/en.lng
index da7caf1..1693bb1 100644
--- a/interface/lib/lang/en.lng
+++ b/interface/lib/lang/en.lng
@@ -33,5 +33,6 @@
$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';
?>
diff --git a/interface/web/dashboard/dashboard.php b/interface/web/dashboard/dashboard.php
new file mode 100644
index 0000000..53a745c
--- /dev/null
+++ b/interface/web/dashboard/dashboard.php
@@ -0,0 +1,119 @@
+<?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
diff --git a/interface/web/dashboard/lib/admin.conf.php b/interface/web/dashboard/lib/admin.conf.php
new file mode 100644
index 0000000..584f28b
--- /dev/null
+++ b/interface/web/dashboard/lib/admin.conf.php
@@ -0,0 +1,29 @@
+<?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
diff --git a/interface/web/dashboard/lib/lang/de.lng b/interface/web/dashboard/lib/lang/de.lng
new file mode 100644
index 0000000..79ffff0
--- /dev/null
+++ b/interface/web/dashboard/lib/lang/de.lng
@@ -0,0 +1,4 @@
+<?php
+$wb['welcome_user_txt'] = "Herzlich Willkommen %s";
+$wb['available_modules_txt'] = "Verfügbare Module";
+?>
diff --git a/interface/web/dashboard/lib/lang/en.lng b/interface/web/dashboard/lib/lang/en.lng
new file mode 100644
index 0000000..177fad0
--- /dev/null
+++ b/interface/web/dashboard/lib/lang/en.lng
@@ -0,0 +1,4 @@
+<?php
+$wb['welcome_user_txt'] = "Welcome %s";
+$wb['available_modules_txt'] = "Available Modules";
+?>
diff --git a/interface/web/dashboard/lib/module.conf.php b/interface/web/dashboard/lib/module.conf.php
new file mode 100644
index 0000000..28f47a2
--- /dev/null
+++ b/interface/web/dashboard/lib/module.conf.php
@@ -0,0 +1,46 @@
+<?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
diff --git a/interface/web/dashboard/templates/dashboard.htm b/interface/web/dashboard/templates/dashboard.htm
new file mode 100644
index 0000000..190252b
--- /dev/null
+++ b/interface/web/dashboard/templates/dashboard.htm
@@ -0,0 +1,36 @@
+<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> </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>
diff --git a/interface/web/nav.php b/interface/web/nav.php
index 73a6371..07eb932 100644
--- a/interface/web/nav.php
+++ b/interface/web/nav.php
@@ -35,13 +35,21 @@
//** 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 @@
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 @@
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 @@
}
$app->tpl->setLoop('nav_left',$nav_translated);
-
+
}
$app->tpl_defaults();
diff --git a/interface/web/themes/default/css/navigation/nav_top.css b/interface/web/themes/default/css/navigation/nav_top.css
index 1b52075..13dc1c8 100644
--- a/interface/web/themes/default/css/navigation/nav_top.css
+++ b/interface/web/themes/default/css/navigation/nav_top.css
@@ -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
diff --git a/interface/web/themes/default/css/screen/content_ispc.css b/interface/web/themes/default/css/screen/content_ispc.css
index 0f52f10..10803ce 100644
--- a/interface/web/themes/default/css/screen/content_ispc.css
+++ b/interface/web/themes/default/css/screen/content_ispc.css
@@ -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; }
diff --git a/interface/web/themes/default/icons/x32/dashboard.png b/interface/web/themes/default/icons/x32/dashboard.png
new file mode 100644
index 0000000..0094f83
--- /dev/null
+++ b/interface/web/themes/default/icons/x32/dashboard.png
Binary files differ
diff --git a/interface/web/themes/default/icons/x64/dashboard.png b/interface/web/themes/default/icons/x64/dashboard.png
new file mode 100644
index 0000000..7b20e56
--- /dev/null
+++ b/interface/web/themes/default/icons/x64/dashboard.png
Binary files differ
diff --git a/interface/web/themes/default_64_navimg/css/additional.css b/interface/web/themes/default_64_navimg/css/additional.css
index 9579806..a58c807 100644
--- a/interface/web/themes/default_64_navimg/css/additional.css
+++ b/interface/web/themes/default_64_navimg/css/additional.css
@@ -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
--
Gitblit v1.9.1