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

98_SVG.pm: add link to .gplot file

01_FHEMWEB.pm: make addlinks faster


git-svn-id: https://svn.fhem.de/fhem/trunk@15553 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-12-04 20:00:29 +00:00
parent 673b5c2bad
commit 8e42527624
2 changed files with 14 additions and 14 deletions

View File

@ -1100,18 +1100,11 @@ FW_addContent(;$)
sub
FW_addLinks($)
{
return undef if(!defined($_[0]));
my @lines = split( /\n/, $_[0]); # Adding links
my $ret = "";
foreach my $line (@lines) {
$ret .= "\n" if( $ret );
foreach my $word ( split( / /, $line ) ) {
$word = "<a href=\"$FW_ME$FW_subdir?detail=$word\">$word</a>"
if( $defs{$word} );
$ret .= "$word ";
}
}
return $ret;
my ($txt) = @_;
return undef if(!defined($txt));
$txt =~ s,\s([a-z0-9._]+)\s,
$defs{$1} ? "<a href='$FW_ME$FW_subdir?detail=$1'>$1</a>" : $1,gei;
return $txt;
}

View File

@ -27,6 +27,7 @@ use vars qw(%FW_webArgs); # all arguments specified in the GET
use vars qw($FW_formmethod);
use vars qw($FW_userAgent);
use vars qw($FW_hiddenroom);
use vars qw($FW_CSRF);
my $SVG_RET; # Returned data (SVG)
sub SVG_calcOffsets($$);
@ -364,7 +365,8 @@ SVG_PEdit($$$$)
return "" if( $pe eq 'never' );
my $gp = "$FW_gplotdir/$defs{$d}{GPLOTFILE}.gplot";
my $gpf = $defs{$d}{GPLOTFILE};
my $gp = "$FW_gplotdir/$gpf.gplot";
my $pm = AttrVal($d,"plotmode",$FW_plotmode);
my ($err, $cfg, $plot, $srcDesc) = SVG_readgplotfile($d, $gp, $pm);
@ -561,10 +563,15 @@ SVG_PEdit($$$$)
e.preventDefault();
EOF
$ret .=
"FW_cmd('$sl', function(arg){" .<<'EOF';
"FW_cmd('$sl', function(arg){" .<<"EOF";
FW_okDialog(arg);
});
});
setTimeout(function(){
\$("table.internals div[informid=$gpf-GPLOTFILE]").each(function(){
\$(this).html(
"<a href='$FW_ME?cmd=style edit $gpf.gplot&fwcsrf=$FW_CSRF'>$gpf</a>");
}) }, 10);
</script>
EOF
return $ret;