mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
FHEMWEB: sortRooms by andre
git-svn-id: https://svn.fhem.de/fhem/trunk@4472 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7cc55da014
commit
836252fef1
@ -138,6 +138,7 @@ FHEMWEB_Initialize($)
|
||||
refresh
|
||||
reverseLogs:0,1
|
||||
roomIcons
|
||||
sortRooms
|
||||
smallscreen:unused
|
||||
stylesheetPrefix
|
||||
touchpad:unused
|
||||
@ -923,6 +924,18 @@ FW_makeTableFromArray($$@) {
|
||||
}
|
||||
}
|
||||
|
||||
sub
|
||||
FW_roomIdx(\@$)
|
||||
{
|
||||
my ($arr,$v) = @_;
|
||||
my ($index) = grep { $arr->[$_] =~ /^$v$/ } 0..$#$arr;
|
||||
|
||||
return "9999-$v" if( !defined($index) );
|
||||
|
||||
return $index;
|
||||
}
|
||||
|
||||
|
||||
##############
|
||||
# Header, Zoom-Icons & list of rooms at the left.
|
||||
sub
|
||||
@ -982,9 +995,13 @@ FW_roomOverview($)
|
||||
}
|
||||
$FW_room = "" if(!$FW_room);
|
||||
|
||||
my @sortBy = split( " ", AttrVal( $FW_wname, "sortRooms", "" ) );
|
||||
@sortBy = sort keys %FW_rooms if( scalar @sortBy == 0 );
|
||||
|
||||
##########################
|
||||
# Rooms and other links
|
||||
foreach my $r (sort keys %FW_rooms) {
|
||||
foreach my $r ( sort { FW_roomIdx(@sortBy,$a) cmp
|
||||
FW_roomIdx(@sortBy,$b) } keys %FW_rooms ) {
|
||||
next if($r eq "hidden" || $FW_hiddenroom{$r});
|
||||
$FW_room = $r if(!$FW_room && $FW_ss);
|
||||
$r =~ s/</</g;
|
||||
@ -2648,6 +2665,14 @@ FW_ActivateInform()
|
||||
</li>
|
||||
<br>
|
||||
|
||||
<a name="sortRooms"></a>
|
||||
<li>sortRooms<br>
|
||||
Space separated list of rooms to override the default
|
||||
sort order of the room links. Example:<br>
|
||||
attr WEB sortRooms DG OG EG Keller
|
||||
</li>
|
||||
<br>
|
||||
|
||||
<a name="sortby"></a>
|
||||
<li>sortby<br>
|
||||
Take the value of this attribute when sorting the devices in the room
|
||||
|
Loading…
Reference in New Issue
Block a user