";
$out .= "";
$out .= "";
# Tabellenheader
if(!$nohead) {
$out .= "";
$out .= " ".(($de)?'Symbol' :'Symbol')." | " if($seen{Symbol});
if ($small) { # nur ein Datumfeld umbrechbar
$out .= " ".(($de)?'Start' :'Begin')." | " if($seen{Begin});
$out .= " ".(($de)?'Ende' :'End')." | " if($seen{End});
}
else {
$out .= " ".(($de)?'Start' :'Begin')." | " if($seen{Begin});
$out .= " ".(($de)?'----' :'----')." | " if($seen{Begin});
$out .= " ".(($de)?'Ende' :'End')." | " if($seen{End});
$out .= " ".(($de)?'----' :'----')." | " if($seen{End});
}
$out .= " ".(($de)?'Resttage' :'Days left')." | " if($seen{DaysLeft});
$out .= " ".(($de)?'Terminziel' :'Goal')." | " if($seen{DaysLeftLong});
$out .= " ".(($de)?'Wochentag' :'Weekday')." | " if($seen{Weekday});
$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 .= " ".(($de)?'ID' :'ID')." | " if($seen{EventId});
$out .= " ";
}
my $maxbnr;
for my $key (keys %{$defs{$name}{READINGS}}) {
my ($bno) = $key =~ /^(\d+)_\d+_EventId$/x;
next if(!defined $bno);
$maxbnr = $bno if(!$maxbnr || $bno > $maxbnr);
}
return "" if(!defined $maxbnr);
my $l = length($maxbnr);
my $k;
for ($k=0;$k<=$maxbnr;$k++) {
my $bnr = sprintf("%0$l.0f", $k); # Prestring erstellen
last if(!ReadingsVal($name, $bnr."_98_EventId", "")); # keine Ausgabe wenn es keine EventId mit Blocknummer 0 gibt -> kein Event/Aufgabe vorhanden
($begind,$begint,$endd,$endt,$gps) = ("","","","","");
# Readings auslesen
$summary = ReadingsVal($name, $bnr."_01_Summary", "");
$desc = ReadingsVal($name, $bnr."_03_Description", "");
$begin = ReadingsVal($name, $bnr."_05_Begin", "");
$end = ReadingsVal($name, $bnr."_10_End", "");
$tz = ReadingsVal($name, $bnr."_15_Timezone", "");
$status = ReadingsVal($name, $bnr."_17_Status", "");
$dleft = ReadingsVal($name, $bnr."_20_daysLeft", "");
$dleftlong = ReadingsVal($name, $bnr."_25_daysLeftLong", "");
$weekday = ReadingsVal($name, $bnr."_30_Weekday", "");
$location = ReadingsVal($name, $bnr."_35_Location", "");
$gpsa = ReadingsVal($name, $bnr."_40_gpsAddress", "");
$gpsc = ReadingsVal($name, $bnr."_45_gpsCoordinates", "");
$completion = ReadingsVal($name, $bnr."_85_percentComplete", "");
$cal = ReadingsVal($name, $bnr."_90_calName", "");
$id = ReadingsVal($name, $bnr."_98_EventId", "");
$isallday = ReadingsVal($name, $bnr."_50_isAllday", "");
if($gpsc) {
my $micon;
if ($mi eq "icon") {
# Karten-Icon auswählen
$di = "it_i-net";
eval { $micon = evalTableSpecs ( {
href => $hash,
def => $di,
base => $hash->{HELPER}{tableSpecs}{columnMapIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapIcon\": $@")
};
}
elsif ($mi eq "data") {
$micon = join(" ", split(",", $gpsc));
}
elsif ($mi eq "text") { # Karten-Text auswählen
my $dt = "link";
eval { $micon = evalTableSpecs ( {
href => $hash,
def => $dt,
base => $hash->{HELPER}{tableSpecs}{columnMapText},
bnr => $bnr,
readref => \@allrds,
rdtype => "string"
}
); 1;
} or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapText\": $@");
};
}
else {
$micon = "";
}
my ($lat,$lng) = split(",", $gpsc);
$lat = (split("=", $lat))[1];
$lng = (split("=", $lng))[1];
# Kartenanbieter auswählen
my $up = "GoogleMaps";
eval { $up = evalTableSpecs ( {
href => $hash,
def => $up,
base => $hash->{HELPER}{tableSpecs}{columnMapProvider},
bnr => $bnr,
readref => \@allrds,
rdtype => "string"
}
); 1;
} or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnMapProvider\": $@");
};
if ($up eq "GoogleMaps") { # Kartenprovider: Google Maps
$gps = " $micon ";
}
elsif ($up eq "OpenStreetMap") {
$gps = " $micon "; # Kartenprovider: OpenstreetMap
}
}
if($begin ne "") { # Datum sprachabhängig konvertieren bzw. heute/morgen setzen
my ($ny,$nm,$nd,undef) = split(/[\s-]/x, TimeNow()); # Jetzt
my ($by,$bm,$bd,$bt) = split(/[\s-]/x, $begin);
my ($ey,$em,$ed,$et) = split(/[\s-]/x, $end);
my $ntimes = fhemTimeLocal(00, 00, 00, $nd, $nm-1, $ny-1900);
my $btimes = fhemTimeLocal(00, 00, 00, $bd, $bm-1, $by-1900);
my $etimes = fhemTimeLocal(00, 00, 00, $ed, $em-1, $ey-1900);
if($de) {
$begind = "$bd.$bm.$by";
$endd = "$ed.$em.$ey";
}
else {
$begind = "$by-$bm-$bd";
$endd = "$ey-$em-$ed";
}
my($a,$b,undef) = split(":", $bt);
$begint = "$a:$b";
my($c,$d,undef) = split(":", $et);
$endt = "$c:$d";
$edleft = "";
if($etimes >= $ntimes) {
$edleft = int(($etimes - $ntimes)/86400);
}
$begind = (($de)?'heute ':'today ') if($dleft eq "0");
$endd = (($de)?'heute ':'today ') if($edleft eq "0");
$begind = (($de)?'morgen ':'tomorrow ') if($dleft eq "1");
$endd = (($de)?'morgen ':'tomorrow ') if($edleft eq "1");
if (($begind eq $endd) && !$isallday) {
$endd = ""; # bei "Ende" nur Uhrzeit angeben wenn Termin am gleichen Tag beginnt/endet aber kein Ganztagstermin ist
}
elsif (($begind eq $endd) && $isallday) {
$begint = "";
$endt = "";
}
}
# Icon für Spalte Resttage spezifizieren
eval { $dleft = evalTableSpecs ( {
href => $hash,
def => $dleft,
base => $hash->{HELPER}{tableSpecs}{columnDaysLeftIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnDaysLeftIcon\": $@");
};
# Icon für Spalte Status spezifizieren
eval { $status = evalTableSpecs ( {
href => $hash,
def => $status,
base => $hash->{HELPER}{tableSpecs}{columnStateIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnStateIcon\": $@");
};
# Icon für Spalte "Symbol" bestimmen
$di = ($hash->{MODEL} eq "Diary") ? "time_calendar" : "time_note";
eval { $symbol = evalTableSpecs ( {
href => $hash,
def => $di,
base => $hash->{HELPER}{tableSpecs}{columnSymbolIcon},
bnr => $bnr,
readref => \@allrds,
rdtype => "image"
}
); 1;
} or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"columnSymbolIcon\": $@");
};
# Gestaltung Spaltentext
my $coldefalign = "center"; # Ausrichtung der Spalte, default: center
eval {
$coldefalign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colSymbolAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnSymbolAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colBeginAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnBeginAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colEndAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnEndAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colDayAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnDaysLeftAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colDLongAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnDaysLeftLongAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colWeekdayAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnWeekdayAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colTzAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnTimezoneAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colSummaryAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnSummaryAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colDescAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnDescriptionAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colStatusAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnStatusAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colCompAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnCompletionAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colLocAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnLocationAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colMapAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnMapAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colCalAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnCalendarAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
$colIdAlign = "cal".evalTableSpecs ( {href => $hash,def => $coldefalign,base => $hash->{HELPER}{tableSpecs}{cellStyle}{columnEventIdAlign} ,bnr => "",readref => \@allrds,rdtype => "string"} );
1;
} or do {
Log3($name, 1, "$name - Syntax error in attribute \"tableSpecs\" near \"cellStyle\": $@")
};
my $colalign = $coldefalign;
# TabellenBody
$out .= "";
$out .= " $symbol | " if($seen{Symbol});
if($small) {
$out .= " ".$begind." ".$begint. " | " if($seen{Begin});
$out .= " ".$endd ." ".$endt. " | " if($seen{End});
}
else {
$out .= " $begind | " if($seen{Begin});
$out .= " $begint | " if($seen{Begin});
$out .= " $endd | " if($seen{End});
$out .= " $endt | " if($seen{End});
}
$out .= " $dleft | " if($seen{DaysLeft});
$out .= " $dleftlong | " if($seen{DaysLeftLong});
$out .= " $weekday | " if($seen{Weekday});
$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 .= " $id | " if($seen{EventId});
$out .= " ";
}
$out .= " ";
$out .= " | ";
$out .= "
";
$out .= "