From 7ef3a34598e4f7b50b3ee1a8c34bbdf11c9352f6 Mon Sep 17 00:00:00 2001 From: rich Date: Sat, 9 Oct 2004 08:33:02 +0000 Subject: [PATCH] Daily view. --- html/_css/standard.css | 29 ++++++++++++++++++++++++++++- scripts/cocanwiki_ext_calendar.ml | 34 +++++++++++++++++++++++++--------- templates/calendar_day.html | 19 +++++++++++++++++++ 3 files changed, 72 insertions(+), 10 deletions(-) diff --git a/html/_css/standard.css b/html/_css/standard.css index 488f816..3ac7ab9 100644 --- a/html/_css/standard.css +++ b/html/_css/standard.css @@ -1,5 +1,5 @@ /* Stylesheet for COCANWIKI. - * $Id: standard.css,v 1.10 2004/10/09 08:19:42 rich Exp $ + * $Id: standard.css,v 1.11 2004/10/09 08:33:02 rich Exp $ */ body { @@ -413,3 +413,30 @@ table.cal_year td.cal_year_events li { display: inline; margin-right: 2em; } + +table.cal_day { + border-collapse: collapse; + border: 1px solid #eee; + width: 90%; + margin-left: 5%; + margin-right: 5%; +} + +table.cal_day ul { + list-style: none; + padding: 0px; + margin: 0px; +} + +table.cal_day li { + display: inline; + margin-right: 2em; +} + +table.cal_day a.cal_day_left { + margin-right: 2em; +} + +table.cal_day a.cal_day_right { + margin-left: 2em; +} 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 diff --git a/templates/calendar_day.html b/templates/calendar_day.html index e69de29..9036945 100644 --- a/templates/calendar_day.html +++ b/templates/calendar_day.html @@ -0,0 +1,19 @@ + + + + + + + +
+<< +::short_weekday:: +::dd:: +::month_name_html:: +::yyyy:: +>> +
+ +
\ No newline at end of file -- 1.8.3.1