diff --git a/fhem/contrib/DS_Starter/57_SSCal.pm b/fhem/contrib/DS_Starter/57_SSCal.pm index 6c69976da..034d64c15 100644 --- a/fhem/contrib/DS_Starter/57_SSCal.pm +++ b/fhem/contrib/DS_Starter/57_SSCal.pm @@ -48,6 +48,7 @@ eval "use FHEM::Meta;1" or my $modMetaAbsent = 1; # Versions History intern my %SSCal_vNotesIntern = ( + "1.7.0" => "05.02.2020 respect global language setting for some presentation, new attribute eventIcon ", "1.6.1" => "03.02.2020 rename attributes to \"calOverviewInDetail\",\"calOverviewInRoom\", bugfix of gps extraction ", "1.6.0" => "03.02.2020 new attribute \"calOverviewFields\" to show specified fields in calendar overview in detail/room view, ". "Model Diary/Tasks defined, periodic call of ToDo-Liists now possible ", @@ -163,6 +164,7 @@ sub SSCal_Initialize($) { "cutOlderDays ". "cutLaterDays ". "disable:1,0 ". + "eventIcon:textField-long ". "filterCompleteTask:1,2,3 ". "filterDueTask:1,2,3 ". "interval ". @@ -321,6 +323,8 @@ sub SSCal_Attr($$$$) { # aName and aVal are Attribute name and value if ($cmd eq "set") { + my $attrVal = $aVal; + if ($aName =~ /filterCompleteTask|filterDueTask/ && $model ne "Tasks") { return " The attribute \"$aName\" is only valid for devices of MODEL \"Tasks\"! Please set this attribute in a device of this model."; } @@ -328,7 +332,20 @@ sub SSCal_Attr($$$$) { if ($aName =~ /showRepeatEvent/ && $model ne "Diary") { return " The attribute \"$aName\" is only valid for devices of MODEL \"Diary\"! Please set this attribute in a device of this model."; } - } + + if ($attrVal =~ m/^\{.*\}$/s && $attrVal =~ m/=>/ && $attrVal !~ m/\$/) { + my $av = eval $attrVal; + # Log3($name, 1, "$name - av: ".$av); + if($@) { + Log3($name, 2, "$name - Error while evaluate: ".$@); + } else { + $attrVal = $av if(ref($av) eq "HASH"); + } + } + $hash->{HELPER}{$aName} = $attrVal; + } else { + delete $hash->{HELPER}{$aName}; + } if ($aName eq "disable") { if($cmd eq "set") { @@ -3189,32 +3206,37 @@ return $bool; # Kalenderliste als HTML-Tabelle zurückgeben ############################################################################################# sub SSCal_calAsHtml($) { - my ($name)= @_; - my $hash = $defs{$name}; + my ($name) = @_; + my $hash = $defs{$name}; + my $lang = AttrVal("global","language","EN"); + my ($begin,$end,$summary,$location,$status,$desc,$gps,$gpsa,$gpsc,$cal,$completion,$tz); - my ($begin,$end,$summary,$location,$status,$desc,$gps,$gpsa,$gpsc,$cal,$completion,$tz); + my $de = 0; + if($lang eq "DE") {$de = 1}; my %seen; my @cof = split(",", AttrVal($name, "calOverviewFields", "Begin,End,Summary,Status,Location")); grep { !$seen{$_}++ } @cof; my $out = ""; - $out .= ""; - $out .= ""; - $out .= ""; - $out .= "
Begin | " if($seen{Begin}); - $out .= "End | " if($seen{End}); - $out .= "Timezone | " if($seen{Timezone}); - $out .= "Summary | " if($seen{Summary}); - $out .= "Description | " if($seen{Description}); - $out .= "Status | " if($seen{Status}); - $out .= " Completion (%) | " if($seen{Completion});
- $out .= "Location | " if($seen{Location}); - $out .= "Map | " if($seen{Map}); - $out .= "Calendar | " if($seen{Calendar}); + $out .= "".(($de)?'Start' :'Begin')." | " if($seen{Begin}); + $out .= "".(($de)?'Ende' :'End')." | " if($seen{End}); + $out .= "".(($de)?'Zeitzone' :'Timezone')." | " if($seen{Timezone}); + $out .= "".(($de)?'Zusammenfassung' :'Summary')." | " if($seen{Summary}); + $out .= "".(($de)?'Beschreibung' :'Description')." | " if($seen{Description}); + $out .= "".(($de)?'Status' :'State')." | " if($seen{Status}); + $out .= " ".(($de)?'Erfüllung (%)' :'Completion (%)')." | " if($seen{Completion});
+ $out .= "".(($de)?'Ort' :'Location')." | " if($seen{Location}); + $out .= "".(($de)?'Karte' :'Map')." | " if($seen{Map}); + $out .= "".(($de)?'Kalender' :'Calendar')." | " if($seen{Calendar}); $out .= "
$begin | " if($seen{Begin}); - $out .= "$end | " if($seen{End}); - $out .= "$tz | " if($seen{Timezone}); - $out .= "$summary | " if($seen{Summary}); - $out .= "$desc | " if($seen{Description}); - $out .= "$status | " if($seen{Status}); - $out .= "$completion | " if($seen{Completion}); - $out .= "$location | " if($seen{Location}); - $out .= "$gps | " if($seen{Map}); - $out .= "$cal | " if($seen{Calendar}); + $out .= "$begin | " if($seen{Begin}); + $out .= "$end | " if($seen{End}); + $out .= "$tz | " if($seen{Timezone}); + $out .= "$summary | " if($seen{Summary}); + $out .= "$desc | " if($seen{Description}); + $out .= "$status | " if($seen{Status}); + $out .= "$completion | " if($seen{Completion}); + $out .= "$location | " if($seen{Location}); + $out .= "$gps | " if($seen{Map}); + $out .= "$cal | " if($seen{Calendar}); $out .= "