2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 16:46:35 +00:00

Dashboard: group names can contain regex special characters now - restoring of group visibility now works as expected - fixed issue that some readingGroups are not updated correctly

git-svn-id: https://svn.fhem.de/fhem/trunk@8949 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
talkabout 2015-07-12 19:56:22 +00:00
parent 0ea89726e4
commit 6dc5c9770b
3 changed files with 54 additions and 24 deletions

View File

@ -1,5 +1,8 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: Dashboard: group names now also can contain regex special characters
restoring of saved group state works now as expected
fixed issue that some readingGroups are not updated correcly
- change: 02_RSS: replaced refresh method by javascript DOM gymnastics
- change: 59_Weather: removed empty header row from WeatherAsHtmlV
- feature: 02_HTTPSRV: support tabletui (Forum #37232)

View File

@ -542,25 +542,45 @@ sub BuildDashboardTab($$)
my @temptabgroup = split(",", $tabgroups[$t]); #Set temp. position for groups without an stored position
my @tabgroup = ();
my @index = ();
foreach my $g (@groups){
for (my $i=0;$i<@temptabgroup;$i++) {
my @stabgroup = split(":", trim($temptabgroup[$i]));
my $matchGroup = trim($stabgroup[0]);
for (my $i=0;$i<@temptabgroup;$i++) {
my @stabgroup = split(":", trim($temptabgroup[$i]));
@index = grep { @groups[$_] eq @stabgroup[0] } (0 .. @groups-1);
# fill groups that are matching the configured groups
if ($g =~ m/$matchGroup/ && $g ne $stabgroup[0]) {
push(@tabgroup, $g);
}
elsif ($g eq $stabgroup[0]) {
push(@tabgroup, $g);
if (@index > 0) {
for (my $j=0; $j<@index;$j++) {
my $groupname = @groups[@index[$j]];
if (@stabgroup > 1) {
$groupname .= ':' . @stabgroup[1];
}
push(@tabgroup,$groupname);
}
}
}
else {
my $matchGroup = '^' . @stabgroup[0] . '$';
@index = grep { @groups[$_] =~ m/$matchGroup/ } (0 .. @groups-1);
if (@index > 0) {
for (my $j=0; $j<@index;$j++) {
my $groupname = @groups[@index[$j]];
if (@stabgroup > 1) {
$groupname .= ':' . @stabgroup[1];
}
push(@tabgroup,$groupname);
}
}
}
}
$tabgroups[$t] = join(',', @tabgroup);
for (my $i=0;$i<@tabgroup;$i++) {
my @stabgroup = split(":", trim($tabgroup[$i]));
my $matchGroup = "," . trim($stabgroup[0]) . ",";
my $matchGroup = "," . quotemeta(trim($stabgroup[0])) . ",";
if ($tabsortings[$t] !~ m/$matchGroup/) {
$tabsortings[$t] = $tabsortings[$t]."t".$t."c".GetMaxColumnId($row,$colcount).",".trim($stabgroup[0]).",true,0,0:";
@ -657,15 +677,11 @@ sub BuildGroupWidgets($$$$$) {
foreach my $singlesorting (@storedsorting) {
my @groupdata = split(",", $singlesorting);
my $groupMatch = $dbgroups;
$groupicon = '';
if (scalar(@groupdata) > 1) {
if (
index($dbsorting, "t".$tab."c".$column.",".$groupdata[1]) >= 0
&& (
index($dbgroups, $groupdata[1]) >= 0
|| $groupdata[1] =~ $groupMatch
)
&& index($dbgroups, $groupdata[1]) >= 0
&& $groupdata[1] ne ""
) { #group is set to tab
my $groupId = $id."t".$tab."c".$column."w".$counter;
@ -694,7 +710,7 @@ sub BuildGroupList($) {
$grp = trim($grp);
foreach my $g (@dashboardgroups){
my ($gtitle, $iconName) = split(":", trim($g));
my $titleMatch = "^" . $gtitle . "\$";
my $titleMatch = "^" . quotemeta($gtitle) . "\$";
$group{$grp}{$d} = 1 if($grp =~ $titleMatch);
}
}
@ -718,14 +734,13 @@ sub BuildGroup
my $ret = "";
my $row = 1;
my %extPage = ();
my $matchGroup = "^" . $currentgroup . "\$";
my $foundDevices = 0;
my $replaceGroup = "";
my $rf = ($FW_room ? "&amp;room=$FW_room" : ""); # stay in the room
foreach my $g (keys %group) {
next if ($g !~ m/$matchGroup/);
next if ($g ne $currentgroup);
$replaceGroup = "," . quotemeta($currentgroup) . ",";
$singleSorting =~ s/$replaceGroup/,$g,/;
$currentgroup = $g;

View File

@ -243,7 +243,9 @@ function restoreOrder(ActiveTabId) {
width = $(this).find(".dashboard_content").children().outerWidth()+10;
}
}
$(this).outerWidth(width);
if (width) {
$(this).outerWidth(width);
}
//---------------------------------------------------------------------------------------------------------------
//-------------------------------- Height of an Group. | Min. Height if need ---------------------------
@ -492,11 +494,16 @@ function dashboard_load_tab(tabIndex) {
function dashboard_insert_tab(tabIndex, content) {
$('#dashboardtabs').append(content);
$("#dashboardtabs").tabs('refresh');
// call FHEM specific widget replacement
FW_replaceWidgets($("#dashboard_tab" + tabIndex));
dashboard_init_tab(tabIndex);
// call FHEMWEB specific link replacement
$("#dashboard_tab" + tabIndex + " a").each(function() { FW_replaceLink(this); });
restoreOrder(tabIndex);
restoreGroupVisibility(tabIndex);
if (gridSize = is_dashboard_flexible()) {
var $container = $("#dashboard_rowcenter_tab" + tabIndex);
$("#dashboard_tab" + tabIndex + " .dashboard_widget").draggable({
@ -515,11 +522,16 @@ function dashboard_insert_tab(tabIndex, content) {
});
}
makeResizable('.dashboard_widget');
// call the initialization of reading groups
FW_readingsGroupReadyFn($('#dashboard_tab' + tabIndex));
if ((DashboardConfigHash['lockstate'] == "lock") || (dashboard_buttonbar == "hidden")) {
dashboard_setlock();
} else {
dashboard_unsetlock();
}
restoreGroupVisibility(tabIndex);
}
function dashboard_init_tab(tabIndex) {
@ -537,7 +549,7 @@ function dashboard_init_tab(tabIndex) {
} else {
hideGroupForButton(this);
}
saveOrder();
//saveOrder();
event.stopImmediatePropagation();
});
} else { $("#dashboard_tab" + tabIndex + " .dashboard_widgetheader").addClass( "dashboard_widgetheader ui-corner-all" );}
@ -565,7 +577,7 @@ function hideGroupForButton(button) {
$(button).parent().removeClass("dashboard_widgetmax");
$(button).parent().addClass("dashboard_widgetmin");
$.cookie($parentElement.attr('id') + '_hidden', '1');
$.cookie($parentElement.attr('id') + '_hidden', '1', {expires : 365});
}
function showGroupForButton(button) {