[Cpan-forum-commit] rev 180 - in trunk: . bin lib/CPAN lib/CPAN/Forum templates

svn at pti.co.il svn at pti.co.il
Sun Aug 27 07:12:50 IDT 2006


Author: gabor
Date: 2006-08-27 07:12:49 +0300 (Sun, 27 Aug 2006)
New Revision: 180

Added:
   trunk/templates/stats.tmpl
Modified:
   trunk/
   trunk/Changes
   trunk/bin/create_feed.pl
   trunk/lib/CPAN/Forum.pm
   trunk/lib/CPAN/Forum/Posts.pm
   trunk/templates/navigation.tmpl
Log:
Add /stats page to show 50 most active modules



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11024
   + 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11029

Modified: trunk/Changes
===================================================================
--- trunk/Changes	2006-08-26 16:48:02 UTC (rev 179)
+++ trunk/Changes	2006-08-27 04:12:49 UTC (rev 180)
@@ -3,6 +3,7 @@
 
   Provide a csv file with the number of posts for each distribution so 
   other sites can include it.
+  Create stats page with top 50 modules
 
   Logging: add client IP to logger to enable filtering log messages based on that 
 

Modified: trunk/bin/create_feed.pl
===================================================================
--- trunk/bin/create_feed.pl	2006-08-26 16:48:02 UTC (rev 179)
+++ trunk/bin/create_feed.pl	2006-08-27 04:12:49 UTC (rev 180)
@@ -23,7 +23,7 @@
 
 ;
 open my $out, '>', $opts{csv} or die $!;
-foreach my $entry (CPAN::Forum::Posts->search_stat_posts) {
+foreach my $entry (CPAN::Forum::Posts->search_stat_posts(5000)) {
     if ($csv->combine($entry->{gname}, $entry->{cnt})) {
         print {$out} $csv->string(), "\n";
     } else {

Modified: trunk/lib/CPAN/Forum/Posts.pm
===================================================================
--- trunk/lib/CPAN/Forum/Posts.pm	2006-08-26 16:48:02 UTC (rev 179)
+++ trunk/lib/CPAN/Forum/Posts.pm	2006-08-27 04:12:49 UTC (rev 180)
@@ -26,9 +26,10 @@
 __PACKAGE__->set_sql(stat_posts => qq{
             SELECT COUNT(*) cnt, groups.name gname
             FROM posts,groups 
-            WHERE posts.gid=groups.id 
+            WHERE posts.gid=groups.id
             GROUP BY gname
             ORDER BY cnt DESC
+            LIMIT ? 
             });
 
 sub retrieve_latest { 

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2006-08-26 16:48:02 UTC (rev 179)
+++ trunk/lib/CPAN/Forum.pm	2006-08-27 04:12:49 UTC (rev 180)
@@ -282,6 +282,7 @@
 
 root templates:
 
+stats.tmpl
 about.tmpl
 change_password.tmpl
 faq.tmpl
@@ -491,7 +492,7 @@
     login login_process 
     register register_process 
     logout 
-    about faq
+    about faq stats
     posts threads dist users 
     search all 
     site_is_closed
@@ -514,7 +515,7 @@
     help
     new_post pwreminder 
     login register 
-    posts about 
+    posts about stats
     threads dist users 
     response_form 
     faq 
@@ -711,6 +712,15 @@
     $t->output;
 }
 
+sub stats {
+    my $self = shift;
+    my $t = $self->load_tmpl("stats.tmpl");
+    my @entries = CPAN::Forum::Posts->search_stat_posts(50);
+    
+    $t->param(entries => \@entries);
+    $t->output;
+}
+
 sub faq {
     my $self = shift;
     my $t = $self->load_tmpl("faq.tmpl");

Modified: trunk/templates/navigation.tmpl
===================================================================
--- trunk/templates/navigation.tmpl	2006-08-26 16:48:02 UTC (rev 179)
+++ trunk/templates/navigation.tmpl	2006-08-27 04:12:49 UTC (rev 180)
@@ -3,6 +3,7 @@
 		<a href="/">home</a> |
 		<a href="/faq/">FAQ</a> |
 		<a href="/about/">about</a> |
+		<a href="/stats/">stats</a> |
 		<a href="/new_post/<TMPL_VAR group>">new post</a> |
 		<TMPL_IF loggedin>
 		  You are logged in as <a href="/users/<TMPL_VAR username>"><TMPL_VAR username></a> |

Added: trunk/templates/stats.tmpl
===================================================================
--- trunk/templates/stats.tmpl	2006-08-26 16:48:02 UTC (rev 179)
+++ trunk/templates/stats.tmpl	2006-08-27 04:12:49 UTC (rev 180)
@@ -0,0 +1,16 @@
+<TMPL_INCLUDE NAME="head.tmpl">
+<p id="pageTitle">Statistics of CPAN::Forum</p>
+
+<TMPL_INCLUDE NAME="navigation.tmpl">
+
+<a name="statistics"></a>
+<div class="about_list">
+<p class="about_title">Top 50 modules (number of posts)</p>
+<table>
+<TMPL_LOOP entries>
+  <tr><td><a href="/dist/<TMPL_VAR gname>"><TMPL_VAR gname></a></td><td><TMPL_VAR cnt></td></tr>
+</TMPL_LOOP>
+</table>
+</div>
+<TMPL_INCLUDE NAME="footer.tmpl">
+



More information about the Cpan-forum-commit mailing list