From 443fe698d166a5e49858e770e9e985cafbe6efdc Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Tue, 11 Feb 2020 07:15:07 +0000 Subject: [PATCH] 95_dashboard: contrib 3.17.1 git-svn-id: https://svn.fhem.de/fhem/trunk@21176 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/95_Dashboard.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fhem/contrib/DS_Starter/95_Dashboard.pm b/fhem/contrib/DS_Starter/95_Dashboard.pm index 5fd02dd76..52244112a 100644 --- a/fhem/contrib/DS_Starter/95_Dashboard.pm +++ b/fhem/contrib/DS_Starter/95_Dashboard.pm @@ -42,6 +42,7 @@ package main; use strict; use warnings; eval "use FHEM::Meta;1" or my $modMetaAbsent = 1; +use Data::Dumper; use vars qw(%FW_icons); # List of icons use vars qw($FW_dir); # base directory for web server @@ -1054,10 +1055,18 @@ sub Dashboard_GetActiveTab ($;$) { } if (defined($FW_httpheader{Cookie})) { - Log3 ($name, 4, "Dashboard $name - Cookie set: ".$FW_httpheader{Cookie}); - my %cookie = map({ $_!~/^.*=$/ ? split('=', $_) : "" } split(/; */, $FW_httpheader{Cookie})); # 10.02.2020, Forum: https://forum.fhem.de/index.php/topic,16503.msg1023004.html#msg1023004 - # my %cookie = map({ split('=', $_) } split(/; */, $FW_httpheader{Cookie})); - if (defined($cookie{dashboard_activetab})) { + Log3 ($name, 4, "Dashboard $name - Cookie delivered: ".$FW_httpheader{Cookie}); + + # my %cookie = map({ split('=', $_) } split(/; */, $FW_httpheader{Cookie})); + my %cookie; # 10.02.2020, Forum: https://forum.fhem.de/index.php/topic,16503.msg1023004.html#msg1023004 + foreach (split(/; */, $FW_httpheader{Cookie})) { + my ($k,$v) = split('=', $_); + next if(!defined $v); + $cookie{$k} = $v; + } + + Log3($name, 5, "Dashboard $name - Cookie Hash: ". Dumper %cookie); + if (defined($cookie{dashboard_activetab})) { $activeTab = $cookie{dashboard_activetab}; $activeTab = ($activeTab <= $maxTab)?$activeTab:$maxTab; }