From 36a3f5fb513a7ef6abb8c3cdac87ede12a3dcdd8 Mon Sep 17 00:00:00 2001
From: rudolfkoenig <>
Date: Fri, 30 Dec 2011 09:08:36 +0000
Subject: [PATCH] SaveAs, bugfixes
git-svn-id: https://svn.fhem.de/fhem/trunk@1152 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/CHANGED | 1 +
fhem/FHEM/98_structure.pm | 1 +
fhem/FHEM/99_XmlList.pm | 4 ++-
fhem/webfrontend/pgm2/01_FHEMWEB.pm | 40 +++++++++++++++++------------
4 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/fhem/CHANGED b/fhem/CHANGED
index 1a4ee1d52..58e391a60 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -29,6 +29,7 @@
- change: HTTPS certs directory moved from cwd into modpath
- feature: shutdown parameter restart added
- feature: usb scan/create command added (part of autocreate).
+ - feature: SaveAs added to FHEMWEB Edit-Files
- 2011-07-08 (5.1)
diff --git a/fhem/FHEM/98_structure.pm b/fhem/FHEM/98_structure.pm
index b841da3cf..b077f33b8 100755
--- a/fhem/FHEM/98_structure.pm
+++ b/fhem/FHEM/98_structure.pm
@@ -173,6 +173,7 @@ structure_Attr($@)
{
my ($type, @list) = @_;
+ return undef if($list[1] eq "alias");
my $hash = $defs{$list[0]};
$hash->{INATTR} = 1;
my $ret = "";
diff --git a/fhem/FHEM/99_XmlList.pm b/fhem/FHEM/99_XmlList.pm
index 5b4cc6220..f88f7d976 100644
--- a/fhem/FHEM/99_XmlList.pm
+++ b/fhem/FHEM/99_XmlList.pm
@@ -30,7 +30,9 @@ XmlEscape($)
$a =~ s/"/"/g;
$a =~ s/</g;
$a =~ s/>/>/g;
- $a =~ s/([^ -~])/sprintf("%02x;", ord($1))/ge;
+# Not needed since we've gone UTF-8
+# $a =~ s/([^ -~])/sprintf("%02x;", ord($1))/ge;
+
return $a;
}
diff --git a/fhem/webfrontend/pgm2/01_FHEMWEB.pm b/fhem/webfrontend/pgm2/01_FHEMWEB.pm
index 3db6c10bc..6a77319c2 100755
--- a/fhem/webfrontend/pgm2/01_FHEMWEB.pm
+++ b/fhem/webfrontend/pgm2/01_FHEMWEB.pm
@@ -48,6 +48,7 @@ my $try_zlib = 1;
#########################
# As we are _not_ multithreaded, it is safe to use global variables.
# Note: for delivering SVG plots we fork
+my %FW_webArgs; # all arguments specifie in the GET
my $FW_cmdret; # Returned data by the fhem call
my $FW_data; # Filecontent from browser when editing a file
my $FW_detail; # currently selected device for detail view
@@ -519,6 +520,7 @@ FW_digestCgi($)
$FW_XHR = undef;
$FW_inform = undef;
+ %FW_webArgs = ();
$arg =~ s,^[?/],,;
foreach my $pv (split("&", $arg)) {
$pv =~ s/\+/ /g;
@@ -527,6 +529,7 @@ FW_digestCgi($)
# Multiline: escape the NL for fhem
$v =~ s/[\r]\n/\\\n/g if($v && $p && $p ne "data");
+ $FW_webArgs{$p} = $v;
if($p eq "detail") { $FW_detail = $v; }
if($p eq "room") { $FW_room = $v; }
@@ -544,7 +547,7 @@ FW_digestCgi($)
$cmd.=" $dev{$c}" if(defined($dev{$c}));
$cmd.=" $arg{$c}" if(defined($arg{$c}));
$cmd.=" $val{$c}" if(defined($val{$c}));
-
+Log 1, "CMD: $cmd";
return $cmd;
}
@@ -759,9 +762,9 @@ FW_roomOverview($)
"", "",
"Howto", "$FW_ME/HOWTO.html",
"Wiki", "http://fhemwiki.de",
- "FAQ", "$FW_ME/faq.html",
+# "FAQ", "$FW_ME/faq.html",
"Details", "$FW_ME/commandref.html",
- "Examples", "$FW_ME/cmd=style%20examples",
+# "Examples", "$FW_ME/cmd=style%20examples",
"Edit files", "$FW_ME/cmd=style%20list",
"Select style","$FW_ME/cmd=style%20select",
"", "");
@@ -1410,11 +1413,11 @@ FW_style($$)
push(@fl, "");
push(@fl, FW_fileList("$FW_dir/(.*.sh|.*Util.*)"));
push(@fl, "");
- push(@fl, FW_fileList("$FW_dir/.*.(css|svg|js)"));
+ push(@fl, FW_fileList("$FW_dir/.*.(css|svg)"));
push(@fl, "");
push(@fl, FW_fileList("$FW_dir/.*.gplot"));
- push(@fl, "");
- push(@fl, FW_fileList("$FW_dir/.*html"));
+# push(@fl, "");
+# push(@fl, FW_fileList("$FW_dir/.*html"));
pO $start;
pO "$msg
" if($msg);
@@ -1486,7 +1489,11 @@ FW_style($$)
pO "