98_weblink.pm: add nodetaillink attribute (Forum #41138)

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9282 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2015-09-20 14:47:15 +00:00
parent e0fc78fea5
commit 3e782a1596

View File

@@ -14,7 +14,7 @@ weblink_Initialize($)
my ($hash) = @_;
$hash->{DefFn} = "weblink_Define";
$hash->{AttrList} = "htmlattr";
$hash->{AttrList} = "htmlattr nodetaillink:1,0";
$hash->{FW_summaryFn} = "weblink_FwFn";
$hash->{FW_detailFn} = "weblink_FwFn";
$hash->{FW_atPageEnd} = 1;
@@ -71,7 +71,7 @@ sub
weblink_FwDetail($@)
{
my ($d, $text, $nobr)= @_;
return "" if(AttrVal($d, "group", ""));
return "" if(AttrVal($d, "group", "") || AttrVal($d, "nodetaillink", ""));
my $alias= AttrVal($d, "alias", $d);
my $ret = ($nobr ? "" : "<br>");
@@ -111,18 +111,21 @@ weblink_FwFn($$$$)
my @lines = split(" ", $link);
my $row = 1;
$ret = "<table>";
$ret .= "<tr><td><div class=\"devType\"><a href=\"/fhem?detail=$d\">".AttrVal($d, "alias", $d)."</a></div></td></tr>";
$ret .= "<tr><td><div class='devType'><a href='/fhem?detail=$d'>"
. AttrVal($d, "alias", $d)."</a></div></td></tr>";
$ret .= "<tr><td><table class=\"block wide\">";
foreach my $line (@lines) {
my @args = split(":", $line, 3);
$ret .= "<tr class=\"".(($row++&1)?"odd":"even")."\">";
$ret .= "<td><a href=\"/fhem?cmd=$args[2]\"><div class=\col1\"><img src=\"/fhem/icons/$args[0]\" width=19 height=19 align=\"center\" alt=\"$args[0]\" title=\"$args[0]\"> $args[1]</div></a></td></td>";
$ret .= "<tr class='".(($row++&1)?"odd":"even")."'>";
$ret .= "<td><a href='/fhem?cmd=$args[2]'><div class='col1'>".
"<img src='/fhem/icons/$args[0]' width='19' height='19' ".
"align='center' alt='$args[0]' title='$args[0]'>".
"$args[1]</div></a></td></td>";
$ret .= "</tr>";
}
$ret .= "</table></td></tr>";
$ret .= "</table><br>";
}
return $ret;
@@ -146,18 +149,24 @@ weblink_FwFn($$$$)
defined links.
Examples:
<ul>
<code>define homepage weblink link http://www.fhem.de</code><br>
<code>define webcam_picture weblink image http://w.x.y.z/current.jpg</code><br>
<code>define interactive_webcam weblink iframe http://w.x.y.z/webcam.cgi</code><br>
<code>define hr weblink htmlCode &lt;hr&gt</code><br>
<code>define w_Frlink weblink htmlCode { WeatherAsHtml("w_Frankfurt") }</code><br>
<code>define systemCommands weblink cmdList pair:Pair:set+cul2+hmPairForSec+60 restart:Restart:shutdown+restart update:UpdateCheck:update+check</code><br>
<code>
define homepage weblink link http://www.fhem.de<br>
define webcam_picture weblink image http://w.x.y.z/current.jpg<br>
define interactive_webcam weblink iframe http://w.x.y.z/webcam.cgi<br>
define hr weblink htmlCode &lt;hr&gt<br>
define w_Frlink weblink htmlCode { WeatherAsHtml("w_Frankfurt") }<br>
define systemCommands weblink cmdList
pair:Pair:set+cul2+hmPairForSec+60
restart:Restart:shutdown+restart
update:UpdateCheck:update+check
</code>
</ul>
<br>
Notes:
<ul>
<li>For cmdList &lt;argument&gt; consist of a list of space separated icon:label:cmd triples.</li>
<li>For cmdList &lt;argument&gt; consists of a list of space
separated icon:label:cmd triples.</li>
</ul>
</ul>
@@ -169,18 +178,6 @@ weblink_FwFn($$$$)
<a name="weblinkattr"></a>
<b>Attributes</b>
<ul>
<a name="htmlattr"></a>
<li>htmlattr<br>
HTML attributes to be used for link, image and iframe type of links.
E.g.:<br>
<ul>
<code>
define yw weblink wl_im1 iframe http://weather.yahooapis.com/forecastrss?w=650272&u=c<br>
attr yw weblink htmlattr width="480" height="560"<br>
</code>
</ul></li>
</ul>
<br>
</ul>