{-# LANGUAGE FlexibleContexts, OverloadedStrings, QuasiQuotes #-} module Clckwrks.Admin.Template where import Control.Applicative ((<$>)) import Control.Monad.Trans (lift) import Clckwrks.Acid (GetSiteName(..)) import Clckwrks.Monad (ClckT(..), ClckState(adminMenus), plugins, query) import Clckwrks.URL (ClckURL(JS)) import Clckwrks.JS.URL (JSURL(..)) import {-# SOURCE #-} Clckwrks.Authenticate.Plugin (authenticatePlugin) import Clckwrks.Authenticate.URL (AuthURL(Auth)) import Clckwrks.ProfileData.API (getUserRoles) import Clckwrks.ProfileData.Types (Role) import Control.Monad.State (get) import Data.Maybe (mapMaybe, fromMaybe) import Data.Text.Lazy (Text) import qualified Data.Text as T import Data.Set (Set) import qualified Data.Set as Set import Happstack.Authenticate.Core (AuthenticateURL(Controllers)) import Happstack.Server (Happstack, Response, toResponse) import HSP.XMLGenerator import HSP.XML (XML, fromStringLit) import Language.Haskell.HSX.QQ (hsx) import Web.Plugins.Core (pluginName, getPluginRouteFn) template :: ( Happstack m , EmbedAsChild (ClckT url m) headers , EmbedAsChild (ClckT url m) body ) => String -> headers -> body -> ClckT url m Response template title headers body = do siteName <- (fromMaybe "Your Site") <$> query GetSiteName p <- plugins <$> get ~(Just authShowURL) <- getPluginRouteFn p (pluginName authenticatePlugin) ~(Just clckShowURL) <- getPluginRouteFn p "clck" -- let passwordShowURL u = authShowURL (Auth (AuthenticationMethods $ Just (passwordAuthenticationMethod, toPathSegments u))) [] toResponse <$> (unXMLGenT $ [hsx|
-- --