Skip to content

Commit 9a549c7

Browse files
authored
Merge pull request #60 from EyesOfNetworkCommunity/gestion_theme
Gestion theme
2 parents 240141d + 171ff12 commit 9a549c7

429 files changed

Lines changed: 10518 additions & 37 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

appliance/eonweb.spec

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Summary: EyesOfNetwork Web Interface
22
Name: eonweb
33
Version: 5.3
4-
Release: 4
4+
Release: 5
55
Source: https://github.com/EyesOfNetworkCommunity/%{name}/archive/%{version}-%{release}.tar.gz
66
Group: Applications/System
77
License: GPL
8-
Requires: backup-manager, cacti0, ged, ged-mysql, eon4apps, lilac, snmptt, thruk
8+
Requires: backup-manager, cacti0, ged, ged-mysql, eon4apps, lilac >= 3.1-2, snmptt, thruk
99
Requires: httpd, mariadb-server, mod_auth_eon, mod_perl
1010
Requires: php, php-mysqlnd, php-ldap, php-process, php-xml
1111
Requires: nagios >= 3.0, nagios-plugins >= 1.4.0, nagvis, nagiosbp, notifier, nagios-plugins-nrpe
@@ -47,10 +47,19 @@ case "$1" in
4747
# Initial install
4848
/bin/chmod 775 %{datadir}/cache
4949
/bin/chown -R root:eyesofnetwork %{datadir}
50+
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatDark/thruk/EONFlatDark/ /etc/thruk/themes/themes-enabled/EONFlatDark
51+
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatLight/thruk/EONFlatLight/ /etc/thruk/themes/themes-enabled/EONFlatLight
52+
/usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.5.sql 2>/dev/null
53+
systemctl restart httpd
5054
;;
5155
2)
5256
# Update EON 5.3.4
53-
/usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.4.sql
57+
/usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.4.sql 2>/dev/null
58+
# Update EON 5.3.5
59+
/usr/bin/mysql -u root --password=root66 eonweb < %{eonconfdir}/updates/5.3.5.sql 2>/dev/null
60+
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatDark/thruk/EONFlatDark/ /etc/thruk/themes/themes-enabled/EONFlatDark
61+
ln -s /srv/eyesofnetwork/eonweb/themes/EONFlatLight/thruk/EONFlatLight/ /etc/thruk/themes/themes-enabled/EONFlatLight
62+
systemctl restart httpd
5463
;;
5564
esac
5665

@@ -66,6 +75,11 @@ rm -rf %{buildroot}
6675
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
6776

6877
%changelog
78+
* Thu Apr 09 2020 Sebastien DAVOULT <d@vou.lt> - 5.3-5.eon
79+
- Add Theme Manager
80+
- Add EONFlatLight theme
81+
- Add EONFlatDark theme
82+
6983
* Thu Apr 09 2020 Sebastien DAVOULT <d@vou.lt> - 5.3-4.eon
7084
- Add 5.3 Services in monitored service Management Processes
7185
- Add ITSM Connector Function

appliance/eonweb.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ CREATE TABLE `users` (
265265
`user_location` varchar(255) DEFAULT NULL,
266266
`user_limitation` tinyint(1) NOT NULL,
267267
`user_language` char(2) DEFAULT '0',
268+
`theme` varchar(50) DEFAULT NULL,
268269
PRIMARY KEY (`user_id`,`user_name`)
269270
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
270271
/*!40101 SET character_set_client = @saved_cs_client */;

appliance/updates/5.3.5.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE users ADD theme VARCHAR(50);
2+
INSERT ignore INTO configs VALUE ('theme', 'Classic-v5');

css/eonweb.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@
7171
}
7272

7373
.navbar-logo {
74-
margin-top: -8px;
74+
margin-top: -12px;
75+
margin-left: -16px;
76+
}
77+
78+
.navbar-brand > img {
79+
display: block;
80+
width: 204px;
81+
height: auto;
7582
}
7683

7784
.form-inline {

header.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
#
2020
#########################################
2121
*/
22-
22+
session_start();
2323
# Global parameters
2424
include("include/config.php");
2525
include("include/arrays.php");
2626
include("include/function.php");
27+
global $database_eonweb;
2728

2829
# Logos
2930
if(file_exists($path_eonweb.$path_logo_custom)) { $path_logo=$path_logo_custom; }
@@ -72,9 +73,25 @@
7273
if(file_exists($module_css)) {
7374
?><!-- EonWeb Module CSS -->
7475
<link href="<?php echo $module_css; ?>" rel="stylesheet">
75-
<?php } ?>
76+
<?php } ?>
77+
78+
<?php
79+
// Select theme
80+
startSessionTheme();
81+
$dir = "/srv/eyesofnetwork/eonweb/themes/";
82+
$listTheme = scandir($dir);
83+
$verif = 0;
84+
foreach($listTheme as $value)
85+
{
86+
if($value == $_SESSION["theme"]) {
87+
setcookie("thruk_theme", $_SESSION["theme"],time()+3600,"/thruk/");
88+
echo '<link rel="stylesheet" type="text/css" href="/themes/'. $_SESSION["theme"] .'/eonweb/custom.css">';
89+
$verif = 1;
90+
}
91+
}
92+
?>
7693
</head>
7794

