Author: julian
Date: 2006-05-11 06:55:58 -0500 (Thu, 11 May 2006)
New Revision: 8

Modified:
   modules/contact-form/lib/SPFProject/Website/ContactForm.pm
Log:
modules/contact-form/lib/SPFProject/Website/ContactForm.pm
* exec(): allow "-"s (dashes) in option names.
* render(): use "default-*" options as default values for input fields for new
  form renderings.
* Fixed the contact form URL in the message signature footer.


Modified: modules/contact-form/lib/SPFProject/Website/ContactForm.pm
===================================================================
--- modules/contact-form/lib/SPFProject/Website/ContactForm.pm  2006-05-11 
01:38:13 UTC (rev 7)
+++ modules/contact-form/lib/SPFProject/Website/ContactForm.pm  2006-05-11 
11:55:58 UTC (rev 8)
@@ -63,16 +63,15 @@
     my @option_specs = Text::ParseWords::shellwords($arguments);
     foreach my $option_spec (@option_specs) {
         $self->{options}->{lc($1)} = defined($2) ? $2 : TRUE
-            if $option_spec =~ /^(\w+)(?:=(.*))?$/;
+            if $option_spec =~ /^([\w-]+)(?:=(.*))?$/;
     }
     
     $self->{$_} = decode_utf8($query->param($_)) || ''
         foreach qw(name organization email-address subject message);
-    #$options{'default-name'};
-    #$options{'default-organization'};
-    #$options{'default-email-address'};
-    #$options{'default-subject'};
-    #$options{'default-message'};
+    $self->{$_} =~ s/[\x0a\x0d]+/ /g
+        foreach qw(name organization email-address subject);
+        # Security measure: suppress newlines, which could jeopardize the
+        # message's header formatting.
     
     $self->control();
     return $self->render();
@@ -180,19 +179,44 @@
             { -class => 'module-spf-website-contact-form' },
             $q->Tr([
                 $q->th('Your name') .
-                $q->td($q->textfield(-name => 'name',          -size => 40, 
-maxlength => 255)),
+                $q->td($q->textfield(
+                    -name       => 'name',
+                    -default    => $self->{options}->{'default-name'},
+                    -size       => 40,
+                    -maxlength  => 255
+                )),
                 
                 $q->th('Organization') .
-                $q->td($q->textfield(-name => 'organization',  -size => 40, 
-maxlength => 255)),
+                $q->td($q->textfield(
+                    -name       => 'organization',
+                    -default    => $self->{options}->{'default-organization'},
+                    -size       => 40,
+                    -maxlength  => 255
+                )),
                 
                 $q->th('* E-mail address') .
-                $q->td($q->textfield(-name => 'email-address', -size => 40, 
-maxlength => 255)),
+                $q->td($q->textfield(
+                    -name       => 'email-address',
+                    -default    => $self->{options}->{'default-email-address'},
+                    -size       => 40,
+                    -maxlength  => 255
+                )),
                 
                 $q->th('Subject') .
-                $q->td($q->textfield(-name => 'subject',       -size => 40, 
-maxlength => 255)),
+                $q->td($q->textfield(
+                    -name       => 'subject',
+                    -default    => $self->{options}->{'default-subject'},
+                    -size       => 40,
+                    -maxlength  => 255
+                )),
                 
                 $q->th({-style => 'vertical-align: top'}, '* Message') .
-                $q->td($q->textarea(-name => 'message', -columns => 75, -rows 
=> 15)),
+                $q->td($q->textarea(
+                    -name       => 'message',
+                    -default    => $self->{options}->{'default-message'},
+                    -columns    => 75,
+                    -rows       => 15
+                )),
                 
                 $q->th('* = Required field') .
                 $q->td({-style => 'text-align: right'}, $q->submit( { -value 
=> 'Submit' } ))
@@ -234,4 +258,5 @@
 {$message}
 
 -- 
-Message was sent via the SPF website contact form <>
+Message was sent via the SPF website contact form
+<http://new.openspf.org/Contact>

-------
To unsubscribe, change your address, or temporarily deactivate your 
subscription, 
please go to http://v2.listbox.com/member/[EMAIL PROTECTED]

Reply via email to