Simple implementation of page bugs.
authorrich <rich>
Wed, 16 Nov 2005 17:30:33 +0000 (17:30 +0000)
committerrich <rich>
Wed, 16 Nov 2005 17:30:33 +0000 (17:30 +0000)
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.

scripts/edit_host_settings.ml
scripts/lib/cocanwiki_template.ml
templates/edit_host_settings_form.html
templates/host_menu.html
templates/page.html

index b9cd2c1..2bb8a01 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: 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 ();
index a90b614..9b562a8 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_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
index 217da6f..0a3735b 100644 (file)
 </td>
 </tr>
 <tr>
+  <th> Page bug: </th>
+  <td>
+    <textarea name="pagebug" cols="70" rows="10">::pagebug_html_textarea::</textarea>
+  </td>
+</tr>
+<tr>
 <td></td>
 <td>
 <input type="submit" name="update" value="   Update global settings   "/>
index 322dda0..36ac6bc 100644 (file)
   ::end::
 </td>
 </tr>
+<tr>
+<th> Page bug: </th>
+<td>
+  ::if(has_pagebug)::
+<pre>
+::pagebug_html::
+</pre>
+  ::end::
+</td>
+</tr>
 </table>
 
 <p>
index 7f1a340..123a401 100644 (file)
 </div>
 ::end::
 
+::if(has_pagebug)::::pagebug::::end::
+
 <div id="footer_div">
 <hr/>