2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 14:04:15 +00:00

57_SSCal: contrib 2.4.0

git-svn-id: https://svn.fhem.de/fhem/trunk@21961 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-05-17 20:44:49 +00:00
parent 4867296077
commit bc4c49f06c

View File

@ -2647,7 +2647,7 @@ sub writeValuesToArray { ## no
my ($y, $m, $d) = $bdate =~ /^(\d{4})-(\d{2})-(\d{2})/x; # Timestamp für Berechnung Erinnerungszeit Begindatum/Zeit ... my ($y, $m, $d) = $bdate =~ /^(\d{4})-(\d{2})-(\d{2})/x; # Timestamp für Berechnung Erinnerungszeit Begindatum/Zeit ...
my ($h, $mi, $s) = $btime =~ /^(\d{2}):(\d{2}):(\d{2})/x; my ($h, $mi, $s) = $btime =~ /^(\d{2}):(\d{2}):(\d{2})/x;
eval { $chts = timelocal($s, $mi, $h, $d, $m-1, $y-1900); # ... neu aus bdate/btime ableiten wegen Änderung durch Recurrance-id eval { $chts = fhemTimeLocal($s, $mi, $h, $d, $m-1, $y-1900); # ... neu aus bdate/btime ableiten wegen Änderung durch Recurrance-id
1; 1;
} or do { } or do {
my $err = (split(" at", $@))[0]; my $err = (split(" at", $@))[0];
@ -3311,9 +3311,7 @@ sub setcredentials {
@key = qw(1 3 4 5 6 3 2 1 9); @key = qw(1 3 4 5 6 3 2 1 9);
$len = scalar @key; $len = scalar @key;
$i = 0; $i = 0;
$credstr = join "", $credstr = join "", map { $i = ($i + 1) % $len; chr((ord($_) + $key[$i]) % 256) } split //, $credstr;
map { $i = ($i + 1) % $len;
chr((ord($_) + $key[$i]) % 256) } split //, $credstr;
# End Scramble-Routine # End Scramble-Routine
$index = $hash->{TYPE}."_".$hash->{NAME}."_".$ao; $index = $hash->{TYPE}."_".$hash->{NAME}."_".$ao;
@ -3367,9 +3365,7 @@ sub getcredentials {
$len = scalar @key; $len = scalar @key;
$i = 0; $i = 0;
$credstr = join "", $credstr = join "",
map { $i = ($i + 1) % $len; map { $i = ($i + 1) % $len; chr((ord($_) - $key[$i] + 256) % 256) } split //, $credstr;
chr((ord($_) - $key[$i] + 256) % 256) }
split //, $credstr;
# Ende Descramble-Routine # Ende Descramble-Routine
($username, $passwd) = split("!_ESC_!",decode_base64($credstr)); ($username, $passwd) = split("!_ESC_!",decode_base64($credstr));
@ -3661,7 +3657,7 @@ return;
# zu ignorieren und auch nicht zu zählen !) # zu ignorieren und auch nicht zu zählen !)
# $dtstart: man benötigt originales DTSTART für den Vergleich bei Recurring Terminen # $dtstart: man benötigt originales DTSTART für den Vergleich bei Recurring Terminen
############################################################################################# #############################################################################################
sub explodeDateTime { ## no critic 'complexity' sub explodeDateTime { ## no critic 'complexity'
my ($hash,$dt,$isallday,$uid,$dtstart) = @_; my ($hash,$dt,$isallday,$uid,$dtstart) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my ($tz,$t) = ("",""); my ($tz,$t) = ("","");
@ -3689,7 +3685,8 @@ sub explodeDateTime { ## no critic 'complexity'
my %seen; my %seen;
if($exdates) { if($exdates) {
my @exd = split(" ", $exdates); my @exd = split(" ", $exdates);
grep { !$seen{$_}++ } @exd; # grep { !$seen{$_}++ } @exd;
for (@exd) { !$seen{$_}++ };
} }
$excl = 1 if($seen{$dtstart}); # check erfolgreich -> exclude recurring date weil (Serienelement gelöscht) $excl = 1 if($seen{$dtstart}); # check erfolgreich -> exclude recurring date weil (Serienelement gelöscht)
@ -3851,8 +3848,9 @@ sub calAsHtml {
my %specs; my %specs;
my $FW_style = AttrVal($FW_wname, "stylesheetPrefix", "default"); my $FW_style = AttrVal($FW_wname, "stylesheetPrefix", "default");
my @scspecs = split(",", $hash->{HELPER}{tableSpecs}{smallScreenStyles}); # Eigenschaft smallScreen in Array lesen my @scspecs = split(",", $hash->{HELPER}{tableSpecs}{smallScreenStyles}); # Eigenschaft smallScreen in Array lesen
grep { !$specs{$_}++ } @scspecs; # grep { !$specs{$_}++ } @scspecs;
$small = 1 if($specs{$FW_style}); # Tabelle für small-Style anpassen for (@scspecs) { !$specs{$_}++ };
$small = 1 if($specs{$FW_style}); # Tabelle für small-Style anpassen
} }
# Auswahl der darzustellenden Tabellenfelder # Auswahl der darzustellenden Tabellenfelder
@ -3862,15 +3860,29 @@ sub calAsHtml {
# Gestaltung Headerzeile # Gestaltung Headerzeile
my $nohead = 0; # Unterdrückung Anzeige Headerzeile: 0 - nein, 1 - Ja my $nohead = 0; # Unterdrückung Anzeige Headerzeile: 0 - nein, 1 - Ja
eval { $nohead = evalTableSpecs ($hash,$nohead,$hash->{HELPER}{tableSpecs}{cellStyle}{noHeader},"",\@allrds,"string"); eval { $nohead = evalTableSpecs ( {
1; href => $hash,
def => $nohead,
base => $hash->{HELPER}{tableSpecs}{cellStyle}{noHeader},
bnr => "",
readref => \@allrds,
rdtype => "string"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"cellStyle\": $@"); Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"cellStyle\": $@");
}; };
my $headalign = "center"; # Ausrichtung der Headerzeile, default: center my $headalign = "center"; # Ausrichtung der Headerzeile, default: center
eval { $headalign = evalTableSpecs ($hash,$headalign,$hash->{HELPER}{tableSpecs}{cellStyle}{headerAlign},"",\@allrds,"string"); eval { $headalign = evalTableSpecs ( {
1; href => $hash,
def => $headalign,
base => $hash->{HELPER}{tableSpecs}{cellStyle}{headerAlign},
bnr => "",
readref => \@allrds,
rdtype => "string"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"cellStyle\": $@"); Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"cellStyle\": $@");
}; };
@ -3964,8 +3976,15 @@ sub calAsHtml {
if ($mi eq "icon") { if ($mi eq "icon") {
# Karten-Icon auswählen # Karten-Icon auswählen
$di = "it_i-net"; $di = "it_i-net";
eval { $micon = evalTableSpecs ($hash,$di,$hash->{HELPER}{tableSpecs}{columnMapIcon},$bnr,\@allrds,"image"); eval { $micon = evalTableSpecs ( {
1; href => $hash,
def => $di,
base => $hash->{HELPER}{tableSpecs}{columnMapIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapIcon\": $@") Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapIcon\": $@")
}; };
@ -3976,8 +3995,15 @@ sub calAsHtml {
} elsif ($mi eq "text") { } elsif ($mi eq "text") {
# Karten-Text auswählen # Karten-Text auswählen
my $dt = "link"; my $dt = "link";
eval { $micon = evalTableSpecs ($hash,$dt,$hash->{HELPER}{tableSpecs}{columnMapText},$bnr,\@allrds,"string"); eval { $micon = evalTableSpecs ( {
1; href => $hash,
def => $dt,
base => $hash->{HELPER}{tableSpecs}{columnMapText},
bnr => $bnr,
readref => \@allrds,
rdtype => "string"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapText\": $@"); Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapText\": $@");
}; };
@ -3992,8 +4018,15 @@ sub calAsHtml {
# Kartenanbieter auswählen # Kartenanbieter auswählen
my $up = "GoogleMaps"; my $up = "GoogleMaps";
eval { $up = evalTableSpecs ($hash,$up,$hash->{HELPER}{tableSpecs}{columnMapProvider},$bnr,\@allrds,"string"); eval { $up = evalTableSpecs ( {
1; href => $hash,
def => $up,
base => $hash->{HELPER}{tableSpecs}{columnMapProvider},
bnr => $bnr,
readref => \@allrds,
rdtype => "string"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapProvider\": $@"); Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapProvider\": $@");
}; };
@ -4045,23 +4078,44 @@ sub calAsHtml {
} }
# Icon für Spalte Resttage spezifizieren # Icon für Spalte Resttage spezifizieren
eval { $dleft = evalTableSpecs ($hash,$dleft,$hash->{HELPER}{tableSpecs}{columnDaysLeftIcon},$bnr,\@allrds,"image"); eval { $dleft = evalTableSpecs ( {
1; href => $hash,
def => $dleft,
base => $hash->{HELPER}{tableSpecs}{columnDaysLeftIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnDaysLeftIcon\": $@"); Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnDaysLeftIcon\": $@");
}; };
# Icon für Spalte Status spezifizieren # Icon für Spalte Status spezifizieren
eval { $status = evalTableSpecs ($hash,$status,$hash->{HELPER}{tableSpecs}{columnStateIcon},$bnr,\@allrds,"image"); eval { $status = evalTableSpecs ( {
1; href => $hash,
def => $status,
base => $hash->{HELPER}{tableSpecs}{columnStateIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnStateIcon\": $@"); Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnStateIcon\": $@");
}; };
# Icon für Spalte "Symbol" bestimmen # Icon für Spalte "Symbol" bestimmen
$di = ($hash->{MODEL} eq "Diary") ? "time_calendar" : "time_note"; $di = ($hash->{MODEL} eq "Diary") ? "time_calendar" : "time_note";
eval { $symbol = evalTableSpecs ($hash,$di,$hash->{HELPER}{tableSpecs}{columnSymbolIcon},$bnr,\@allrds,"image"); eval { $symbol = evalTableSpecs ( {
1; href => $hash,
def => $di,
base => $hash->{HELPER}{tableSpecs}{columnSymbolIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnSymbolIcon\": $@"); Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnSymbolIcon\": $@");
}; };
@ -4069,22 +4123,22 @@ sub calAsHtml {
# Gestaltung Spaltentext # Gestaltung Spaltentext
my $coldefalign = "center"; # Ausrichtung der Spalte, default: center my $coldefalign = "center"; # Ausrichtung der Spalte, default: center
eval { eval {
$coldefalign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnAlign} ,"",\@allrds,"string"); $coldefalign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colSymbolAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnSymbolAlign} ,"",\@allrds,"string"); $colSymbolAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnSymbolAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colBeginAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnBeginAlign} ,"",\@allrds,"string"); $colBeginAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnBeginAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colEndAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnEndAlign} ,"",\@allrds,"string"); $colEndAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnEndAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colDayAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnDaysLeftAlign} ,"",\@allrds,"string"); $colDayAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnDaysLeftAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colDLongAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnDaysLeftLongAlign} ,"",\@allrds,"string"); $colDLongAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnDaysLeftLongAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colWeekdayAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnWeekdayAlign} ,"",\@allrds,"string"); $colWeekdayAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnWeekdayAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colTzAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnTimezoneAlign} ,"",\@allrds,"string"); $colTzAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnTimezoneAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colSummaryAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnSummaryAlign} ,"",\@allrds,"string"); $colSummaryAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnSummaryAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colDescAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnDescriptionAlign} ,"",\@allrds,"string"); $colDescAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnDescriptionAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colStatusAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnStatusAlign} ,"",\@allrds,"string"); $colStatusAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnStatusAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colCompAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnCompletionAlign} ,"",\@allrds,"string"); $colCompAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnCompletionAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colLocAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnLocationAlign} ,"",\@allrds,"string"); $colLocAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnLocationAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colMapAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnMapAlign} ,"",\@allrds,"string"); $colMapAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnMapAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colCalAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnCalendarAlign} ,"",\@allrds,"string"); $colCalAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnCalendarAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colIdAlign = "cal".evalTableSpecs ($hash,$coldefalign,$hash->{HELPER}{tableSpecs}{cellStyle}{columnEventIdAlign} ,"",\@allrds,"string"); $colIdAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnEventIdAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
1; 1;
} or do { } or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"cellStyle\": $@") Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"cellStyle\": $@")
@ -4140,8 +4194,16 @@ return $out;
# #
###################################################################################### ######################################################################################
sub evalTableSpecs { ## no critic 'complexity' sub evalTableSpecs { ## no critic 'complexity'
my ($hash,$default,$specs,$bnr,$allrds,$rdtype) = @_; # my ($hash,$default,$specs,$bnr,$allrds,$rdtype) = @_;
my $name = $hash->{NAME}; my ($argref) = @_;
my $hash = $argref->{href};
my $default = $argref->{def};
my $specs = $argref->{base};
my $bnr = $argref->{bnr};
my $allrds = $argref->{readref};
my $rdtype = $argref->{rdtype};
my $name = $hash->{NAME};
my $check; my $check;
$rdtype = $rdtype // "string"; # "string" als default Rückgabe Datentyp $rdtype = $rdtype // "string"; # "string" als default Rückgabe Datentyp
@ -4228,7 +4290,7 @@ sub evalTableSpecs { ##
} }
} else { # ref Wert der Eigenschaft ist nicht HASH oder ARRAY } else { # ref Wert der Eigenschaft ist nicht HASH oder ARRAY
if($specs =~ m/\{.*\}/xs) { # den Wert als Perl-Funktion ausführen wenn in {} if($specs =~ m/\{.*\}/xs) { # den Wert als Perl-Funktion ausführen wenn in {}
$specs =~ s/\$NAME/$name/xg; # Platzhalter $NAME, $BNR ersetzen $specs =~ s/\$NAME/$name/xg; # Platzhalter $NAME, $BNR ersetzen
$specs =~ s/\$BNR/$bnr/xg; $specs =~ s/\$BNR/$bnr/xg;
$default = $check->($specs); $default = $check->($specs);
@ -5293,7 +5355,7 @@ return $default;
Über verschiedene Schlüssel-Wertpaar Kombinationen kann die Darstellung der Informationen in der Übersichtstabelle Über verschiedene Schlüssel-Wertpaar Kombinationen kann die Darstellung der Informationen in der Übersichtstabelle
angepasst werden. Das Wiki-Kapitel angepasst werden. Das Wiki-Kapitel
<a href="https://wiki.fhem.de/wiki/-_Integration_des_Synology_Calendar_Servers#Darstellung_der_.C3.9Cbersichtstabelle_in_Raum-_und_Detailansicht_beeinflussen">Darstellung der Übersichtstabelle in Raum- und Detailansicht beeinflussen</a> <a href="https://wiki.fhem.de/wiki/SSCal_-_Integration_des_Synology_Calendar_Servers#Darstellung_der_.C3.9Cbersichtstabelle_in_Raum-_und_Detailansicht_beeinflussen">Darstellung der Übersichtstabelle in Raum- und Detailansicht beeinflussen</a>
liefert detailiierte Informationen dazu. liefert detailiierte Informationen dazu.
</li><br> </li><br>