]> ruin.nu Git - yawbih.git/blobdiff - Main.hs
Stripping \ from the keyword
[yawbih.git] / Main.hs
diff --git a/Main.hs b/Main.hs
index ea9316b3f68dedc03091d24ce365ea1766cc0fc9..c8d5524c32af97a80f24876fc408de25e029f950 100644 (file)
--- a/Main.hs
+++ b/Main.hs
@@ -15,7 +15,7 @@ testDB = createPGB "wave" "wiki" "wiki" "12wiki34db"
 
 main = do 
        db <- testDB
-       runWithHook [] (\(key:act) -> showPage db key) $ showPage db "MainPage"
+       runWithHook [] (\(key:act) -> showPage db (filter (/= '\\') key)) $ showPage db "MainPage"
 
 ps a = standardQuery "Hello" a
 
@@ -65,7 +65,7 @@ parseText full = case parse wikiParser "" full of
 footer db key = do
        hr empty
        table $ tr $ do
-               td $ submitLink0 (editPage db key) (text "Edit this page")
+               td $ submitLink0 (editPage db key) (text "Edit this keyword")
                td $ submitLink0 (listRevs db key) (text "List old versions")
                td $ text "Keyword: " 
                td $ activate (showPage db) textInputField empty
@@ -91,8 +91,16 @@ showRev db key id = do
                case s of 
                        Nothing -> text "No such revision"
                        Just s -> parseText s
+               p empty
+               submitLink0 (changeCurrent db key id) (text "Set this version as the current one")
                footer db key
-
+changeCurrent db key id = do
+       b <- io $ setCurrent db key id
+       if b then showPage db key
+               else standardQuery key $ do
+                       text "Could not set this revision as the current active one."
+                       p empty
+                       linkKey db key
        
 ex [] = return ()
 ex ((Paragraph):xs) = do