2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

98_SVG.pm: if the SVG ist renamed, rename the gplotfile too, if it is a unique one (Forum #59786)

git-svn-id: https://svn.fhem.de/fhem/trunk@12481 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-11-01 09:18:30 +00:00
parent 94c0ff6e2b
commit 8f7f4fbbf7

View File

@ -74,6 +74,7 @@ SVG_Initialize($)
use warnings 'qw';
$hash->{AttrList} = join(" ", @attrList);
$hash->{SetFn} = "SVG_Set";
$hash->{NotifyFn} = "SVG_Notify";
$hash->{FW_summaryFn} = "SVG_FwFn";
$hash->{FW_detailFn} = "SVG_FwFn";
$hash->{FW_atPageEnd} = 1;
@ -99,6 +100,7 @@ SVG_Define($$)
$hash->{LOGFILE} = ($3 ? $3 : "CURRENT");
$hash->{STATE} = "initialized";
$hash->{LOGDEVICE} =~ s/^fileplot //; # Autocreate bug.
notifyRegexpChanged($hash, "global");
return undef;
}
@ -145,6 +147,19 @@ SVG_Attr($$$$)
return AttrVal($parent, $attr, $default);
}
sub
SVG_Notify($$)
{
my ($me, $dev) = @_;
my $events = deviceEvents($defs{global}, 0);
return if(!$events ||
$events->[0] !~m/^RENAMED (.+) (.+)$/ ||
$2 ne $me->{NAME} ||
$1 ne $me->{GPLOTFILE});
SVG_Set($me, $me->{NAME}, "copyGplotFile"); # Forum #59786
}
##################
sub
SVG_FwDetail($@)