X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Fcocanwiki_ext_calendar.ml;h=c1df9f92309febf473710d2bd1737ab515705901;hb=6eacefcb7258db7b56fe796af84961cafac90eac;hp=e4e25065ab618cc00815075fa569565227b559ea;hpb=222362cfc31cfff96b41d8840feec190baf36075;p=cocanwiki.git diff --git a/scripts/cocanwiki_ext_calendar.ml b/scripts/cocanwiki_ext_calendar.ml index e4e2506..c1df9f9 100644 --- a/scripts/cocanwiki_ext_calendar.ml +++ b/scripts/cocanwiki_ext_calendar.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: cocanwiki_ext_calendar.ml,v 1.2 2004/10/07 18:56:53 rich Exp $ + * $Id: cocanwiki_ext_calendar.ml,v 1.3 2004/10/09 08:33:02 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -232,20 +232,36 @@ let extension (dbh : Dbi.connection) hostid url = template#to_string - | Some (yyyy, mm, dd) -> (* Single day view. *) + | Some ((yyyy, mm, dd) as date) -> (* Single day view. *) let template = day_template in - failwith "not impl"; - - - - - - + (* XXX This will change once we start doing date and time events. + * For now it is very simple indeed. + *) + template#set "yyyy" (string_of_int yyyy); + template#set "mm" (sprintf "%02d" mm); + template#set "dd" (sprintf "%02d" dd); + template#set "month_name" (long_month mm); + let dow = GregorianDate.day_of_week date in + template#set "short_weekday" (short_weekday dow); + let prev_yyyy, prev_mm, prev_dd = + GregorianDate.add_delta_days date (-1) in + let next_yyyy, next_mm, next_dd = + GregorianDate.add_delta_days date 1 in + template#set "prev_yyyy" (string_of_int prev_yyyy); + template#set "prev_mm" (sprintf "%02d" prev_mm); + template#set "prev_dd" (sprintf "%02d" prev_dd); + template#set "next_yyyy" (string_of_int next_yyyy); + template#set "next_mm" (sprintf "%02d" next_mm); + template#set "next_dd" (sprintf "%02d" next_dd); + let table = List.map (fun (_, (title, page)) -> + [ "title", Template.VarString title; + "page", Template.VarString page ]) pages in + template#table "events" table; template#to_string