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

svn at pti.co.il svn at pti.co.il
Tue Aug 29 18:43:10 IDT 2006


Author: gabor
Date: 2006-08-29 18:43:10 +0300 (Tue, 29 Aug 2006)
New Revision: 196

Added:
   trunk/templates/authors.tmpl
Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
   trunk/templates/internal_error.tmpl
Log:
List all posts related to modules of a single CPAN author



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

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2006-08-29 12:44:43 UTC (rev 195)
+++ trunk/lib/CPAN/Forum.pm	2006-08-29 15:43:10 UTC (rev 196)
@@ -505,7 +505,7 @@
     register register_process 
     logout 
     about faq stats
-    posts threads dist users 
+    posts threads dist users author
     search all 
     site_is_closed
     help
@@ -528,7 +528,7 @@
     new_post pwreminder 
     login register 
     posts about stats
-    threads dist users 
+    threads dist users author
     response_form 
     faq 
     admin
@@ -1595,6 +1595,47 @@
     }
 }
 
+=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 
@@ -1603,8 +1644,7 @@
 =cut
 
 sub dist {
-    my $self = shift;
-    
+    my ($self) = @_;
     my $q = $self->query;
 
     my $group_name = ${$self->param("path_parameters")}[0] || '';
@@ -1616,8 +1656,6 @@
             );
     }
     $self->log->debug("show dist: '$group_name'");
-#   $group_name =~ s/-/::/g;
-#   (my $dashgroup = $group_name) =~ s/::/-/g;
 
     my $t = $self->load_tmpl("groups.tmpl",
         loop_context_vars => 1,
@@ -1625,7 +1663,6 @@
     );
     $t->param(hide_group => 1);
                 
-#   $t->param(dashgroup => $dashgroup);
     $t->param(group => $group_name);
     $t->param(title => "CPAN Forum - $group_name");
 
@@ -1656,7 +1693,6 @@
     $t->output;
 }
 
-
 sub _subscriptions {
     my ($self, $t, $group) = @_;
 
@@ -2274,7 +2310,7 @@
             $it = CPAN::Forum::Posts->search_post_by_pauseid($pauseid);
         }
         else {
-            $self->log->warnings("rss requested for $params[0]");
+            $self->log->warning("rss requested for $params[0]");
         }
     }
     else {

Added: trunk/templates/authors.tmpl
===================================================================
--- trunk/templates/authors.tmpl	2006-08-29 12:44:43 UTC (rev 195)
+++ trunk/templates/authors.tmpl	2006-08-29 15:43:10 UTC (rev 196)
@@ -0,0 +1,33 @@
+<TMPL_INCLUDE NAME="head.tmpl">
+<p id="pageTitle"><b><TMPL_VAR pauseid></b></p>
+<link href="/rss/author/<TMPL_VAR pauseid>" rel="alternate"
+      type="application/rss+xml" title ="CPAN::Forum <TMPL_VAR pauseid> rss" />
+<TMPL_INCLUDE NAME="navigation.tmpl">
+<TMPL_INCLUDE NAME="search_form.tmpl">
+<TMPL_INCLUDE NAME="links.tmpl">
+
+<p>
+Post made to modules whose author is <b><TMPL_VAR pauseid></b>.
+</p>
+
+<p>
+If you are <a href="/register/">registered</a> on the forum you can subscribe
+to get alerted whan someone posts a new message to any of the modules
+maintained by <TMPL_VAR pauseid>.
+<!-- <a href="/mypan/dist/<TMPL_VAR pauseid>">subscribe to e-mail notification
+<TMPL_VAR group></a>  -->
+</p>
+
+<TMPL_INCLUDE NAME="listing.tmpl">
+
+<!--
+<p>
+Users currently monitoring the modules of <TMPL_VAR pauseid>:
+<TMPL_LOOP users>
+   <a href="/users/<TMPL_VAR username>"><TMPL_VAR username></a>, 
+</TMPL_LOOP>
+</p>
+-->
+
+<p><a href="/rss/author/<TMPL_VAR pauseid>"><img src="/img/rss1.gif" alt="RSS Feed" /></a></p>
+<TMPL_INCLUDE NAME="footer.tmpl">

Modified: trunk/templates/internal_error.tmpl
===================================================================
--- trunk/templates/internal_error.tmpl	2006-08-29 12:44:43 UTC (rev 195)
+++ trunk/templates/internal_error.tmpl	2006-08-29 15:43:10 UTC (rev 196)
@@ -24,6 +24,10 @@
 No such user.
 </TMPL_IF>
 
+<TMPL_IF no_such_pauseid>
+No such PAUSEID in our database.
+</TMPL_IF>
+
 <TMPL_IF failed_to_add_group>
 <p>
 Failed to add group.



More information about the Cpan-forum-commit mailing list