3 import CGI hiding (div, head, map, span, Text)
10 import Text.ParserCombinators.Parsec
12 testDB = createPGB "wave" "wiki" "wiki" "12wiki34db"
18 runWithHook [] (\(key:act) -> sp db key act ) $ sp db "MainPage" []
20 ps a = standardQuery "Hello" a
23 s <- io $ getCurrent db key
26 Just (x,_) -> return x
27 standardQuery key $ do
28 t <- p $ makeTextarea s' (attr_SS "rows" "10" ## attr_SS "cols" "75" ## attr_SS "colspan" "2")
30 a <- textInputField (fieldSIZE 20)
32 c <- textInputField (fieldSIZE 20)
33 --p $ submit (F2 t a) testing (attr "value" "Send")
34 p $ defaultSubmit (F3 t a c) (savePage db key) (attr "value" "Send")
35 --submit0 (sp db key []) (attr "value" "Send1")
38 s <- io $ getCurrent db key
39 standardQuery key $ showPage db key s
41 savePage db key (F3 t a c) = do
42 s <- io $ update db key fulltext author comment
43 standardQuery key $ do
44 text "Updated with revision: "
46 address (hlink (URL {unURL = ("wiki?"++key)}) (text "Back to keyword") )
52 showPage db key s = do
54 Nothing -> text "No text added for this keyword"
55 Just (full, date) -> do
56 case parse wikiParser "" full of
62 p $ text $ "Last edited: "++date
67 submit0 (editPage db key) (attr "value" "Edit")
68 --address (hlink (URL {unURL = ("wiki?"++key++"+edit")}) (text "Edit this page")
71 ex ((Paragraph):xs) = do
77 ex ((Link l d):xs) = do
78 hlink (URL {unURL = ("wiki?"++l)}) (text d)
82 ex2 ((Paragraph):xs) = "<p>"++ex2 xs
83 ex2 ((Text s):xs) = s++ex2 xs
84 ex2 ((Link l d):xs) = "<link: "++l++" desc: "++d++">"++ex2 xs
87 test s = case parse wikiParser "" s of