diff options
author | Vincent Ambo <v.ambo@me.com> | 2012-03-14T00·36+0100 |
---|---|---|
committer | Vincent Ambo <v.ambo@me.com> | 2012-03-14T00·36+0100 |
commit | 47e1be1f7852c141f604c36199dd767d3a5c3d86 (patch) | |
tree | 4262ce50e9e19cccdb26e3bbcedc8cb0259aab55 /src/Main.hs | |
parent | 36c4d7e84e1b2e18389eeda66c33d25fc7819f15 (diff) |
* fixed entry-adding
* temporarily removed adminHandler and merged it into tazBlog :: ServerPart Response
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/Main.hs b/src/Main.hs index 43faeac93f5c..b05599de588a 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -54,13 +54,29 @@ tazBlog acid = , path $ \(year :: Int) -> path $ \(month :: Int) -> path $ \(id_ :: String) -> formatOldLink year month id_ , dir "res" $ serveDirectory DisableBrowsing [] "../res" , dir "notice" $ ok $ toResponse showSiteNotice - , do dir "admin" $ guardSession acid - adminHandler acid + , do dirs "admin/postentry" $ nullDir + guardSession acid + postEntry acid + , do dir "admin" $ nullDir + guardSession acid + ok $ toResponse $ adminIndex ("tazjin" :: Text) , dir "admin" $ ok $ toResponse $ adminLogin , dir "dologin" $ processLogin acid , serveDirectory DisableBrowsing [] "../res" ] +{- +adminHandler :: AcidState Blog -> ServerPart Response +adminHandler acid = + msum [ dir "postentry" $ postEntry acid + , dir "entrylist" $ dir (show DE) $ entryList DE + , dir "entrylist" $ dir (show EN) $ entryList EN + , dir "edit" $ path $ \(eId :: Integer) -> editEntry eId + , dir "doedit" $ updateEntry + , ok $ toResponse $ adminIndex ("tazjin" :: Text) --User NYI + ] +-} + blogHandler :: AcidState Blog -> BlogLang -> ServerPart Response blogHandler acid lang = msum [ path $ \(eId :: Integer) -> showEntry acid lang $ EntryId eId @@ -110,23 +126,13 @@ addComment acid lang eId = do {- ADMIN stuff -} -adminHandler :: AcidState Blog -> ServerPart Response -adminHandler acid = - msum [ dir "postentry" $ postEntry acid - , dir "entrylist" $ dir (show DE) $ entryList DE - , dir "entrylist" $ dir (show EN) $ entryList EN - , dir "edit" $ path $ \(eId :: Integer) -> editEntry eId - , dir "doedit" $ updateEntry - , ok $ toResponse $ adminIndex ("tazjin" :: Text) --User NYI - ] updateEntry :: ServerPart Response updateEntry = undefined postEntry :: AcidState Blog -> ServerPart Response postEntry acid = do - liftIO $ putStrLn "postEntry called" - --decodeBody tmpPolicy + decodeBody tmpPolicy now <- liftIO $ getCurrentTime let eId = timeToId now lang <- lookText' "lang" |