forked from alsonkemp/turbinado
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checking in all of the Environment + Website changes
- Loading branch information
alson
committed
Nov 25, 2008
1 parent
a9327b2
commit c59c8d3
Showing
29 changed files
with
516 additions
and
752 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,58 @@ | ||
import Control.Monad.Trans | ||
import Data.List | ||
import Data.Maybe | ||
import qualified Network.HTTP as HTTP | ||
import qualified Network.URI as URI | ||
|
||
page :: View XML | ||
page = <html> | ||
<head> | ||
<% styleSheet "normalize" "screen" %> | ||
<% styleSheet "jsddm" "screen" %> | ||
<% styleSheet "pressurized" "screen" %> | ||
<% styleSheet "turbinado" "screen" %> | ||
<% javaScript "jquery" %> | ||
<% javaScript "jsddm" %> | ||
<script type="text/javascript"> | ||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
</script> | ||
<script type="text/javascript"> | ||
var pageTracker = _gat._getTracker("UA-6158816-1"); | ||
pageTracker._trackViewview(); | ||
</script> | ||
<% googleAnalytics "UA-6158816-1" %> | ||
</head> | ||
<body> | ||
<table class="wrapper"> | ||
<tr> | ||
<td class="title"> | ||
<h1>Turbinado</h1> | ||
<img class="title-image" src="/images/turbinado.jpg" /> | ||
<h2>Sugar For</h2> | ||
<h2>The Web</h2> | ||
</td> | ||
<td class="container"> | ||
<ul id="jsddm"> | ||
<li><a href="/Home/Index">Home</a> | ||
<ul> | ||
<li><a href="/Home/About">About</a></li> | ||
<li><a href="/Home/Performance">Performance</a></li> | ||
</ul> | ||
</li> | ||
<li><a href="/Tutorial/Index">Tutorial</a> | ||
</li> | ||
<li><a href="/Develop/Index">Develop</a></li> | ||
</ul> | ||
<div class="clear"></div> | ||
<% breadCrumbs %> | ||
<div id="content-block" class="content-block"> | ||
<% insertView %> | ||
</div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"> | ||
<div class="footer">Turbinado - www.turbinado.org</div> | ||
</td> | ||
</tr> | ||
</table> | ||
<div id="wrapper"> | ||
<div id="header"> | ||
<div id="logo"> | ||
<h1> | ||
<a href="http://www.turbinado.org"> | ||
<img src="/images/turbinado.jpg" /> | ||
<span style="left:140px; position:absolute; top:65px;"> | ||
Turbinado | ||
</span> | ||
</a> | ||
</h1> | ||
</div> | ||
</div> | ||
<div id="menu"> | ||
<ul> | ||
<% menuItem "/Home/Index" "Home" %> | ||
<% menuItem "/Home/About" "About" %> | ||
<% menuItem "/Home/Performance" "Performance" %> | ||
<% menuItem "/Tutorial/Index" "Tutorial" %> | ||
<% menuItem "/Develop/Index" "Develop" %> | ||
</ul> | ||
</div> | ||
<div id="page"> | ||
<div id="content"> | ||
<% insertView %> | ||
</div> | ||
</div> | ||
<div style="clear: both;" /> | ||
</div> | ||
<div id="footer"> | ||
<p>Copyright (c) 2008 Turbinado.org. All rights reserved.</p> | ||
<p>Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p> | ||
</div> | ||
</body> | ||
</html> | ||
|
||
menuItem :: FilePath -> String -> View XML | ||
menuItem p t = do e <- getEnvironment | ||
let ru = HTTP.rqURI $ fromJust $ getRequest e | ||
active = if isPrefixOf p (URI.uriPath ru) then "active" else "" | ||
<li class=active><a href=p><%t%></a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
module Config.Routes where | ||
|
||
routes = [ "/:controller/:action.:format" | ||
routes = [ "/:controller/:action/:id" | ||
, "/:controller/:action.:format" | ||
, "/:controller/:action" | ||
, "/:controller" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,77 @@ | ||
module Turbinado.Controller ( | ||
getEnvironment, | ||
evalController, | ||
-- limited export from Turbinado.Controller.Monad | ||
Controller, | ||
runController, | ||
get, put, | ||
-- * Functions | ||
doIO, catch, | ||
|
||
module Turbinado.Environment, | ||
redirectTo, | ||
-- * Database | ||
quickQuery, | ||
quickQuery', | ||
run, | ||
HDBC.SqlValue(..), | ||
HDBC.SqlType(..), | ||
|
||
module Data.Maybe, | ||
|
||
module Turbinado.Environment.CodeStore, | ||
module Turbinado.Environment.Logger, | ||
module Turbinado.Environment.Request, | ||
module Turbinado.Environment.Response, | ||
module Turbinado.Environment.Settings | ||
module Turbinado.Environment.Settings, | ||
module Turbinado.Environment.Types, | ||
module Turbinado.Environment.ViewData | ||
) where | ||
|
||
import Control.Exception (catchDyn) | ||
import Control.Monad | ||
import Control.Monad.State | ||
import Control.Monad.Trans (MonadIO(..)) | ||
import Data.Maybe | ||
import qualified Network.HTTP as HTTP | ||
import Prelude hiding (catch) | ||
import qualified Database.HDBC as HDBC | ||
|
||
import Turbinado.Environment | ||
import Turbinado.Environment.Database | ||
import Turbinado.Environment.Logger | ||
import Turbinado.Environment.Request | ||
import Turbinado.Environment.Response | ||
import Turbinado.Environment.Settings | ||
import Turbinado.Environment.Types | ||
import Turbinado.Environment.ViewData | ||
import Turbinado.Controller.Monad | ||
import Turbinado.Environment.CodeStore | ||
import Turbinado.Utility.General | ||
import Turbinado.Server.StandardResponse | ||
|
||
-- evalController :: Controller () -> Environment -> IO Environment | ||
-- evalController p = runController p e | ||
|
||
evalController :: Controller () -> EnvironmentFilter | ||
evalController p e = runController p e | ||
-- | ||
-- * Helper functions | ||
-- | ||
|
||
redirectTo :: String -> Controller () | ||
redirectTo l = redirectResponse l | ||
|
||
-- | ||
-- * Environment functions | ||
-- * Database functions | ||
-- | ||
|
||
getEnvironment :: Controller Environment | ||
getEnvironment = get | ||
quickQuery :: String -> [HDBC.SqlValue] -> Controller [[HDBC.SqlValue]] | ||
quickQuery s vs = do e <- get | ||
let c = fromJust $ getDatabase e | ||
doIO $ HDBC.handleSqlError $ HDBC.quickQuery c s vs | ||
|
||
quickQuery' :: String -> [HDBC.SqlValue] -> Controller [[HDBC.SqlValue]] | ||
quickQuery' s vs = do e <- get | ||
let c = fromJust $ getDatabase e | ||
doIO $ HDBC.handleSqlError $ HDBC.quickQuery' c s vs | ||
|
||
run :: String -> [HDBC.SqlValue] -> Controller Integer | ||
run s vs = do e <- get | ||
let c = fromJust $ getDatabase e | ||
doIO $ HDBC.handleSqlError $ HDBC.run c s vs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.