2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 20:06:18 +00:00

33_readingsGroup.pm: added direct show/hide js and command

git-svn-id: https://svn.fhem.de/fhem/trunk@7217 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2014-12-14 21:00:54 +00:00
parent 20711adff3
commit 015b154e8f
2 changed files with 32 additions and 17 deletions

View File

@ -370,9 +370,9 @@ readingsGroup_makeLink($$$)
} }
sub sub
readingsGroup_2html($) readingsGroup_2html($;$)
{ {
my($hash) = @_; my($hash,$extPage) = @_;
$hash = $defs{$hash} if( ref($hash) ne 'HASH' ); $hash = $defs{$hash} if( ref($hash) ne 'HASH' );
return undef if( !$hash ); return undef if( !$hash );
@ -432,7 +432,9 @@ readingsGroup_2html($)
my $devices = $hash->{DEVICES}; my $devices = $hash->{DEVICES};
my $group = AttrVal( $d, "group", undef ); my $group;
$group = $extPage->{group} if( $extPage );
$group = AttrVal( $d, "group", undef ) if( !$group );
$group = "" if( !$group ); $group = "" if( !$group );
$group =~ s/,/_/g; $group =~ s/,/_/g;
@ -840,13 +842,13 @@ readingsGroup_2html($)
sub sub
readingsGroup_detailFn() readingsGroup_detailFn()
{ {
my ($FW_wname, $d, $room, $pageHash) = @_; # pageHash is set for summaryFn. my ($FW_wname, $d, $room, $extPage) = @_; # extPage is set for summaryFn.
my $hash = $defs{$d}; my $hash = $defs{$d};
$hash->{mayBeVisible} = 1; $hash->{mayBeVisible} = 1;
return readingsGroup_2html($d); return readingsGroup_2html($d,$extPage);
} }
sub sub
@ -1081,7 +1083,7 @@ readingsGroup_Set($@)
{ {
my ($hash, $name, $cmd, $param, @a) = @_; my ($hash, $name, $cmd, $param, @a) = @_;
my $list = "visibility:toggle,toggle2"; my $list = "visibility:toggle,toggle2,show,hide";
if( $cmd eq "refresh" ) { if( $cmd eq "refresh" ) {
readingsGroup_updateDevices($hash); readingsGroup_updateDevices($hash);
@ -1258,6 +1260,14 @@ readingsGroup_Attr($$$;$)
<a name="readingsGroup_Set"></a> <a name="readingsGroup_Set"></a>
<b>Set</b> <b>Set</b>
<ul> <ul>
<li>hide<br>
will hide all visible instances of this readingsGroup</li>
<li>show<br>
will show all visible instances of this readingsGroup</li>
<li>toggle<br>
will toggle the hidden/shown state of all visible instances of this readingsGroup</li>
<li>toggle2<br>
will toggle the expanded/collapsed state of all visible instances of this readingsGroup</li>
</ul><br> </ul><br>
<a name="readingsGroup_Get"></a> <a name="readingsGroup_Get"></a>

View File

@ -19,6 +19,18 @@ FW_readingsGroupToggle(d) {
} }
} }
function
FW_readingsGroupShow(d,v) {
var rg = document.getElementById( 'readingsGroup-'+d );
if( rg ) {
s=rg.style;
if( s.display=='none' && v )
FW_readingsGroupToggle(d);
else if( s.display!='none' && !v )
FW_readingsGroupToggle(d);
}
}
function function
FW_readingsGroupToggle2(d) { FW_readingsGroupToggle2(d) {
var rg = document.getElementById( 'readingsGroup-'+d ); var rg = document.getElementById( 'readingsGroup-'+d );
@ -64,15 +76,6 @@ FW_readingsGroupToggle2(d) {
} }
} }
function
FW_readingsGroupHide(d) {
}
function
FW_readingsGroupShow(d) {
}
function function
FW_readingsGroupUpdateLine(d){ FW_readingsGroupUpdateLine(d){
var dd = d[0].split("-", 3); var dd = d[0].split("-", 3);
@ -85,8 +88,10 @@ FW_readingsGroupUpdateLine(d){
if( d[1] == 'toggle' ) FW_readingsGroupToggle( dd[0] ); if( d[1] == 'toggle' ) FW_readingsGroupToggle( dd[0] );
if( d[1] == 'toggle2' ) FW_readingsGroupToggle2( dd[0] ); if( d[1] == 'toggle2' ) FW_readingsGroupToggle2( dd[0] );
if( d[1] == 'show' ) FW_readingsGroupShow( dd[0], 1 );
if( d[1] == 'hide' ) FW_readingsGroupShow( dd[0], 0 );
console.log("xxx: "+d[1]); //console.log("xxx: "+d[1]);
} }
FW_widgets['readingsGroup'] = { FW_widgets['readingsGroup'] = {