/* Stylesheet for COCANWIKI.
- * $Id: standard.css,v 1.21 2004/10/22 17:17:42 rich Exp $
+ * $Id: standard.css,v 1.22 2004/10/23 09:36:10 rich Exp $
*/
/* Based on the basic stylesheet. */
}
li.recent_li a {
- padding-left: 16px;
+ padding-left: 18px;
background: url(/_graphics/recent.png) center left no-repeat;
}
background: url(/_graphics/sitemap.png) center left no-repeat;
}
-li.recent_li a {
- padding-left: 18px;
- background: url(/_graphics/recent.png) center left no-repeat;
+li.stylesheet_li a {
+ padding-left: 16px;
+ background: url(/_graphics/edit.png) center left no-repeat;
}
li.versions_li a {
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: create_user.ml,v 1.4 2004/10/11 14:13:04 rich Exp $
+ * $Id: create_user.ml,v 1.5 2004/10/23 09:36:11 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
if String.length username > 32 || String.length password > 32 then
*)
- let email = trim (q#param "email") in
- let email = if string_is_whitespace email then `Null else `String email in
-
(* Not a duplicate? *)
let sth = dbh#prepare_cached "select id from users
where hostid = ? and name = ?" in
let force_password_change = q#param_true "force_password_change" in
(* Create the user account. *)
- let sth = dbh#prepare_cached "insert into users (name, password, email,
+ let sth = dbh#prepare_cached "insert into users (name, password,
hostid, can_edit, can_manage_users,
can_manage_contacts, can_manage_site,
can_edit_global_css, can_import_mail,
force_password_change)
- values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" in
- sth#execute [`String username; `String password; email; `Int hostid;
+ values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" in
+ sth#execute [`String username; `String password; `Int hostid;
`Bool can_edit; `Bool can_manage_users;
`Bool can_manage_contacts; `Bool can_manage_site;
`Bool can_edit_global_css; `Bool can_import_mail;
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_css.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
+ * $Id: edit_host_css.ml,v 1.3 2004/10/23 09:36:11 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
"Note: You must RELOAD the page to see changes to stylesheets.")
let () =
- register_script ~restrict:[CanEdit] run
+ register_script ~restrict:[CanEditGlobalCSS] run
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit_host_css_form.ml,v 1.2 2004/10/04 15:19:56 rich Exp $
+ * $Id: edit_host_css_form.ml,v 1.3 2004/10/23 09:36:11 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
q#template template
let () =
- register_script ~restrict:[CanEdit] run
+ register_script ~restrict:[CanEditGlobalCSS] run
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: host_menu.ml,v 1.5 2004/10/10 16:14:43 rich Exp $
+ * $Id: host_menu.ml,v 1.6 2004/10/23 09:36:11 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
open Cocanwiki
open Cocanwiki_template
-let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
+let run r (q : cgi) (dbh : Dbi.connection) hostid host user =
let template = get_template dbh hostid "host_menu.html" in
- (* Get lots of host-specific stuff from the database. *)
- let sth =
- dbh#prepare_cached
- "select h.canonical_hostname, h.css is not null, h.edit_anon,
- h.create_account_anon, h.theme_css is not null,
- t.name, t.description, h.feedback_email, h.mailing_list,
- h.search_box, h.navigation, h.view_anon
- from hosts h left outer join themes t on h.theme_css = t.theme_css
- where h.id = ?" in
- sth#execute [`Int hostid];
+ (* Get user's specific permissions. *)
+ let can_manage_users = can_manage_users host user in
+ let can_manage_contacts = can_manage_contacts host user in
+ let can_edit_global_css = can_edit_global_css host user in
+ let can_manage_site = can_manage_site host user in
+ template#conditional "can_manage_users" can_manage_users;
+ template#conditional "can_manage_contacts" can_manage_contacts;
+ template#conditional "can_edit_global_css" can_edit_global_css;
+ template#conditional "can_manage_site" can_manage_site;
- let canonical_hostname, has_global_css, edit_anon, create_account_anon,
- has_theme_css, theme_name, theme_description, has_feedback_email,
- feedback_email, mailing_list, search_box, navigation, view_anon =
- match sth#fetch1 () with
- [ `String canonical_hostname; `Bool has_global_css;
- `Bool edit_anon; `Bool create_account_anon; `Bool has_theme_css;
- (`String _ | `Null) as theme_name;
- (`String _ | `Null) as theme_description;
- (`String _ | `Null) as feedback_email;
- `Bool mailing_list; `Bool search_box; `Bool navigation;
- `Bool view_anon ] ->
- let theme_name =
- match theme_name with `String s -> s | `Null -> "" in
- let theme_description =
- match theme_description with `String s -> s | `Null -> "" in
- let feedback_email, has_feedback_email =
- match feedback_email with
- `String s -> s, true
- | `Null -> "", false in
- canonical_hostname, has_global_css, edit_anon, create_account_anon,
- has_theme_css, theme_name, theme_description, has_feedback_email,
- feedback_email, mailing_list, search_box, navigation, view_anon
- | _ -> assert false in
+ if can_manage_site then (
+ (* Get lots of host-specific stuff from the database. *)
+ let sth =
+ dbh#prepare_cached
+ "select h.canonical_hostname, h.css is not null, h.edit_anon,
+ h.create_account_anon, h.theme_css is not null,
+ t.name, t.description, h.feedback_email, h.mailing_list,
+ h.search_box, h.navigation, h.view_anon
+ from hosts h left outer join themes t on h.theme_css = t.theme_css
+ where h.id = ?" in
+ sth#execute [`Int hostid];
- template#set "canonical_hostname" canonical_hostname;
- template#conditional "has_global_css" has_global_css;
- template#conditional "edit_anon" edit_anon;
- template#conditional "create_account_anon" create_account_anon;
- template#conditional "has_theme_css" has_theme_css;
- template#set "theme_name" theme_name;
- template#set "theme_description" theme_description;
- template#conditional "has_feedback_email" has_feedback_email;
- template#set "feedback_email" feedback_email;
- template#conditional "mailing_list" mailing_list;
- template#conditional "search_box" search_box;
- template#conditional "navigation" navigation;
- template#conditional "view_anon" view_anon;
+ let canonical_hostname, has_global_css, edit_anon, create_account_anon,
+ has_theme_css, theme_name, theme_description, has_feedback_email,
+ feedback_email, mailing_list, search_box, navigation, view_anon =
+ match sth#fetch1 () with
+ [ `String canonical_hostname; `Bool has_global_css;
+ `Bool edit_anon; `Bool create_account_anon; `Bool has_theme_css;
+ (`String _ | `Null) as theme_name;
+ (`String _ | `Null) as theme_description;
+ (`String _ | `Null) as feedback_email;
+ `Bool mailing_list; `Bool search_box; `Bool navigation;
+ `Bool view_anon ] ->
+ let theme_name =
+ match theme_name with `String s -> s | `Null -> "" in
+ let theme_description =
+ match theme_description with `String s -> s | `Null -> "" in
+ let feedback_email, has_feedback_email =
+ match feedback_email with
+ `String s -> s, true
+ | `Null -> "", false in
+ canonical_hostname, has_global_css, edit_anon, create_account_anon,
+ has_theme_css, theme_name, theme_description, has_feedback_email,
+ feedback_email, mailing_list, search_box, navigation, view_anon
+ | _ -> assert false in
+
+ template#set "canonical_hostname" canonical_hostname;
+ template#conditional "has_global_css" has_global_css;
+ template#conditional "edit_anon" edit_anon;
+ template#conditional "create_account_anon" create_account_anon;
+ template#conditional "has_theme_css" has_theme_css;
+ template#set "theme_name" theme_name;
+ template#set "theme_description" theme_description;
+ template#conditional "has_feedback_email" has_feedback_email;
+ template#set "feedback_email" feedback_email;
+ template#conditional "mailing_list" mailing_list;
+ template#conditional "search_box" search_box;
+ template#conditional "navigation" navigation;
+ template#conditional "view_anon" view_anon
+ );
q#template template
let () =
- register_script ~restrict:[CanManageSite] run
+ register_script ~restrict:[CanEdit] run
(* 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.33 2004/10/17 19:43:19 rich Exp $
+ * $Id: page.ml,v 1.34 2004/10/23 09:36:11 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
navigation
| _ -> assert false in
- (* Can the user edit? Manage users? etc. *)
+ (* Can the user edit? *)
let can_edit = can_edit host user in
- let can_manage_users = can_manage_users host user in
- let can_manage_contacts = can_manage_contacts host user in
- let can_manage_site = can_manage_site host user in
- let can_edit_global_css = can_edit_global_css host user in
(* Do we have a stats page set up? *)
let has_stats = server_settings_stats_page dbh <> None in
t#conditional "navigation" navigation;
t#conditional "can_edit" can_edit;
- t#conditional "can_manage_users" can_manage_users;
- t#conditional "can_manage_contacts" can_manage_contacts;
- t#conditional "can_manage_site" can_manage_site;
- t#conditional "can_edit_global_css" can_edit_global_css;
-
t#conditional "has_stats" has_stats;
(* Pull out the sections in this page. *)
t#set "search_terms" search_terms;
t#conditional "has_host_css" has_host_css;
-
t#conditional "can_edit" can_edit;
- t#conditional "can_manage_users" can_manage_users;
- t#conditional "can_manage_contacts" can_manage_contacts;
- t#conditional "can_manage_site" can_manage_site;
- t#conditional "can_edit_global_css" can_edit_global_css;
-
t#conditional "has_stats" has_stats;
q#template t
</tr>
<tr>
-<th> Email: </th>
-<td> <input name="email" value="" size="40"/> </td>
-</tr>
-<tr>
<th> Permissions: </th>
<td>
<!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>Global settings</title>
+<title>Sitewide settings</title>
<meta name="author" content="http://www.merjis.com/" />
<link rel="stylesheet" href="::theme_css_html_tag::" type="text/css" title="Standard"/>
<link rel="alternate stylesheet" href="/_css/easytoread.css" type="text/css" title="High contrast, big fonts"/>
</head><body>
-<h1>Global settings</h1>
+<h1>Sitewide settings</h1>
+
+<ul>
+<li> <a href="/_bin/largest_pages.cmo">Largest pages</a> </li>
+<li> <a href="/_bin/dead_ends.cmo">Dead end pages</a> </li>
+<li> <a href="/_bin/broken_links.cmo">Broken links</a> </li>
+
+<li> <a href="/_bin/edit_sitemenu.cmo">Edit site menu</a> </li>
+
+::if(can_manage_users)::
+<li> <a href="/_users">Users</a> </li>
+::end::
+
+::if(can_manage_contacts)::
+<li> <a href="/_bin/contacts.cmo">Contact forms</a> </li>
+::end::
+
+::if(can_edit_global_css)::
+<li> <a href="/_bin/edit_host_css_form.cmo">Edit global stylesheet</a> </li>
+::end::
+
+</ul>
+
+::if(can_manage_site)::
+
+<h2>Site management</h2>
<table class="left_table">
<tr>
<tr>
<th> Global stylesheet: </th>
<td> ::if(has_global_css)::<a href="/_global.css">View global stylesheet</a>::else::No global stylesheet for this site.::end::<br/>
-<a href="/_bin/edit_host_css_form.cmo">Edit global stylesheet ...</a> </td>
+::if(can_edit_global_css)::
+<a href="/_bin/edit_host_css_form.cmo">Edit global stylesheet ...</a>
+::end::
+</td>
</tr>
<tr>
<th> Allow anyone to see the site: </th>
<ul>
<li> <a href="/_bin/rebuild_links.cmo">Rebuild link structure</a>
</ul>
+::end::
::include(footer.html)::
</body>
</ul>
<ul id="editmenu" class="menu">
-<li class="first login_li"> ::if(user_logged_in):: ::username_html:: <a href="/_logout">(logout)</a> ::else:: <a href="/_login">Create account or log in</a> ::end:: </li>
+
+<li class="first login_li"> ::if(user_logged_in):: ::username_html:: (<a href="/_prefs">prefs</a>, <a href="/_logout">logout</a>) ::else:: <a href="/_login">Create account or log in</a> ::end:: </li>
+
::if(can_edit)::
<li class="edit_li"> <a href="/::page_html_tag::/edit"><strong>Edit this page</strong></a> </li>
<li class="recent_li"> <a href="/_recent">Recent changes</a> </li>
<li class="versions_li"> <a href="/::page_html_tag::/history">Versions of this page</a> </li>
-<li> <a href="/::page_html_tag::/editcss">Edit stylesheet for this page</a> </li>
-<li> <a href="/::page_html_tag::/edittitle">Edit title</a> </li>
<li class="wlh_li"> <a href="/_bin/what_links_here.cmo?page=::page_url::">What links here?</a> </li>
-<li> <a href="/_bin/edit_sitemenu.cmo">Edit site menu</a> </li>
-<li> <a href="/_bin/largest_pages.cmo">Largest pages</a> </li>
-<li> <a href="/_bin/dead_ends.cmo">Dead end pages</a> </li>
-<li> <a href="/_bin/broken_links.cmo">Broken links</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="images_li"> <a href="/_images">Images</a> </li>
<li class="files_li"> <a href="/_files">Files</a> </li>
::if(has_stats)::
<li> <a href="/::page_html_tag::/stats">Stats</a> </li>
::end::
::end::
-::if(can_manage_users)::
-<li> <a href="/_users">Users</a> </li>
-::end::
-::if(can_manage_contacts)::
-<li> <a href="/_bin/contacts.cmo">Contact forms</a> </li>
-::end::
-::if(can_manage_site)::
-<li> <a href="/_bin/host_menu.cmo">Global settings</a> </li>
-::end::
-::if(can_edit_global_css)::
-<li> <a href="/_bin/edit_host_css_form.cmo">Edit global stylesheet</a> </li>
-::end::
-::if(can_edit)::
-<li> <a href="/_admin">Server administration</a> </li>
-::end::
+
<li class="maillist_li"> <a href="/_bin/page_email_form.cmo?page=::page_url::">Send email if this page changes</a> </li>
+
::if(mailing_list)::
<li class="maillist_li"> <a href="/_bin/mailing_list_form.cmo">Join our mailing list</a> </li>
::end::
+
+::if(can_edit)::
+<li> <a href="/_bin/host_menu.cmo">Sitewide settings</a> </li>
+::end::
+
::if(user_logged_in)::
-<li> <a href="/_bin/change_password_form.cmo">Change password</a> </li>
+<li> <a href="/_bin/change_password_form.cmo">Change password</a> (XXX TEMP XXX) </li>
::end::
+
</ul>
</div>