diff --git a/FHEM/01_FHEMWEB.pm b/FHEM/01_FHEMWEB.pm index 7fc668761..6b8ba05bf 100644 --- a/FHEM/01_FHEMWEB.pm +++ b/FHEM/01_FHEMWEB.pm @@ -218,7 +218,7 @@ FHEMWEB_Initialize($) ############### # Initialize internal structures - map { addToAttrList($_) } ( + map { addToAttrList($_, "FHEMWEB") } ( "cmdIcon", "devStateIcon:textField-long", "devStateStyle", diff --git a/fhem.pl b/fhem.pl index 2740378b4..b73e47724 100755 --- a/fhem.pl +++ b/fhem.pl @@ -104,10 +104,10 @@ sub Value($); sub WriteStatefile(); sub XmlEscape($); sub addEvent($$;$); -sub addToDevAttrList($$); +sub addToDevAttrList($$;$); sub applyGlobalAttrFromEnv(); sub delFromDevAttrList($$); -sub addToAttrList($); +sub addToAttrList($;$); sub delFromAttrList($); sub addToWritebuffer($$@); sub attrSplit($); @@ -388,8 +388,8 @@ my @attrList = qw( timestamp-on-change-reading ); $readingFnAttributes = join(" ", @attrList); -my %framework_attrList = map { s/:.*//; $_ => 1 } @attrList; -map { $framework_attrList{$_} = 1 } qw( +my %attrSource = map { s/:.*//; $_ => "framework" } @attrList; +map { $attrSource{$_} = "framework" } qw( ignore disable disabledForIntervals @@ -2802,7 +2802,7 @@ getAllAttr($;$$) $list .= " " if($list); $list .= $v; map { s/:.*//; - $typeHash->{$_} = $framework_attrList{$_} ? "framework" : $type } + $typeHash->{$_} = $attrSource{$_} ? $attrSource{$_} : $type } split(" ",$v) if($typeHash); }; @@ -4276,10 +4276,11 @@ AddDuplicate($$) } # Add an attribute to the userattr list, if not yet present +# module is the source, needed when searching for help sub -addToDevAttrList($$) +addToDevAttrList($$;$) { - my ($dev,$arg) = @_; + my ($dev,$arg,$module) = @_; my $ua = $attr{$dev}{userattr}; $ua = "" if(!$ua); @@ -4287,6 +4288,7 @@ addToDevAttrList($$) grep { " $AttrList " !~ m/ $_ / } split(" ", "$ua $arg"); $attr{$dev}{userattr} = join(" ", sort keys %hash); + map { s/:.*//; $attrSource{$_} = $module; } split(" ", $arg) if($module); } # The counterpart: delete it. @@ -4308,9 +4310,10 @@ delFromDevAttrList($$) sub -addToAttrList($) +addToAttrList($;$) { - addToDevAttrList("global", shift); + my ($arg,$module) = @_; + addToDevAttrList("global", $arg, $module); } sub diff --git a/www/pgm2/fhemweb.js b/www/pgm2/fhemweb.js index ad46a5641..efb978f98 100644 --- a/www/pgm2/fhemweb.js +++ b/www/pgm2/fhemweb.js @@ -309,7 +309,8 @@ FW_jqueryReadyFn() return; $("#devSpecHelp").remove(); var sel=this, devName=m[2], selType=m[1]; - FW_displayHelp(devName, sel, selType, val, 1); + var group = $(this).parent().find(':selected').parent().attr('label'); + FW_displayHelp(devName, sel, selType, val, group); }); FW_smallScreenCommands(); @@ -334,8 +335,17 @@ FW_jqueryReadyFn() } function -FW_displayHelp(devName, sel, selType, val, level) +FW_displayHelp(devName, sel, selType, val, group) { + if(group) { + if(group.indexOf("userattr") >= 0) + return; + if(group == "framework") + devName = "commandref"; + else if(group != "Module") + devName = group; + } + FW_getHelp(devName, function(data) { // show either the next or the outer li $("#content") .append("
"); @@ -345,7 +355,8 @@ FW_displayHelp(devName, sel, selType, val, level) var mtype = wb.find("a[id]").attr("id"), aTag; if(!mtype) mtype = wb.find("a[name]").attr("name"); - if(level == 3) // commandref + + if(devName == "commandref") mtype = ""; if(mtype) { // current syntax: FHEMWEB-attr-webCmd @@ -384,14 +395,6 @@ FW_displayHelp(devName, sel, selType, val, level) } wb.remove(); - if(!$(aTag).length) { - while(++level <= 3) { - if(level == 2 && devName != "FHEMWEB") - return FW_displayHelp("FHEMWEB", sel, selType, val, level); - if(level == 3 && devName != "commandref") - return FW_displayHelp("commandref", sel, selType, val, level); - } - } }); }