[Cpan-forum-commit] rev 93 - in trunk: lib/CPAN templates

svn at pti.co.il svn at pti.co.il
Sun Feb 6 12:47:53 IST 2005


Author: gabor
Date: 2005-02-06 12:47:53 +0200 (Sun, 06 Feb 2005)
New Revision: 93

Modified:
   trunk/lib/CPAN/Forum.pm
   trunk/templates/admin.tmpl
Log:
admin configure site-wise page size via the web interface

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2005-02-06 10:13:34 UTC (rev 92)
+++ trunk/lib/CPAN/Forum.pm	2005-02-06 10:47:53 UTC (rev 93)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-our $VERSION = "0.11";
+our $VERSION = "0.11_01";
 
 use base "CGI::Application";
 use CGI::Application::Plugin::Session;
@@ -16,7 +16,8 @@
 
 use CPAN::Forum::INC;
 
-my $limit       = 20;
+my $limit;
+
 my $limit_rss   = 10;
 my $cookiename  = "cpanforum";
 my $SUBJECT = qr{[\w .:~!@#\$%^&*\()+?><,'";=-]+};
@@ -582,6 +583,9 @@
 	);
 
 	$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(
@@ -1942,6 +1946,11 @@
 		$self->log->fatal("Could not find from field !!");
 	}
 
+	if (my ($conf) = CPAN::Forum::Configure->find_or_create({field => 'per_page'})) {
+		$conf->value($q->param('per_page'));
+		$conf->update;
+	}
+
 	my $t = $self->load_tmpl("admin.tmpl");
 	$t->param(updated => 1);
 	$t->output;

Modified: trunk/templates/admin.tmpl
===================================================================
--- trunk/templates/admin.tmpl	2005-02-06 10:13:34 UTC (rev 92)
+++ trunk/templates/admin.tmpl	2005-02-06 10:47:53 UTC (rev 93)
@@ -3,6 +3,7 @@
 
 <TMPL_INCLUDE NAME="navigation.tmpl">
 
+<TMPL_INCLUDE NAME="search_form.tmpl">
 
 <TMPL_IF updated>
 Data updated. <a href="/admin/">look it again</a>
@@ -14,6 +15,7 @@
 </p>
 <table>
 <tr><td>From address:</td><td><input name="from" value="<TMPL_VAR from>" size="50"></td></tr>
+<tr><td>Page size:</td><td><input name="per_page" value="<TMPL_VAR per_page>" size="5"></td></tr>
 </table>
 <p>
 <input type="submit" value="Update" />



More information about the Cpan-forum-commit mailing list