[edit web page: add bbs Yoshikuni Jujo **20081206014912] { adddir ./web_page/cgi-bin addfile ./web_page/cgi-bin/EhsTools.hs hunk ./web_page/cgi-bin/EhsTools.hs 1 +module EhsTools ( + cgiPage +) where + +cgiPage :: IO String -> IO String -> IO String -> IO String +cgiPage title pre body = do + t <- title + p <- pre + b <- body + return $ "#!/usr/local/bin/perl\n" ++ + plPrint "Content-type: text/html\n\n" ++ + plPrint "\n" ++ + plPrint ("") ++ + plPrint ("" ++ t ++ "") ++ + plPrint ("

" ++ t ++ "

") ++ + plPrint p ++ + b ++ plPrint "\n" + +plPrint :: String -> String +plPrint str = "print " ++ show str ++ ";\n" addfile ./web_page/cgi-bin/Hakefile hunk ./web_page/cgi-bin/Hakefile 1 +import Development.Hake +import Development.Hake.FunSetIO + +target = "bbs.pl" +modules = [ "EhsTools.hs" ] +remoteAddr = "ftp37.nifty.com" +remoteDir = "/cgi-bin/second/projects/hake/" +uploaded = "upload_done" + +main = hake $ [ + + dflt [ target ] + , + rule "" ".ehs" $ \t (s:_) -> rawSystemE [ "ehs", s, "-o", t ] + , + file [ "upload" ] [ target ] $ \t ss -> do + newers <- getNewers uploaded ss + ec <- mapM (\s -> rawSystemE [ "yjftp", "put", s, remoteAddr ++ remoteDir, "hc751476" ]) + newers + if all (==ExitSuccess) ec + then rawSystemE [ "touch", uploaded ] >> return ExitSuccess + else return $ head $ filter (/=ExitSuccess) ec + + ] `addDeps` [ + + (target, modules) + + ] addfile ./web_page/cgi-bin/bbs.pl.ehs hunk ./web_page/cgi-bin/bbs.pl.ehs 1 +<% cgiPage -%>BBS about hake<%--%> + +<%% import EhsTools %%> +<%% import System.Time(getClockTime) %%> + +

modified at <%==$ getClockTime %>

+ +
+

name : +

+

+
+ +
+ +<%--%> + +$ENV{REQUEST_URI} =~ /\/([^\/\.]+)[^\/]*$/; +$filename = $1 . ".txt"; + +sub input2str { + + $str = $_[0]; + $str =~ s/.+?=//; + $str =~ s/%(..)/chr hex $1/ge; + $str =~ s/\+/ /g; + $str =~ s/\r\n//g; + return $str; + +} + +if ($ENV{CONTENT_LENGTH} != 0) { + + <> =~ /(.+)&(.+)/; + $date = `LANG=C date`; + $name = input2str($1); + $cont = input2str($2); + + open CONT, ">>" . $filename; + flock CONT, 2; + print CONT "

", $date, $name, "

\n

", $cont, "

\n"; + close CONT; + +} + +open CONT, $filename; +flock CONT, 1; +print ; +close CONT; + +<%-%> hunk ./web_page/index.xhtml.ehs 37 +

BBS

+

Please write about hake.

+

BBS about hake

hunk ./web_page/index.xhtml.ehs 42 -

-

+

Yoshikuni Jujo
+ PAF01143[AT]nifty.ne.jp

+

+

}