diff --git a/fhem/CHANGED b/fhem/CHANGED index c8fccdc5e..0d4443e14 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 95_Dashboard: new attribute dashboard_hideGroupHeader, path + handling of backgroundimage changed, comref revised - bugfix: 98_weekprofile: read weekprofile from HMCCUDEV|HM-TC-IT-WM-W-EU - change: 93_DbLog: change cache from %defs to %data, improved log infos with verbose 5 of SVG generation, bugfix check TIMESTAMP diff --git a/fhem/FHEM/95_Dashboard.pm b/fhem/FHEM/95_Dashboard.pm index a644ac0d0..0258dfa65 100644 --- a/fhem/FHEM/95_Dashboard.pm +++ b/fhem/FHEM/95_Dashboard.pm @@ -55,6 +55,8 @@ use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW # Versions History intern our %Dashboard_vNotesIntern = ( + "3.17.0" => "06.10.2019 Path handling of backgroundimage changed ", + "3.16.0" => "04.10.2019 new attribute dashboard_hideGroupHeader, commandref revised ", "3.15.2" => "29.09.2019 fix warnings, Forum: https://forum.fhem.de/index.php/topic,16503.msg978883.html#msg978883 ", "3.15.1" => "25.09.2019 change initial attributes, commandref revised ", "3.15.0" => "24.09.2019 set activateTab, rename dashboard_activetab to dashboard_homeTab, ". @@ -74,6 +76,8 @@ our %Dashboard_vNotesIntern = ( ######################### # Forward declaration sub Dashboard_GetGroupList(); +sub Dashboard_searchImage($$$$); +use vars qw($FW_dir); # base directory for web server ######################### # Global variables @@ -97,7 +101,8 @@ sub Dashboard_Initialize ($) { "dashboard_colcount:1,2,3,4,5 ". "dashboard_customcss " . "dashboard_debug:0,1 ". - "dashboard_flexible " . + "dashboard_flexible " . + "dashboard_hideGroupHeader:1,0 " . "dashboard_rowtopheight ". "dashboard_rowbottomheight ". "dashboard_row:top,center,bottom,top-center,center-bottom,top-center-bottom ". @@ -268,11 +273,11 @@ sub Dashboard_Get($@) { # Attr ################################################################ sub Dashboard_Attr($$$) { - my ($cmd, $name, $attrName, $attrVal) = @_; + my ($cmd, $name, $aName, $aVal) = @_; my $hash = $defs{$name}; if ($cmd eq "set") { - if ($attrName =~ m/dashboard_tab([1-9][0-9]*)groups/ || $attrName =~ m/dashboard_tab([1-9][0-9]*)devices/) { + if ($aName =~ m/dashboard_tab([1-9][0-9]*)groups/ || $aName =~ m/dashboard_tab([1-9][0-9]*)devices/) { # add dynamic attributes addToDevAttrList($name, "dashboard_tab" . ($1 + 1) . "name"); addToDevAttrList($name, "dashboard_tab" . ($1 + 1) . "devices"); @@ -284,14 +289,31 @@ sub Dashboard_Attr($$$) { addToDevAttrList($name, "dashboard_tab" . ($1 + 1) . "backgroundimage"); } - if ($attrName =~ m/alias/) { + if ($aName =~ m/alias/) { # if an alias is set to the dashboard, replace the name shown in the left navigation by this alias my $url = '/dashboard/'.$name; - $data{FWEXT}{$url}{NAME} = $attrVal; + $data{FWEXT}{$url}{NAME} = $aVal; } - if ($attrName =~ m/dashboard_homeTab/) { - Dashboard_activateTab ($name,$attrVal); + if ($aName =~ m/dashboard_homeTab/) { + Dashboard_activateTab ($name,$aVal); + } + } + + if ($aName =~ m/dashboard_(.*)backgroundimage/) { + my $ct = ""; + if (!$1) { + $ct = "MAIN"; + } else { + $ct = $1; + } + delete $hash->{HELPER}{BIMG}{$ct}; + if($cmd eq "set") { + Dashboard_searchImage($name, "$FW_dir/images", $aVal,$ct); + if (!$hash->{HELPER}{BIMG}{$ct}) { + Log3 ($name, 2, "Dashboard $name - Background image file not found: $aVal"); + return "Background image file not found: $aVal"; + } } } @@ -408,8 +430,7 @@ sub Dashboard_SummaryFN ($$$$) { my $showfullsize = AttrVal($name, "dashboard_showfullsize", 0); my $flexible = AttrVal($name, "dashboard_flexible", 0); my $customcss = AttrVal($name, "dashboard_customcss", "none"); - my $backgroundimage = AttrVal($name, "dashboard_backgroundimage", ""); - my $row = AttrVal($name, "dashboard_row", "center"); + # my $row = AttrVal($name, "dashboard_row", "center"); my $debug = AttrVal($name, "dashboard_debug", "0"); my ($activetab,$tabname) = Dashboard_GetActiveTab($name,1); my $tabcount = Dashboard_GetTabCount($hash, 1); @@ -427,6 +448,9 @@ sub Dashboard_SummaryFN ($$$$) { readingsSingleUpdate($hash, "state", "Disabled", 0 ); return ""; } + + # Hintergrundbild bauen + my $bimg = $hash->{HELPER}{BIMG}{MAIN}?"url(/fhem/images/$hash->{HELPER}{BIMG}{MAIN})":"none"; if ($debug == 1) { $debugfield = "edit"; } if ($showtabs eq "tabs-and-buttonbar-at-the-top") { $showbuttonbar = "top"; } @@ -453,28 +477,44 @@ sub Dashboard_SummaryFN ($$$$) { ############################ Set FHEM url to avoid hardcoding it in javascript ############################ $ret .= ""; + ## Dashboard-Tab Details Tabelle (Stift rechte Seite im Kopf) $ret .= "
\n"; $ret .= "\n"; + ## Ende Dashboard-Tab Details Tabelle $ret .= "\n";
+
+ ## Tab Content
+ $ret .= " ";
+ $ret .= "\n";
+ $ret .= " | ";
########################### Dashboard Tab-Liste ##############################################
$ret .= " |