2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

95_Dashboard: fix deleting links

git-svn-id: https://svn.fhem.de/fhem/trunk@20214 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-09-21 06:33:02 +00:00
parent 47fc62ec28
commit 2ebcd80986
2 changed files with 59 additions and 28 deletions

View File

@ -55,6 +55,7 @@ use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW
# Versions History intern
our %Dashboard_vNotesIntern = (
"3.13.1" => "21.09.2019 don't eliminate links for PageEnd-Devices ",
"3.13.0" => "20.09.2019 change attribute noLinks to dashboard_noLinks, eliminate links for PageEnd-Devices ",
"3.12.0" => "16.09.2019 new attribute noLinks, review comref and get-options ",
"3.11.0" => "16.09.2019 attr dashboard_activetab is now working properly, commandref revised, calculate attribute ".
@ -828,9 +829,6 @@ sub Dashboard_BuildGroup ($$$$$$) {
if ($devret !~ /informId/i) {
$ret .= " informId=\"$d\"";
}
if(AttrVal($name, "dashboard_noLinks", 0)) {
$devret =~ s/.*(<a\s+href="\/fhem\?detail=.*>(.*)<\/a>).*/$2/mg; # keine Links zur Detailansicht des Devices für PageEnd Devices (bringen Link inkludiert mit)
}
$ret .= ">$devret</td>";
use strict "refs";
@ -890,7 +888,7 @@ return $ret;
#############################################################################################
sub Dashboard_GetMaxColumnId ($$) {
my ($row, $colcount) = @_;
my $maxcolid = "0";
my $maxcolid = "0";
if (index($row,"bottom") > 0) { $maxcolid = "200"; }
elsif (index($row,"center") > 0) { $maxcolid = $colcount-1; }
@ -903,8 +901,8 @@ return $maxcolid;
#
#############################################################################################
sub Dashboard_CheckDashboardEntry ($) {
my ($hash) = @_;
my $now = time();
my ($hash) = @_;
my $now = time();
my $timeToExec = $now + 5;
RemoveInternalTimer($hash);

View File

@ -1,4 +1,4 @@
# $Id: 95_Dashboard.pm 20185 2019-09-17 22:13:48Z DS_Starter $
# $Id: 95_Dashboard.pm 20211 2019-09-20 22:02:11Z DS_Starter $
########################################################################################
# 95_Dashboard.pm
#
@ -55,7 +55,9 @@ use vars qw($FW_ss); # is smallscreen, needed by 97_GROUP/95_VIEW
# Versions History intern
our %Dashboard_vNotesIntern = (
"3.11.1" => "16.09.2019 new attribute noLinks ",
"3.13.1" => "21.09.2019 don't eliminate links for PageEnd-Devices ",
"3.13.0" => "20.09.2019 change attribute noLinks to dashboard_noLinks, eliminate links for PageEnd-Devices ",
"3.12.0" => "16.09.2019 new attribute noLinks, review comref and get-options ",
"3.11.0" => "16.09.2019 attr dashboard_activetab is now working properly, commandref revised, calculate attribute ".
"dashboard_activetab (is now a userattr) ",
"3.10.1" => "29.06.2018 added FW_hideDisplayName, Forum #88727 ",
@ -115,7 +117,7 @@ sub Dashboard_Initialize ($) {
"dashboard_tab[0-9]+rowcentercolwidth " .
"dashboard_tab[0-9]+backgroundimage " .
"dashboard_width ".
"noLinks:1,0 ";
"dashboard_noLinks:1,0 ";
$data{FWEXT}{jquery}{SCRIPT} = "/pgm2/".$fwjquery if (!$data{FWEXT}{jquery}{SCRIPT});
$data{FWEXT}{jqueryui}{SCRIPT} = "/pgm2/".$fwjqueryui if (!$data{FWEXT}{jqueryui}{SCRIPT});
@ -184,7 +186,7 @@ sub Dashboard_Get($@) {
my $arg2 = (defined($a[2]) ? $a[2] : "");
if ($arg eq "config") {
my $name = $hash->{NAME};
my $name = $hash->{NAME};
my $attrdata = $attr{$name};
if ($attrdata) {
my $x = keys %$attrdata;
@ -201,7 +203,7 @@ sub Dashboard_Get($@) {
foreach my $idir (@iconFolders) {$iconDirs .= "$attr{global}{modpath}/www/images/".$idir.",";}
$res .= " \"icondirs\": \"$iconDirs\", \"dashboard_tabcount\": " . Dashboard_GetTabCount($hash, 0). ", \"dashboard_activetab\": " . Dashboard_GetActiveTab($hash->{NAME});
$res .= ($i != $x) ? ",\n" : "\n";
$res .= ($i != $x) ? ",\n" : "\n";
foreach my $attr (sort keys %$attrdata) {
$i++;
@ -214,7 +216,7 @@ sub Dashboard_Get($@) {
} else {
next;
}
$res .= ($i != $x) ? ",\n" : "\n";
$res .= ($i != $x) ? ",\n" : "\n";
}
$res .= " }\n";
$res .= "}\n";
@ -240,11 +242,12 @@ sub Dashboard_Get($@) {
} elsif ($arg eq "icon") {
shift @a;
shift @a;
return "Please provide only one icon whose path and full name is to show." if(!@a || $a[1]);
my $icon = join (' ', @a);
return FW_iconPath($icon);
} else {
return "Unknown argument $arg choose one of config:noArg groupWidget tab icon";
return "Unknown argument $arg choose one of config:noArg icon";
}
}
@ -804,12 +807,12 @@ sub Dashboard_BuildGroup ($$$$$$) {
$devName = "" if($modules{$defs{$d}{TYPE}}{FW_hideDisplayName}); # Forum 88667
if (!$modules{$defs{$d}{TYPE}}{FW_atPageEnd}) { # Don't show Link for "atEnd"-devices
if(AttrVal($name, "noLinks", 0)) {
if(AttrVal($name, "dashboard_noLinks", 0)) {
$ret .= "<td>$icon$devName</td>"; # keine Links zur Detailansicht des Devices
} else {
$ret .= FW_pH ("detail=$d", "$icon$devName", 1, "col1", 1); # FW_pH = add href (<link>, <Text>, <?>, <class>, <Wert zurückgeben>, <?>)
}
}
}
$row++;
@ -885,7 +888,7 @@ return $ret;
#############################################################################################
sub Dashboard_GetMaxColumnId ($$) {
my ($row, $colcount) = @_;
my $maxcolid = "0";
my $maxcolid = "0";
if (index($row,"bottom") > 0) { $maxcolid = "200"; }
elsif (index($row,"center") > 0) { $maxcolid = $colcount-1; }
@ -898,8 +901,8 @@ return $maxcolid;
#
#############################################################################################
sub Dashboard_CheckDashboardEntry ($) {
my ($hash) = @_;
my $now = time();
my ($hash) = @_;
my $now = time();
my $timeToExec = $now + 5;
RemoveInternalTimer($hash);
@ -1027,12 +1030,12 @@ sub Dashboard_setVersionInfo($) {
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) { # META-Daten sind vorhanden
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 95_Dashboard.pm 20185 2019-09-17 22:13:48Z DS_Starter $ im Kopf komplett! vorhanden )
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 95_Dashboard.pm 20211 2019-09-20 22:02:11Z DS_Starter $ im Kopf komplett! vorhanden )
$modules{$type}{META}{x_version} =~ s/1.1.1/$v/g;
} else {
$modules{$type}{META}{x_version} = $v;
}
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 95_Dashboard.pm 20185 2019-09-17 22:13:48Z DS_Starter $ im Kopf komplett! vorhanden )
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 95_Dashboard.pm 20211 2019-09-20 22:02:11Z DS_Starter $ im Kopf komplett! vorhanden )
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) { # es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
use version 0.77; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); # mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden
}
@ -1103,7 +1106,22 @@ return;
<b>Get</b>
<ul>
<ul>
N/A
<a name="config"></a>
<li><b>get &lt;name&gt; config </b><br>
Delivers the configuration of the dashboard back. <br>
<br>
</li>
<a name="icon"></a>
<li><b>get &lt;name&gt; icon &lt;icon name&gt; </b><br>
Delivers the path and full name of the denoted icon back. <br><br>
<b>Example: </b><br>
get &lt;name&gt; icon measure_power_meter
<br>
</li>
</ul>
</ul>
<br>
@ -1267,14 +1285,14 @@ return;
</li>
<br>
<a name="noLinks"></a>
<li><b>noLinks</b><br>
<a name="dashboard_noLinks"></a>
<li><b>dashboard_noLinks</b><br>
No link generation to the detail view of the devices takes place. <br><br>
<b>Note: </b><br>
Some device types deliver the links to their detail view integrated in the devices name or alias.
In such cases you have to deactivate the link generation inside of the device (for example in devices of type readingsGroup,
SSCamSTRM or SMAPortal).
SSCamSTRM, SVG or SMAPortal).
</li>
<br>
@ -1337,7 +1355,22 @@ return;
<b>Get</b>
<ul>
<ul>
N/A
<a name="config"></a>
<li><b>get &lt;name&gt; config </b><br>
Liefert die Konfiguration des Dashboards zurück. <br>
<br>
</li>
<a name="icon"></a>
<li><b>get &lt;name&gt; icon &lt;icon name&gt; </b><br>
Liefert den Pfad und vollen Namen des angegebenen Icons zurück. <br><br>
<b>Beispiel: </b><br>
get &lt;name&gt; icon measure_power_meter
<br>
</li>
</ul>
</ul>
<br>
@ -1513,14 +1546,14 @@ return;
</li>
<br>
<a name="noLinks"></a>
<li><b>noLinks</b><br>
<a name="dashboard_noLinks"></a>
<li><b>dashboard_noLinks</b><br>
Es erfolgt keine Linkerstellung zur Detailansicht von Devices. <br><br>
<b>Hinweis: </b><br>
Bei manchen Devicetypen wird der Link zur Detailansicht integriert im Namen bzw. Alias des Device mitgeliefert.
In diesen Fällen muß die Linkgenerierung direkt im Device abgestellt werden (z.B. bei Devices der Typen readingsGroup,
SSCamSTRM oder SMAPortal).
SSCamSTRM, SVG oder SMAPortal).
</li>
<br>