1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-04 22:19:38 +00:00

FHEMWEB: Small speedup in room overview if showRoom is not set

git-svn-id: https://svn.fhem.de/fhem/trunk@5967 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-05-25 08:45:19 +00:00
parent 65ba53ed28
commit 57b778d54c

View File

@ -772,31 +772,19 @@ FW_digestCgi($)
sub sub
FW_updateHashes() FW_updateHashes()
{ {
################# %FW_rooms = (); # Make a room hash
# Make a room hash %FW_groups = (); # Make a group hash
%FW_rooms = (); %FW_types = (); # Needed for type sorting
foreach my $d (keys %defs ) { foreach my $d (keys %defs ) {
next if(IsIgnored($d)); next if(IsIgnored($d));
foreach my $r (split(",", AttrVal($d, "room", "Unsorted"))) { foreach my $r (split(",", AttrVal($d, "room", "Unsorted"))) {
$FW_rooms{$r}{$d} = 1; $FW_rooms{$r}{$d} = 1;
} }
}
#################
# Make a group hash
%FW_groups = ();
foreach my $d (keys %defs ) {
next if(IsIgnored($d));
foreach my $r (split(",", AttrVal($d, "group", ""))) { foreach my $r (split(",", AttrVal($d, "group", ""))) {
$FW_groups{$r}{$d} = 1; $FW_groups{$r}{$d} = 1;
} }
}
###############
# Needed for type sorting
%FW_types = ();
foreach my $d (sort keys %defs ) {
next if(IsIgnored($d));
my $t = AttrVal($d, "subType", $defs{$d}{TYPE}); my $t = AttrVal($d, "subType", $defs{$d}{TYPE});
$t = AttrVal($d, "model", $t) if($t && $t eq "unknown"); # RKO: ??? $t = AttrVal($d, "model", $t) if($t && $t eq "unknown"); # RKO: ???
$FW_types{$d} = $t; $FW_types{$d} = $t;
@ -1096,13 +1084,21 @@ FW_roomOverview($)
} }
$FW_room = "" if(!$FW_room); $FW_room = "" if(!$FW_room);
my @sortBy = split( " ", AttrVal( $FW_wname, "sortRooms", "" ) ); my @rlist;
@sortBy = sort keys %FW_rooms if( scalar @sortBy == 0 ); if(AttrVal($FW_wname, "sortRooms", "")) { # Slow!
my @sortBy = split( " ", AttrVal( $FW_wname, "sortRooms", "" ) );
@rlist = sort { FW_roomIdx(@sortBy,$a) cmp
FW_roomIdx(@sortBy,$b) } keys %FW_rooms;
} else {
@rlist = sort keys %FW_rooms;
}
########################## ##########################
# Rooms and other links # Rooms and other links
foreach my $r ( sort { FW_roomIdx(@sortBy,$a) cmp foreach my $r (@rlist) {
FW_roomIdx(@sortBy,$b) } keys %FW_rooms ) {
next if($r eq "hidden" || $FW_hiddenroom{$r}); next if($r eq "hidden" || $FW_hiddenroom{$r});
$FW_room = $r if(!$FW_room && $FW_ss); $FW_room = $r if(!$FW_room && $FW_ss);
$r =~ s/</&lt;/g; $r =~ s/</&lt;/g;