html/_css/images.css
html/_css/login.css
html/_css/markup.css
+html/_css/new_page.css
html/_css/print.css
html/_css/standard.css
html/_css/stats_top.css
html/_graphics/maillist.png
html/_graphics/mailto.png
html/_graphics/markup-preview.png
+html/_graphics/new.png
html/_graphics/newpage.png
html/_graphics/ok.png
html/_graphics/pinkhatch.png
html/_graphics/wlh.png
html/_graphics/xml.png
html/_js/editor.js
+html/_js/new_page.js
html/_js/visualise_links.js
html/_js/wz_jsgraphics.js
html/_static/markup.html
scripts/mailing_list_send.ml
scripts/mailing_list_unsubscribe.ml
scripts/mailing_list_view.ml
+scripts/new_page_form.ml
scripts/page.ml
scripts/page_email_confirm.ml
scripts/page_email_form.ml
templates/mailing_list_send.txt
templates/mailing_list_view.html
templates/mailing_list_view.txt
+templates/new_page_form.html
templates/ok_error.html
templates/page.html
templates/page_404.html
--- /dev/null
+/* $Id: new_page.css,v 1.1 2004/10/24 17:32:54 rich Exp $ */
+
+div#show_link {
+ width: 25em;
+ height: 8em;
+}
\ No newline at end of file
/* Stylesheet for COCANWIKI.
- * $Id: standard.css,v 1.23 2004/10/23 09:47:24 rich Exp $
+ * $Id: standard.css,v 1.24 2004/10/24 17:32:54 rich Exp $
*/
/* Based on the basic stylesheet. */
background: url(/_graphics/maillist.png) center left no-repeat;
}
+li.new_li a {
+ padding-left: 16px;
+ background: url(/_graphics/new.png) center left no-repeat;
+}
+
li.recent_li a {
padding-left: 18px;
background: url(/_graphics/recent.png) center left no-repeat;
--- /dev/null
+/* $Id: new_page.js,v 1.1 2004/10/24 17:32:54 rich Exp $ */
+
+var div;
+var timer;
+
+function init ()
+{
+ document.f.title.focus ();
+ document.f.submit.disabled = true;
+ div = document.getElementById ("show_link");
+}
+
+function update ()
+{
+ if (timer) clearTimeout (timer);
+ timer = setTimeout ("update_now ()", 1);
+}
+
+function update_now ()
+{
+ timer = null;
+
+ var title = document.f.title.value;
+ if (title.search (/[a-z0-9]/gi) == -1) {
+ document.f.submit.disabled = true;
+ div.innerHTML = "";
+ } else {
+ document.f.submit.disabled = false;
+ title = title.replace (/&/g, "&");
+ title = title.replace (/</g, "<");
+ title = title.replace (/>/g, ">");
+ title = title.replace (/\"/g, """);
+ div.innerHTML = "You can create links to this page when editing by putting two square brackets around the page name, like this: <br/><br/> <code>[[" + title + "]]</code>";
+ }
+}
lib/cocanwiki_template.cmi
mailing_list_view.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \
lib/cocanwiki_template.cmx
+new_page_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi
+new_page_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx
page.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo lib/cocanwiki_links.cmi \
lib/cocanwiki_ok.cmo lib/cocanwiki_server_settings.cmo \
lib/cocanwiki_template.cmi lib/wikilib.cmi
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: wikilib.ml,v 1.1 2004/10/21 11:42:05 rich Exp $
+ * $Id: wikilib.ml,v 1.2 2004/10/24 17:32:55 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
(* URL cannot begin with '_'. *)
else if url.[0] = '_' then
GenURL_BadURL
+ (* Titles which begin or end with spaces are probably mistakes. *)
+ else if isspace title.[0] || isspace title.[String.length title - 1] then
+ GenURL_BadURL
else (
(* Check that the URL doesn't already exist in the database. If it does
* then it probably means that another page exists with similar enough
--- /dev/null
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: new_page_form.ml,v 1.1 2004/10/24 17:32:54 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 "new_page_form.html" in
+
+ q#template template
+
+let () =
+ register_script ~restrict:[CanEdit] run
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>New 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"/>
+<link rel="stylesheet" href="/_css/new_page.css" type="text/css" title="Standard"/>
+<link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
+<script src="/_js/new_page.js" type="text/javascript"></script>
+</head><body onload="init();">
+
+<h1>New page</h1>
+
+<p>
+<em> Note that you would normally create a new page just by
+clicking on any <a href="#" class="newpage" title="Shows a link in the distinctive style for links to unknown pages.">link like this</a>. </em>
+</p>
+
+<form method="post" action="/_bin/edit.cmo" name="f">
+<table class="left_table">
+<tr>
+<th> Page name: </th>
+<td> <input name="title" value="" size="50" onkeypress="update(); return true;"/> </td>
+</tr>
+<tr>
+<td></td>
+<td>
+ <div id="show_link">
+ <noscript>
+ You can create links to this page when editing by putting
+ two square brackets around the page name, like this: <br/><br/>
+ <code>[[page name]]</code>
+ </noscript>
+ </div>
+</td>
+</tr>
+<tr>
+<td></td>
+<td> <input type="submit" name="submit" value="Create new page"/> </td>
+</tr>
+</table>
+</form>
+
+::include(footer.html)::
+</body>
+</html>
\ No newline at end of file
<li class="versions_li"> <a href="/::page_html_tag::/history">Versions of this page</a> </li>
<li class="wlh_li"> <a href="/_bin/what_links_here.cmo?page=::page_url::">What links here?</a> </li>
<li class="stylesheet_li"> <a href="/::page_html_tag::/editcss">Edit stylesheet</a> </li>
-<li> <a href="/::page_html_tag::/edittitle">Rename page</a> </li>
+<li class="edittitle_li"> <a href="/::page_html_tag::/edittitle">Rename page</a> </li>
+<li class="new_li"> <a href="/_bin/new_page_form.cmo">New page</a> </li>
<li class="images_li"> <a href="/_images">Images</a> </li>
<li class="files_li"> <a href="/_files">Files</a> </li>
::if(has_stats)::