Daily view.
authorrich <rich>
Sat, 9 Oct 2004 08:33:02 +0000 (08:33 +0000)
committerrich <rich>
Sat, 9 Oct 2004 08:33:02 +0000 (08:33 +0000)
html/_css/standard.css
scripts/cocanwiki_ext_calendar.ml
templates/calendar_day.html

index 488f816..3ac7ab9 100644 (file)
@@ -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;
+}
index e4e2506..c1df9f9 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * 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
 
index e69de29..9036945 100644 (file)
@@ -0,0 +1,19 @@
+<table class="cal_day">
+<tr>
+<th>
+<a href="/::prev_yyyy::/::prev_mm::/::prev_dd::" class="cal_day_left" title="Previous day">&lt;&lt;</a>
+::short_weekday::
+::dd::
+<a href="/::yyyy::/::mm::">::month_name_html::</a>
+<a href="/::yyyy::">::yyyy::</a>
+<a href="/::next_yyyy::/::next_mm::/::next_dd::" class="cal_day_right" title="Next day">&gt;&gt;</a>
+</th>
+</tr>
+<tr>
+<td>
+<ul>
+::table(events)::<li><a href="/::page::">::title_html::</a></li>::end::
+</ul>
+</td>
+</tr>
+</table>
\ No newline at end of file