X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=Main.hs;h=3fcb66788db970fcf0bc036539e124470858634e;hb=6bb9a6da06d8911d0fc2dd821705323fa3beb0dc;hp=eb1e82d7cdd1ef04a925e4b392220575199fa698;hpb=464842463236cab162bb4cffa8bebe8b42f3b3eb;p=yawbih.git diff --git a/Main.hs b/Main.hs index eb1e82d..3fcb667 100644 --- a/Main.hs +++ b/Main.hs @@ -6,6 +6,7 @@ import CGIOutput import CGITypes import System import Wiki +import Control.Monad import Text.ParserCombinators.Parsec @@ -65,17 +66,32 @@ parseText full = case parse wikiParser "" full of footer db key = do hr empty table $ tr $ do - td $ submitLink0 (editPage db key) (text "Edit this keyword") - td $ submitLink0 (listRevs db key) (text "List old versions") + td $ submitLink0 (showPage db "MainPage") (text "Back to main page") + when (e key) $ td $ submitLink0 (editPage db key) (text "Edit this keyword") + when (e key) $ td $ submitLink0 (listRevs db key) (text "List old versions") + td $ submitLink0 (listKeywords db) (text "List all keywords") td $ text "Keyword: " td $ activate (showPage db) textInputField empty +e "" = False +e _ = True + listRevs db key = do list <- io $ getList db key - standardQuery key $ table $ do - tr $ mapM (\header -> th (text header)) - ["Id", "Date", "Author", "Comment"] - mapM (revRow db key) list + standardQuery key $ do + table $ do + tr $ mapM (\header -> th (text header)) + ["Id", "Date", "Author", "Comment"] + mapM (revRow db key) list + footer db key + +listKeywords db = do + list <- io $ listKeys db + standardQuery "List of keywords" $ do + table (do + tr $ th (text "Keyword") + mapM (\key -> tr $ td $ linkKey db key) list) + footer db "" linkKey db key = submitLink0 (showPage db key) (text key)