[Cpan-forum-commit] rev 95 - in trunk/lib/CPAN: . Forum
svn at pti.co.il
svn at pti.co.il
Sun Feb 6 13:12:09 IST 2005
Author: gabor
Date: 2005-02-06 13:12:08 +0200 (Sun, 06 Feb 2005)
New Revision: 95
Modified:
trunk/lib/CPAN/Forum.pm
trunk/lib/CPAN/Forum/Configure.pm
Log:
read per_page from the configure module directly
Modified: trunk/lib/CPAN/Forum/Configure.pm
===================================================================
--- trunk/lib/CPAN/Forum/Configure.pm 2005-02-06 11:05:29 UTC (rev 94)
+++ trunk/lib/CPAN/Forum/Configure.pm 2005-02-06 11:12:08 UTC (rev 95)
@@ -7,8 +7,13 @@
__PACKAGE__->columns(All => qw/field value/);
-1;
+sub param {
+ my ($self, $field, $value) = @_;
+ my ($handle) = CPAN::Forum::Configure->search({field => $field});
+ return $handle->value if $handle;
+ return;
+}
1;
Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm 2005-02-06 11:05:29 UTC (rev 94)
+++ trunk/lib/CPAN/Forum.pm 2005-02-06 11:12:08 UTC (rev 95)
@@ -16,8 +16,6 @@
use CPAN::Forum::INC;
-my $limit;
-
my $limit_rss = 10;
my $cookiename = "cpanforum";
my $SUBJECT = qr{[\w .:~!@#\$%^&*\()+?><,'";=-]+};
@@ -584,8 +582,6 @@
$self->log->debug("--- START ---");
- my ($field) = CPAN::Forum::Configure->search({field => "per_page"});
- $limit = $field->value if $field;
CGI::Session->name($cookiename);
$self->session_config(
@@ -606,6 +602,12 @@
$self->session_cookie();
}
+sub config {
+ my ($self, $field) = @_;
+
+ CPAN::Forum::Configure->param($field);
+}
+
# modes that can be accessed without a valid session
my @free_modes = qw(home
pwreminder pwreminder_process
@@ -737,19 +739,19 @@
);
my $page = $q->param('page') || 1;
- $self->_search_results($t, {where => {}, page => $page, per_page => $limit});
+ $self->_search_results($t, {where => {}, page => $page});
$t->output;
}
sub _search_results {
my ($self, $t, $params) = @_;
+ $params->{per_page} = $self->config("per_page");
+
my $pager = CPAN::Forum::Posts->mysearch($params);
my @results = $pager->search_where();
my $total = $pager->total_entries;
$self->log->debug("number of entries: total=$total");
- #$self->session->param('per_page' => $per_page);
- #$self->session->param('current_page' => $pager->current_page);
my $data = $self->build_listing(\@results);
$t->param(messages => $data);
@@ -1570,7 +1572,7 @@
}
my $page = $q->param('page') || 1;
- $self->_search_results($t, {where => {gid => $gid}, page => $page, per_page => $limit});
+ $self->_search_results($t, {where => {gid => $gid}, page => $page});
$t->output;
}
@@ -1619,7 +1621,7 @@
$t->param(title => "Information about $username");
my $page = $q->param('page') || 1;
- $self->_search_results($t, {where => {uid => $username}, page => $page, per_page => $limit});
+ $self->_search_results($t, {where => {uid => $username}, page => $page});
$t->output;
}
@@ -1872,7 +1874,7 @@
$self->log->debug("Search 2: " . join "|", %where);
my $page = $q->param('page') || 1;
- $self->_search_results($t, {where => \%where, page => $page, per_page => $limit});
+ $self->_search_results($t, {where => \%where, page => $page});
$t->param($what => 1);
}
More information about the Cpan-forum-commit
mailing list