summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs15
-rw-r--r--src/Pages.hs2
2 files changed, 12 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs
index cb4e1fb..78098af 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -140,10 +140,11 @@ pageCalendarDay conf index req alias datestr =
(Nothing, _) -> sendText404 "Channel not found"
(_, Nothing) -> sendText404 "Invalid date"
(Just chan, Just day) -> do
- let kind = case query req "ef" of
- Just "all" -> CKAll
- Just "compr" -> CKCompressed
- _ -> CKAll
+ let (kind, kindCookie) =
+ case query req "ef" <|> cookie req "ef" of -- event filter
+ Just "all" -> (CKAll, Just "ef=all; Path=/")
+ Just "compr" -> (CKCompressed, Just "ef=compr; Path=/")
+ _ -> (CKAll, Nothing)
events <- indexGetEventsDay index chan kind day
mpagehighlight <-
if | Just (TE.decodeASCII' -> Just eventID) <- query req "eid" -> do
@@ -155,11 +156,15 @@ pageCalendarDay conf index req alias datestr =
_ -> return Nothing
| otherwise -> return Nothing
- sendHtml200 $
+ let headers = [("Content-Type", "text/html")] ++
+ maybe [] (\s -> [("Set-Cookie", s)]) kindCookie
+ return $ responseBS status200 headers $
renderPageCalendarDay CalendarDayData
{ network = chanNetwork chan
, channel = chanChannel chan
, alias = alias
+ , efAll = kind == CKAll
+ , efCompr = kind == CKCompressed
, date = T.pack (ymdToString (dayToYMD day))
, events =
[EventData
diff --git a/src/Pages.hs b/src/Pages.hs
index 7b114a6..1a076ec 100644
--- a/src/Pages.hs
+++ b/src/Pages.hs
@@ -69,6 +69,8 @@ data CalendarDayData = CalendarDayData
{ network :: Text
, channel :: Text
, alias :: Text
+ , efAll :: Bool
+ , efCompr :: Bool
, date :: Text
, events :: [EventData Text ()]
}