registration automatically closes
authorTroy Sankey <sankeytms@gmail.com>
Sun, 9 Feb 2014 11:17:57 +0000 (03:17 -0800)
committerTroy Sankey <sankeytms@gmail.com>
Sun, 9 Feb 2014 11:17:57 +0000 (03:17 -0800)
index.pl

index cf3cb1d..521949c 100755 (executable)
--- a/index.pl
+++ b/index.pl
@@ -85,32 +85,65 @@ sub print_rsvp_form {
   print $q->start_table(),
         "<tr>",
         "<td style=\"text-align:right;\">", "<em>Full Name: </em>", "</td>",
-        "<td>", $q->textfield(-name=>'full_name',
-                              -size=>30,
-                              -maxlength=>80,
-                              -disabled=>$disabled), "</td>",
+        "<td>";
+  if ($disabled) {
+    print $q->textfield(-name=>'full_name',
+                        -size=>30,
+                        -maxlength=>80,
+                        -disabled=>undef);
+  } else {
+    print $q->textfield(-name=>'full_name',
+                        -size=>30,
+                        -maxlength=>80);
+  }
+  print "</td>",
         "</tr>\n",
         "<tr>",
         "<td style=\"text-align:right;\">", "<em>Email: </em>", "</td>",
-        "<td>", $q->textfield(-name=>'email',
-                              -size=>30,
-                              -maxlength=>80,
-                              -disabled=>$disabled), " <em>(must be one of the emails in your key)</em>", "</td>",
+        "<td>";
+  if ($disabled) {
+    print $q->textfield(-name=>'email',
+                        -size=>30,
+                        -maxlength=>80,
+                        -disabled=>undef);
+  } else {
+    print $q->textfield(-name=>'email',
+                        -size=>30,
+                        -maxlength=>80);
+  }             
+  print " <em>(must be one of the emails in your key)</em>", "</td>",
         "</tr>\n",
         "<tr>",
         "<td style=\"text-align:right;\">", "<em>Your PGP Key Fingerprint: </em>", "</td>",
-        "<td>", $q->textfield(-name=>'fingerprint',
-                              -default=>'',
-                              -override=>1,
-                              -size=>50,
-                              -maxlength=>50,
-                              -disabled=>$disabled), "</td>",
+        "<td>";
+  if ($disabled) {
+    print $q->textfield(-name=>'fingerprint',
+                        -default=>'',
+                        -override=>1,
+                        -size=>50,
+                        -maxlength=>50,
+                        -disabled=>undef);
+  } else {
+    print $q->textfield(-name=>'fingerprint',
+                        -default=>'',
+                        -override=>1,
+                        -size=>50,
+                        -maxlength=>50);
+  }
+  print "</td>",
         "</tr>\n",
         "<tr>",
         "<td></td>",
-        "<td>", $q->submit(-name=>'submit',
-                           -value=>'Submit',
-                           -disabled=>$disabled), " <em>(registration disabled 24h before the event)</em></td>",
+        "<td>";
+  if ($disabled) {
+    print $q->submit(-name=>'submit',
+                     -value=>'Submit',
+                     -disabled=>undef);
+  } else {
+    print $q->submit(-name=>'submit',
+                     -value=>'Submit');
+  }
+  print " <em>(registration disabled 24h before the event)</em></td>",
         "</tr>",
         $q->end_table();
 
@@ -482,15 +515,15 @@ sub print_body_home {
     print "<p>Next keysigning party: <ins>none planned yet :-(</ins></p>";
   }
   print "<p>If you would like to attend, please RSVP by filling in the form below. You may attend even if registration has been closed!</p>";
-  my $registration_closed;
+  my $registration_closed = 0;
   if (!defined $next_party_idx) {
     $registration_closed = 1;
   } else {
     # registration is closed if now + 24h > next party.
     $registration_closed =
-      (-1 == DateTime->compare(DateTime->now( time_zone => 'local' )
+      (1 == DateTime->compare(DateTime->now( time_zone => 'local' )
                                        ->add_duration( DateTime::Duration->new( days => 1 ) ),
-                               $next_party_datetime));
+                              $next_party_datetime));
   }
   print_rsvp_form($registration_closed);
   print "<p>For instructions and more information, see the ",