From: rich Date: Wed, 16 Nov 2005 17:30:33 +0000 (+0000) Subject: Simple implementation of page bugs. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=73768bf884eee241d3cb061d07f2de7e1818bc68;p=cocanwiki.git Simple implementation of page bugs. Nothing fancy at the moment - for example no sort of templating or page-specific bugs, which you'd need to implement Nedstat tracking. However this implementation will work fine for Urchin. --- diff --git a/scripts/edit_host_settings.ml b/scripts/edit_host_settings.ml index b9cd2c1..2bb8a01 100644 --- a/scripts/edit_host_settings.ml +++ b/scripts/edit_host_settings.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: edit_host_settings.ml,v 1.7 2004/11/03 13:36:45 rich Exp $ + * $Id: edit_host_settings.ml,v 1.8 2005/11/16 17:30:33 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 @@ -48,6 +48,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = let brand = trim (q#param "brand") in let brand_tagline = trim (q#param "brand_tagline") in let brand_description = trim (q#param "brand_description") in + let pagebug = trim (q#param "pagebug") in let theme_css = if theme_css = "" then `Null else `String theme_css in let feedback_email = @@ -57,6 +58,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = if brand_tagline = "" then `Null else `String brand_tagline in let brand_description = if brand_description = "" then `Null else `String brand_description in + let pagebug = + if pagebug = "" then `Null else `String pagebug in (* Update the database. *) let sth = dbh#prepare_cached "update hosts set edit_anon = ?, @@ -65,12 +68,14 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } _ = search_box = ?, navigation = ?, view_anon = ?, brand = ?, brand_tagline = ?, - brand_description = ? + brand_description = ?, + pagebug = ? where id = ?" in sth#execute [`Bool edit_anon; `Bool create_account_anon; theme_css; feedback_email; `Bool mailing_list; `Bool search_box; `Bool navigation; `Bool view_anon; brand; brand_tagline; brand_description; + pagebug; `Int hostid]; dbh#commit (); diff --git a/scripts/lib/cocanwiki_template.ml b/scripts/lib/cocanwiki_template.ml index a90b614..9b562a8 100644 --- a/scripts/lib/cocanwiki_template.ml +++ b/scripts/lib/cocanwiki_template.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_template.ml,v 1.3 2004/11/03 13:36:45 rich Exp $ + * $Id: cocanwiki_template.ml,v 1.4 2005/11/16 17:30:34 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 @@ -84,15 +84,16 @@ let get_template ?page (dbh : Dbi.connection) hostid filename = let sth = dbh#prepare_cached "select h.theme_css, p.name, p.url, h.search_box, - h.brand, h.brand_tagline, h.brand_description + h.brand, h.brand_tagline, h.brand_description, + h.pagebug from hosts h left outer join powered_by p on h.powered_by = p.id where h.id = ?" in sth#execute [`Int hostid]; let theme_css, powered_by_name, powered_by_url, search_box, - brand, brand_tagline, brand_description = + brand, brand_tagline, brand_description, pagebug = match sth#fetch1 () with - | [ a; b; c; d; e; f; g] -> a, b, c, d, e, f, g + | [ a; b; c; d; e; f; g; h] -> a, b, c, d, e, f, g, h | _ -> assert false in let theme_css = @@ -134,6 +135,12 @@ let get_template ?page (dbh : Dbi.connection) hostid filename = has_brand_description, brand_description | _ -> assert false in + let has_pagebug, pagebug = + match pagebug with + | `Null -> false, "" + | `String pagebug -> true, pagebug + | _ -> assert false in + template#set "theme_css" theme_css; template#set "powered_by_name" powered_by_name; template#set "powered_by_url" powered_by_url; @@ -144,6 +151,8 @@ let get_template ?page (dbh : Dbi.connection) hostid filename = template#set "brand_tagline" brand_tagline; template#conditional "has_brand_description" has_brand_description; template#set "brand_description" brand_description; + template#conditional "has_pagebug" has_pagebug; + template#set "pagebug" pagebug; (* Site menu. *) let sth = dbh#prepare_cached "select url, label, ordering from sitemenu diff --git a/templates/edit_host_settings_form.html b/templates/edit_host_settings_form.html index 217da6f..0a3735b 100644 --- a/templates/edit_host_settings_form.html +++ b/templates/edit_host_settings_form.html @@ -78,6 +78,12 @@ + Page bug: + + + + + diff --git a/templates/host_menu.html b/templates/host_menu.html index 322dda0..36ac6bc 100644 --- a/templates/host_menu.html +++ b/templates/host_menu.html @@ -104,6 +104,16 @@ ::end:: + + Page bug: + + ::if(has_pagebug):: +
+::pagebug_html::
+
+ ::end:: + +

diff --git a/templates/page.html b/templates/page.html index 7f1a340..123a401 100644 --- a/templates/page.html +++ b/templates/page.html @@ -117,6 +117,8 @@ ::end:: +::if(has_pagebug)::::pagebug::::end:: +