From ed0756f32c50d84f36f25590aefb6168762545ed Mon Sep 17 00:00:00 2001 From: rich Date: Mon, 14 Aug 2006 11:36:50 +0000 Subject: [PATCH] Support for NOODP flag, sitewide and per-page. --- schema/cocanwiki.sql | 6 +++-- scripts/edit.ml | 16 ++++++++++++- scripts/edit_host_settings.ml | 6 +++-- scripts/edit_host_settings_form.ml | 15 ++++++++---- scripts/edit_page_css.ml | 9 ++++---- scripts/host_menu.ml | 12 ++++++---- scripts/lib/cocanwiki_create_host.ml | 7 +++--- scripts/lib/cocanwiki_diff.ml | 11 ++++++--- scripts/lib/cocanwiki_pages.ml | 21 +++++++++++------ scripts/lib/cocanwiki_pages.mli | 3 ++- scripts/lib/cocanwiki_template.ml | 12 +++++++--- scripts/page.ml | 41 ++++++++++++++++++++------------- scripts/rename_page.ml | 3 ++- scripts/restore.ml | 9 ++++---- templates/00-TEMPLATE.html | 2 +- templates/broken_links.html | 2 +- templates/change_password_form.html | 2 +- templates/contact_show.html | 2 +- templates/contacts.html | 2 +- templates/crash.html | 2 +- templates/create_contact_form.html | 2 +- templates/create_macro_form.html | 2 +- templates/create_user_form.html | 2 +- templates/dead_ends.html | 2 +- templates/delete_contact_form.html | 2 +- templates/delete_file_form.html | 2 +- templates/delete_image_form.html | 2 +- templates/delete_macro_form.html | 2 +- templates/delete_user_form.html | 2 +- templates/diff.html | 2 +- templates/edit.html | 15 +++++++++++- templates/edit_conflict.html | 2 +- templates/edit_contact_form.html | 2 +- templates/edit_file_form.html | 2 +- templates/edit_host_css_form.html | 2 +- templates/edit_host_settings_form.html | 8 ++++++- templates/edit_image_form.html | 2 +- templates/edit_macro_form.html | 2 +- templates/edit_macros.html | 2 +- templates/edit_page_css_form.html | 2 +- templates/edit_sitemenu.html | 2 +- templates/edit_user_form.html | 2 +- templates/files.html | 2 +- templates/forgot_password_form.html | 2 +- templates/history.html | 2 +- templates/host_menu.html | 6 ++++- templates/images.html | 2 +- templates/invite_user_confirm_form.html | 2 +- templates/invite_user_form.html | 2 +- templates/largest_pages.html | 2 +- templates/login_form.html | 2 +- templates/mail_import_form.html | 2 +- templates/mailing_list_form.html | 2 +- templates/mailing_list_view.html | 2 +- templates/new_page_form.html | 2 +- templates/ok_error.html | 2 +- templates/orphans.html | 2 +- templates/page_404_header.html | 2 +- templates/page_email_form.html | 2 +- templates/page_header.html | 5 ++-- templates/recent.html | 2 +- templates/recently_visited.html | 2 +- templates/rename_page_form.html | 2 +- templates/restore_form.html | 2 +- templates/search.html | 2 +- templates/send_feedback_form.html | 2 +- templates/set_password_form.html | 2 +- templates/sitemap.html | 2 +- templates/stats.html | 2 +- templates/stats_top.html | 2 +- templates/tarpit_form.html | 2 +- templates/undelete_file_form.html | 2 +- templates/undelete_image_form.html | 2 +- templates/upload_file_form.html | 2 +- templates/upload_image_form.html | 2 +- templates/user_prefs_form.html | 2 +- templates/users.html | 2 +- templates/visualise_links.html | 2 +- templates/what_links_here.html | 2 +- tools/copy_page.ml | 7 +++--- 80 files changed, 208 insertions(+), 126 deletions(-) diff --git a/schema/cocanwiki.sql b/schema/cocanwiki.sql index 17a00df..1254c38 100644 --- a/schema/cocanwiki.sql +++ b/schema/cocanwiki.sql @@ -1078,7 +1078,8 @@ CREATE TABLE pages ( css text, logged_user integer, title_description_fti tsvector NOT NULL, - keywords text + keywords text, + noodp boolean ); @@ -1159,7 +1160,8 @@ CREATE TABLE hosts ( brand_tagline text, brand_description text, pagebug text, - ie_imagetoolbar_no boolean DEFAULT false NOT NULL + ie_imagetoolbar_no boolean DEFAULT false NOT NULL, + global_noodp boolean DEFAULT false NOT NULL ); diff --git a/scripts/edit.ml b/scripts/edit.ml index f28ba2d..00ebc93 100644 --- a/scripts/edit.ml +++ b/scripts/edit.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.ml,v 1.35 2006/08/04 12:45:31 rich Exp $ + * $Id: edit.ml,v 1.36 2006/08/14 11:36:50 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 @@ -58,6 +58,11 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = let keywords = q#param "keywords" in let keywords = if string_is_whitespace keywords then None else Some keywords in + let noodp = match q#param "noodp" with + | "" -> None + | "t" -> Some true + | "f" -> Some false + | _ -> failwith "unknown value for noodp parameter" in let redirect = q#param "redirect" in let redirect = if string_is_whitespace redirect then None else Some redirect in @@ -87,6 +92,7 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = pt = pt; description = description; keywords = keywords; + noodp = noodp; redirect = redirect; contents_ = contents; } in @@ -227,6 +233,14 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = template#set "keywords" (match model.keywords with None -> "" | Some keywords -> keywords); + template#conditional "noodp_null" false; + template#conditional "noodp_true" false; + template#conditional "noodp_false" false; + (match model.noodp with + | None -> template#conditional "noodp_null" true + | Some true -> template#conditional "noodp_true" true + | Some false -> template#conditional "noodp_false" true); + (match model.pt with Page page -> template#set "pt_type" "page"; diff --git a/scripts/edit_host_settings.ml b/scripts/edit_host_settings.ml index 34d1eeb..ce56463 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.12 2006/08/14 10:04:25 rich Exp $ + * $Id: edit_host_settings.ml,v 1.13 2006/08/14 11:36:50 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 @@ -42,6 +42,7 @@ let run r (q : cgi) dbh hostid { hostname = hostname } _ = let mailing_list = q#param_true "mailing_list" in let search_box = q#param_true "search_box" in let ie_imagetoolbar_no = q#param_true "ie_imagetoolbar_no" in + let global_noodp = q#param_true "global_noodp" in let navigation = q#param_true "navigation" in let view_anon = q#param_true "view_anon" in let brand = trim (q#param "brand") in @@ -71,7 +72,8 @@ let run r (q : cgi) dbh hostid { hostname = hostname } _ = view_anon = $view_anon, brand = $?brand, brand_tagline = $?brand_tagline, brand_description = $?brand_description, - pagebug = $?pagebug, ie_imagetoolbar_no = $ie_imagetoolbar_no + pagebug = $?pagebug, ie_imagetoolbar_no = $ie_imagetoolbar_no, + global_noodp = $global_noodp where id = $hostid"; PGOCaml.commit dbh; diff --git a/scripts/edit_host_settings_form.ml b/scripts/edit_host_settings_form.ml index bd4bbb4..1cf7451 100644 --- a/scripts/edit_host_settings_form.ml +++ b/scripts/edit_host_settings_form.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_form.ml,v 1.8 2006/08/14 10:04:25 rich Exp $ + * $Id: edit_host_settings_form.ml,v 1.9 2006/08/14 11:36:50 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 @@ -44,16 +44,19 @@ let run r (q : cgi) dbh hostid _ _ = PGSQL(dbh) "select canonical_hostname, edit_anon, create_account_anon, theme_css, feedback_email, mailing_list, search_box, navigation, view_anon, - brand, brand_tagline, brand_description, ie_imagetoolbar_no + brand, brand_tagline, brand_description, ie_imagetoolbar_no, + global_noodp from hosts where id = $hostid" in let canonical_hostname, edit_anon, create_account_anon, theme_css, feedback_email, mailing_list, search_box, navigation, view_anon, - brand, brand_tagline, brand_description, ie_imagetoolbar_no = + brand, brand_tagline, brand_description, ie_imagetoolbar_no, + global_noodp = match rows with | [canonical_hostname, edit_anon, create_account_anon, theme_css, feedback_email, mailing_list, search_box, navigation, view_anon, - brand, brand_tagline, brand_description, ie_imagetoolbar_no] -> + brand, brand_tagline, brand_description, ie_imagetoolbar_no, + global_noodp ] -> let theme_css = match theme_css with Some s -> s | None -> "" in let feedback_email = @@ -66,7 +69,8 @@ let run r (q : cgi) dbh hostid _ _ = match brand_description with Some s -> s | None -> "" in canonical_hostname, edit_anon, create_account_anon, theme_css, feedback_email, mailing_list, search_box, navigation, view_anon, - brand, brand_tagline, brand_description, ie_imagetoolbar_no + brand, brand_tagline, brand_description, ie_imagetoolbar_no, + global_noodp | _ -> assert false in template#set "canonical_hostname" canonical_hostname; @@ -76,6 +80,7 @@ let run r (q : cgi) dbh hostid _ _ = template#conditional "mailing_list" mailing_list; template#conditional "search_box" search_box; template#conditional "ie_imagetoolbar_no" ie_imagetoolbar_no; + template#conditional "global_noodp" global_noodp; template#conditional "navigation" navigation; template#conditional "view_anon" view_anon; template#set "brand" brand; diff --git a/scripts/edit_page_css.ml b/scripts/edit_page_css.ml index a79b65f..8b18b9b 100644 --- a/scripts/edit_page_css.ml +++ b/scripts/edit_page_css.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_page_css.ml,v 1.22 2006/08/04 12:45:31 rich Exp $ + * $Id: edit_page_css.ml,v 1.23 2006/08/14 11:36:50 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 @@ -50,11 +50,11 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = * us to revert changes to the CSS easily. *) let rows = PGSQL(dbh) - "select id, title, description, keywords, creation_date, redirect + "select id, title, description, keywords, noodp, creation_date, redirect from pages where hostid = $hostid and url = $page" in - let oldpageid, title, description, keywords, creation_date, redirect = + let oldpageid, title, description, keywords, noodp, creation_date, redirect = match rows with | [row] -> row | _ -> assert false in @@ -68,10 +68,11 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = where hostid = $hostid and id = $oldpageid"; PGSQL(dbh) "insert into pages (hostid, url, title, - description, keywords, + description, keywords, noodp, creation_date, logged_ip, logged_user, redirect, css) values ($hostid, $page, $title, $description, $?keywords, + $?noodp, $creation_date, $?logged_ip, $?logged_user, $?redirect, $?css)"; diff --git a/scripts/host_menu.ml b/scripts/host_menu.ml index 59909eb..736b4cd 100644 --- a/scripts/host_menu.ml +++ b/scripts/host_menu.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: host_menu.ml,v 1.11 2006/08/14 10:04:25 rich Exp $ + * $Id: host_menu.ml,v 1.12 2006/08/14 11:36:50 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 @@ -52,7 +52,7 @@ let run r (q : cgi) dbh hostid host user = h.search_box, h.navigation, h.view_anon, h.brand, coalesce (h.brand_tagline, ''), coalesce (h.brand_description, ''), - h.ie_imagetoolbar_no + h.ie_imagetoolbar_no, h.global_noodp from hosts h left outer join themes t on h.theme_css = t.theme_css where h.id = $hostid" in @@ -60,14 +60,15 @@ let run r (q : cgi) dbh hostid host user = has_theme_css, theme_name, theme_description, has_feedback_email, feedback_email, mailing_list, search_box, navigation, view_anon, has_brand, brand, brand_tagline, brand_description, - ie_imagetoolbar_no = + ie_imagetoolbar_no, global_noodp = match rows with [ Some canonical_hostname, Some has_global_css, Some edit_anon, Some create_account_anon, Some has_theme_css, theme_name, theme_description, feedback_email, Some mailing_list, Some search_box, Some navigation, Some view_anon, - brand, brand_tagline, brand_description, Some ie_imagetoolbar_no ] -> + brand, brand_tagline, brand_description, Some ie_imagetoolbar_no, + Some global_noodp ] -> let theme_name = match theme_name with Some s -> s | None -> "" in let theme_description = @@ -88,7 +89,7 @@ let run r (q : cgi) dbh hostid host user = has_theme_css, theme_name, theme_description, has_feedback_email, feedback_email, mailing_list, search_box, navigation, view_anon, has_brand, brand, brand_tagline, brand_description, - ie_imagetoolbar_no + ie_imagetoolbar_no, global_noodp | _ -> assert false in template#set "canonical_hostname" canonical_hostname; @@ -103,6 +104,7 @@ let run r (q : cgi) dbh hostid host user = template#conditional "mailing_list" mailing_list; template#conditional "search_box" search_box; template#conditional "ie_imagetoolbar_no" ie_imagetoolbar_no; + template#conditional "global_noodp" global_noodp; template#conditional "navigation" navigation; template#conditional "view_anon" view_anon; template#conditional "has_brand" has_brand; diff --git a/scripts/lib/cocanwiki_create_host.ml b/scripts/lib/cocanwiki_create_host.ml index e898811..28a26f7 100644 --- a/scripts/lib/cocanwiki_create_host.ml +++ b/scripts/lib/cocanwiki_create_host.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_create_host.ml,v 1.5 2006/08/04 12:45:33 rich Exp $ + * $Id: cocanwiki_create_host.ml,v 1.6 2006/08/14 11:36:50 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 @@ -74,8 +74,9 @@ let create_host dbh canonical_hostname hostnames template (* Copy pages. *) PGSQL(dbh) "insert into pages (hostid, url, title, description, keywords, - redirect, css) - select $hostid, url, title, description, keywords, redirect, css + redirect, css, noodp) + select $hostid, url, title, description, keywords, redirect, css, + noodp from pages where hostid = $template and url is not null"; diff --git a/scripts/lib/cocanwiki_diff.ml b/scripts/lib/cocanwiki_diff.ml index e44e8ae..3f4fdfa 100644 --- a/scripts/lib/cocanwiki_diff.ml +++ b/scripts/lib/cocanwiki_diff.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_diff.ml,v 1.7 2006/08/04 12:45:33 rich Exp $ + * $Id: cocanwiki_diff.ml,v 1.8 2006/08/14 11:36:50 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 @@ -41,6 +41,10 @@ let page_for_diff model css = (match model.redirect with | None -> "" | Some redirect -> "Redirect: " ^ redirect ^ "\n\n") ^ + "ROBOTS NOODP: " ^ + (match model.noodp with + | None -> "inherit sitewide default" + | Some noodp -> string_of_bool noodp) ^ "\n\n" ^ (String.concat "" (List.map ( fun (sectionname, divname, jsgo, content) -> @@ -106,9 +110,9 @@ let diff_cmd old_page new_page = let get_version_for_diff dbh version = if version = 0l then "" else ( - let title, description, keywords, redirect, css = List.hd ( + let title, description, keywords, noodp, redirect, css = List.hd ( PGSQL(dbh) - "select title, description, keywords, redirect, css from pages + "select title, description, keywords, noodp, redirect, css from pages where id = $version" ) in @@ -121,6 +125,7 @@ let get_version_for_diff dbh version = pt = Title title; description = description; keywords = keywords; + noodp = noodp; redirect = redirect; contents_ = contents_ } in diff --git a/scripts/lib/cocanwiki_pages.ml b/scripts/lib/cocanwiki_pages.ml index d0d3285..d616cb7 100644 --- a/scripts/lib/cocanwiki_pages.ml +++ b/scripts/lib/cocanwiki_pages.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_pages.ml,v 1.9 2006/08/04 12:45:33 rich Exp $ + * $Id: cocanwiki_pages.ml,v 1.10 2006/08/14 11:36:50 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 @@ -35,6 +35,7 @@ type model = { pt : pt; (* Page of title (only used if id=0) *) description : string; (* Description. *) keywords : string option; (* Keywords. *) + noodp : bool option; (* NOODP per-page override. *) redirect : string option; (* Redirect to. *) (* NB. Don't call this 'contents' because that clashes with the * Pervasives.contents fields of the ref type. @@ -55,6 +56,7 @@ let new_page pt = pt = pt; description = description; keywords = None; + noodp = None; redirect = None; contents_ = [] } in model @@ -66,6 +68,7 @@ let new_page_with_title title = pt = Title title; description = title; keywords = None; + noodp = None; redirect = None; contents_ = contents } in model @@ -75,16 +78,16 @@ let load_page dbh hostid ~url ?version () = let rows = match version with | None -> - PGSQL(dbh) "select id, title, description, keywords, redirect + PGSQL(dbh) "select id, title, description, keywords, noodp, redirect from pages where hostid = $hostid and url = $url" | Some version -> - PGSQL(dbh) "select id, title, description, keywords, redirect + PGSQL(dbh) "select id, title, description, keywords, noodp, redirect from pages where hostid = $hostid and id = $version and (url = $url or url_deleted = $url)" in - let pageid, title, description, keywords, redirect = + let pageid, title, description, keywords, noodp, redirect = match rows with | [row] -> row | _ -> raise Not_found in @@ -100,6 +103,7 @@ let load_page dbh hostid ~url ?version () = pt = Page url; description = description; keywords = keywords; + noodp = noodp; redirect = redirect; contents_ = contents } in model @@ -135,12 +139,14 @@ let save_page r dbh hostid ?user model = let description = model.description in let keywords = model.keywords in + let noodp = model.noodp in let redirect = model.redirect in PGSQL(dbh) "insert into pages (hostid, url, title, - description, keywords, + description, keywords, noodp, logged_ip, logged_user, redirect) values ($hostid, $url, $title, $description, $?keywords, + $?noodp, $?logged_ip, $?logged_user, $?redirect)"; let pageid = PGOCaml.serial4 dbh "pages_id_seq" in @@ -215,13 +221,14 @@ let save_page r dbh hostid ?user model = let description = model.description in let keywords = model.keywords in + let noodp = model.noodp in let redirect = model.redirect in PGSQL(dbh) "insert into pages (hostid, url, title, - description, keywords, + description, keywords, noodp, creation_date, logged_ip, logged_user, redirect, css) - values ($hostid, $url, $title, $description, $?keywords, + values ($hostid, $url, $title, $description, $?keywords, $?noodp, $creation_date, $?logged_ip, $?logged_user, $?redirect, $?css)"; diff --git a/scripts/lib/cocanwiki_pages.mli b/scripts/lib/cocanwiki_pages.mli index 41151bb..9770874 100644 --- a/scripts/lib/cocanwiki_pages.mli +++ b/scripts/lib/cocanwiki_pages.mli @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: cocanwiki_pages.mli,v 1.6 2006/08/04 12:45:33 rich Exp $ + * $Id: cocanwiki_pages.mli,v 1.7 2006/08/14 11:36:50 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 @@ -33,6 +33,7 @@ type model = { pt : pt; (* Page of title (only used if id=0) *) description : string; (* Description. *) keywords : string option; (* Keywords. *) + noodp : bool option; (* NOODP per-page override. *) redirect : string option; (* Redirect to. *) contents_ : section list; (* List of sections. *) } diff --git a/scripts/lib/cocanwiki_template.ml b/scripts/lib/cocanwiki_template.ml index 266c92e..9442f7d 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.9 2006/08/14 10:04:25 rich Exp $ + * $Id: cocanwiki_template.ml,v 1.10 2006/08/14 11:36:50 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 @@ -87,12 +87,13 @@ let get_template ?page dbh hostid filename = "select h.theme_css, h.css is not null, p.name, p.url, h.search_box, h.brand, h.brand_tagline, h.brand_description, - h.pagebug, h.ie_imagetoolbar_no + h.pagebug, h.ie_imagetoolbar_no, h.global_noodp from hosts h left outer join powered_by p on h.powered_by = p.id where h.id = $hostid" in let theme_css, has_host_css, powered_by_name, powered_by_url, search_box, - brand, brand_tagline, brand_description, pagebug, ie_imagetoolbar_no = + brand, brand_tagline, brand_description, pagebug, ie_imagetoolbar_no, + global_noodp = match rows with | [ row ] -> row | _ -> assert false in @@ -145,6 +146,9 @@ let get_template ?page dbh hostid filename = let ie_imagetoolbar_no = match ie_imagetoolbar_no with Some b -> b | _ -> assert false in + let global_noodp = + match global_noodp with Some b -> b | _ -> assert false in + template#set "theme_css" theme_css; template#conditional "has_host_css" has_host_css; template#set "powered_by_name" powered_by_name; @@ -159,6 +163,7 @@ let get_template ?page dbh hostid filename = template#conditional "has_pagebug" has_pagebug; template#set "pagebug" pagebug; template#conditional "ie_imagetoolbar_no" ie_imagetoolbar_no; + template#conditional "noodp" global_noodp; (* Site menu. *) let rows = PGSQL(dbh) @@ -204,6 +209,7 @@ let get_template ?page dbh hostid filename = template#conditional "has_pagebug" false; template#set "pagebug" ""; template#conditional "ie_imagetoolbar_no" false; + template#conditional "noodp" false; template#conditional "is_homepage" false; template#table "sitemenu" []; ); diff --git a/scripts/page.ml b/scripts/page.ml index 9521fe0..adba28f 100644 --- a/scripts/page.ml +++ b/scripts/page.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: page.ml,v 1.52 2006/08/04 12:45:31 rich Exp $ + * $Id: page.ml,v 1.53 2006/08/14 11:36:50 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 @@ -38,6 +38,7 @@ open Cocanwiki_strings type fp_status = | FPOK of int32 * string * string * string option * Calendar.t * bool + * bool option | FPInternalRedirect of string | FPExternalRedirect of string | FPNotFound @@ -185,7 +186,7 @@ let run r (q : cgi) dbh hostid (* This code generates ordinary pages. *) let make_page title description keywords - pageid last_modified_date has_page_css + pageid last_modified_date has_page_css noodp version page page' extension = let t = template_page in let th = template_page_header in @@ -218,6 +219,14 @@ let run r (q : cgi) dbh hostid th#conditional "has_page_css" has_page_css; + (* If the per-page noodp is not null, set the noodp flag here. Otherwise + * we will use the default (from hosts.global_noodp) which was set + * in Cocanwiki_template. + *) + (match noodp with + | None -> () + | Some b -> th#conditional "noodp" b); + (* Are we showing an old version of the page? If so, warn. *) (match version with None -> @@ -561,49 +570,49 @@ let run r (q : cgi) dbh hostid if allow_redirect then ( let rows = PGSQL(dbh) "select url, redirect, id, title, description, keywords, - last_modified_date, css is not null + last_modified_date, css is not null, noodp from pages where hostid = $hostid and lower (url) = lower ($page)" in match rows with - | [Some page', _, _, _, _, _, _, _] + | [Some page', _, _, _, _, _, _, _, _] when page <> page' -> (* different case *) FPExternalRedirect page' | [ _, None, id, title, description, keywords, - last_modified_date, has_page_css ] -> + last_modified_date, has_page_css, noodp ] -> let has_page_css = Option.get has_page_css in FPOK (id, title, description, keywords, last_modified_date, - has_page_css) - | [_, Some redirect, _, _, _, _, _, _] -> + has_page_css, noodp) + | [_, Some redirect, _, _, _, _, _, _, _] -> FPInternalRedirect redirect | [] -> FPNotFound | _ -> assert false ) else (* redirects not allowed ... *) ( let rows = PGSQL(dbh) "select id, title, description, keywords, last_modified_date, - css is not null + css is not null, noodp from pages where hostid = $hostid and url = $page" in match rows with | [ id, title, description, keywords, - last_modified_date, has_page_css ] -> + last_modified_date, has_page_css, noodp ] -> let has_page_css = Option.get has_page_css in FPOK (id, title, description, keywords, last_modified_date, - has_page_css) + has_page_css, noodp) | [] -> FPNotFound | _ -> assert false ) | Some version -> let rows = PGSQL(dbh) "select id, title, description, keywords, last_modified_date, - css is not null + css is not null, noodp from pages where hostid = $hostid and id = $version and (url = $page or url_deleted = $page)" in match rows with | [ id, title, description, keywords, - last_modified_date, has_page_css ] -> + last_modified_date, has_page_css, noodp ] -> let has_page_css = Option.get has_page_css in FPOK (id, title, description, keywords, last_modified_date, - has_page_css) + has_page_css, noodp) | [] -> FPNotFound | _ -> assert false in @@ -627,11 +636,11 @@ let run r (q : cgi) dbh hostid ) else match fetch_page page' version allow_redirect with | FPOK (pageid, title, description, keywords, - last_modified_date, has_page_css)-> + last_modified_date, has_page_css, noodp)-> (* Check if the page is also a template. *) let extension = get_extension page' in make_page title (Some description) keywords (Some pageid) - (printable_date last_modified_date) has_page_css + (printable_date last_modified_date) has_page_css noodp version page page' extension | FPInternalRedirect page' -> loop page' (i+1) @@ -647,7 +656,7 @@ let run r (q : cgi) dbh hostid | (Some _) as extension -> let title = page' in make_page title None None None - "Now" false None page page' + "Now" false None None page page' extension | None -> make_404 ()) diff --git a/scripts/rename_page.ml b/scripts/rename_page.ml index b7ad181..d27e951 100644 --- a/scripts/rename_page.ml +++ b/scripts/rename_page.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: rename_page.ml,v 1.8 2006/08/04 12:45:31 rich Exp $ + * $Id: rename_page.ml,v 1.9 2006/08/14 11:36:50 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 @@ -81,6 +81,7 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = let new_model = { new_model with description = old_model.description; keywords = old_model.keywords; + noodp = old_model.noodp; contents_ = old_model.contents_ } in let old_model = { old_model with redirect = Some new_page } in ignore (save_page r dbh hostid ~user old_model); diff --git a/scripts/restore.ml b/scripts/restore.ml index 01e505f..af88891 100644 --- a/scripts/restore.ml +++ b/scripts/restore.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: restore.ml,v 1.24 2006/08/04 12:45:31 rich Exp $ + * $Id: restore.ml,v 1.25 2006/08/14 11:36:50 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 @@ -46,13 +46,13 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = (* Copy the old version of the page to be live. *) let rows = PGSQL(dbh) - "select title, description, keywords, creation_date, + "select title, description, keywords, noodp, creation_date, redirect, css from pages where hostid = $hostid and url_deleted = $page and id = $version" in - let title, description, keywords, creation_date, redirect, css = + let title, description, keywords, noodp, creation_date, redirect, css = match rows with | [row] -> row | _ -> assert false in @@ -64,10 +64,11 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user = PGSQL(dbh) "update pages set url_deleted = url, url = null where hostid = $hostid and url = $page"; PGSQL(dbh) "insert into pages (hostid, url, title, - description, keywords, + description, keywords, noodp, creation_date, logged_ip, logged_user, redirect, css) values ($hostid, $page, $title, $description, $?keywords, + $?noodp, $creation_date, $?logged_ip, $?logged_user, $?redirect, $?css)"; diff --git a/templates/00-TEMPLATE.html b/templates/00-TEMPLATE.html index 30f5cc8..15499a9 100644 --- a/templates/00-TEMPLATE.html +++ b/templates/00-TEMPLATE.html @@ -2,7 +2,7 @@ XXX TITLE XXX - + diff --git a/templates/broken_links.html b/templates/broken_links.html index 8b3f6ac..b750572 100644 --- a/templates/broken_links.html +++ b/templates/broken_links.html @@ -2,7 +2,7 @@ Broken links - + diff --git a/templates/change_password_form.html b/templates/change_password_form.html index 5235b98..b5a8c98 100644 --- a/templates/change_password_form.html +++ b/templates/change_password_form.html @@ -2,7 +2,7 @@ Change your password - + diff --git a/templates/contact_show.html b/templates/contact_show.html index 507f255..0d3778f 100644 --- a/templates/contact_show.html +++ b/templates/contact_show.html @@ -2,7 +2,7 @@ Contact form: ::name_html:: - + diff --git a/templates/contacts.html b/templates/contacts.html index ad24695..c30c9ef 100644 --- a/templates/contacts.html +++ b/templates/contacts.html @@ -2,7 +2,7 @@ Contact forms - + diff --git a/templates/crash.html b/templates/crash.html index e322086..365ea65 100644 --- a/templates/crash.html +++ b/templates/crash.html @@ -2,7 +2,7 @@ Bug! - + diff --git a/templates/create_contact_form.html b/templates/create_contact_form.html index 9dd7474..4fe82e2 100644 --- a/templates/create_contact_form.html +++ b/templates/create_contact_form.html @@ -2,7 +2,7 @@ Create a contact form - + diff --git a/templates/create_macro_form.html b/templates/create_macro_form.html index 0af167e..bf73d35 100644 --- a/templates/create_macro_form.html +++ b/templates/create_macro_form.html @@ -2,7 +2,7 @@ Create a macro - + diff --git a/templates/create_user_form.html b/templates/create_user_form.html index 97e93dd..2aa0995 100644 --- a/templates/create_user_form.html +++ b/templates/create_user_form.html @@ -2,7 +2,7 @@ Create a user account - + diff --git a/templates/dead_ends.html b/templates/dead_ends.html index 4d31eab..e95a083 100644 --- a/templates/dead_ends.html +++ b/templates/dead_ends.html @@ -2,7 +2,7 @@ Dead end pages - + diff --git a/templates/delete_contact_form.html b/templates/delete_contact_form.html index 9177530..026fe12 100644 --- a/templates/delete_contact_form.html +++ b/templates/delete_contact_form.html @@ -2,7 +2,7 @@ Delete contact forms - + diff --git a/templates/delete_file_form.html b/templates/delete_file_form.html index fb62e7b..b631194 100644 --- a/templates/delete_file_form.html +++ b/templates/delete_file_form.html @@ -3,7 +3,7 @@ Delete file - + diff --git a/templates/delete_image_form.html b/templates/delete_image_form.html index f136650..0d90ddb 100644 --- a/templates/delete_image_form.html +++ b/templates/delete_image_form.html @@ -3,7 +3,7 @@ Delete image - + diff --git a/templates/delete_macro_form.html b/templates/delete_macro_form.html index bd571cb..ba788b7 100644 --- a/templates/delete_macro_form.html +++ b/templates/delete_macro_form.html @@ -2,7 +2,7 @@ Delete macro - + diff --git a/templates/delete_user_form.html b/templates/delete_user_form.html index 828ca50..a9342a3 100644 --- a/templates/delete_user_form.html +++ b/templates/delete_user_form.html @@ -2,7 +2,7 @@ Delete user: ::username_html:: - + diff --git a/templates/diff.html b/templates/diff.html index 16171a5..adb6f57 100644 --- a/templates/diff.html +++ b/templates/diff.html @@ -2,7 +2,7 @@ Diff - + diff --git a/templates/edit.html b/templates/edit.html index e033ab7..edbda5d 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -3,7 +3,7 @@ ::title_html:: [edit] - + @@ -44,6 +44,19 @@ Redirect to:
+ + + ROBOTS NOODP:
+(See +Google sitemaps on page snippets) + + +
+
+ + + + ::if(has_errors):: diff --git a/templates/edit_conflict.html b/templates/edit_conflict.html index 8cc3073..578ba9a 100644 --- a/templates/edit_conflict.html +++ b/templates/edit_conflict.html @@ -2,7 +2,7 @@ Edit conflict - + diff --git a/templates/edit_contact_form.html b/templates/edit_contact_form.html index 473ddea..8776eca 100644 --- a/templates/edit_contact_form.html +++ b/templates/edit_contact_form.html @@ -2,7 +2,7 @@ Edit contact: ::name_html:: - + diff --git a/templates/edit_file_form.html b/templates/edit_file_form.html index ba37e27..ebc8c0c 100644 --- a/templates/edit_file_form.html +++ b/templates/edit_file_form.html @@ -2,7 +2,7 @@ Edit description fields - + diff --git a/templates/edit_host_css_form.html b/templates/edit_host_css_form.html index ac8526b..c860a75 100644 --- a/templates/edit_host_css_form.html +++ b/templates/edit_host_css_form.html @@ -2,7 +2,7 @@ Edit global stylesheet - + diff --git a/templates/edit_host_settings_form.html b/templates/edit_host_settings_form.html index 567512f..6690d38 100644 --- a/templates/edit_host_settings_form.html +++ b/templates/edit_host_settings_form.html @@ -2,7 +2,7 @@ Edit global settings - + @@ -48,6 +48,12 @@ + Global NOODP: + +
Google sitemaps on page snippets + + + Theme: