mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-12-03 05:38 am

[dw-free] add dropdown for journaltype filter to navstrip on network page

[commit: http://hg.dwscoalition.org/dw-free/rev/5cbdb67acc8b]

http://bugs.dwscoalition.org/show_bug.cgi?id=1336

Add 'show people', etc options on Network page. [staff profile] denise did
half of this patch.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/weblib.pl
  • htdocs/manage/circle/filter.bml
--------------------------------------------------------------------------------
diff -r 85021e82c86e -r 5cbdb67acc8b cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Thu Dec 03 05:34:55 2009 +0000
+++ b/cgi-bin/weblib.pl	Thu Dec 03 05:38:36 2009 +0000
@@ -2699,7 +2699,7 @@ sub control_strip
                 $ret .= $statustext{'yourjournal'};
             }
             $ret .= "<br />";
-            if ( $view eq "read" ) {
+            if ( $view eq "read" || $view eq "network" ) {
                 my @filters = ("all", $BML::ML{'web.controlstrip.select.friends.all'}, "showpeople", $BML::ML{'web.controlstrip.select.friends.journals'}, "showcommunities", $BML::ML{'web.controlstrip.select.friends.communities'}, "showsyndicated", $BML::ML{'web.controlstrip.select.friends.feeds'});
                 # content_filters returns an array of content filters this user had, sorted by sortorder
                 # since this is only shown if LJ::u_equals($remote, $journal) , we don't have to care whether a filter is public or not
@@ -2717,11 +2717,15 @@ sub control_strip
                 } elsif ($r->uri =~ /^\/read\/?(.+)?/i) {
                     my $filter = $1 || "default view";
                     $selected = "filter:" . LJ::durl(lc($filter));
+                } elsif ($r->uri eq "/network" && $r->query_string ne "") {
+                    $selected = "showpeople"      if $r->query_string eq "show=P&filter=0";
+                    $selected = "showcommunities" if $r->query_string eq "show=C&filter=0";
+                    $selected = "showsyndicated"  if $r->query_string eq "show=F&filter=0";
                 }
 
                 $ret .= "$links{'manage_friends'}&nbsp;&nbsp; ";
                 $ret .= "$BML::ML{'web.controlstrip.select.friends.label'} <form method='post' style='display: inline;' action='$LJ::SITEROOT/manage/circle/filter'>\n";
-                $ret .= LJ::html_hidden("user", $remote->{'user'}, "mode", "view", "type", "allfilters");
+                $ret .= LJ::html_hidden( "user", $remote->{'user'}, "mode", "view", "type", "allfilters", "pageview", $view );
                 $ret .= LJ::html_select({'name' => "view", 'selected' => $selected }, @filters) . " ";
                 $ret .= LJ::html_submit($BML::ML{'web.controlstrip.btn.view'});
                 $ret .= "</form>";
diff -r 85021e82c86e -r 5cbdb67acc8b htdocs/manage/circle/filter.bml
--- a/htdocs/manage/circle/filter.bml	Thu Dec 03 05:34:55 2009 +0000
+++ b/htdocs/manage/circle/filter.bml	Thu Dec 03 05:38:36 2009 +0000
@@ -10,6 +10,9 @@
     
     if ($POST{'mode'} eq "view") 
     {
+        # for safety, since we will be redirecting to this page be strict in the value we accept for the pageview
+        my $pageview = $POST{pageview} eq "network" ? "network" : "read";
+
         my $user = lc($POST{'user'});
         my $extra;
         if ( $POST{type} eq "allfilters" ) {
@@ -25,7 +28,7 @@
             }
         }
         my $u = LJ::load_user($user);
-        BML::redirect($u->journal_base() . "/read${extra}");
+        BML::redirect($u->journal_base() . "/$pageview${extra}");
     }
 
     my $remote = LJ::get_remote();
--------------------------------------------------------------------------------