From 569bf6119564332fba6f3c691c610b7c76ab978d Mon Sep 17 00:00:00 2001
From: rudolfkoenig <>
Date: Wed, 18 Feb 2015 17:32:56 +0000
Subject: [PATCH] 98_help.pm: new module (Forum #33916)
git-svn-id: https://svn.fhem.de/fhem/trunk@8030 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/CHANGED | 1 +
fhem/{contrib => FHEM}/98_help.pm | 21 +++++++++++++++++--
fhem/contrib/fhemupdate.pl | 1 +
fhem/fhem.pl | 35 +++++--------------------------
fhem/www/pgm2/brightstyle.css | 2 ++
fhem/www/pgm2/darkCommon.css | 2 ++
fhem/www/pgm2/defaultCommon.css | 2 ++
fhem/www/pgm2/fhemweb.js | 17 +++++++++++++++
8 files changed, 49 insertions(+), 32 deletions(-)
rename fhem/{contrib => FHEM}/98_help.pm (83%)
diff --git a/fhem/CHANGED b/fhem/CHANGED
index e5cca4ce1..3deff4db3 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# 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.
+ - feature: help is now a separate module
- feature: pahColor() added to Color.pm to convert temperatures
into rgb values. See forum thread #30128
- feature: FB_CALLMONITOR: read all available phonebooks directly wia
diff --git a/fhem/contrib/98_help.pm b/fhem/FHEM/98_help.pm
similarity index 83%
rename from fhem/contrib/98_help.pm
rename to fhem/FHEM/98_help.pm
index 73a1800b6..ce28958a6 100644
--- a/fhem/contrib/98_help.pm
+++ b/fhem/FHEM/98_help.pm
@@ -95,15 +95,32 @@ sub CommandHelp {
=begin html
-
help
+?, help
+ ? [<moduleName>]
help [<moduleName>]
- - returns a list of available commands, when called without a moduleName
+ - returns a list of available commands, when called without a
+ moduleName
- returns a module dependent helptext, same as in commandref
=end html
+
+=begin html_DE
+
+
+?, help
+
+ ? [<moduleName>]
+ help [<moduleName>]
+
+ Liefert eine Liste aller Befehle mit einer Kurzbeschreibung zurück.
+ Falls moduleName spezifiziert ist, wird die modul-spezifische Hilfe
+ aus commandref zurückgeliefert.
+
+=end html_DE
+
=cut
diff --git a/fhem/contrib/fhemupdate.pl b/fhem/contrib/fhemupdate.pl
index f16ce5bb4..db6c6f236 100755
--- a/fhem/contrib/fhemupdate.pl
+++ b/fhem/contrib/fhemupdate.pl
@@ -52,6 +52,7 @@ my @filelist2 = (
"FHEM/lib/MP3/Tag/.*",
"FHEM/lib/UPnP/.*",
"www/pgm2/.*",
+ "www/pgm2/images/.*.png",
"www/jscolor/.*",
"www/codemirror/.*",
"www/gplot/.*.gplot",
diff --git a/fhem/fhem.pl b/fhem/fhem.pl
index 0b7845730..473c16ad2 100755
--- a/fhem/fhem.pl
+++ b/fhem/fhem.pl
@@ -133,7 +133,6 @@ sub CommandDeleteAttr($$);
sub CommandDeleteReading($$);
sub CommandDisplayAttr($$);
sub CommandGet($$);
-sub CommandHelp($$);
sub CommandIOWrite($$);
sub CommandInclude($$);
sub CommandInform($$);
@@ -249,7 +248,7 @@ $modules{Global}{LOADED} = 1;
$modules{Global}{AttrList} =
"archivecmd apiversion archivedir configfile lastinclude logfile " .
"modpath nrarchive pidfilename port statefile title " .
- "mseclog:1,0 version nofork:1,0 logdir holiday2we " .
+ "mseclog:1,0 version nofork:1,0 language:EN,DE logdir holiday2we " .
"autoload_undefined_devices:1,0 dupTimeout latitude longitude altitude " .
"backupcmd backupdir backupsymlink backup_before_update " .
"exclude_from_update motd restoreDirs uniqueID ".
@@ -263,24 +262,22 @@ $readingFnAttributes = "event-on-change-reading event-on-update-reading ".
%cmds = (
- "?" => { Fn=>"CommandHelp",
- Hlp=>",get this help" },
- "attr" => { Fn=>"CommandAttr",
+ "?" => { ReplacedBy => "help" },
+ "attr" => { Fn=>"CommandAttr",
Hlp=>" [],set attribute for "},
"define" => { Fn=>"CommandDefine",
Hlp=>" ,define a device/at/notify entity" },
"deleteattr" => { Fn=>"CommandDeleteAttr",
Hlp=>" [],delete attribute for " },
"deletereading" => { Fn=>"CommandDeleteReading",
- Hlp=>" [],delete user defined reading for " },
+ Hlp=>" [],delete user defined reading for ".
+ "" },
"delete" => { Fn=>"CommandDelete",
Hlp=>",delete the corresponding definition(s)"},
"displayattr"=> { Fn=>"CommandDisplayAttr",
Hlp=>" [attrname],display attributes" },
"get" => { Fn=>"CommandGet",
Hlp=>" ,request data from " },
- "help" => { Fn=>"CommandHelp",
- Hlp=>",get this help" },
"include" => { Fn=>"CommandInclude",
Hlp=>",read the commands from " },
"inform" => { Fn=>"CommandInform",
@@ -340,7 +337,6 @@ if(int(@ARGV) < 1) {
print "install as windows service: fhem.pl configfile -i\n";
print "uninstall the windows service: fhem.pl -u\n";
}
- CommandHelp(undef, undef);
exit(1);
}
@@ -1068,27 +1064,6 @@ devspec2array($)
return @ret;
}
-#####################################
-sub
-CommandHelp($$)
-{
- my ($cl, $param) = @_;
-
- my $str = "\n" .
- "Possible commands:\n\n" .
- "Command Parameter Description\n" .
- "-----------------------------------------------\n";
-
- for my $cmd (sort keys %cmds) {
- next if(!$cmds{$cmd}{Hlp});
- next if($cl && $cmds{$cmd}{ClientFilter} &&
- $cl->{TYPE} !~ m/$cmds{$cmd}{ClientFilter}/);
- my @a = split(",", $cmds{$cmd}{Hlp}, 2);
- $str .= sprintf("%-9s %-25s %s\n", $cmd, $a[0], $a[1]);
- }
- return $str;
-}
-
#####################################
sub
CommandInclude($$)
diff --git a/fhem/www/pgm2/brightstyle.css b/fhem/www/pgm2/brightstyle.css
index 6f5854a64..045ad0050 100644
--- a/fhem/www/pgm2/brightstyle.css
+++ b/fhem/www/pgm2/brightstyle.css
@@ -102,3 +102,5 @@ div#svgmarker {
color:#278727; background:#FFFFE7;
border:2px solid #278727; border-radius:4px;
}
+
+div.detLink { display:inline-block; margin-right:0.5em; }
diff --git a/fhem/www/pgm2/darkCommon.css b/fhem/www/pgm2/darkCommon.css
index 4ce09b41d..8824e45c0 100644
--- a/fhem/www/pgm2/darkCommon.css
+++ b/fhem/www/pgm2/darkCommon.css
@@ -4,3 +4,5 @@
div.ui-dialog { border:3px solid white; padding: 0.2em; }
div.ui-dialog div.ui-dialog-titlebar { display:none; }
div.ui-widget-content { background:#444444; color:#CCCCCC; }
+
+div.detLink { display:inline-block; margin-right:0.5em; }
diff --git a/fhem/www/pgm2/defaultCommon.css b/fhem/www/pgm2/defaultCommon.css
index ac5b23715..ab38c2a92 100644
--- a/fhem/www/pgm2/defaultCommon.css
+++ b/fhem/www/pgm2/defaultCommon.css
@@ -86,3 +86,5 @@ div#svgmarker {
color:#278727; background:#FFFFE7;
border:2px solid #278727; border-radius:4px;
}
+
+div.detLink { display:inline-block; margin-right:0.5em; }
diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js
index 2d45eb049..de1d82d2b 100644
--- a/fhem/www/pgm2/fhemweb.js
+++ b/fhem/www/pgm2/fhemweb.js
@@ -140,6 +140,23 @@ FW_jqueryReadyFn()
return true;
});
});
+
+ $("div.devSpecHelp a").each(function(){ // Help on detail window
+ var dev = $(this).attr("href").split("#").pop();
+ $(this).attr("href", "#");
+ $(this).click(function(evt){
+ if($("#devSpecHelp").length) {
+ $("#devSpecHelp").remove();
+ return;
+ }
+ $("#content").append('');
+ FW_cmd(FW_root+"?cmd=help "+dev+"&XHR=1", function(data) {
+ $("#devSpecHelp").html(data);
+ });
+ });
+ });
+
+
}