in the database to activate it for a particular site.
scripts/restore_form.ml
scripts/rss.ml
scripts/search.ml
+scripts/send_feedback.ml
+scripts/send_feedback_form.ml
scripts/signup.ml
scripts/sitemap.ml
scripts/undelete_file.ml
templates/recent.html
templates/restore_form.html
templates/rss.xml
+templates/send_feedback.txt
+templates/send_feedback_form.html
templates/sitemap.html
templates/undelete_file_form.html
templates/undelete_image_form.html
00-TEMPLATE.cmx: cocanwiki.cmx cocanwiki_template.cmx
cgi_expires.cmo: cocanwiki_date.cmo
cgi_expires.cmx: cocanwiki_date.cmx
-cocanwiki.cmo: cocanwiki_ok.cmo
-cocanwiki.cmx: cocanwiki_ok.cmx
+cocanwiki.cmo: cocanwiki_ok.cmo cocanwiki_strings.cmo
+cocanwiki.cmx: cocanwiki_ok.cmx cocanwiki_strings.cmx
cocanwiki_diff.cmo: cocanwiki_files.cmo
cocanwiki_diff.cmx: cocanwiki_files.cmx
cocanwiki_images.cmo: cocanwiki_files.cmo cocanwiki_strings.cmo \
logout.cmo: cocanwiki.cmo cocanwiki_ok.cmo
logout.cmx: cocanwiki.cmx cocanwiki_ok.cmx
page.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_ok.cmo \
- cocanwiki_strings.cmo cocanwiki_template.cmi wikilib.cmi
+ cocanwiki_template.cmi wikilib.cmi
page.cmx: cocanwiki.cmx cocanwiki_date.cmx cocanwiki_ok.cmx \
- cocanwiki_strings.cmx cocanwiki_template.cmx wikilib.cmx
+ cocanwiki_template.cmx wikilib.cmx
pagestyle.cmo: cgi_expires.cmo cocanwiki.cmo
pagestyle.cmx: cgi_expires.cmx cocanwiki.cmx
preview.cmo: cocanwiki.cmo wikilib.cmi
rss.cmx: cocanwiki.cmx cocanwiki_template.cmx wikilib.cmx
search.cmo: cocanwiki.cmo
search.cmx: cocanwiki.cmx
+send_feedback.cmo: cocanwiki.cmo cocanwiki_ok.cmo cocanwiki_template.cmi
+send_feedback.cmx: cocanwiki.cmx cocanwiki_ok.cmx cocanwiki_template.cmx
+send_feedback_form.cmo: cocanwiki.cmo cocanwiki_template.cmi
+send_feedback_form.cmx: cocanwiki.cmx cocanwiki_template.cmx
signup.cmo: cocanwiki.cmo cocanwiki_ok.cmo cocanwiki_strings.cmo
signup.cmx: cocanwiki.cmx cocanwiki_ok.cmx cocanwiki_strings.cmx
sitemap.cmo: cocanwiki.cmo cocanwiki_date.cmo cocanwiki_strings.cmo \
# Makefile for COCANWIKI.
-# $Id: Makefile,v 1.13 2004/09/20 15:34:36 rich Exp $
+# $Id: Makefile,v 1.14 2004/09/20 17:18:26 rich Exp $
include ../Makefile.config
restore_form.cmo \
rss.cmo \
search.cmo \
+ send_feedback.cmo \
+ send_feedback_form.cmo \
signup.cmo \
sitemap.cmo \
undelete_file.cmo \
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: page.ml,v 1.15 2004/09/20 15:34:36 rich Exp $
+ * $Id: page.ml,v 1.16 2004/09/20 17:18:26 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
let page = q#param "page" in
let page = if page = "" then "index" else page in
- (* Host-specific CSS? *)
- let sth = dbh#prepare_cached "select css is not null from hosts
- where id = ?" in
+ (* Host-specific fields. *)
+ let sth = dbh#prepare_cached "select css is not null,
+ feedback_email is not null
+ from hosts where id = ?" in
sth#execute [`Int hostid];
- let has_host_css =
+ let has_host_css, has_feedback_email =
match sth#fetch1 () with
- | [ `Bool has_host_css ] -> has_host_css
+ | [ `Bool has_host_css; `Bool has_feedback_email ] ->
+ has_host_css, has_feedback_email
| _ -> assert false in
(* Can the user edit? Manage users? etc. *)
t#conditional "has_host_css" has_host_css;
t#conditional "has_page_css" has_page_css;
+ t#conditional "has_feedback_email" has_feedback_email;
+
t#conditional "can_edit" can_edit;
t#conditional "can_manage_users" can_manage_users;
t#conditional "can_manage_contacts" can_manage_contacts;
--- /dev/null
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: send_feedback.ml,v 1.1 2004/09/20 17:18:26 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *)
+
+open Apache
+open Registry
+open Cgi
+open Printf
+
+open ExtString
+
+open Cocanwiki
+open Cocanwiki_template
+open Cocanwiki_ok
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
+ let template = get_template dbh hostid "send_feedback.txt" in
+
+ if q#param_true "cancel" then (
+ (* Request cancelled. *)
+ q#redirect ("http://" ^ hostname);
+ raise CgiExit
+ );
+
+ (* Get the feedback email for this host. *)
+ let sth =
+ dbh#prepare_cached "select feedback_email from hosts where id = ?" in
+ sth#execute [`Int hostid];
+
+ let to_addr = sth#fetch1string () in
+
+ (* Get the fields. *)
+ let page = q#param "page" in
+ let name = q#param "name" in
+ let email = q#param "email" in
+ let feedback = q#param "feedback" in
+
+ template#set "page" page;
+ template#set "name" name;
+ template#set "email" email;
+ template#set "feedback" feedback;
+
+ (* Get the IP address for logging purposes. *)
+ let ip =
+ try Connection.remote_ip (Request.connection r) with Not_found -> "" in
+
+ (* Get the User-Agent string. Consider in future rejecting spammers
+ * who don't set User-Agent.
+ *)
+ let ua =
+ try Table.get (Request.headers_in r) "User-Agent" with Not_found -> "" in
+
+ (* Get the user details, if any. *)
+ let username =
+ match user with
+ Anonymous -> "anonymous"
+ | User (userid, username, _) ->
+ sprintf "%s (%d)" username userid in
+
+ template#set "ip" ip;
+ template#set "ua" ua;
+ template#set "username" username;
+ template#set "hostname" hostname;
+
+ (* Send the feedback email. *)
+ let subject = "Wiki feedback: Feedback about " ^ page ^ " page" in
+ let body = template#to_string in
+ Sendmail.send_mail ~subject ~to_addr:[to_addr] ~body ();
+
+ (* Confirm. *)
+ ok ~title:"Thank you for your feedback" ~buttons:[ok_button "/"]
+ q "An email has been sent to the site administrators."
+
+let () =
+ register_script run
--- /dev/null
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: send_feedback_form.ml,v 1.1 2004/09/20 17:18:26 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *)
+
+open Apache
+open Registry
+open Cgi
+open Printf
+
+open Cocanwiki
+open Cocanwiki_template
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
+ let template = get_template dbh hostid "send_feedback_form.html" in
+
+ let page = q#param "page" in
+
+ template#set "page" page;
+
+ q#template template
+
+let () =
+ register_script ~restrict:[CanManageUsers] run
<ul id="footer" class="menu">
<li class="first"> Last change: ::last_modified_date_html:: </li>
<li> <a href="/copyright">Copyright © ::year::</a> </li>
+::if(has_feedback_email)::
+<li> <a href="/_bin/send_feedback_form.cmo?page=::page_url::">Send feedback</a> </li>
+::end::
<li> Powered by <a href="http://sandbox.merjis.com/">::cocanwiki_package_html:: ::cocanwiki_version_html::</a> </li>
</ul>
</div>
--- /dev/null
+This is an automatically generated message from the feedback form at
+::hostname::. Someone has filled out this form and sent it to you
+below.
+
+----------------------------------------------------------------------
+Feedback about page http://::hostname::/::page:::
+
+Name: ::name::
+Email: ::email::
+
+Feedback:
+
+::feedback::
+----------------------------------------------------------------------
+
+LOGGING INFORMATION:
+
+IP address: ::ip::
+Username: ::username::
+User-Agent: ::ua::
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>Send feedback about this page</title>
+<meta name="robots" content="noindex,nofollow"/>
+<meta name="author" content="http://www.merjis.com/" />
+<link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
+</head><body>
+
+<h1>Send feedback about this page</h1>
+
+<form method="post" action="/_bin/send_feedback.cmo">
+<input type="hidden" name="page" value="::page_html_tag::"/>
+<table class="left_table">
+<tr>
+<th> Name: </th>
+<td> <input name="name" value="" size="50" /> </td>
+</tr>
+<tr>
+<th> Email: </th>
+<td> <input name="email" value="" size="50" /> </td>
+</tr>
+<tr>
+<th> Feedback: </th>
+<td> <textarea name="feedback" rows="8" cols="60"></textarea> </td>
+</tr>
+<tr>
+<td> </td>
+<td> <em>All fields are optional, but please give us your
+email address if you'd like us to get back to you.</em> </td>
+</tr>
+<tr>
+<td></td>
+<td> <input type="submit" name="submit" value=" Send feedback " />
+<input type="submit" name="cancel" value=" Cancel " /> </td>
+</tr>
+</table>
+</form>
+
+<h2>Contents of the page</h2>
+
+<iframe longdesc="Frame showing the original contents of the page about which you are sending feedback." width="100%" height="500" src="/::page_html_tag::"></iframe>
+<noframes>
+<a href="/::page_html_tag::" target="_blank">Go here to see the page on which you are sending feedback.</a>
+</noframes>
+
+<ul id="topmenu" class="menu">
+<li class="first"> <a href="/">Home page</a> </li>
+<li> <a href="/_sitemap">Sitemap</a> </li>
+<li> <a href="/_recent">Recent changes</a> </li>
+</ul>
+
+<div id="menu_div">
+<ul id="bottommenu" class="menu">
+<li class="first"> <a href="/">Home page</a> </li>
+::table(sitemenu)::<li> <a href="/::url_html_tag::">::label_html::</a> </li>
+::end::
+<li> <a href="/_sitemap">Sitemap</a> </li>
+</ul>
+</div>
+
+<div id="footer_div">
+<hr/>
+
+<ul id="footer" class="menu">
+<li class="first"> <a href="/copyright">Copyright © ::year::</a> </li>
+<li> Powered by <a href="http://sandbox.merjis.com/">::cocanwiki_package_html:: ::cocanwiki_version_html::</a> </li>
+</ul>
+</div>
+
+</body>
+</html>
\ No newline at end of file