Edit the description fields (metadata) for images and files.
authorrich <rich>
Mon, 1 Nov 2004 17:05:14 +0000 (17:05 +0000)
committerrich <rich>
Mon, 1 Nov 2004 17:05:14 +0000 (17:05 +0000)
Email notify for deleted files now includes the name.

Replaced homebrew 'string_is_whitespace' function with one from the
libraries.

Updated MANIFEST.

Updated deps.

14 files changed:
MANIFEST
scripts/.depend
scripts/delete_file.ml
scripts/delete_image.ml
scripts/edit_file.ml [new file with mode: 0644]
scripts/edit_file_form.ml [new file with mode: 0644]
scripts/edit_image.ml [new file with mode: 0644]
scripts/edit_image_form.ml [new file with mode: 0644]
scripts/upload_file.ml
scripts/upload_image.ml
templates/edit_file_form.html [new file with mode: 0644]
templates/edit_image_form.html [new file with mode: 0644]
templates/files.html
templates/images.html

index 273860a..4fa2701 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -97,10 +97,14 @@ scripts/diff.ml
 scripts/edit.ml
 scripts/edit_contact.ml
 scripts/edit_contact_form.ml
+scripts/edit_file.ml
+scripts/edit_file_form.ml
 scripts/edit_host_css.ml
 scripts/edit_host_css_form.ml
 scripts/edit_host_settings.ml
 scripts/edit_host_settings_form.ml
+scripts/edit_image.ml
+scripts/edit_image_form.ml
 scripts/edit_page_css.ml
 scripts/edit_page_css_form.ml
 scripts/edit_page_title.ml
@@ -225,8 +229,10 @@ templates/diff.html
 templates/edit.html
 templates/edit_conflict.html
 templates/edit_contact_form.html
+templates/edit_file_form.html
 templates/edit_host_css_form.html
 templates/edit_host_settings_form.html
+templates/edit_image_form.html
 templates/edit_page_css_form.html
 templates/edit_page_email.txt
 templates/edit_page_title_form.html
index 4b938bc..2f0ab5b 100644 (file)
@@ -108,6 +108,14 @@ edit_contact.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \
     lib/cocanwiki_strings.cmx 
 edit_contact_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi 
 edit_contact_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx 
+edit_file.cmo: lib/cocanwiki.cmo lib/cocanwiki_emailnotify.cmo \
+    lib/cocanwiki_ok.cmo lib/cocanwiki_strings.cmo 
+edit_file.cmx: lib/cocanwiki.cmx lib/cocanwiki_emailnotify.cmx \
+    lib/cocanwiki_ok.cmx lib/cocanwiki_strings.cmx 
+edit_file_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo \
+    lib/cocanwiki_template.cmi 
+edit_file_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \
+    lib/cocanwiki_template.cmx 
 edit_host_css.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo \
     lib/cocanwiki_strings.cmo 
 edit_host_css.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \
@@ -118,6 +126,14 @@ edit_host_settings.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo
 edit_host_settings.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx 
 edit_host_settings_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi 
 edit_host_settings_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx 
+edit_image.cmo: lib/cocanwiki.cmo lib/cocanwiki_emailnotify.cmo \
+    lib/cocanwiki_ok.cmo lib/cocanwiki_strings.cmo 
+edit_image.cmx: lib/cocanwiki.cmx lib/cocanwiki_emailnotify.cmx \
+    lib/cocanwiki_ok.cmx lib/cocanwiki_strings.cmx 
+edit_image_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_date.cmo \
+    lib/cocanwiki_template.cmi 
+edit_image_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_date.cmx \
+    lib/cocanwiki_template.cmx 
 edit_page_css.cmo: lib/cocanwiki.cmo lib/cocanwiki_diff.cmi \
     lib/cocanwiki_emailnotify.cmo lib/cocanwiki_ok.cmo \
     lib/cocanwiki_strings.cmo 
@@ -307,15 +323,17 @@ undelete_image.cmx: lib/cocanwiki.cmx lib/cocanwiki_ok.cmx \
 undelete_image_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi 
 undelete_image_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx 
 upload_file.cmo: lib/cocanwiki.cmo lib/cocanwiki_emailnotify.cmo \
-    lib/cocanwiki_images.cmi lib/cocanwiki_ok.cmo lib/cocanwiki_template.cmi 
+    lib/cocanwiki_images.cmi lib/cocanwiki_ok.cmo lib/cocanwiki_strings.cmo \
+    lib/cocanwiki_template.cmi 
 upload_file.cmx: lib/cocanwiki.cmx lib/cocanwiki_emailnotify.cmx \
