2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

contrib/Infopanel: updated

added: buttonpanel
added: button
added: demo layout for buttonpanel

git-svn-id: https://svn.fhem.de/fhem/trunk@7765 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2015-01-29 18:06:51 +00:00
parent f7b3576451
commit ab9f8731e3
2 changed files with 124 additions and 1 deletions

View File

@ -41,6 +41,7 @@ sub btIP_Notify;
sub btIP_readLayout($); sub btIP_readLayout($);
sub btIP_itemArea; sub btIP_itemArea;
sub btIP_itemButton;
sub btIP_itemCircle; sub btIP_itemCircle;
sub btIP_itemDate; sub btIP_itemDate;
sub btIP_itemEllipse; sub btIP_itemEllipse;
@ -187,6 +188,35 @@ sub btIP_itemArea {
return $output; return $output;
} }
sub btIP_itemButton {
my ($id,$x1,$y1,$x2,$y2,$rx,$ry,$link,$text,%params)= @_;
$id = ($id eq '-') ? createUniqueId() : $id;
my $width = $x2 - $x1;
my $height = $y2 - $y1;
my ($r,$g,$b,$a) = btIP_color($params{boxcolor});
$text = AnalyzePerlCommand(undef,$text);
$link = AnalyzePerlCommand(undef,$link);
my $target = 'secret';
$target = '_top' if $link =~ s/^-//;
$target = '_blank' if $link =~ s/^\+//;
my $output = "<a id=\”$id\” x=\"$x1\" y=\"$y1\" width=\"$width\" height=\"$height\" ".
"xlink:href=\"$link\" target=\"$target\" >\n";
$output .= "<rect id=\”$id\” x=\"$x1\" y=\"$y1\" rx=\"$rx\" ry=\"$ry\" width=\"$width\" height=\"$height\" ".
"style=\"fill:rgb($r,$g,$b); fill-opacity:$a; stroke-width:0;\" />\n";
my $oldhalign = $params{thalign};
my $oldvalign = $params{tvalign};
$params{thalign} = "middle";
$params{tvalign} = "middle";
$output .= btIP_itemText($id."_text",($x1+$x2)/2,($y1+$y2)/2,$text,%params);
$params{thalign} = $oldhalign;
$params{tvalign} = $oldvalign;
$output .= "</a>\n";
return $output;
}
sub btIP_itemCircle { sub btIP_itemCircle {
my ($id,$x,$y,$r,$filled,%params)= @_; my ($id,$x,$y,$r,$filled,%params)= @_;
$id = ($id eq '-') ? createUniqueId() : $id; $id = ($id eq '-') ? createUniqueId() : $id;
@ -591,7 +621,7 @@ sub btIP_evalLayout($$@) {
my ($id,$x,$y,$x1,$y1,$x2,$y2,$r1,$r2); my ($id,$x,$y,$x1,$y1,$x2,$y2,$r1,$r2);
my ($scale,$inline,$boxwidth,$boxheight,$boxcolor); my ($scale,$inline,$boxwidth,$boxheight,$boxcolor);
my ($text,$imgtype,$srctype,$arg,$format); my ($text,$link,$imgtype,$srctype,$arg,$format);
my $cont= ""; my $cont= "";
foreach my $line (@layout) { foreach my $line (@layout) {
@ -638,6 +668,22 @@ sub btIP_evalLayout($$@) {
$params{boxcolor} = AnalyzePerlCommand(undef, $def); $params{boxcolor} = AnalyzePerlCommand(undef, $def);
} }
when("button") {
($id,$x1,$y1,$x2,$y2,$r1,$r2,$link,$text)= split("[ \t]+", $def, 9);
($x1,$y1)= btIP_xy($x1,$y1,%params);
($x2,$y2)= btIP_xy($x2,$y2,%params);
my $arg = AnalyzePerlCommand(undef,$arg);
$params{xx} = $x;
$params{yy} = $y;
$svg .= btIP_itemButton($id,$x1,$y1,$x2,$y2,$r1,$r2,$link,$text,%params);
}
when("buttonpanel"){
$defs{$params{name}}{fhem}{div} = "<div id=\"hiddenDiv\" ".
"style=\"display:none\" >".
"<iframe id=\"secretFrame\" name=\"secret\" src=\"\"></div>\n";
}
when("circle") { when("circle") {
($id,$x1,$y1,$r1,$format)= split("[ \t]+", $def, 5); ($id,$x1,$y1,$r1,$format)= split("[ \t]+", $def, 5);
($x1,$y1)= btIP_xy($x1,$y1,%params); ($x1,$y1)= btIP_xy($x1,$y1,%params);

View File

@ -0,0 +1,77 @@
#
# 50 Pixel für die Gestaltung
# einer Kopfzeile freihalten
#
rgb "7F7F7FFF" # grau
line - 0 50 800 50
# Definiere Layout als ButtonPanel
#
buttonpanel
# Farbe für ButtonText
#
rgb "4D4D4DFF"
# Farbe für Button
#
boxcolor "FF0000FF"
button 11 0 55 160 135 0 0 {"Button11Link"} {"Button11Text"}
boxcolor "00FF00FF"
button 12 160 55 320 135 0 0 {"+http://www.google.de"} {"Google in new"}
boxcolor "FF0000FF"
button 13 320 55 480 135 0 0 {"-http://www.google.de"} {"Google in same"}
boxcolor "00FF00FF"
button 14 480 55 640 135 0 0 {"http://www.google.de"} {"Google invisible"}
boxcolor "FF0000FF"
button 15 640 55 800 135 0 0 {"Button15Link"} {"Button15Text"}
boxcolor "00FF00FF"
button 21 0 135 160 215 0 0 {"Button21Link"} {"Button21Text"}
boxcolor "FF0000FF"
button 22 160 135 320 215 0 0 {"Button22Link"} {"Button22Text"}
boxcolor "00FF00FF"
button 23 320 135 480 215 0 0 {"Button23Link"} {"Button23Text"}
boxcolor "FF0000FF"
button 24 480 135 640 215 0 0 {"Button24Link"} {"Button24Text"}
boxcolor "00FF00FF"
button 25 640 135 800 215 0 0 {"Button25Link"} {"Button25Text"}
boxcolor "FF0000FF"
button 31 0 215 160 290 0 0 {"Button31Link"} {"Button31Text"}
boxcolor "00FF00FF"
button 32 160 215 320 290 0 0 {"Button32Link"} {"Button32Text"}
boxcolor "FF0000FF"
button 33 320 215 480 290 0 0 {"Button33Link"} {"Button33Text"}
boxcolor "00FF00FF"
button 34 480 215 640 290 0 0 {"Button34Link"} {"Button34Text"}
boxcolor "FF0000FF"
button 35 640 215 800 290 0 0 {"Button35Link"} {"Button35Text"}
boxcolor "00FF00FF"
button 41 0 290 160 370 0 0 {"Button41Link"} {"Button41Text"}
boxcolor "FF0000FF"
button 42 160 290 320 370 0 0 {"Button42Link"} {"Button42Text"}
boxcolor "00FF00FF"
button 43 320 290 480 370 0 0 {"Button43Link"} {"Button43Text"}
boxcolor "FF0000FF"
button 44 480 290 640 370 0 0 {"Button44Link"} {"Button44Text"}
boxcolor "00FF00FF"
button 45 640 290 800 370 0 0 {"Button45Link"} {"Button45Text"}
boxcolor "999999FF"
button 51 0 370 160 430 0 0 {"Button51Link"} {"Button51Text"}
boxcolor "CCCCCCFF"
button 52 160 370 320 430 0 0 {"Button52Link"} {"Button52Text"}
boxcolor "999999FF"
button 53 320 370 480 430 0 0 {"Button53Link"} {"Button53Text"}
boxcolor "CCCCCCFF"
button 54 480 370 640 430 0 0 {"Button54Link"} {"Button54Text"}
boxcolor "999999FF"
button 55 640 370 800 430 0 0 {"Button55Link"} {"Button55Text"}
#