From e526b2dcbcea1c30d2f0f8c198893078ba629def Mon Sep 17 00:00:00 2001 From: rich Date: Thu, 7 Dec 2006 17:16:17 +0000 Subject: [PATCH] Don't forget the date\! --- html/_css/rss.css | 6 +++++- scripts/lib/cocanwiki_func_rss.ml | 13 +++++++++---- templates/cocanwiki_func_rss.html | 4 +++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/html/_css/rss.css b/html/_css/rss.css index 796a7d1..b914fd8 100644 --- a/html/_css/rss.css +++ b/html/_css/rss.css @@ -1,5 +1,5 @@ /* RSS feeds ({{rss}} function). - * $Id: rss.css,v 1.1 2006/12/07 17:05:47 rich Exp $ + * $Id: rss.css,v 1.2 2006/12/07 17:16:17 rich Exp $ */ p.rss_description a { @@ -10,4 +10,8 @@ p.rss_description a { span.rss_item_description a { color: black; text-decoration: none; +} + +span.rss_item_date { + font-size: 75%; } \ No newline at end of file diff --git a/scripts/lib/cocanwiki_func_rss.ml b/scripts/lib/cocanwiki_func_rss.ml index 761c2c1..dafeba7 100644 --- a/scripts/lib/cocanwiki_func_rss.ml +++ b/scripts/lib/cocanwiki_func_rss.ml @@ -1,5 +1,5 @@ (* An RSS feed reader function. - * $Id: cocanwiki_func_rss.ml,v 1.1 2006/12/07 17:05:47 rich Exp $ + * $Id: cocanwiki_func_rss.ml,v 1.2 2006/12/07 17:16:17 rich Exp $ *) open Printf @@ -24,6 +24,7 @@ open Cocanwiki_template * description Blog description * items Items in the feed * item_title Title of items + * item_date Date and time of items * item_link Link to items * item_description Description of items * Default is everything. @@ -44,9 +45,10 @@ let refresh_re = Pcre.regexp "^(\\d+)(h|d)$" exception Error of string type show = Title | Link | Description - | Items | Item_title | Item_link | Item_description + | Items | Item_title | Item_date | Item_link | Item_description let default_show = [ Title; Link; Description; - Items; Item_title; Item_link; Item_description ] + Items; Item_title; Item_date; + Item_link; Item_description ] let event_system = Unixqueue.create_unix_event_system () let connection = @@ -85,7 +87,7 @@ let rss r dbh hostid arg = *) let rows = PGSQL(dbh) "select enable_rss_func from hosts where id = $hostid" in - if rows <> [Some true] then + if rows <> [true] then raise (Error "RSS is disabled on this host. You have to enable it manually by setting enable_rss_func for the relevant row in the hosts table. RSS introduces a potential security hole (cross-site scripting) and should not be used where you have untrusted editors or with untrusted RSS feeds."); let arg = match arg with @@ -155,6 +157,7 @@ let rss r dbh hostid arg = | "description" -> Description | "items" -> Items | "item_title" -> Item_title + | "item_date" -> Item_date | "item_link" -> Item_link | "item_description" -> Item_description | str -> @@ -170,6 +173,7 @@ let rss r dbh hostid arg = template#conditional "show_description" false; template#conditional "show_items" false; template#conditional "show_item_title" false; + template#conditional "show_item_date" false; template#conditional "show_item_link" false; template#conditional "show_item_description" false; List.iter ( @@ -179,6 +183,7 @@ let rss r dbh hostid arg = | Description -> template#conditional "show_description" true | Items -> template#conditional "show_items" true | Item_title -> template#conditional "show_item_title" true + | Item_date -> template#conditional "show_item_date" true | Item_link -> template#conditional "show_item_link" true | Item_description -> template#conditional "show_item_description" true ) show; diff --git a/templates/cocanwiki_func_rss.html b/templates/cocanwiki_func_rss.html index 32c485d..1ab2452 100644 --- a/templates/cocanwiki_func_rss.html +++ b/templates/cocanwiki_func_rss.html @@ -16,7 +16,9 @@
  • ::if(show_item_title):: ::if(show_item_link)::::end::::title::::if(show_item_link)::::end:: - ::end::
    + ::end:: + ::date_html:: +
    ::if(show_item_description):: ::if(show_item_link)::::end::::description::::if(show_item_link)::::end:: -- 1.8.3.1