From 2ebcd80986dfb9ca3bd953a4c5b9c22717189fb1 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sat, 21 Sep 2019 06:33:02 +0000 Subject: [PATCH] 95_Dashboard: fix deleting links git-svn-id: https://svn.fhem.de/fhem/trunk@20214 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/95_Dashboard.pm | 10 ++-- fhem/contrib/DS_Starter/95_Dashboard.pm | 77 ++++++++++++++++++------- 2 files changed, 59 insertions(+), 28 deletions(-) diff --git a/fhem/FHEM/95_Dashboard.pm b/fhem/FHEM/95_Dashboard.pm index 3852237e7..1e10c7e97 100644 --- a/fhem/FHEM/95_Dashboard.pm +++ b/fhem/FHEM/95_Dashboard.pm @@ -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>).*/$2/mg; # keine Links zur Detailansicht des Devices für PageEnd Devices (bringen Link inkludiert mit) - } $ret .= ">$devret"; 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); diff --git a/fhem/contrib/DS_Starter/95_Dashboard.pm b/fhem/contrib/DS_Starter/95_Dashboard.pm index 49283e436..ce30abd55 100644 --- a/fhem/contrib/DS_Starter/95_Dashboard.pm +++ b/fhem/contrib/DS_Starter/95_Dashboard.pm @@ -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 .= "$icon$devName"; # keine Links zur Detailansicht des Devices } else { $ret .= FW_pH ("detail=$d", "$icon$devName", 1, "col1", 1); # FW_pH = add href (, , , , , ) } - } + } $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 {->VERSION()} im FHEMWEB kann Modulversion abgefragt werden } @@ -1103,7 +1106,22 @@ return; Get
      - N/A + + +
    • get <name> config
      + Delivers the configuration of the dashboard back.
      +
      +
    • + + +
    • get <name> icon <icon name>
      + Delivers the path and full name of the denoted icon back.

      + + Example:
      + get <name> icon measure_power_meter +
      +
    • +

@@ -1267,14 +1285,14 @@ return;
- -
  • noLinks
    + +
  • dashboard_noLinks
    No link generation to the detail view of the devices takes place.

    Note:
    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).

  • @@ -1337,7 +1355,22 @@ return; Get
        - N/A + + +
      • get <name> config
        + Liefert die Konfiguration des Dashboards zurück.
        +
        +
      • + + +
      • get <name> icon <icon name>
        + Liefert den Pfad und vollen Namen des angegebenen Icons zurück.

        + + Beispiel:
        + get <name> icon measure_power_meter +
        +
      • +

    @@ -1513,14 +1546,14 @@ return;
    - -
  • noLinks
    + +
  • dashboard_noLinks
    Es erfolgt keine Linkerstellung zur Detailansicht von Devices.

    Hinweis:
    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).