mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
Definition helper, first part
git-svn-id: https://svn.fhem.de/fhem/trunk@1379 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
146ffb8954
commit
c12811a7c4
@ -825,9 +825,8 @@ FW_roomOverview($)
|
||||
"", "",
|
||||
"Howto", "$FW_ME/HOWTO.html",
|
||||
"Wiki", "http://fhemwiki.de",
|
||||
# "FAQ", "$FW_ME/faq.html",
|
||||
"Details", "$FW_ME/commandref.html",
|
||||
# "Examples", "$FW_ME/cmd=style%20examples",
|
||||
"Definition...", "$FW_ME/cmd=style%20addDef",
|
||||
"Edit files", "$FW_ME/cmd=style%20list",
|
||||
"Select style", "$FW_ME/cmd=style%20select",
|
||||
"Event monitor", "$FW_ME/cmd=style%20eventMonitor",
|
||||
@ -1444,7 +1443,6 @@ FW_calcWeblink($$)
|
||||
@l = localtime($t+7*86400);
|
||||
$FW_devs{$d}{to} = sprintf("%04d-%02d-%02d",$l[5]+1900,$l[4]+1,$l[3]);
|
||||
|
||||
|
||||
} elsif($zoom eq "month") {
|
||||
|
||||
my @l = localtime($now);
|
||||
@ -1596,6 +1594,70 @@ FW_style($$)
|
||||
FW_pO "Events:<br>\n";
|
||||
FW_pO "</div>";
|
||||
FW_pO "</div>";
|
||||
|
||||
} elsif($a[1] eq "addDef") {
|
||||
my $cnt = 0;
|
||||
my %isHelper;
|
||||
my $colCnt = ($FW_ss ? 2 : 8);
|
||||
FW_pO "<div id=\"content\">";
|
||||
|
||||
FW_pO "Helpers:";
|
||||
FW_pO "<div id=\"block\"><table><tr>";
|
||||
foreach my $mn ( "at", "notify", "average", "dummy", "holiday", "sequence",
|
||||
"structure", "watchdog", "weblink", "FileLog", "PID", "Twilight") {
|
||||
$isHelper{$mn} = 1;
|
||||
FW_pH "cmd=style addDef $mn", "$mn", 1;
|
||||
FW_pO "</tr><tr>" if(++$cnt % $colCnt == 0);
|
||||
}
|
||||
FW_pO "</tr>" if($cnt % $colCnt);
|
||||
FW_pO "</table></div>";
|
||||
|
||||
$cnt = 0;
|
||||
FW_pO "<br>Other Modules:";
|
||||
FW_pO "<div id=\"block\"><table><tr>";
|
||||
foreach my $mn (sort keys %modules) {
|
||||
my $mp = $modules{$mn};
|
||||
next if($isHelper{$mn});
|
||||
# If it is not loaded, read it through to check if it has a Define Function
|
||||
if(!$mp->{LOADED} && !$mp->{defChecked}) {
|
||||
$mp->{defChecked} = 1;
|
||||
if(open(FH, "$attr{global}{modpath}/FHEM/$modules{$mn}{ORDER}_$mn.pm")) {
|
||||
while(my $l = <FH>) {
|
||||
$mp->{DefFn} = 1 if(index($l, "{DefFn}") > 0);
|
||||
}
|
||||
close(FH);
|
||||
}
|
||||
}
|
||||
|
||||
next if(!$mp->{DefFn});
|
||||
FW_pH "cmd=style addDef $mn", "$mn", 1;
|
||||
FW_pO "</tr><tr>" if(++$cnt % $colCnt == 0);
|
||||
}
|
||||
FW_pO "</tr>" if($cnt % $colCnt);
|
||||
FW_pO "</table></div><br>";
|
||||
|
||||
if($a[2]) {
|
||||
if(!open(FH, "$FW_dir/commandref.html")) {
|
||||
FW_pO "<h3>comandref.html is missing</h3>";
|
||||
} else {
|
||||
my $inDef;
|
||||
while(my $l = <FH>) {
|
||||
if($l =~ m/<h3>$a[2]</) {
|
||||
$inDef = 1;
|
||||
} else {
|
||||
next if (!$inDef);
|
||||
last if($l =~ m/<h3>/);
|
||||
}
|
||||
chomp($l);
|
||||
$l =~ s/href="#/href="$FW_reldoc#/g;
|
||||
FW_pO $l;
|
||||
}
|
||||
close(FH);
|
||||
}
|
||||
}
|
||||
|
||||
FW_pO "</div>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user