[Yapcom checkin] rev 8 - / lib/YAPC templates

[prev] [thread] [next] [lurker] [Date index for 2003/11/23]

From: svn
Subject: [Yapcom checkin] rev 8 - / lib/YAPC templates
Date: 17:59 on 23 Nov 2003
Author: gabor
Date: 2003-11-23 17:59:56 +0200 (Sun, 23 Nov 2003)
New Revision: 8

Modified:
   README
   lib/YAPC/Config.pm
   lib/YAPC/Organizer.pm
   lib/YAPC/Talk.pm
   templates/proposal.tmpl
Log:
make proposal length configurable

Modified: README
===================================================================
--- README	2003-11-23 15:32:15 UTC (rev 7)
+++ README	2003-11-23 15:59:56 UTC (rev 8)
@@ -38,8 +38,8 @@
     - further refactoring the tests
     - add pages to get back lost password and get validation code again
         if e-mail was not yet validated.
+    - make list of proposal lengths configurable and add 180 min too
 
-
 0.07_01 2003.11.15
     - send e-mail on every registration to administrator
     - start adding tests for changing user info

Modified: lib/YAPC/Config.pm
===================================================================
--- lib/YAPC/Config.pm	2003-11-23 15:32:15 UTC (rev 7)
+++ lib/YAPC/Config.pm	2003-11-23 15:59:56 UTC (rev 8)
@@ -1,7 +1,7 @@
 package YAPC::Config;
 use strict;
 use warnings;
-our (@STORAGE, $dir, $db_dir, $db_file, $TIMEOUT, $templates_dir, $email_address);
+our (@STORAGE, $dir, $db_dir, $db_file, $TIMEOUT, $templates_dir, $email_address, @proposal_lengths);
 
 $dir = "/home/gabor/projects/perl/perl.org.il/YAPC/dev";
 $email_address = 'yapc@xxxx.xxx.xx';
@@ -16,4 +16,13 @@
 $TIMEOUT = 100;
 $templates_dir = "$dir/templates";
 
+
+@proposal_lengths = (5, 30, 60, 90, 180);
 1;
+
+=head1 VERSION
+
+$Id:$
+
+=cut
+

Modified: lib/YAPC/Organizer.pm
===================================================================
--- lib/YAPC/Organizer.pm	2003-11-23 15:32:15 UTC (rev 7)
+++ lib/YAPC/Organizer.pm	2003-11-23 15:59:56 UTC (rev 8)
@@ -92,6 +92,8 @@
     my $t = $self->_server_page($page, $filename);
     if ($page eq 'proposal') {
        $t->param(run => 'send_proposal');
+       my @length_selection = map {{ value => $_, text => $_} } @YAPC::Config::proposal_lengths;
+       $t->param(length => \@length_selection);
     }
     return $t->output;
 }
@@ -372,6 +374,9 @@
        my $msg = $@;
        my $t = $self->_server_page('send_proposal', "$templates_dir/proposal.tmpl");
        $t->param(MESSAGE => 'There was an error in the provided data.');
+       my $length = $q->param('length');
+       my @length_selection = map {{ value => $_, text => $_, selected => ($length eq $_)} } @YAPC::Config::proposal_lengths;
+       $t->param(length => \@length_selection);
        return $t->output;
     } else {
        my $talker_id = YAPC::Talk->get_user_id(id => $talk->id);

Modified: lib/YAPC/Talk.pm
===================================================================
--- lib/YAPC/Talk.pm	2003-11-23 15:32:15 UTC (rev 7)
+++ lib/YAPC/Talk.pm	2003-11-23 15:59:56 UTC (rev 8)
@@ -4,6 +4,7 @@
 use Carp;
 use YAPC::DBI;
 use base 'YAPC::DBI';
+use YAPC::Config;
 __PACKAGE__->set_up_table('talks');
 
 =head2 propose
@@ -37,7 +38,7 @@
        croak("Incorrect language\n");
     }
 
-    if (not grep {$args{'length'} eq $_} qw(5 30 60 90)) {
+    if (not grep {$args{'length'} eq $_} @YAPC::Config::proposal_lengths) {
        croak("Incorrect length\n");
     }
 
@@ -63,6 +64,12 @@
    return $talks[0]->user_id;
 } 
 
+=head2 VERSION
 
+$Id:$
+
+=cut
+
+
 1;
 

Modified: templates/proposal.tmpl
===================================================================
--- templates/proposal.tmpl	2003-11-23 15:32:15 UTC (rev 7)
+++ templates/proposal.tmpl	2003-11-23 15:59:56 UTC (rev 8)
@@ -15,12 +15,13 @@
        <option value="Hebrew">Hebrew
        <option value="English">English
        </select></td></tr>
-<tr><td>Length (in minutes):</td><td><select name="length">
-       <option value="5">5
-       <option value="30">30
-       <option value="60">60
-       <option value="90">90
-       </select></td></tr>
+<tr><td>Length (in minutes):</td><td>
+     <select name="length">
+       <TMPL_LOOP NAME="length">
+         <option value="<TMPL_VAR NAME=value>" <TMPL_IF NAME=selected>selected</TMPL_IF>>
+           <TMPL_VAR NAME=text>
+       </TMPL_LOOP>
+     </select></td></tr>
 <tr><td colspan="2">Abstract<br>
         <textarea cols=60 rows=20 name="abstract"><TMPL_VAR NAME=abstract></textarea></td></tr>
 <tr><td colspan="2">Comments and special requests to the organizers<br>

Generated at 19:06 on 23 Nov 2003 by mariachi 0.51