Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r21517: LJSUP-11555 (Need to add view_tag and ta...

Committer: ailyin
LJSUP-11555 (Need to add view_tag and tag.title to the page of one tag)
U   trunk/bin/upgrading/s2layers/core1.s2
U   trunk/cgi-bin/LJ/S2/RecentPage.pm
U   trunk/cgi-bin/LJ/S2.pm
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/bin/upgrading/s2layers/core1.s2
===================================================================
--- trunk/bin/upgrading/s2layers/core1.s2	2012-03-22 14:13:01 UTC (rev 21516)
+++ trunk/bin/upgrading/s2layers/core1.s2	2012-03-22 14:20:53 UTC (rev 21517)
@@ -290,7 +290,6 @@
 "Represents a tag in its most basic form."
 {
     var readonly string name "Textual representation of this tag.";
-    var readonly string id "ID of this tag.";
     var readonly string url "URL to view entries with this tag.";
 }
 
@@ -667,6 +666,10 @@
     "Array of entries available to be seen by the viewer of the page.";
 
     var RecentNav nav;
+
+    var bool tagfilter_active;
+    var string tagfilter_mode;
+    var Tag[] tagfilter_tags;
 }
 
 class FriendsPage extends RecentPage

Modified: trunk/cgi-bin/LJ/S2/RecentPage.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/RecentPage.pm	2012-03-22 14:13:01 UTC (rev 21516)
+++ trunk/cgi-bin/LJ/S2/RecentPage.pm	2012-03-22 14:20:53 UTC (rev 21517)
@@ -33,8 +33,17 @@
                     Image("$LJ::IMGPREFIX/data_$what.gif", 32, 15, $caption));
     };
 
+    $p->{'tagfilter_tags'} = [];
+
     if ( $opts->{'tagids'} ) {
         $p->{'page_id'} = 'journal-' . $u->username . '-tags-' . $opts->{'tagmode'} . '-' . join( '-', @{ $opts->{'tagids'} } );
+
+        $p->{'tagfilter_active'} = 1;
+        $p->{'tagfilter_mode'}   = $opts->{'tagmode'};
+        while ( my ( $tagname, $tagid ) = each %{ $opts->{'tagmap'} } ) {
+            push @{ $p->{'tagfilter_tags'} },
+                LJ::S2::Tag( $u, $tagid, $tagname );
+        }
     }
 
     $p->{'data_link'} = {

Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2012-03-22 14:13:01 UTC (rev 21516)
+++ trunk/cgi-bin/LJ/S2.pm	2012-03-22 14:20:53 UTC (rev 21517)
@@ -1908,8 +1908,6 @@
     
     my $t = {
         _type => 'Tag',
-        _id => $kwid,
-        id => $kwid,
         name => LJ::ehtml($kw),
         url => LJ::journal_base($u) . '/tag/' . LJ::eurl($kw),
     };

Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2012-03-22 14:13:01 UTC (rev 21516)
+++ trunk/cgi-bin/LJ/User.pm	2012-03-22 14:20:53 UTC (rev 21517)
@@ -9973,18 +9973,20 @@
         # get user's tags so we know what remote can see, and setup an inverse mapping
         # from keyword to tag
         $opts->{tagids} = [];
+        $opts->{'tagmap'} = {};
         my $tags = LJ::Tags::get_usertags($u, { remote => $remote });
         my %kwref = ( map { $tags->{$_}->{name} => $_ } keys %{$tags || {}} );
-        foreach (@{$opts->{tags}}) {
-            unless ($kwref{$_}) {
+        foreach my $tagname (@{$opts->{tags}}) {
+            unless ($kwref{$tagname}) {
                 LJ::Request->pnotes ('error' => 'e404');
                 LJ::Request->pnotes ('remote' => LJ::get_remote ());
                 $opts->{'handler_return'} = "404 Not Found";
                 return;
             }
             #return $error->("Sorry, one or more specified tags do not exist.", "404 Not Found")
-            #    unless $kwref{$_};
-            push @{$opts->{tagids}}, $kwref{$_};
+            #    unless $kwref{$tagname};
+            push @{$opts->{tagids}}, $kwref{$tagname};
+            $opts->{'tagmap'}->{$tagname} = $kwref{$tagname};
         }
 
         $opts->{tagmode} = $opts->{getargs}->{mode} eq 'and' ? 'and' : 'or';

Tags: ailyin, andy, livejournal, pm, s2
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments