[Cpan-forum-commit] rev 197 - in trunk: . lib/CPAN lib/CPAN/Forum lib/CPAN/Forum/RM
svn at pti.co.il
svn at pti.co.il
Tue Aug 29 18:43:16 IDT 2006
Author: gabor
Date: 2006-08-29 18:43:15 +0300 (Tue, 29 Aug 2006)
New Revision: 197
Added:
trunk/lib/CPAN/Forum/RM/
trunk/lib/CPAN/Forum/RM/Author.pm
Modified:
trunk/
trunk/lib/CPAN/Forum.pm
Log:
Move the author run-mode to a separate file
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11061
+ 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11062
Added: trunk/lib/CPAN/Forum/RM/Author.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Author.pm 2006-08-29 15:43:10 UTC (rev 196)
+++ trunk/lib/CPAN/Forum/RM/Author.pm 2006-08-29 15:43:15 UTC (rev 197)
@@ -0,0 +1,45 @@
+package CPAN::Forum::RM::Author;
+use strict;
+use warnings;
+
+=head2 author
+
+List posts by module author (PAUSEID)
+
+=cut
+
+sub author {
+ my ($self) = @_;
+ my $q = $self->query;
+
+ my $pauseid = ${$self->param("path_parameters")}[0] || '';
+ $self->log->debug("show posts to modules of PAUSEID: '$pauseid'");
+
+ my $t = $self->load_tmpl("authors.tmpl",
+ loop_context_vars => 1,
+ global_vars => 1,
+ );
+
+ $t->param(pauseid => $pauseid);
+ $t->param(title => "CPAN Forum - $pauseid");
+
+ my ($author) = CPAN::Forum::Authors->search(pauseid => $pauseid);
+ if (not $author) {
+ $self->log->warning("Invalid pauseid $pauseid called in $ENV{PATH_INFO}");
+ return $self->internal_error(
+ "",
+ "no_such_pauseid",
+ );
+ }
+ # TODO: simplify query!
+ my @group_ids = map {$_->id}
+ CPAN::Forum::Groups->search( pauseid => $author->id );
+ $self->log->warning("Group IDs: @group_ids");
+ my $page = $q->param('page') || 1;
+ $self->_search_results($t, {where => {gid => \@group_ids}, page => $page});
+ #$self->_subscriptions($t, $gr);
+ $t->output;
+}
+
+1;
+
Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm 2006-08-29 15:43:10 UTC (rev 196)
+++ trunk/lib/CPAN/Forum.pm 2006-08-29 15:43:15 UTC (rev 197)
@@ -536,6 +536,10 @@
mypan selfconfig
search all rss);
+my %RM_MAP = (
+ author => 'CPAN::Forum::RM::Author',
+);
+
=head2 setup
Standard CGI::Application method
@@ -570,8 +574,11 @@
}
my $rm = $self->_set_run_mode();
- $self->log->debug("Current runmode: $rm");
+ if ($RM_MAP{$rm}) {
+ eval "use base $RM_MAP{$rm}";
+ }
+ $self->log->debug("Current runmode: $rm");
$self->log->debug("Current user: " . ($self->session->param("username") || ""));
$self->log->debug("Current sid: " . ($self->session->id() || ""));
@@ -1595,47 +1602,7 @@
}
}
-=head2 author
-List posts by module author (PAUSEID)
-
-=cut
-
-sub author {
- my ($self) = @_;
- my $q = $self->query;
-
- my $pauseid = ${$self->param("path_parameters")}[0] || '';
- $self->log->debug("show posts to modules of PAUSEID: '$pauseid'");
-
- my $t = $self->load_tmpl("authors.tmpl",
- loop_context_vars => 1,
- global_vars => 1,
- );
-
- $t->param(pauseid => $pauseid);
- $t->param(title => "CPAN Forum - $pauseid");
-
- my ($author) = CPAN::Forum::Authors->search(pauseid => $pauseid);
- if (not $author) {
- $self->log->warning("Invalid pauseid $pauseid called in $ENV{PATH_INFO}");
- return $self->internal_error(
- "",
- "no_such_pauseid",
- );
- }
- # TODO: simplify query!
- my @group_ids = map {$_->id}
- CPAN::Forum::Groups->search( pauseid => $author->id );
- $self->log->warning("Group IDs: @group_ids");
- my $page = $q->param('page') || 1;
- $self->_search_results($t, {where => {gid => \@group_ids}, page => $page});
- #$self->_subscriptions($t, $gr);
- $t->output;
-}
-
-
-
=head2 dist
List last few posts belonging to this group, provides a link to post a new
More information about the Cpan-forum-commit
mailing list