 | gitit-0.6.5: Wiki using happstack, git or darcs, and pandoc. | Contents | Index |
|
|
|
|
|
| Description |
| Useful functions for defining wiki handlers.
|
|
| Synopsis |
|
|
|
|
| Combinators for dealing with users
|
|
| withUserFromSession :: Handler -> Handler |
| Run the handler after setting REMOTE_USER with the user from
the session.
|
|
| withUserFromHTTPAuth :: Handler -> Handler |
| Run the handler after setting REMOTE_USER from the authorization
header. Works with simple HTTP authentication or digest authentication.
|
|
| requireUserThat :: (User -> Bool) -> Handler -> Handler |
| Run the handler if a user satisfying the predicate is logged in.
Redirect to login if nobody logged in; raise error if someone is
logged in but doesn't satisfy the predicate.
|
|
| requireUser :: Handler -> Handler |
| Run the handler if a user is logged in, otherwise redirect
to login page.
|
|
| getLoggedInUser :: GititServerPart (Maybe User) |
| Returns Just logged in user or Nothing.
|
|
| sessionTime :: Int |
|
| Combinators to exclude certain actions
|
|
| unlessNoEdit :: Handler -> Handler -> Handler |
| unlessNoEdit responder fallback runs responder unless the
page has been designated not editable in configuration; in that
case, runs fallback.
|
|
| unlessNoDelete :: Handler -> Handler -> Handler |
| unlessNoDelete responder fallback runs responder unless the
page has been designated not deletable in configuration; in that
case, runs fallback.
|
|
| Guards for routing
|
|
| guardCommand :: String -> GititServerPart () |
|
| guardPath :: (String -> Bool) -> GititServerPart () |
|
| guardIndex :: GititServerPart () |
| Succeeds if path is an index path: e.g. /foo/bar/.
|
|
| guardBareBase :: GititServerPart () |
|
| Functions to get info from the request
|
|
| getPath :: ServerMonad m => m String |
| Returns the current path (subtracting initial commands like /_edit).
|
|
| getPage :: GititServerPart String |
| Returns the current page name (derived from the path).
|
|
| getReferer :: ServerMonad m => m String |
| Returns the contents of the referer header.
|
|
| getWikiBase :: ServerMonad m => m String |
| Returns the base URL of the wiki in the happstack server.
So, if the wiki handlers are behind a dir foo, getWikiBase will
return /foo/. getWikiBase doesn't know anything about HTTP
proxies, so if you use proxies to map a gitit wiki to /foo/,
you'll still need to follow the instructions in README.
|
|
| uriPath :: String -> String |
| Returns path portion of URI, without initial /.
Consecutive spaces are collapsed. We don't want to distinguish
Hi There and Hi There.
|
|
| Useful predicates
|
|
| isPage :: String -> Bool |
|
| isPageFile :: FilePath -> Bool |
|
| isDiscussPage :: String -> Bool |
|
| isDiscussPageFile :: FilePath -> Bool |
|
| isSourceCode :: String -> Bool |
|
| Combinators that change the request locally
|
|
| withMessages :: ServerMonad m => [String] -> m a -> m a |
| Runs a server monad in a local context after setting
the messages request header.
|
|
| withInput :: ServerMonad m => String -> String -> m a -> m a |
| Runs a server monad in a local context after setting
request header.
|
|
| Miscellaneous
|
|
| urlForPage :: String -> String |
| Returns encoded URL path for the page with the given name, relative to
the wiki base.
|
|
| pathForPage :: String -> FilePath |
| Returns the filestore path of the file containing the page's source.
|
|
| getMimeTypeForExtension :: String -> GititServerPart String |
| Retrieves a mime type based on file extension.
|
|
| validate |
| :: [(Bool, String)] | list of conditions and error messages
| | -> [String] | list of error messages
| | Simple helper for validation of forms.
|
|
|
| filestoreFromConfig :: Config -> FileStore |
| Returns a filestore object derived from the
repository path and filestore type specified in configuration.
|
|
| Produced by Haddock version 2.3.0 |