[working on table pagination, notes on windows install, table header thomashartman1@gmail.com**20080919101354] hunk ./src/Controller.hs 45 + --, exactdir "/tutorial/jobs" viewJobs + + --,pathPartsSp ["tutorial","jobs"] $ withData viewJobs hunk ./src/Controller.hs 50 - lastPathPartSp (\rq tmpl -> ( tutlayoutReq rq []) tmpl ) -- tutlayoutSp [] + lastPathPartSp0 (\rq tmpl -> ( tutlayoutReq rq []) tmpl ) hunk ./src/Controller.hs 75 -viewJobs = [ ServerPartT $ \rq -> do +viewJobs {- (TablePagination currpage resperpage) -} = + [ ServerPartT $ \rq -> do hunk ./src/Controller.hs 88 + ++ map (\num -> ( ("job" ++ (show num)), Just "$0") ) [1..2000] hunk ./src/Controller.hs 90 - jobTable = paintTable jobCells + jobTable = paintTable (Just ["project","budget"]) jobCells + lift . putStrLn . show . rqInputs $ rq hunk ./src/Controller.hs 95 + hunk ./src/Controller.hs 137 - basedomain <- return . (\(h,p) -> "http://" ++ h ++ (if p==80 then "" else ":" ++ (show p))) . rqPeer $ rq + + + -- THIS BREAKS ONLINE. AND DOESN'T EVEN FIX LOCAL! FIX ME. + let basedomain = "http://localhost:5001" + + --basedomain <- return . (\(h,p) -> "http://" ++ h ++ (if p==80 then "" else ":" ++ (show p))) . rqPeer $ rq hunk ./src/Misc.hs 88 - + +pathPartsSp pps f = ServerPartT $ \rq -> + if rqPaths rq == pps + then f rq + else noHandle hunk ./src/Misc.hs 96 -lastPathPartSp f = ServerPartT $ \rq -> +lastPathPartSp0 f = ServerPartT $ \rq -> hunk ./src/Misc.hs 101 +{- hunk ./src/Misc.hs 106 +-} hunk ./src/Model.hs 16 -data ChangeUserInfo = ChangeUserInfo String String String + hunk ./src/Model.hs 27 +data ChangeUserInfo = ChangeUserInfo String String String hunk ./src/Model.hs 29 - fromData = liftM3 ChangeUserInfo (look "oldpass" `mplus` return "no old password") + fromData = liftM3 ChangeUserInfo ( (look "oldpass") `mplus` (return "no old password") ) hunk ./src/Model.hs 33 + +data TablePagination = TablePagination { currentPage ::Int, + resultsPerPage :: Int } +instance FromData TablePagination where + fromData = liftM2 TablePagination ( return . read =<< look "pagp" `mplus` return "1" ) + ( return . read =<< look "rsperpage" `mplus` return "10" ) + + hunk ./src/View.hs 84 -paintTable :: [[String]] -> String -paintTable cells = table . concat . map (tr . concat) . ( (map . map) td ) $ cells +paintTable :: Maybe [String] -> [[String]] -> String +paintTable mbHeaderCells tablecells = table trows + where trows = maybe rows ( (++rows) . paintHeaderTr) mbHeaderCells + rows = paintTrs $ tablecells + hunk ./src/View.hs 90 +paintHeaderTr hc = tr . concat . (map (td {-. biggerfont -} ) ) $ hc +paintTrs cells = concat . map (tr . concat) . ( (map . map) td ) $ cells + +biggerfont x = "" ++ x ++ "" hunk ./templates/menubar.st 17 -
div 1 |
+ div 2 |
+