2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

01_FHEMWEB.pm: update probablyAssociatedWith content (Forum #108960)

git-svn-id: https://svn.fhem.de/fhem/trunk@21357 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2020-03-05 16:30:01 +00:00
parent 4736425175
commit 46ef7ab5a2

View File

@ -14,6 +14,7 @@ use Time::HiRes qw(gettimeofday);
sub FW_IconURL($); sub FW_IconURL($);
sub FW_addContent(;$); sub FW_addContent(;$);
sub FW_addToWritebuffer($$@); sub FW_addToWritebuffer($$@);
sub FW_alias($$);
sub FW_answerCall($); sub FW_answerCall($);
sub FW_confFiles($); sub FW_confFiles($);
sub FW_dev2image($;$); sub FW_dev2image($;$);
@ -563,28 +564,21 @@ FW_Read($$)
Log3 $FW_wname, 4, "$name $method $arg; BUFLEN:".length($hash->{BUF}); Log3 $FW_wname, 4, "$name $method $arg; BUFLEN:".length($hash->{BUF});
my $pf = AttrVal($FW_wname, "plotfork", undef); my $pf = AttrVal($FW_wname, "plotfork", undef);
$pf = 1 if(!defined($pf) && AttrVal($FW_wname, "plotEmbed", 0) == 2); $pf = 1 if(!defined($pf) && AttrVal($FW_wname, "plotEmbed", 0) == 2);
if($pf) { # 0 disables if($pf) {
# Process SVG rendering as a parallel process
my $p = $data{FWEXT}; my $p = $data{FWEXT};
if(grep { $p->{$_}{FORKABLE} && $arg =~ m+^$FW_ME$_+ } keys %{$p}) { if(grep { $p->{$_}{FORKABLE} && $arg =~ m+^$FW_ME$_+ } keys %{$p}) {
my $pid = fhemFork(); my $pid = fhemFork();
if($pid) { # success, parent if($pid) { # success, parent
use constant PRIO_PROCESS => 0; use constant PRIO_PROCESS => 0;
setpriority(PRIO_PROCESS, $pid, getpriority(PRIO_PROCESS,$pid) + $pf) setpriority(PRIO_PROCESS, $pid, getpriority(PRIO_PROCESS,$pid) + $pf)
if($^O !~ m/Win/); if($^O !~ m/Win/);
# a) while child writes a new request might arrive if client uses
# pipelining or
# b) parent doesn't know about ssl-session changes due to child writing
# to socket
# -> have to close socket in parent... so that its only used in this
# child.
TcpServer_Disown( $hash ); TcpServer_Disown( $hash );
delete($defs{$name}); delete($defs{$name});
delete($attr{$name}); delete($attr{$name});
FW_Read($hash, 1) if($hash->{BUF}); FW_Read($hash, 1) if($hash->{BUF});
return; return;
} elsif(defined($pid)){ # child } elsif(defined($pid)){ # child
delete $hash->{BUF}; delete $hash->{BUF};
$hash->{isChild} = 1; $hash->{isChild} = 1;
@ -1554,12 +1548,14 @@ FW_makeTableFromArray($$@) {
my ($txt,$class,@obj) = @_; my ($txt,$class,@obj) = @_;
if (@obj>0) { if (@obj>0) {
my $row=1; my $row=1;
my $nameDisplay = AttrVal($FW_wname,"nameDisplay",undef);
FW_pO "<div class='makeTable wide'>"; FW_pO "<div class='makeTable wide'>";
FW_pO "<span class='mkTitle'>$txt</span>"; FW_pO "<span class='mkTitle'>$txt</span>";
FW_pO "<table class=\"block wide $class\">"; FW_pO "<table class=\"block wide $class\">";
foreach (sort @obj) { foreach (sort @obj) {
FW_pF "<tr class=\"%s\"><td>", (($row++)&1)?"odd":"even"; FW_pF "<tr class=\"%s\"><td>", (($row++)&1)?"odd":"even";
FW_pH "detail=$_", AttrVal($_, 'alias', $_); my $alias = FW_alias($_, $nameDisplay);
FW_pH "detail=$_", ($alias eq $_) ? $_ : "$_ $alias";
FW_pO "</td><td>"; FW_pO "</td><td>";
FW_pO $defs{$_}{STATE} if(defined($defs{$_}{STATE})); FW_pO $defs{$_}{STATE} if(defined($defs{$_}{STATE}));
FW_pO "</td><td>"; FW_pO "</td><td>";
@ -1780,14 +1776,14 @@ FW_roomOverview($)
} }
sub sub
FW_alias($) FW_alias($$)
{ {
my ($d) = @_; my ($DEVICE,$nameDisplay) = @_;
if($FW_room) { my $ALIAS = AttrVal($DEVICE, "alias", $DEVICE);
return AttrVal($d, "alias_$FW_room", AttrVal($d, "alias", $d)); $ALIAS = AttrVal($DEVICE, "alias_$FW_room", $ALIAS) if($FW_room);
} else { $ALIAS = eval $nameDisplay if(defined($nameDisplay));
return AttrVal($d, "alias", $d);
} return $ALIAS;
} }
sub sub
@ -1797,11 +1793,7 @@ FW_makeDeviceLine($$$$$)
my $rf = ($FW_room ? "&amp;room=$FW_room" : ""); # stay in the room my $rf = ($FW_room ? "&amp;room=$FW_room" : ""); # stay in the room
FW_pF "\n<tr class=\"%s\">", ($row&1)?"odd":"even"; FW_pF "\n<tr class=\"%s\">", ($row&1)?"odd":"even";
my $devName = FW_alias($d); my $devName = FW_alias($d,$nameDisplay);
if(defined($nameDisplay)) {
my ($DEVICE, $ALIAS) = ($d, $devName);
$devName = eval $nameDisplay;
}
my $icon = AttrVal($d, "icon", ""); my $icon = AttrVal($d, "icon", "");
$icon = FW_makeImage($icon,$icon,"icon") . "&nbsp;" if($icon); $icon = FW_makeImage($icon,$icon,"icon") . "&nbsp;" if($icon);