[MKDoc-commit] Patch from Sam to add Descriptions to Image components.

chris at mkdoc.demon.co.uk chris at mkdoc.demon.co.uk
Mon Jul 11 12:11:50 BST 2005


Log Message:
-----------
Patch from Sam to add Descriptions to Image components.

Tags:
----
mkdoc-1-6

Modified Files:
--------------
    mkd/flo/editor:
        Image.pm
    mkd/templates/component/image:
        en.html
    mkd/templates/editor/image:
        en.html

-------------- next part --------------
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/component/image/Attic/en.html,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -Ltemplates/component/image/en.html -Ltemplates/component/image/en.html -u -r1.1.2.6 -r1.1.2.7
--- templates/component/image/en.html
+++ templates/component/image/en.html
@@ -11,11 +11,14 @@
 >
   <a 
     href="#"
-    petal:omit-tag="false: self/link"
-    petal:attributes="href self/link/uri; title self/link/description"
+    petal:omit-tag="false:  self/link"
+    petal:attributes="href  self/link/uri; 
+                      title self/link/description"
   ><img
      src="#"
      alt="a beautiful image"
-     petal:attributes="src self/uri; alt self/title" 
+     petal:attributes="src   self/uri; 
+                       alt   self/title;
+                       title self/description" 
   /></a>
 </span>
Index: Image.pm
===================================================================
RCS file: /var/spool/cvs/mkd/flo/editor/Image.pm,v
retrieving revision 1.7.2.26
retrieving revision 1.7.2.27
diff -Lflo/editor/Image.pm -Lflo/editor/Image.pm -u -r1.7.2.26 -r1.7.2.27
--- flo/editor/Image.pm
+++ flo/editor/Image.pm
@@ -111,18 +111,12 @@
     # if CGI is defined, then we probably want to do some stuff
     if (defined $cgi)
     {
-	# update alt field
-	if (defined $cgi->param ($param_name . "_alt"))
-	{
-	    my $alt = $cgi->param ($param_name . "_alt");
-	    $self->{title} = $alt;
-	}
-	else
-	{
-	    my $empty = "";
-	    $self->{title} = $empty;
-	}
-	
+	# update fields
+        $self->{title}       = $cgi->param($param_name . "_alt");
+        $self->{title}       = "" unless defined $self->{title};
+        $self->{description} = $cgi->param($param_name . "_description");
+        $self->{description} = "" unless defined $self->{description};
+
 	# if the upload field is not empty, then the user
 	# just uploaded a new image
 	if (defined $cgi->param ($param_name . "_upload"))
@@ -199,7 +193,7 @@
 sub description
 {
     my $self = shift;
-    return $self->{title};
+    return $self->{description};
 }
 
 
Index: en.html
===================================================================
RCS file: /var/spool/cvs/mkd/templates/editor/image/Attic/en.html,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -Ltemplates/editor/image/en.html -Ltemplates/editor/image/en.html -u -r1.1.2.9 -r1.1.2.10
--- templates/editor/image/en.html
+++ templates/editor/image/en.html
@@ -13,6 +13,7 @@
                 name_move_down   string:${self/block_name}_down;
                 name_delete      string:${self/block_name}_delete;
                 name_alt         string:${self/block_name}_alt;
+                name_description string:${self/block_name}_description;
                 name_upload      string:${self/block_name}_upload;
                 dir              self/direction;
                 align            self/align"
@@ -127,6 +128,37 @@
         lang="en"
         dir="ltr"
       >
+        The description of the image.  This may be used to describe
+        the image to site visitors.
+      </em>
+      <label
+        for="image_description"
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+        title="The description of the image."
+        petal:attributes="for name_description"
+      >Description</label>
+      <br />
+      <input
+        type="text"
+        name="image_description"
+        id="image_description"
+        class="input-text"
+        value="Image Description"
+        size="60"
+        title="Enter the description of the image here."
+        petal:attributes="name name_description; id name_description; value self/description"
+      />
+    </p>
+
+    <p>
+      <em
+        class="help"
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+      >
          Use the Browse button to select the file from your computer and the Upload 
          button to upload it. 
       </em>


More information about the MKDoc-commit mailing list