Unverified Commit 9a549c75 authored by Sébastien DAVOULT's avatar Sébastien DAVOULT Committed by GitHub
Browse files

Merge pull request #60 from EyesOfNetworkCommunity/gestion_theme

Gestion theme
parents 240141d5 171ff121
Summary: EyesOfNetwork Web Interface Summary: EyesOfNetwork Web Interface
Name: eonweb Name: eonweb
Version: 5.3 Version: 5.3
Release: 4 Release: 5
Source: https://github.com/EyesOfNetworkCommunity/%{name}/archive/%{version}-%{release}.tar.gz Source: https://github.com/EyesOfNetworkCommunity/%{name}/archive/%{version}-%{release}.tar.gz
Group: Applications/System Group: Applications/System
License: GPL License: GPL
Requires: backup-manager, cacti0, ged, ged-mysql, eon4apps, lilac, snmptt, thruk Requires: backup-manager, cacti0, ged, ged-mysql, eon4apps, lilac >= 3.1-2, snmptt, thruk
Requires: httpd, mariadb-server, mod_auth_eon, mod_perl Requires: httpd, mariadb-server, mod_auth_eon, mod_perl
Requires: php, php-mysqlnd, php-ldap, php-process, php-xml Requires: php, php-mysqlnd, php-ldap, php-process, php-xml
Requires: nagios >= 3.0, nagios-plugins >= 1.4.0, nagvis, nagiosbp, notifier, nagios-plugins-nrpe Requires: nagios >= 3.0, nagios-plugins >= 1.4.0, nagvis, nagiosbp, notifier, nagios-plugins-nrpe
...@@ -47,10 +47,19 @@ case "$1" in ...@@ -47,10 +47,19 @@ case "$1" in
# Initial install # Initial install
/bin/chmod 775 %{datadir}/cache /bin/chmod 775 %{datadir}/cache
/bin/chown -R root:eyesofnetwork %{datadir} /bin/chown -R root:eyesofnetwork %{datadir}
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatDark/thruk/EONFlatDark/ /etc/thruk/themes/themes-enabled/EONFlatDark
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatLight/thruk/EONFlatLight/ /etc/thruk/themes/themes-enabled/EONFlatLight
/usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.5.sql 2>/dev/null
systemctl restart httpd
;; ;;
2) 2)
# Update EON 5.3.4 # Update EON 5.3.4
/usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.4.sql /usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.4.sql 2>/dev/null
# Update EON 5.3.5
/usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.5.sql 2>/dev/null
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatDark/thruk/EONFlatDark/ /etc/thruk/themes/themes-enabled/EONFlatDark
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatLight/thruk/EONFlatLight/ /etc/thruk/themes/themes-enabled/EONFlatLight
systemctl restart httpd
;; ;;
esac esac
...@@ -66,6 +75,11 @@ rm -rf %{buildroot} ...@@ -66,6 +75,11 @@ rm -rf %{buildroot}
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%changelog %changelog
* Thu Apr 09 2020 Sebastien DAVOULT <d@vou.lt> - 5.3-5.eon
- Add Theme Manager
- Add EONFlatLight theme
- Add EONFlatDark theme
* Thu Apr 09 2020 Sebastien DAVOULT <d@vou.lt> - 5.3-4.eon * Thu Apr 09 2020 Sebastien DAVOULT <d@vou.lt> - 5.3-4.eon
- Add 5.3 Services in monitored service Management Processes - Add 5.3 Services in monitored service Management Processes
- Add ITSM Connector Function - Add ITSM Connector Function
......
...@@ -265,6 +265,7 @@ CREATE TABLE `users` ( ...@@ -265,6 +265,7 @@ CREATE TABLE `users` (
`user_location` varchar(255) DEFAULT NULL, `user_location` varchar(255) DEFAULT NULL,
`user_limitation` tinyint(1) NOT NULL, `user_limitation` tinyint(1) NOT NULL,
`user_language` char(2) DEFAULT '0', `user_language` char(2) DEFAULT '0',
`theme` varchar(50) DEFAULT NULL,
PRIMARY KEY (`user_id`,`user_name`) PRIMARY KEY (`user_id`,`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
......
ALTER TABLE users ADD theme VARCHAR(50);
INSERT ignore INTO configs VALUE ('theme', 'Classic-v5');
...@@ -71,7 +71,14 @@ ...@@ -71,7 +71,14 @@
} }
.navbar-logo { .navbar-logo {
margin-top: -8px; margin-top: -12px;
margin-left: -16px;
}
.navbar-brand > img {
display: block;
width: 204px;
height: auto;
} }
.form-inline { .form-inline {
......
...@@ -19,11 +19,12 @@ ...@@ -19,11 +19,12 @@
# #
######################################### #########################################
*/ */
session_start();
# Global parameters # Global parameters
include("include/config.php"); include("include/config.php");
include("include/arrays.php"); include("include/arrays.php");
include("include/function.php"); include("include/function.php");
global $database_eonweb;
# Logos # Logos
if(file_exists($path_eonweb.$path_logo_custom)) { $path_logo=$path_logo_custom; } if(file_exists($path_eonweb.$path_logo_custom)) { $path_logo=$path_logo_custom; }
...@@ -72,9 +73,25 @@ if(file_exists($path_eonweb.$path_logo_navbar_custom)) { $path_logo_navbar=$path ...@@ -72,9 +73,25 @@ if(file_exists($path_eonweb.$path_logo_navbar_custom)) { $path_logo_navbar=$path
if(file_exists($module_css)) { if(file_exists($module_css)) {
?><!-- EonWeb Module CSS --> ?><!-- EonWeb Module CSS -->
<link href="<?php echo $module_css; ?>" rel="stylesheet"> <link href="<?php echo $module_css; ?>" rel="stylesheet">
<?php } ?> <?php } ?>
<?php
// Select theme
startSessionTheme();
$dir = "/srv/eyesofnetwork/eonweb/themes/";
$listTheme = scandir($dir);
$verif = 0;
foreach($listTheme as $value)
{
if($value == $_SESSION["theme"]) {
setcookie("thruk_theme", $_SESSION["theme"],time()+3600,"/thruk/");
echo '<link rel="stylesheet" type="text/css" href="/themes/'. $_SESSION["theme"] .'/eonweb/custom.css">';
$verif = 1;
}
}
?>
</head> </head>
<body> <body <?php if($verif==1){ echo 'id='.$_SESSION["theme"];}?>>
<div id="wrapper"> <div id="wrapper">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW X6 -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="5.19444in" height="1.18055in" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 5194 1181"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<style type="text/css">
<![CDATA[
.str1 {stroke:#A82A76;stroke-width:30.7638}
.str2 {stroke:#A82A76;stroke-width:30.7638;stroke-linecap:round}
.str0 {stroke:#A9ABAE;stroke-width:55.5551}
.fil2 {fill:none;fill-rule:nonzero}
.fil1 {fill:#0077BD;fill-rule:nonzero}
.fil0 {fill:#A82A76;fill-rule:nonzero}
]]>
</style>
</defs>
<g id="Layer_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<path class="fil0" d="M2429 760c79,0 135,-52 135,-155 0,-102 -56,-154 -135,-154 -79,0 -135,52 -135,154 0,103 56,155 135,155zm0 -46c-44,0 -78,-32 -78,-109 0,-77 34,-107 78,-107 44,0 78,30 78,107 0,77 -35,109 -78,109zm355 -258c-14,-8 -29,-14 -53,-14 -40,0 -68,24 -68,75l0 23 -32 0 0 43 32 0 0 174 55 0 0 -174 50 0 2 -43 -52 0 0 -24c0,-18 7,-27 21,-27 10,0 18,2 27,7l19 -39zm70 -1l0 303 55 0 0 -196c0,-22 0,-42 -2,-60l1 0c4,17 13,39 23,58l97 198 83 0 0 -303 -55 0 0 189c0,20 0,43 2,67l-1 0c-4,-21 -19,-51 -27,-67l-93 -190 -83 0zm557 195c0,-70 -36,-114 -99,-114 -62,0 -104,44 -104,112 0,73 45,112 108,112 46,0 73,-27 88,-59l-40 -18c-9,20 -25,32 -48,32 -27,0 -48,-11 -53,-42l148 -23zm-149 -16c0,-34 18,-56 48,-56 25,0 41,14 43,42l-92 14zm244 -144l0 49 -32 0 0 43 32 0 0 106c0,50 22,72 66,72 19,0 33,-3 47,-8l-8 -41c-9,2 -18,4 -25,4 -15,0 -25,-7 -25,-28l0 -104 50 0 2 -43 -52 0 0 -55 -55 7zm168 49l55 218 72 0 39 -166 39 166 72 0 55 -218 -56 -2 -35 177 -39 -175 -72 0 -39 175 -35 -177 -56 2zm497 41c31,0 48,30 48,67 0,37 -17,68 -48,68 -31,0 -48,-31 -48,-68 0,-37 17,-67 48,-67zm0 -45c-66,0 -103,48 -103,111 0,63 37,113 103,113 66,0 103,-50 103,-113 0,-63 -37,-111 -103,-111zm195 3l0 218 55 0 0 -140c15,-21 40,-28 63,-27 0,-1 6,-52 6,-54 -35,-1 -61,14 -75,38l0 -36 -48 1zm206 -94l0 312 55 0 0 -58 30 -36 55 96 61 -2 0 -2 -78 -132 70 -80 0 -3 -57 -2 -81 100 0 -194 -55 2z"/>
<path class="fil1" d="M1261 454l0 303 173 0 0 -46 -117 0 0 -84 98 0 0 -46 -98 0 0 -81 114 0 2 -46 -171 0zm238 85l76 223 -4 13c-9,30 -28,36 -59,41l9 42c64,-3 90,-27 109,-83l78 -236 -56 -2 -48 170 -48 -170 -56 2zm475 110c0,-70 -36,-114 -99,-114 -62,0 -104,44 -104,112 0,73 45,112 108,112 46,0 73,-27 88,-59l-40 -18c-9,20 -25,32 -48,32 -27,0 -48,-11 -53,-42l148 -23zm-149 -16c0,-34 18,-56 48,-56 25,0 41,14 43,42l-92 14zm217 74c10,28 37,53 89,53 46,0 86,-23 86,-70 0,-76 -115,-54 -115,-90 0,-14 12,-20 31,-20 19,0 34,9 40,24l41 -21c-12,-32 -44,-48 -83,-48 -52,0 -84,26 -84,65 0,76 115,58 115,93 0,14 -11,21 -31,21 -21,0 -38,-9 -45,-28l-43 20z"/>
<path class="fil2 str0" d="M759 897c169,0 307,-137 307,-307 0,-169 -137,-307 -307,-307 -169,0 -307,137 -307,307 0,169 137,307 307,307z"/>
<path class="fil0" d="M953 700l-56 -43c-7,12 -16,23 -26,33 -1,1 -2,2 -3,2l57 44c4,3 9,5 14,5 7,0 14,-3 18,-9 8,-10 6,-24 -4,-32l0 0z"/>
<path class="fil2 str1" d="M727 718c86,0 155,-68 155,-152 0,-84 -70,-152 -155,-152 -86,0 -155,68 -155,152 0,84 70,152 155,152z"/>
<path class="fil2 str2" d="M727 476c0,0 80,0 95,75"/>
</g>
</svg>
...@@ -84,11 +84,11 @@ $path_eonweb="$path_eon/eonweb"; ...@@ -84,11 +84,11 @@ $path_eonweb="$path_eon/eonweb";
$path_frame="/module/module_frame/index.php?url="; $path_frame="/module/module_frame/index.php?url=";
$dir_imgcache="cache"; $dir_imgcache="cache";
$path_images="/images"; $path_images="/images";
$path_logo="$path_images/logo.png"; $path_logo="$path_images/logo.svg";
$path_logo_custom="$path_images/custom.logo.png"; $path_logo_custom="$path_images/custom.logo.png";
$path_logo_favicon="$path_images/favicon.png"; $path_logo_favicon="$path_images/favicon.png";
$path_logo_favicon_custom="$path_images/custom.favicon.png"; $path_logo_favicon_custom="$path_images/custom.favicon.png";
$path_logo_navbar="$path_images/logo-navbar.png"; $path_logo_navbar="$path_images/logo.svg";
$path_logo_navbar_custom="$path_images/custom.logo-navbar.png"; $path_logo_navbar_custom="$path_images/custom.logo-navbar.png";
$path_languages="$path_eonweb/include/languages"; $path_languages="$path_eonweb/include/languages";
$path_messages="$path_languages/messages"; $path_messages="$path_languages/messages";
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# #
######################################### #########################################
*/ */
session_start();
# Internationalization # Internationalization
include("classes/Translator.class.php"); include("classes/Translator.class.php");
...@@ -752,7 +752,7 @@ function ldap_escape($str, $login=false, $escape=false){ ...@@ -752,7 +752,7 @@ function ldap_escape($str, $login=false, $escape=false){
} }
// User creation // User creation
function insert_user($user_name, $user_descr, $user_group, $user_password1, $user_password2, $user_type, $user_location, $user_mail, $user_limitation, $message, $in_nagvis = false, $in_cacti = false, $nagvis_group = false, $user_language = false){ function insert_user($user_name, $user_descr, $user_group, $user_password1, $user_password2, $user_type, $user_location, $user_mail, $user_limitation, $message, $in_nagvis = false, $in_cacti = false, $nagvis_group = false, $user_language = false, $theme = false){
global $database_host; global $database_host;
global $database_cacti; global $database_cacti;
global $database_username; global $database_username;
...@@ -787,7 +787,7 @@ function insert_user($user_name, $user_descr, $user_group, $user_password1, $use ...@@ -787,7 +787,7 @@ function insert_user($user_name, $user_descr, $user_group, $user_password1, $use
$user_password = md5($user_password1); $user_password = md5($user_password1);
// Insert into eonweb // Insert into eonweb
sqlrequest("$database_eonweb","INSERT INTO users (user_name,user_descr,group_id,user_passwd,user_type,user_location,user_limitation,user_language) VALUES('$user_name', '$user_descr', '$user_group', '$user_password', '$user_type', '$user_location', '$user_limitation', '$user_language')"); sqlrequest("$database_eonweb","INSERT INTO users (user_name,user_descr,group_id,user_passwd,user_type,user_location,user_limitation,user_language,theme) VALUES('$user_name', '$user_descr', '$user_group', '$user_password', '$user_type', '$user_location', '$user_limitation', '$user_language', '$theme')");
$user_id=mysqli_result(sqlrequest("$database_eonweb","SELECT user_id FROM users WHERE user_name='$user_name'"),0,"user_id"); $user_id=mysqli_result(sqlrequest("$database_eonweb","SELECT user_id FROM users WHERE user_name='$user_name'"),0,"user_id");
$group_name=mysqli_result(sqlrequest("$database_eonweb","SELECT group_name FROM groups WHERE group_id='$user_group'"),0,"group_name"); $group_name=mysqli_result(sqlrequest("$database_eonweb","SELECT group_name FROM groups WHERE group_id='$user_group'"),0,"group_name");
...@@ -1349,6 +1349,43 @@ function getEonConfig($name,$type=false) ...@@ -1349,6 +1349,43 @@ function getEonConfig($name,$type=false)
} }
function startSessionTheme(){
global $database_eonweb;
if(isset($_COOKIE["user_name"])){
$conn = connexionDB($database_eonweb);
$sql = $conn->prepare("SELECT `theme` FROM users WHERE user_name = :userName");
$sql->bindParam("userName", $_COOKIE["user_name"]);
$sql->execute();
$result = $sql->fetch();
$conn = null;
$sql = null;
$theme_value = $result["theme"];
if($theme_value == "Default"){
$conn = connexionDB($database_eonweb);
$sql = "SELECT value FROM configs WHERE name = 'theme'";
$result = $conn->query($sql);
$data = $result->fetch();
$theme_value = $data["value"];
$conn = null;
$sql = null;
}
$_SESSION["theme"] = $theme_value;
} else {
$conn = connexionDB($database_eonweb);
$sql = "SELECT value FROM configs WHERE name = 'theme'";
$result = $conn->query($sql);
$data = $result->fetch();
$theme_value = $data["value"];
$conn = null;
$sql = null;
$_SESSION["theme"] = $theme_value;
}
}
function checkUpdateDB(){ function checkUpdateDB(){
global $version; global $version;
global $database_eonweb; global $database_eonweb;
......
...@@ -202,6 +202,7 @@ ...@@ -202,6 +202,7 @@
"label.admin_user.user_lang_en": "Anglais", "label.admin_user.user_lang_en": "Anglais",
"label.admin_user.user_lang_fr": "Français", "label.admin_user.user_lang_fr": "Français",
"label.admin_user.user_lang_0": "Langue du navigateur", "label.admin_user.user_lang_0": "Langue du navigateur",
"label.admin_user.user_theme": "Choisir un thême",
"label.admin_user.user_ldap": "Utilisateur LDAP", "label.admin_user.user_ldap": "Utilisateur LDAP",
"label.admin_user.user_limit": "Utilisateur limité", "label.admin_user.user_limit": "Utilisateur limité",
"label.admin_user.user_mail": "Email de l'utilisateur", "label.admin_user.user_mail": "Email de l'utilisateur",
......
...@@ -202,6 +202,7 @@ ...@@ -202,6 +202,7 @@
"label.admin_user.user_lang_en": "English", "label.admin_user.user_lang_en": "English",
"label.admin_user.user_lang_fr": "French", "label.admin_user.user_lang_fr": "French",
"label.admin_user.user_lang_0": "Browser language", "label.admin_user.user_lang_0": "Browser language",
"label.admin_user.user_theme": "Choose a theme",
"label.admin_user.user_ldap": "LDAP user", "label.admin_user.user_ldap": "LDAP user",
"label.admin_user.user_limit": "User limited", "label.admin_user.user_limit": "User limited",
"label.admin_user.user_mail": "User mail", "label.admin_user.user_mail": "User mail",
......
...@@ -28,7 +28,7 @@ function display_login(){ ...@@ -28,7 +28,7 @@ function display_login(){
global $path_logo; global $path_logo;
echo ' echo '
<div class="container"> <div class="container" id="login">
<div class="row"> <div class="row">
<div class="img col-md-4 col-md-offset-4"> <div class="img col-md-4 col-md-offset-4">
<div class="login-panel panel panel-default"> <div class="login-panel panel panel-default">
...@@ -231,7 +231,7 @@ else { ...@@ -231,7 +231,7 @@ else {
// Create session ID // Create session ID
$sessid=rand(); $sessid=rand();
sqlrequest($database_eonweb,"INSERT INTO sessions (session_id,user_id) VALUES ('$sessid','$usrid')"); sqlrequest($database_eonweb,"INSERT INTO sessions (session_id,user_id) VALUES ('$sessid','$usrid')");
// Send cookie // Send cookie
$cookie_time = ($cookie_time=="0") ? 0 : time() + $cookie_time; $cookie_time = ($cookie_time=="0") ? 0 : time() + $cookie_time;
setcookie("session_id",$sessid,$cookie_time); setcookie("session_id",$sessid,$cookie_time);
...@@ -239,7 +239,7 @@ else { ...@@ -239,7 +239,7 @@ else {
setcookie("user_id",$usrid,$cookie_time); setcookie("user_id",$usrid,$cookie_time);
setcookie("user_limitation",$usrlimit,$cookie_time); setcookie("user_limitation",$usrlimit,$cookie_time);
setcookie("group_id",$grpid,$cookie_time); setcookie("group_id",$grpid,$cookie_time);
// Rename filters // Rename filters
$filter="$path_eonweb/$dir_imgcache/".strtolower($_POST['login'])."-ged.xml"; $filter="$path_eonweb/$dir_imgcache/".strtolower($_POST['login'])."-ged.xml";
$filter_old="$path_eonweb/$dir_imgcache/".$_POST['login']."-ged.xml"; $filter_old="$path_eonweb/$dir_imgcache/".$_POST['login']."-ged.xml";
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
# #
######################################### #########################################
*/ */
session_start();
include("header.php"); include("header.php");
logging("logout","User logged out"); logging("logout","User logged out");
...@@ -36,10 +36,11 @@ setcookie("nagvis_session",FALSE,0,"/nagvis"); ...@@ -36,10 +36,11 @@ setcookie("nagvis_session",FALSE,0,"/nagvis");
setcookie("Cacti",FALSE); setcookie("Cacti",FALSE);
setcookie("clickedFolder",FALSE); setcookie("clickedFolder",FALSE);
setcookie("highlightedTreeviewLink",FALSE); setcookie("highlightedTreeviewLink",FALSE);
session_unset();
session_destroy();
?> ?>
<div class="container"> <div class="container" id="login">
<div class="row"> <div class="row">
<div class="img col-md-4 col-md-offset-4"> <div class="img col-md-4 col-md-offset-4">
<div class="login-panel panel panel-default"> <div class="login-panel panel panel-default">
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
# #
######################################### #########################################
*/ */
ini_set('display_errors','on'); //ini_set('display_errors','on');
error_reporting(E_ALL); //error_reporting(E_ALL);
include("../../header.php"); include("../../header.php");
include("../../side.php"); include("../../side.php");
......
...@@ -36,7 +36,7 @@ include("../../side.php"); ...@@ -36,7 +36,7 @@ include("../../side.php");
function retrieve_user_info($user_id) function retrieve_user_info($user_id)
{ {
global $database_eonweb; global $database_eonweb;
return sqlrequest("$database_eonweb","SELECT user_name, user_descr, group_id, user_passwd, user_type, user_location, user_limitation, user_language FROM users WHERE user_id='$user_id'"); return sqlrequest("$database_eonweb","SELECT user_name, user_descr, group_id, user_passwd, user_type, user_location, user_limitation, user_language, theme FROM users WHERE user_id='$user_id'");
} }
// Display user language selection // Display user language selection
...@@ -77,11 +77,49 @@ include("../../side.php"); ...@@ -77,11 +77,49 @@ include("../../side.php");
return $res; return $res;
} }
// Display theme
function GetThemeList() {
global $database_eonweb;
global $user_id;
// creation of a select and catch values
$conn = connexionDB($database_eonweb);
$sql = $conn->prepare("SELECT `theme` FROM users WHERE user_id = :userId");
$sql->bindParam("userId", $user_id);
$sql->execute();
$result = $sql->fetch();
$conn = null;
$sql = null;
$dir = "/srv/eyesofnetwork/eonweb/themes/";
$listTheme = scandir($dir);
$res = '<select class="form-control" name="theme">';
foreach($listTheme as $value) {
if(is_dir($dir . $value)) {
if($value != "." && $value != "..") {
if($value == $result["theme"]){
$res.="<option value='".$value."' selected=selected>".$value."</option>";
}
else if($value == "Default" && $result["theme"] == NULL){
$res.="<option value='".$value."' id='aa' selected=selected>".$value."</option>";
}
else{
$res.="<option value='".$value."'>".$value."</option>";
}
}
}
}
$res .= '</select>';
return $res;
}
//-------------------------------------------------------- //--------------------------------------------------------
// Update User Information & Right // Update User Information & Right
function update_user($user_id, $user_name, $user_descr, $user_group, $user_password1, $user_password2 ,$user_type, $user_location, $user_mail, $user_limitation, $old_group_id, $old_name, $create_user_in_nagvis, $create_user_in_cacti, $nagvis_role_id, $user_language) function update_user($user_id, $user_name, $user_descr, $user_group, $user_password1, $user_password2 ,$user_type, $user_location, $user_mail, $user_limitation, $old_group_id, $old_name, $create_user_in_nagvis, $create_user_in_cacti, $nagvis_role_id, $user_language, $theme)
{ {
global $database_host; global $database_host;
global $database_cacti; global $database_cacti;
...@@ -111,11 +149,11 @@ include("../../side.php"); ...@@ -111,11 +149,11 @@ include("../../side.php");
if ($user_password1 != "abcdefghijklmnopqrstuvwxyz") { if ($user_password1 != "abcdefghijklmnopqrstuvwxyz") {
$passwd_temp = md5($user_password1); $passwd_temp = md5($user_password1);
// Update into eonweb // Update into eonweb
sqlrequest("$database_eonweb","UPDATE users set user_name='$user_name', user_descr='$user_descr',group_id='$user_group',user_passwd='$passwd_temp',user_type='$user_type',user_location='$user_location',user_limitation='$user_limitation',user_language='$user_language' WHERE user_id ='$user_id'"); sqlrequest("$database_eonweb","UPDATE users set user_name='$user_name', user_descr='$user_descr',group_id='$user_group',user_passwd='$passwd_temp',user_type='$user_type',user_location='$user_location',user_limitation='$user_limitation',user_language='$user_language', theme='$theme' WHERE user_id ='$user_id'");
} }
else { else {
// Update into eonweb // Update into eonweb
sqlrequest("$database_eonweb","UPDATE users set user_name='$user_name', user_descr='$user_descr',group_id='$user_group',user_type='$user_type',user_location='$user_location',user_limitation='$user_limitation',user_language='$user_language' WHERE user_id ='$user_id'"); sqlrequest("$database_eonweb","UPDATE users set user_name='$user_name', user_descr='$user_descr',group_id='$user_group',user_type='$user_type',user_location='$user_location',user_limitation='$user_limitation',user_language='$user_language', theme='$theme' WHERE user_id ='$user_id'");
} }
// Update into lilac // Update into lilac
...@@ -230,6 +268,7 @@ include("../../side.php"); ...@@ -230,6 +268,7 @@ include("../../side.php");
$user_language = retrieve_form_data("user_language",""); $user_language = retrieve_form_data("user_language","");
$old_group_id = mysqli_result(sqlrequest($database_eonweb,"select group_id from users where user_id='$user_id'"),0,"group_id"); $old_group_id = mysqli_result(sqlrequest($database_eonweb,"select group_id from users where user_id='$user_id'"),0,"group_id");
$old_name = retrieve_form_data("user_name_old",""); $old_name = retrieve_form_data("user_name_old","");
$theme = retrieve_form_data("theme","");
$create_user_in_nagvis = retrieve_form_data("create_user_in_nagvis",""); $create_user_in_nagvis = retrieve_form_data("create_user_in_nagvis","");
$nagvis_role_id = retrieve_form_data("nagvis_group",""); $nagvis_role_id = retrieve_form_data("nagvis_group","");
...@@ -272,9 +311,9 @@ include("../../side.php"); ...@@ -272,9 +311,9 @@ include("../../side.php");
$user_group = retrieve_form_data("user_group",""); $user_group = retrieve_form_data("user_group","");
$nagvis_grp = retrieve_form_data("nagvis_group", ""); $nagvis_grp = retrieve_form_data("nagvis_group", "");
$user_id=insert_user(stripAccents($user_name), $user_descr, $user_group, $user_password1, $user_password2, $user_type, $user_location,$user_mail,$user_limitation, true, $create_user_in_nagvis, $create_user_in_cacti, $nagvis_grp, $user_language); $user_id=insert_user(stripAccents($user_name), $user_descr, $user_group, $user_password1, $user_password2, $user_type, $user_location,$user_mail,$user_limitation, true, $create_user_in_nagvis, $create_user_in_cacti, $nagvis_grp, $user_language, $theme);
//message(8,"User location: $user_location",'ok'); // For debug pupose, to be removed //message(8,"User location: $user_location",'ok'); // For debug pupose, to be removed
// Retrieve Group Information from database // Retrieve Group Information from database
if($user_id){ if($user_id){
$user_name_descr = retrieve_user_info($user_id); $user_name_descr = retrieve_user_info($user_id);
...@@ -288,6 +327,7 @@ include("../../side.php"); ...@@ -288,6 +327,7 @@ include("../../side.php");
$user_location=mysqli_result($user_name_descr,0,"user_location"); $user_location=mysqli_result($user_name_descr,0,"user_location");
$user_password1= "abcdefghijklmnopqrstuvwxyz"; $user_password1= "abcdefghijklmnopqrstuvwxyz";
$user_password2= "abcdefghijklmnopqrstuvwxyz"; $user_password2= "abcdefghijklmnopqrstuvwxyz";
$theme = retrieve_form_data("theme","");
} }
} }
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
...@@ -304,7 +344,7 @@ include("../../side.php"); ...@@ -304,7 +344,7 @@ include("../../side.php");
// ACCOUNT UPDATE (and retrieve parameters) // ACCOUNT UPDATE (and retrieve parameters)
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
if (isset($_POST['update'])){ if (isset($_POST['update'])){
update_user($user_id, stripAccents($user_name), $user_descr, $user_group, $user_password1, $user_password2, $user_type, $user_location, $user_mail, $user_limitation, $old_group_id, $old_name, $create_user_in_nagvis, $create_user_in_cacti, $nagvis_role_id, $user_language); update_user($user_id, stripAccents($user_name), $user_descr, $user_group, $user_password1, $user_password2, $user_type, $user_location, $user_mail, $user_limitation, $old_group_id, $old_name, $create_user_in_nagvis, $create_user_in_cacti, $nagvis_role_id, $user_language, $theme);
//message(8,"Update: User location = $user_location",'ok'); // For debug pupose, to be removed //message(8,"Update: User location = $user_location",'ok'); // For debug pupose, to be removed
//message(8,"Update: User name = $user_name",'ok'); // For debug pupose, to be removed //message(8,"Update: User name = $user_name",'ok'); // For debug pupose, to be removed
} }
...@@ -447,6 +487,14 @@ include("../../side.php"); ...@@ -447,6 +487,14 @@ include("../../side.php");
<?php echo GetUserLang(); ?> <?php echo GetUserLang(); ?>
</div> </div>
</div> </div>
<!-- Choose a theme -->
<div class="row form-group">
<label class="col-md-3"><?php echo getLabel("label.admin_user.user_theme"); ?></label>
<div class="col-md-9">
<?php echo GetThemeList(); ?>
</div>
</div>
<!-- If not user admin --> <!-- If not user admin -->
<?php if($user_id!="1") { ?> <?php if($user_id!="1") { ?>
......
...@@ -35,7 +35,7 @@ function ajaxCharts(link) ...@@ -35,7 +35,7 @@ function ajaxCharts(link)
}, },
dataType: "JSON", dataType: "JSON",
success: function(response){ success: function(response){
var title = '<a style="font-size:18px;color:#333333;text-decoration:none;" class="graph_title" style="text-decoration:none;" href="'+path_nagios_status+'?hostgroup=all&style=hostdetail">Equipements Nagios</a>'; var title = '<a style="font-size:20px;color:#FFFFFF;text-decoration:none;" class="graph_title" style="text-decoration:none;" href="'+path_nagios_status+'?hostgroup=all&style=hostdetail">Equipements Nagios</a>';
if(link == "with_link"){ if(link == "with_link"){
drawPieChart("container_hosts_state", title, response, "hostState", "with_link"); drawPieChart("container_hosts_state", title, response, "hostState", "with_link");
} }
...@@ -97,7 +97,7 @@ function ajaxCharts(link) ...@@ -97,7 +97,7 @@ function ajaxCharts(link)
}, },
dataType: "JSON", dataType: "JSON",
success: function(response){ success: function(response){
var title = '<a style="font-size:18px;color:#333333;text-decoration:none;" class="graph_title" style="text-decoration:none;" href="/module/monitoring_ged/ged.php?q=active">Evenements actifs</a>'; var title = '<a style="font-size:18px;color:#FFF;text-decoration:none;" class="graph_title" style="text-decoration:none;" href="/module/monitoring_ged/ged.php?q=active">Evenements actifs</a>';
drawColumnChart("container_event_state_nbr_by_time", title, response); drawColumnChart("container_event_state_nbr_by_time", title, response);
$("#menu-toggle").click(function(){ $("#menu-toggle").click(function(){
$('#container_event_state_nbr_by_time').highcharts().reflow();