[render1 thomashartman1@gmail.com**20081004103811] hunk ./src/Controller.hs 96 - paintVMenu . map (\c -> simpleLink (templates rglobs) ("/tutorial/viewprofile?user="++c,c) ) $ consultants + paintVHtml . map (\c -> simpleLink (templates rglobs) ("/tutorial/viewprofile?user="++c,c) ) $ consultants hunk ./src/Controller.hs 112 - paintVMenu . map (\c -> simpleLink (templates rglobs) ("/tutorial/viewprofile?user="++c,c) ) $ consultantswanted + paintVHtml . map (\c -> simpleLink (templates rglobs) ("/tutorial/viewprofile?user="++c,c) ) $ consultantswanted hunk ./src/Controller.hs 146 -staticfiles = [ fileservedir "templates" - , fileservedir "static" - , fileservedirWith (ifHaskellFile [withRequest colorize]) "src" +staticfiles = [ staticserve "static" + , browsedir "templates" + , browsedirWith (ifHaskellFile [withRequest colorize]) "src" hunk ./src/Controller.hs 151 -fileservedirWith sp d = multi [ +browsedirWith sp d = multi [ hunk ./src/Controller.hs 153 - , fileservedir d + , browsedir d hunk ./src/Controller.hs 156 -fileservedir :: String -> ServerPartT IO Response -fileservedir d = multi [ - dirlisting d - , dir d [ fileServe [] d ] - ] - - ---dirlisting :: String -> ServerPartT IO Response -dirlisting d = spsIf (dirmatch) $ [ ServerPartT $ \rq -> do - currDir <- liftIO $ getCurrentDirectory - fs <- liftIO $ getDirectoryContents currDir - return . toResponse . HtmlString . show $ fs - ] - where dirmatch :: Request -> Bool - dirmatch rq = ( pathstring $ rqPaths rq ) == d - hunk ./src/Controller.hs 157 - +browsedir :: String -> ServerPartT IO Response +browsedir d = multi [ + ServerPartT $ \rq -> do + let rqp = ( pathstring $ rqPaths rq ) + if (not $ isInfixOf d rqp) + then noHandle + else do + isDir <- liftIO $ doesDirectoryExist rqp + if isDir + then do + fs <- liftIO $ getDirectoryContents rqp + return . toResponse . HtmlString $ concatMap p fs + else do + isfile <- liftIO $ doesFileExist rqp + f <- liftIO $ readFile rqp + return . toResponse $ f + ] hunk ./src/Controller.hs 175 +staticserve d = dir d [ fileServe [] d ] hunk ./src/View.hs 91 -simpleLink templates (url,anchortext) = - renderTemplateGroup templates [("url",{-myUrlEncode-} url),("anchortext",anchortext)] "simplelink" +simpleLink templates (url,anchortext) = render1 [("url",url),("anchortext",anchortext)] "$anchortext$" hunk ./src/View.hs 93 +-- render1 . setManyAttrib [("url",url),("anchortext",anchortext)] . newSTMP $ "$anchortext$" +render1 attribs tmpl = render . setManyAttrib attribs . newSTMP $ tmpl + + hunk ./src/View.hs 98 - + + + +paintVHtml :: [String] -> String +paintVHtml = concatMap p +p s = render1 [("s",s)] "
$s$
" hunk ./src/View.hs 105 -paintVMenu = concatMap (\mi -> "" ++ mi ++ "
") addfile ./templates/debugging.st hunk ./templates/debugging.st 1 - +