-    lib/cocanwiki_images.cmx lib/cocanwiki_ok.cmx lib/cocanwiki_template.cmx 
+    lib/cocanwiki_images.cmx lib/cocanwiki_ok.cmx lib/cocanwiki_strings.cmx \
+    lib/cocanwiki_template.cmx 
 upload_file_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi 
 upload_file_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx 
 upload_image.cmo: lib/cocanwiki.cmo lib/cocanwiki_emailnotify.cmo \
-    lib/cocanwiki_images.cmi lib/cocanwiki_ok.cmo 
+    lib/cocanwiki_images.cmi lib/cocanwiki_ok.cmo lib/cocanwiki_strings.cmo 
 upload_image.cmx: lib/cocanwiki.cmx lib/cocanwiki_emailnotify.cmx \
-    lib/cocanwiki_images.cmx lib/cocanwiki_ok.cmx 
+    lib/cocanwiki_images.cmx lib/cocanwiki_ok.cmx lib/cocanwiki_strings.cmx 
 upload_image_form.cmo: lib/cocanwiki.cmo lib/cocanwiki_template.cmi 
 upload_image_form.cmx: lib/cocanwiki.cmx lib/cocanwiki_template.cmx 
 user_prefs.cmo: lib/cocanwiki.cmo lib/cocanwiki_ok.cmo \
index 9c1ac60..209afc6 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: delete_file.ml,v 1.7 2004/10/21 19:54:29 rich Exp $
+ * $Id: delete_file.ml,v 1.8 2004/11/01 17:05:14 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
@@ -32,6 +32,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } user=
   let id = int_of_string (q#param "id") in
 
   if q#param_true "yes" then (
+    (* Get the name. *)
+    let sth = dbh#prepare_cached "select coalesce (name, name_deleted)
+                                    from files
+                                   where hostid = ? and id = ?" in
+    sth#execute [`Int hostid; `Int id];
+    let name = sth#fetch1string () in
+
     (* Delete the file. *)
     let sth = dbh#prepare_cached "update files
                                      set name_deleted = name, name = null
@@ -42,7 +49,8 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } user=
     dbh#commit ();
 
     (* Email notify. *)
-    let subject = "File #" ^ string_of_int id ^ " has been deleted." in
+    let subject = "File " ^ name ^ "#" ^ string_of_int id ^
+                 " has been deleted." in
     let body = fun () ->
       "Page: http://" ^ hostname ^ "/_files?deleted=1" in
 
index 5b64357..ee62ea2 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: delete_image.ml,v 1.7 2004/10/21 19:54:29 rich Exp $
+ * $Id: delete_image.ml,v 1.8 2004/11/01 17:05:14 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
@@ -32,6 +32,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } user=
   let id = int_of_string (q#param "id") in
 
   if q#param_true "yes" then (
+    (* Get the name. *)
+    let sth = dbh#prepare_cached "select coalesce (name, name_deleted)
+                                    from images
+                                   where hostid = ? and id = ?" in
+    sth#execute [`Int hostid; `Int id];
+    let name = sth#fetch1string () in
+
     (* Delete the image. *)
     let sth = dbh#prepare_cached "update images
                                      set name_deleted = name, name = null
@@ -42,11 +49,13 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } user=
     dbh#commit ();
 
     (* Email notify. *)
-    let subject = "Image #" ^ string_of_int id ^ " has been deleted." in
+    let subject = "Image " ^ name ^ "#" ^ string_of_int id ^
+                 " has been deleted." in
     let body = fun () ->
       "Page: http://" ^ hostname ^ "/_images?deleted=1" in
 
     email_notify ~body ~subject ~user dbh hostid;
+
     (* Done. *)
     let buttons = [ ok_button "/_images" ] in
     ok ~title:"Image deleted" ~buttons
