----------------------------------------------------------------------------- -- -- Module : MFlow.Wai.Blaze.Html.All -- Copyright : -- License : BSD3 -- -- Maintainer : agocorona@gmail.com -- Stability : experimental -- Portability : -- -- | -- ----------------------------------------------------------------------------- module MFlow.Wai.Blaze.Html.All ( module Data.TCache ,module MFlow ,module MFlow.Wai ,module MFlow.Forms ,module MFlow.Forms.Widgets ,module MFlow.Forms.Blaze.Html ,module MFlow.Forms.Admin ,module Network.Wai ,module Network.Wai.Handler.Warp ,module Control.Applicative --,module Text.Blaze.Internal ,module Text.Blaze.Html5 ,module Text.Blaze.Html5.Attributes ,module Control.Monad.IO.Class ,runNavigation ) where import MFlow import MFlow.Wai import MFlow.Forms import MFlow.Forms.Widgets import MFlow.Forms.XHtml import MFlow.Forms.Admin import MFlow.Forms.Blaze.Html import Text.Blaze.Html5 hiding (map) import Text.Blaze.Html5.Attributes hiding (label,span,style,cite,title,summary,step,form) import Network.Wai import Network.Wai.Handler.Warp import Data.TCache import Text.Blaze.Internal(text) import Control.Workflow (Workflow, unsafeIOtoWF) import Control.Applicative import Control.Monad.IO.Class import System.Environment import Data.Maybe(fromMaybe) import Data.Char(isNumber) ---- | run a transient flow (see 'transient'). The port is read from the first exectution parameter ---- if no parameter, it is read from the PORT environment variable. ---- if this does not exist, the port 80 is used. --runServerTransient :: FormInput view => FlowM view IO () -> IO Bool --runServerTransient f= do -- addMessageFlows[("", transient $ runFlow f)] -- porti <- getPort -- wait $ run porti waiMessageFlow -- ---- | a more grandiloquent name for runServerTransient ---- ---- > runNavigation= runServerTransient --runNavigation :: FormInput view => FlowM view IO () -> IO Bool --runNavigation= runServerTransient -- The port is read from the first exectution parameter -- if no parameter, it is read from the PORT environment variable. -- if this does not exist, the port 80 is used. getPort= do args <- getArgs port <- case args of port:xs -> return port _ -> do env <- getEnvironment return $ fromMaybe "80" $ lookup "PORT" env let porti= if and $ map isNumber port then fromIntegral $ read port else 80 putStr "using port " print porti return porti -- | run a persistent flow. The port is read from the first exectution parameter -- if no parameter, it is read from the PORT environment variable. -- if this does not exist, the port 80 is used. runNavigation :: String -> FlowM Html (Workflow IO) () -> IO Bool runNavigation n f= do addMessageFlows[(n, runFlow f)] porti <- getPort wait $ run porti waiMessageFlow ---- | a more grandiloquent synonym of runServerTransient ---- ---- > runPersNavigation= runServer --runPersistentNavigation :: FormInput view => FlowM view (Workflow IO) () -> IO Bool --runPersistentNavigation= runServer