wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17808: LJSUP-7431. Change the Suggest community...

Committer: gprochaev
LJSUP-7431. Change the Suggest community page

U   trunk/cgi-bin/LJ/Widget/AddCommunity.pm
U   trunk/cgi-bin/LJ/Widget/Browse.pm
U   trunk/htdocs/community/directory.bml
Modified: trunk/cgi-bin/LJ/Widget/AddCommunity.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/AddCommunity.pm	2010-11-29 04:06:38 UTC (rev 17807)
+++ trunk/cgi-bin/LJ/Widget/AddCommunity.pm	2010-11-29 04:44:04 UTC (rev 17808)
@@ -10,6 +10,8 @@
     my $class = shift;
     my %opts = @_;
 
+    my $vertical = $opts{'vertical'};
+
     my ($caption, $form_text, $submit_caption) =
         map { BML::ml('widget.addcommunity.' . $_,
             {
@@ -18,6 +20,9 @@
             })
         } qw(caption form_text submit_button_caption);
 
+    my $vert_id = $vertical ? $vertical->vert_id : undef;
+    my $vert_input = $vert_id ? "<input type='hidden' name='vert_id' value='$vert_id'>" : '';
+
     return <<EOT;
     <div class="right-mod">
         <div class="mod-tl">
@@ -31,7 +36,7 @@
                             <form action='$LJ::SITEROOT/community/directory.bml' method='post'>
                             <p>$form_text</p>
                             <fieldset>
-                                <input type="submit" value="$submit_caption" />
+                                $vert_input<input type="submit" value="$submit_caption" />
                             <fieldset>
                             </form>
                         </div>

Modified: trunk/cgi-bin/LJ/Widget/Browse.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Browse.pm	2010-11-29 04:06:38 UTC (rev 17807)
+++ trunk/cgi-bin/LJ/Widget/Browse.pm	2010-11-29 04:44:04 UTC (rev 17808)
@@ -393,7 +393,7 @@
         ad                      => $ad,
         nav_line                => $nav_line,
         popular_interests_widget=> LJ::Widget::PopularInterests->render(),
-        add_community_widget    => LJ::Widget::AddCommunity->render(),
+        add_community_widget    => LJ::Widget::AddCommunity->render(vertical => $vertical),
         search_widget           => LJ::Widget::Search->render(type => $vertical ? "tags" : "yandex", view => $view),
         top_posts               => \@top_posts,
         top_comms               => \@top_comms,

Modified: trunk/htdocs/community/directory.bml
===================================================================
--- trunk/htdocs/community/directory.bml	2010-11-29 04:06:38 UTC (rev 17807)
+++ trunk/htdocs/community/directory.bml	2010-11-29 04:44:04 UTC (rev 17808)
@@ -76,6 +76,7 @@
 
     $ret .= "<form action='directory.bml' method='GET'>\n";
     $ret .= LJ::make_authas_select($remote, { authas => $GET{authas}, type => 'C' });
+    $ret .= "<input type='hidden' name='vert_id' value='".$POST{'vert_id'}."'>" if $POST{'vert_id'};
     $ret .= "</form>\n\n";
 
     return $ret unless $cname;
@@ -122,7 +123,8 @@
         push @catid_, $cat_id if $cat_id;
         push @catrem, $POST{"catremove_$i"} if $POST{"catremove_$i"};
         push @cat_, $cat_id ? LJ::Browse->load_by_id ($cat_id) : undef;
-        push @vert_, $POST{"vert_id_$i"} ? LJ::Vertical->load_by_id ($POST{"vert_id_$i"}) : undef;
+        my $vert_id = $POST{"vert_id_$i"} || $GET{"vert_id"};
+        push @vert_, $vert_id ? LJ::Vertical->load_by_id ($vert_id) : undef;
     }
 
     # saving a form submission
@@ -162,9 +164,9 @@
     $ret .= "<div style='width:50%;'><div style='background:#C7E0F6;padding:5px 7px;'>&nbsp;</div>\n";
     $ret .= "<table style='width:100%;border-collapse:collapse;'>";
     foreach my $i (1..$limit) {
-        $ret .= "<tr><td valign='top' style='border-bottom:1px solid #CCC;padding:10px 10px 10px 5px;font-weight:bold;'><!-- $i.-->Vertical</td>";
         my $j = $i - 1;
         if (@listings[$j]) {
+            $ret .= "<tr><td valign='top' style='border-bottom:1px solid #CCC;padding:10px 10px 10px 5px;font-weight:bold;'><!-- $i.-->Category</td>";
             my $listing = @listings[$j];
             my $cat = LJ::Browse->load_by_id($listing->{catid});
             my $status = "<span style='font-weight: bold; color:";
@@ -184,22 +186,25 @@
                                      value => $listing->{pendid}, });
         } else {
             my @verticals = LJ::Vertical->load_all();
-            @verticals = map { { text => $_->{name}, value => $_->{vert_id} } } @verticals;
+            if (!$LJ::DISABLED{'verticals_menu'}) {
+                $ret .= "<tr><td valign='top' style='border-bottom:1px solid #CCC;padding:10px 10px 10px 5px;font-weight:bold;'><!-- $i.-->Category</td>";
+                @verticals = map { { text => $_->{name}, value => $_->{vert_id} } } @verticals;
 
-            $ret .= "<td style='border-bottom:1px solid #CCC;padding:10px 10px 10px 5px;'>".LJ::html_select({
-                        name => "vert_id_$i",
-			style => "width:100%;",
-                        selected => $POST{"vert_id_$i"},
-                        },
-                        { text => 'Select Vertical',
-                        value => '',},
-                        @verticals
-                    );
-            $ret .= "</td><td style='border-bottom:1px solid #CCC;padding:10px 10px 10px 5px;'>\n";
+                $ret .= "<td style='border-bottom:1px solid #CCC;padding:10px 10px 10px 5px;'>".LJ::html_select({
+                            name => "vert_id_$i",
+			    style => "width:100%;",
+                            selected => $vert_[$j] ? $vert_[$j]->vert_id : 0,
+                            },
+                            { text => 'Select Vertical',
+                            value => '',},
+                            @verticals
+                        );
+                $ret .= "</td><td style='border-bottom:1px solid #CCC;padding:10px 10px 10px 5px;'>\n";
 
-            $ret .= LJ::html_submit('select_v', 'Select Vertical') . "</td></tr>";
+                $ret .= LJ::html_submit('select_v', 'Select Vertical') . "</td></tr>";
+            }
 
-            if (LJ::did_post() && $vert_[$j]) {
+            if ((LJ::did_post() && $vert_[$j]) || ($LJ::DISABLED{'verticals_menu'})) {
                 my @children = $cat_[$j] ? $cat_[$j]->children : ();
                 # Get the full list of categories
                 my @categories = LJ::Browse->load_all($vert_[$j]);

Tags: bml, livejournal, pm, wisest-owl
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