diff --git a/scripts/edit_file.ml b/scripts/edit_file.ml
new file mode 100644 (file)
index 0000000..98e8a97
--- /dev/null
@@ -0,0 +1,61 @@
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: edit_file.ml,v 1.1 2004/11/01 17:05:14 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_ok
+open Cocanwiki_strings
+open Cocanwiki_emailnotify
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
+  let id = int_of_string (q#param "id") in
+
+  (* Get the fields. *)
+  let title = q#param "title" in
+
+  let title = if string_is_whitespace title then `Null else `String title in
+
+  (* Edit it. *)
+  let sth = dbh#prepare_cached "update files set title = ?
+                                 where hostid = ? and id = ?
+                                   and name is not null" in
+  sth#execute [title; `Int hostid; `Int id];
+
+  (* Email notify. *)
+  let subject = "Description fields on file #" ^
+               string_of_int id ^ " where changed." in
+  let body = fun () -> "Page: http://" ^ hostname ^ "/_files" in
+
+  email_notify ~body ~subject ~user dbh hostid;
+
+  (* Done it. *)
+  dbh#commit ();
+
+  let buttons = [ ok_button "/_files" ] in
+  ok ~title:"Description fields updated" ~buttons
+    q "The description fields were updated."
+
+let () =
+  register_script ~restrict:[CanEdit] run
diff --git a/scripts/edit_file_form.ml b/scripts/edit_file_form.ml
new file mode 100644 (file)
index 0000000..6db29c9
--- /dev/null
@@ -0,0 +1,59 @@
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: edit_file_form.ml,v 1.1 2004/11/01 17:05:14 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
+open Cocanwiki_date
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
+  let template = get_template dbh hostid "edit_file_form.html" in
+
+  let id = int_of_string (q#param "id") in
+
+  let sth = dbh#prepare_cached "select name, coalesce (title, ''),
+                                       mime_type,
+                                       upload_date
+                                  from files
+                                 where hostid = ? and id = ?" in
+  sth#execute [`Int hostid; `Int id];
+
+  let name, title, mime_type, upload_date =
+    match sth#fetch1 () with
+       [ `String name; `String title; `String mime_type;
+         `Timestamp upload_date ] ->
+         name, title, mime_type, upload_date
+      | _ -> assert false in
+
+  template#set "id" (string_of_int id);
+  template#set "name" name;
+  template#set "title" title;
+  template#set "mime_type" mime_type;
+  template#set "upload_date" (printable_date upload_date);
+
+  q#template template
+
+let () =
+  register_script ~restrict:[CanEdit] run
diff --git a/scripts/edit_image.ml b/scripts/edit_image.ml
new file mode 100644 (file)
index 0000000..d489d3a
--- /dev/null
@@ -0,0 +1,78 @@
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: edit_image.ml,v 1.1 2004/11/01 17:05:14 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_ok
+open Cocanwiki_strings
+open Cocanwiki_emailnotify
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid {hostname = hostname} user =
+  let id = int_of_string (q#param "id") in
+
+  (* Get the fields. *)
+  let alt = q#param "alt" in
+  let title = q#param "title" in
+  let longdesc = q#param "longdesc" in
+  let clazz = q#param "class" in
+
+  (* Check some ALT text was supplied. *)
+  if string_is_whitespace alt then (
+    error ~title:"Missing Alt text" ~back_button:true
+      q ("You must supply Alt text describing the image.  This is required " ^
+        "by accessibility laws and to allow search engines to discover the " ^
+        "content of images.");
+    return ()
+  );
+
+  let title = if string_is_whitespace title then `Null else `String title in
+  let longdesc =
+    if string_is_whitespace longdesc then `Null else `String longdesc in
+  let clazz = if string_is_whitespace clazz then `Null else `String clazz in
+
+  (* Edit it. *)
+  let sth = dbh#prepare_cached "update images set alt = ?, title = ?,
+                                  longdesc = ?, class = ?
+                                 where hostid = ? and id = ?
+                                   and name is not null" in
+  sth#execute [`String alt; title; longdesc; clazz;
+              `Int hostid; `Int id];
+
+  (* Email notify. *)
+  let subject = "Description fields on image #" ^
+               string_of_int id ^ " where changed." in
+  let body = fun () -> "Page: http://" ^ hostname ^ "/_images" in
+
+  email_notify ~body ~subject ~user dbh hostid;
+
+  (* Done it. *)
+  dbh#commit ();
+
+  let buttons = [ ok_button "/_images" ] in
+  ok ~title:"Description fields updated" ~buttons
+    q "The description fields were updated."
+
+let () =
+  register_script ~restrict:[CanEdit] run
diff --git a/scripts/edit_image_form.ml b/scripts/edit_image_form.ml
new file mode 100644 (file)
index 0000000..7e29d9d
--- /dev/null
@@ -0,0 +1,71 @@
+(* COCANWIKI - a wiki written in Objective CAML.
+ * Written by Richard W.M. Jones <rich@merjis.com>.
+ * Copyright (C) 2004 Merjis Ltd.
+ * $Id: edit_image_form.ml,v 1.1 2004/11/01 17:05:14 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
+open Cocanwiki_date
+
+let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
+  let template = get_template dbh hostid "edit_image_form.html" in
+
+  let id = int_of_string (q#param "id") in
+
+  let sth = dbh#prepare_cached "select name, alt, coalesce (title, ''),
+                                       coalesce (longdesc, ''),
+                                       coalesce (class, ''),
+                                       mime_type,
+                                       coalesce (tn_width, 0),
+                                       coalesce (tn_height, 0),
+                                       upload_date
+                                  from images
+                                 where hostid = ? and id = ?" in
+  sth#execute [`Int hostid; `Int id];
+
+  let name, alt, title, longdesc, clazz, mime_type, tn_width, tn_height,
+    upload_date =
+    match sth#fetch1 () with
+       [ `String name; `String alt; `String title; `String longdesc;
+         `String clazz; `String mime_type; `Int tn_width; `Int tn_height;
+         `Timestamp upload_date ] ->
+         name, alt, title, longdesc, clazz, mime_type, tn_width, tn_height,
+         upload_date
+      | _ -> assert false in
+
+  template#set "id" (string_of_int id);
+  template#set "name" name;
+  template#set "alt" alt;
+  template#set "title" title;
+  template#set "longdesc" longdesc;
+  template#set "class" clazz;
+  template#set "mime_type" mime_type;
+  template#set "tn_width" (string_of_int tn_width);
+  template#set "tn_height" (string_of_int tn_height);
+  template#set "upload_date" (printable_date upload_date);
+
+  q#template template
+
+let () =
+  register_script ~restrict:[CanEdit] run
index 5642cd7..fc567b0 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: upload_file.ml,v 1.9 2004/11/01 16:24:50 rich Exp $
+ * $Id: upload_file.ml,v 1.10 2004/11/01 17:05:14 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
@@ -31,9 +31,7 @@ open Cocanwiki_template
 open Cocanwiki_ok
 open Cocanwiki_emailnotify
 open Cocanwiki_images
-
-let is_ws_re = Pcre.regexp "^\\s*$"
-let is_whitespace str = Pcre.pmatch ~rex:is_ws_re str
+open Cocanwiki_strings
 
 (* Valid file names. *)
 let file_ok_re = Pcre.regexp "^[a-z0-9][-._a-z0-9]*$"
@@ -64,7 +62,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } user=
   (* Identify the MIME type from the extension. *)
   let mime_type = mime_type_of_filename name in
 
-  let title = if is_whitespace title then `Null else `String title in
+  let title = if string_is_whitespace title then `Null else `String title in
 
   (* Check if something with the same name already exists.  If replace=1
    * then we can replace it, otherwise we must present an error message.
index 170c400..238b5a2 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: upload_image.ml,v 1.10 2004/11/01 16:24:50 rich Exp $
+ * $Id: upload_image.ml,v 1.11 2004/11/01 17:05:14 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
@@ -30,9 +30,7 @@ open Cocanwiki
 open Cocanwiki_ok
 open Cocanwiki_emailnotify
 open Cocanwiki_images
-
-let is_ws_re = Pcre.regexp "^\\s*$"
-let is_whitespace str = Pcre.pmatch ~rex:is_ws_re str
+open Cocanwiki_strings
 
 (* Valid image names. *)
 let image_ok_re = Pcre.regexp "^[a-z0-9][-._a-z0-9]*\\.(jpg|jpeg|gif|ico|png)$"
@@ -96,7 +94,7 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } user=
   );
 
   (* Check some ALT text was supplied. *)
-  if is_whitespace alt then (
+  if string_is_whitespace alt then (
     error ~title:"Missing Alt text" ~back_button:true
       q ("You must supply Alt text describing the image.  This is required " ^
         "by accessibility laws and to allow search engines to discover the " ^
@@ -104,9 +102,10 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid { hostname = hostname } user=
     return ()
   );
 
-  let title = if is_whitespace title then `Null else `String title in
-  let longdesc = if is_whitespace longdesc then `Null else `String longdesc in
-  let clazz = if is_whitespace clazz then `Null else `String clazz in
+  let title = if string_is_whitespace title then `Null else `String title in
+  let longdesc =
+    if string_is_whitespace longdesc then `Null else `String longdesc in
+  let clazz = if string_is_whitespace clazz then `Null else `String clazz in
 
   (* Make a thumbnail of this image. *)
   let thumbnail, tn_mime_type, tn_width, tn_height =
diff --git a/templates/edit_file_form.html b/templates/edit_file_form.html
new file mode 100644 (file)
index 0000000..ba37e27
--- /dev/null
@@ -0,0 +1,37 @@
+<!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>Edit description fields</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><span>Edit description fields</span></h1>
+
+<form method="post" action="edit_file.cmo">
+<input type="hidden" name="id" value="::id::"/>
+
+<table class="left_table">
+<tr>
+<th> File: </th>
+<td> <img src="/_graphics/file.png" border="0" width="20" height="22" alt="File icon" /> ::name_html:: </td>
+</tr>
+
+<tr>
+<th> Title: </th>
+<td> <input name="title" value="::title_html_tag::" size="70" /> </td>
+</tr>
+
+<tr>
+<td></td>
+<td><input type="submit" value="Save changes" /></td>
+</tr>
+
+</table>
+
+</form>
+
+::include(footer.html)::
+</body>
+</html>
\ No newline at end of file
diff --git a/templates/edit_image_form.html b/templates/edit_image_form.html
new file mode 100644 (file)
index 0000000..c7df86c
--- /dev/null
@@ -0,0 +1,52 @@
+<!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>Edit description fields</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><span>Edit description fields</span></h1>
+
+<form method="post" action="edit_image.cmo">
+<input type="hidden" name="id" value="::id::"/>
+
+<table class="left_table">
+<tr>
+<th> Image: </th>
+<td> <img src="/_image/::name_html_tag::?thumbnail=1&version=::id::" width="::tn_width::" height="::tn_height::" alt="::alt_html_tag::" title="Thumbnail of ::name_html_tag::."/> ::name_html:: </td>
+</tr>
+
+<tr>
+<th> Alt text: </th>
+<td> <input name="alt" value="::alt_html_tag::" size="70" /> </td>
+</tr>
+
+<tr>
+<th> Title: </th>
+<td> <input name="title" value="::title_html_tag::" size="70" /> </td>
+</tr>
+
+<tr>
+<th> Longdesc: </th>
+<td> <textarea name="longdesc" rows="5" cols="80">::longdesc_html_textarea::</textarea> </td>
+</tr>
+
+<tr>
+<th> Class: </th>
+<td> <input name="class" value="::class_html_tag::" size="20" /> </td>
+</tr>
+
+<tr>
+<td></td>
+<td><input type="submit" value="Save changes" /></td>
+</tr>
+
+</table>
+
+</form>
+
+::include(footer.html)::
+</body>
+</html>
\ No newline at end of file
index 9f5f85c..2d2872f 100644 (file)
@@ -43,8 +43,8 @@ Name: <strong>::name_html::</strong> (size: ::ksize_html:: K) <br/>
 ::if(is_deleted)::
 <li class="first"><a href="/_bin/undelete_file_form.cmo?id=::id_url::">Restore</a></li>
 ::else::
-<li class="first"><a href="/_bin/edit_file_form.cmo?id=::id_url::">Edit</a> </li>
-<li><a href="/_bin/upload_file_form.cmo?id=::id_url::&replace=1">Replace</a> </li>
+<li class="first"><a href="/_bin/edit_file_form.cmo?id=::id_url::">Edit description fields</a> </li>
+<li><a href="/_bin/upload_file_form.cmo?id=::id_url::&replace=1">Replace file</a> </li>
 <li><a href="/_bin/delete_file_form.cmo?id=::id_url::">Delete</a></li>
 ::end::
 </ul>
index 7fbb10d..eab7f42 100644 (file)
@@ -45,8 +45,8 @@ ALT text: ::alt_html:: <br/>
 ::if(is_deleted)::
 <li class="first"><a href="/_bin/undelete_image_form.cmo?id=::id_url::">Restore</a></li>
 ::else::
-<li class="first"><a href="/_bin/edit_image_form.cmo?id=::id_url::">Edit</a></li>
-<li><a href="/_bin/upload_image_form.cmo?id=::id_url::&replace=1">Replace</a></li>
+<li class="first"><a href="/_bin/edit_image_form.cmo?id=::id_url::">Edit description fields</a></li>
+<li><a href="/_bin/upload_image_form.cmo?id=::id_url::&replace=1">Replace image</a></li>
 <li><a href="/_bin/delete_image_form.cmo?id=::id_url::">Delete</a></li>
 ::end::
 </ul>