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

svn at pti.co.il svn at pti.co.il
Thu Aug 2 09:25:02 EEST 2007


Author: gabor
Date: 2007-08-02 09:25:02 +0300 (Thu, 02 Aug 2007)
New Revision: 315

Modified:
   trunk/
   trunk/lib/CPAN/Forum/RM/Subscriptions.pm
   trunk/templates/authors.tmpl
Log:
allow people to subscribe based on PAUSEID



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4371
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
   + 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4372
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752

Modified: trunk/lib/CPAN/Forum/RM/Subscriptions.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Subscriptions.pm	2007-08-02 06:24:46 UTC (rev 314)
+++ trunk/lib/CPAN/Forum/RM/Subscriptions.pm	2007-08-02 06:25:02 UTC (rev 315)
@@ -51,6 +51,13 @@
             return $self->internal_error("Accessing");
         }
         ($gids, $subscriptions) = $self->_get_module_subscription($user, $group_name, $group);
+    } elsif (@params == 2 and $params[0] eq "author") {
+        my $pauseid_str = $params[1];
+        my $subs = CPAN::Forum::DB::Authors->get_author_by_pauseid($pauseid_str); # SQL
+        if (not $subs) {
+            return $self->internal_error("Accessing");
+        }
+        ($gids, $subscriptions) = $self->_get_pauseid_subscription($user, $pauseid_str, $subs->{id});
     } else {
         ($gids, $subscriptions) = $self->_get_all_subscriptions($user);
     }
@@ -134,7 +141,33 @@
     return ($gids, \@subscriptions);
 }
 
+sub _get_pauseid_subscription {
+    my ($self, $user, $pauseid_str, $pauseid_id)  = @_;
 
+    my @subscriptions;
+    my $gids = "_" . $pauseid_id;
+    my ($s) = CPAN::Forum::DB::Subscriptions_pauseid->find_one(uid => $user->{id}, pauseid => $pauseid_id); # SQL
+    if ($s) {
+        push @subscriptions, {
+            gid       => "_" . $pauseid_id,
+            group     => $pauseid_str,
+            allposts  => $s->{allposts},
+            starters  => $s->{starters},
+            followups => $s->{followups},
+        };
+    } else {
+        push @subscriptions, {
+            gid       => "_" . $pauseid_id,
+            group     => $pauseid_str,
+            allposts  => 0,
+            starters  => 0,
+            followups => 0,
+        };
+    }
+    return ($gids, \@subscriptions);
+}
+
+
 =head2 update_subscription
 
 Process the submitted form created by C<mypan()>

Modified: trunk/templates/authors.tmpl
===================================================================
--- trunk/templates/authors.tmpl	2007-08-02 06:24:46 UTC (rev 314)
+++ trunk/templates/authors.tmpl	2007-08-02 06:25:02 UTC (rev 315)
@@ -10,9 +10,9 @@
 </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>.
+If you are <a href="/register/">registered</a> on the forum you can 
+<a href="/mypan/author/<TMPL_VAR pauseid>">subscribe to get alerted</a> when 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>



More information about the Cpan-forum-commit mailing list