2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

Javascripting support for FHEMWEB

git-svn-id: https://svn.fhem.de/fhem/trunk@438 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2009-09-13 07:20:09 +00:00
parent 6d94e14344
commit c889ef8163
2 changed files with 12 additions and 0 deletions

View File

@ -529,3 +529,4 @@
- feature: CUL: device acces code reorganized, TCP/IP support added - feature: CUL: device acces code reorganized, TCP/IP support added
- feature: Pachube module from Axel - feature: Pachube module from Axel
- feature: dumpdef module from Axel in contrib - feature: dumpdef module from Axel in contrib
- feature: javascripting support in FHEMWEB (Klaus/Axel)

View File

@ -229,12 +229,14 @@ FW_AnswerCall($)
close(FH); close(FH);
$__RETTYPE = "text/plain; charset=ISO-8859-1" if($f !~ m/\.*html$/); $__RETTYPE = "text/plain; charset=ISO-8859-1" if($f !~ m/\.*html$/);
return 1; return 1;
} elsif($arg =~ m,^$__ME/(.*).css,) { } elsif($arg =~ m,^$__ME/(.*).css,) {
open(FH, "$__dir/$1.css") || return; open(FH, "$__dir/$1.css") || return;
pO join("", <FH>); pO join("", <FH>);
close(FH); close(FH);
$__RETTYPE = "text/css"; $__RETTYPE = "text/css";
return 1; return 1;
} elsif($arg =~ m,^$__ME/icons/(.*)$,) { } elsif($arg =~ m,^$__ME/icons/(.*)$,) {
open(FH, "$__dir/$1") || return; open(FH, "$__dir/$1") || return;
binmode (FH); # necessary for Windows binmode (FH); # necessary for Windows
@ -243,9 +245,18 @@ FW_AnswerCall($)
my @f_ext = split(/\./,$1); #kpb my @f_ext = split(/\./,$1); #kpb
$__RETTYPE = "image/$f_ext[-1]"; $__RETTYPE = "image/$f_ext[-1]";
return 1; return 1;
} elsif($arg =~ m,^$__ME/(.*).js,) { #kpb java include
open(FH, "$__dir/$1.js") || return;
pO join("", <FH>);
close(FH);
$__RETTYPE = "application/javascript";
return 1;
} elsif($arg !~ m/^$__ME(.*)/) { } elsif($arg !~ m/^$__ME(.*)/) {
Log(5, "Unknown document $arg requested"); Log(5, "Unknown document $arg requested");
return 0; return 0;
} }
############################## ##############################