2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 13:26:02 +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
FW_updateHashes()
{
#################
# Make a room hash
%FW_rooms = ();
%FW_rooms = (); # Make a room hash
%FW_groups = (); # Make a group hash
%FW_types = (); # Needed for type sorting
foreach my $d (keys %defs ) {
next if(IsIgnored($d));
foreach my $r (split(",", AttrVal($d, "room", "Unsorted"))) {
$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", ""))) {
$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});
$t = AttrVal($d, "model", $t) if($t && $t eq "unknown"); # RKO: ???
$FW_types{$d} = $t;
@ -1096,13 +1084,21 @@ FW_roomOverview($)
}
$FW_room = "" if(!$FW_room);
my @sortBy = split( " ", AttrVal( $FW_wname, "sortRooms", "" ) );
@sortBy = sort keys %FW_rooms if( scalar @sortBy == 0 );
my @rlist;
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
foreach my $r ( sort { FW_roomIdx(@sortBy,$a) cmp
FW_roomIdx(@sortBy,$b) } keys %FW_rooms ) {
foreach my $r (@rlist) {
next if($r eq "hidden" || $FW_hiddenroom{$r});
$FW_room = $r if(!$FW_room && $FW_ss);
$r =~ s/</&lt;/g;