X-Git-Url: https://ruin.nu/git/?p=yawbih.git;a=blobdiff_plain;f=Main.hs;h=418c16820b88fafff475bcc544eee02f227bcabd;hp=eb1e82d7cdd1ef04a925e4b392220575199fa698;hb=64b58e5b75b4c8e95574fa9080166f5cf1079005;hpb=464842463236cab162bb4cffa8bebe8b42f3b3eb diff --git a/Main.hs b/Main.hs index eb1e82d..418c168 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,11 +66,16 @@ 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 @@ -77,6 +83,14 @@ listRevs db key = do ["Id", "Date", "Author", "Comment"] mapM (revRow db key) list +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) revRow db key (id, date, author, comment) = tr $ do