78-
<body>
95+
<body <?php if($verif==1){ echo 'id='.$_SESSION["theme"];}?>>
7996

8097
<div id="wrapper">

images/logo.svg

Lines changed: 28 additions & 0 deletions
Loading

include/config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@
8484
$path_frame="/module/module_frame/index.php?url=";
8585
$dir_imgcache="cache";
8686
$path_images="/images";
87-
$path_logo="$path_images/logo.png";
87+
$path_logo="$path_images/logo.svg";
8888
$path_logo_custom="$path_images/custom.logo.png";
8989
$path_logo_favicon="$path_images/favicon.png";
9090
$path_logo_favicon_custom="$path_images/custom.favicon.png";
91-
$path_logo_navbar="$path_images/logo-navbar.png";
91+
$path_logo_navbar="$path_images/logo.svg";
9292
$path_logo_navbar_custom="$path_images/custom.logo-navbar.png";
9393
$path_languages="$path_eonweb/include/languages";
9494
$path_messages="$path_languages/messages";

include/function.php

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#
2020
#########################################
2121
*/
22-
22+
session_start();
2323
# Internationalization
2424
include("classes/Translator.class.php");
2525

@@ -752,7 +752,7 @@ function ldap_escape($str, $login=false, $escape=false){
752752
}
753753

754754
// User creation
755-
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){
755+
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){
756756
global $database_host;
757757
global $database_cacti;
758758
global $database_username;
@@ -787,7 +787,7 @@ function insert_user($user_name, $user_descr, $user_group, $user_password1, $use
787787
$user_password = md5($user_password1);
788788

789789
// Insert into eonweb
790-
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')");
790+
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')");
791791
$user_id=mysqli_result(sqlrequest("$database_eonweb","SELECT user_id FROM users WHERE user_name='$user_name'"),0,"user_id");
792792
$group_name=mysqli_result(sqlrequest("$database_eonweb","SELECT group_name FROM groups WHERE group_id='$user_group'"),0,"group_name");
793793

@@ -1349,6 +1349,43 @@ function getEonConfig($name,$type=false)
13491349

13501350
}
13511351

1352+
function startSessionTheme(){
1353+
global $database_eonweb;
1354+
1355+
if(isset($_COOKIE["user_name"])){
1356+
1357+
$conn = connexionDB($database_eonweb);
1358+
$sql = $conn->prepare("SELECT `theme` FROM users WHERE user_name = :userName");
1359+
$sql->bindParam("userName", $_COOKIE["user_name"]);
1360+
$sql->execute();
1361+
$result = $sql->fetch();
1362+
$conn = null;
1363+
$sql = null;
1364+
$theme_value = $result["theme"];
1365+
if($theme_value == "Default"){
1366+
$conn = connexionDB($database_eonweb);
1367+
$sql = "SELECT value FROM configs WHERE name = 'theme'";
1368+
$result = $conn->query($sql);
1369+
$data = $result->fetch();
1370+
$theme_value = $data["value"];
1371+
$conn = null;
1372+
$sql = null;
1373+
}
1374+
1375+
$_SESSION["theme"] = $theme_value;
1376+
1377+
} else {
1378+
$conn = connexionDB($database_eonweb);
1379+
$sql = "SELECT value FROM configs WHERE name = 'theme'";
1380+
$result = $conn->query($sql);
1381+
$data = $result->fetch();
1382+
$theme_value = $data["value"];
1383+
$conn = null;
1384+
$sql = null;
1385+
$_SESSION["theme"] = $theme_value;
1386+
}
1387+
}
1388+
13521389
function checkUpdateDB(){
13531390
global $version;
13541391
global $database_eonweb;

include/languages/messages-fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
"label.admin_user.user_lang_en": "Anglais",
203203
"label.admin_user.user_lang_fr": "Français",
204204
"label.admin_user.user_lang_0": "Langue du navigateur",
205+
"label.admin_user.user_theme": "Choisir un thême",
205206
"label.admin_user.user_ldap": "Utilisateur LDAP",
206207
"label.admin_user.user_limit": "Utilisateur limité",
207208
"label.admin_user.user_mail": "Email de l'utilisateur",

include/languages/messages.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
"label.admin_user.user_lang_en": "English",
203203
"label.admin_user.user_lang_fr": "French",
204204
"label.admin_user.user_lang_0": "Browser language",
205+
"label.admin_user.user_theme": "Choose a theme",
205206
"label.admin_user.user_ldap": "LDAP user",
206207
"label.admin_user.user_limit": "User limited",
207208
"label.admin_user.user_mail": "User mail",

0 commit comments

Comments
 (0)