[prev] [thread] [next] [lurker] [Date index for 2003/11/25]
Author: gabor
Date: 2003-11-25 00:09:13 +0200 (Tue, 25 Nov 2003)
New Revision: 32
Modified:
lib/YAPC/Organizer.pm
Log:
clean up run_modes
Modified: lib/YAPC/Organizer.pm
===================================================================
--- lib/YAPC/Organizer.pm 2003-11-24 21:51:44 UTC (rev 31)
+++ lib/YAPC/Organizer.pm 2003-11-24 22:09:13 UTC (rev 32)
@@ -29,18 +29,32 @@
$self->start_mode('default');
$self->mode_param('run');
$self->run_modes(
- 'default' => 'default',
- 'registration' => 'do_registration',
- 'validation' => 'do_validation',
- 'list_people' => 'do_list_people',
- 'login' => 'do_login',
- 'logout' => 'do_logout',
- 'proposal' => 'do_proposal',
- 'change_password' => 'do_change_password',
- 'get_validation_code' => 'get_validation_code',
- 'get_lost_password' => 'get_lost_password',
- 'no_such_page' => 'do_no_such_page',
- 'user_account' => 'user_account',
+# default
+ 'default' => 'default',
+
+# user_pages
+ 'proposal' => 'proposal',
+ #personal_info
+ 'change_password' => 'change_password',
+ 'user_account' => 'user_account',
+ 'logout' => 'logout',
+
+# admin_pages
+ #admin
+ #admin_list_people
+ #admin_list_proposals
+
+# other pages
+ 'list_people' => 'list_people',
+ 'login' => 'login',
+
+# ?? maybe should be other ?
+ 'registration' => 'registration',
+ 'validation' => 'validation',
+ 'get_validation_code' => 'get_validation_code',
+ 'get_lost_password' => 'get_lost_password',
+ 'no_such_page' => 'no_such_page',
+
);
}
@@ -98,8 +112,8 @@
if (grep {$_ eq $page} @admin_pages) {
my ($person) = YAPC::Person->search(id => $id);
if (grep {$_ eq $person->email} @YAPC::Config::admins) {
- if ($page eq 'admin_list_people') { return $self->do_admin_list_people; }
- if ($page eq 'admin_list_proposals') { return $self->do_admin_list_proposals; }
+ if ($page eq 'admin_list_people') { return $self->admin_list_people; }
+ if ($page eq 'admin_list_proposals') { return $self->admin_list_proposals; }
my $t = $self->_server_page('admin', "$templates_dir/admin.tmpl");
$t->param(approved => 1);
return $t->output;
@@ -116,7 +130,7 @@
}
# maybe this should be replaced with a generic show page call
-sub do_user_account {
+sub user_account {
my $self = shift;
my $t = $self->_server_page('user_account', "$templates_dir/user_account.tmpl");
return $t->output;
@@ -132,15 +146,14 @@
}
-sub do_no_such_page {
+sub no_such_page {
my $self = shift;
- #$filename = "$templates_dir/error.tmpl";
my $t = $self->_server_page('error', "$templates_dir/error.tmpl");
return $t->output;
}
-sub do_change_password {
+sub change_password {
my $self = shift;
my $q = $self->query;
@@ -262,7 +275,6 @@
# <TMPL_VALUE NAME="name" VALUE="value">
my %h;
my $filter = sub {
-# %h = ();
my $text_ref = shift;
while ($$text_ref =~ s/<\s*TMPL_VALUE\s+NAME="([^"]*)"\s+VALUE="([^"]*)"\s*>//) {
$h{$1} = $2;
@@ -285,7 +297,7 @@
return $t;
}
-sub do_list_people {
+sub list_people {
my $self = shift;
my $ar = [];
@@ -307,7 +319,7 @@
return $t->output;
}
-sub do_admin_list_people {
+sub admin_list_people {
my $self = shift;
my $ar = [];
@@ -320,12 +332,11 @@
my $t = $self->_server_page('admin_list_people', "$templates_dir/admin_list_people.tmpl");
my $stat = YAPC::Person->get_statistics();
$t->param(%$stat);
- #warn Dumper $ar;
$t->param(USERS => $ar);
return $t->output;
}
-sub do_admin_list_proposals {
+sub admin_list_proposals {
my $self = shift;
my $ar = [];
@@ -336,7 +347,7 @@
title => $p->title,
};
}
- #warn Dumper $ar;
+
my $t = $self->_server_page('admin_list_proposals', "$templates_dir/admin_list_proposals.tmpl");
$t->param(TALKS => $ar);
return $t->output;
@@ -344,12 +355,12 @@
-sub do_login {
+sub login {
my $self = shift;
my $q = $self->query;
if ($self->is_logged_in) {
- return $self->do_user_account;
+ return $self->user_account;
}
@@ -383,36 +394,33 @@
);
$self->header_props(-cookie => $cookie);
- #my $page = $q->param("next") || 'user_account';
my $page = $q->param("next") || 'user_account';
my $tm = $self->_server_page($page, "$templates_dir/$page.tmpl");
return $tm->output;
}
-=head2 do_logout
+=head2 logout
Removes the entry from the login table.
Does NOT remove the cookie from the browser.
=cut
-sub do_logout {
+sub logout {
my $self = shift;
my $q = $self->query;
- #my %args = $q->Vars
my $cookie = $q->cookie('Yapcom');
eval {
YAPC::Login->logout(cookie => $cookie);
};
my $err = $@;
- #$ENV{REQUEST_URI} = '/logout.html';
my $t = $self->_server_page('logout', "$templates_dir/logout.tmpl");
$t->param(ERROR => $err);
$t->output;
}
-sub do_registration {
+sub registration {
my $self = shift;
my $q = $self->query;
#warn $q->param('run');
@@ -453,7 +461,7 @@
}
}
-sub do_validation {
+sub validation {
my $self = shift;
my $q = $self->query;
@@ -461,7 +469,6 @@
my $gbr = YAPC::Person->acknowladge($q->Vars);
};
if ($@) {
- #warn $@;
my $t = $self->_server_page('validation', "$templates_dir/validation.tmpl");
return $t->output;
} else {
@@ -470,7 +477,7 @@
}
}
-sub build_prop_page {
+sub _build_prop_page {
my $self = shift;
my $q = $self->query;
my $t = shift;
@@ -483,9 +490,9 @@
my @language_selection = map {{ value => $_, text => $_, selected => ($language eq $_)} } @YAPC::Config::proposal_languages;
$t->param(language => \@language_selection);
return $t->output;
- #$t->param(run => 'proposal');
}
-sub do_proposal {
+
+sub proposal {
my $self = shift;
my $q = $self->query;
my $talk;
@@ -500,10 +507,10 @@
if ($@) {
my $msg = $@;
$t->param(MESSAGE => 'There was an error in the provided data.');
- return $self->build_prop_page($t);
+ return $self->_build_prop_page($t);
}
} else { # first time on this page
- return $self->build_prop_page($t);
+ return $self->_build_prop_page($t);
}
# success
@@ -525,7 +532,7 @@
$text .= "Abstract: " . $talk->abstract . "\n";
$text .= "Comments: " . $talk->other . "\n";
- # sending e-mail to administrator about new proposal
+ # sending e-mail to administrator about new proposal
my %mail = (To => $YAPC::Config::email_address,
From => $YAPC::Config::email_address,
Subject => "[YAPC talk] " . $talk->title,
Generated at 01:06 on 25 Nov 2003 by mariachi 0.51