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

[livejournal] r18351: LJSUP-7829. Landing pages. Additional de...

Committer: gprochaev
LJSUP-7829. Landing pages. Additional development

U   trunk/cgi-bin/LJ/Vertical.pm
U   trunk/cgi-bin/LJ/Widget/Browse.pm
U   trunk/htdocs/admin/browse/load_all_structure.bml
Modified: trunk/cgi-bin/LJ/Vertical.pm
===================================================================
--- trunk/cgi-bin/LJ/Vertical.pm	2011-02-18 05:17:04 UTC (rev 18350)
+++ trunk/cgi-bin/LJ/Vertical.pm	2011-02-18 07:47:42 UTC (rev 18351)
@@ -1729,6 +1729,10 @@
     return $LJ::VERTICAL_TREE{$self->name}->{is_hidden} ? 1 : 0;
 }
 
+sub parentid {
+    return 0;
+}
+
 sub _get_set {
     my $self = shift;
     my $key  = shift;

Modified: trunk/cgi-bin/LJ/Widget/Browse.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Browse.pm	2011-02-18 05:17:04 UTC (rev 18350)
+++ trunk/cgi-bin/LJ/Widget/Browse.pm	2011-02-18 07:47:42 UTC (rev 18351)
@@ -14,24 +14,43 @@
     my ($parentid, $level, $test_uri, $vertical, @categories) = @_;
     my @tree = ();
 
-    foreach my $c
-        (grep { (!$parentid && !$_->parentid) || ($_->parentid == $parentid) } grep { $_ } @categories) {
+    my @all_categories = !$level
+        ? grep { (!$parentid && !$_->parentid) || ($_->vert_id == $parentid) } grep { $_ } @categories
+        : grep { (!$parentid && !$_->parentid) || ($_->parentid == $parentid) } grep { $_ } @categories;
+
+    foreach my $c ( @all_categories ) {
             my $c_uri = $c->uri;
 
             my $is_current = ($test_uri =~ m/^\Q$c_uri\E/);
 
             ++$level;
-            push @tree,
-                {
-                    name            => $c->display_name(),
-                    title           => $c->title_html(),
-                    url             => $c->url(),
-                    summary         => LJ::Widget::CategorySummary->render( category => $c ),
-                    level           => $level,
-                    is_expanded     => $is_current,
-                    is_current      => $is_current,
-                    "level$level"   => [ _build_tree($c->catid, $level, $test_uri, $vertical, @categories) ],
-                };
+
+            if ($c->isa('LJ::Vertical')) {
+                @categories = LJ::Browse->load_all($c);
+                push @tree,
+                    {
+                        name            => $c->display_name(),
+                        title           => '',#$c->title_html(),
+                        url             => '',#$c->url(),
+                        summary         => '',#LJ::Widget::CategorySummary->render( category => $c ),
+                        level           => $level,
+                        is_expanded     => $is_current,
+                        is_current      => $is_current,
+                        "level$level"   => [ _build_tree(0, $level, $test_uri, $c, @categories) ],
+                    };
+            } else {
+                push @tree,
+                    {
+                        name            => $c->display_name(),
+                        title           => $c->title_html(),
+                        url             => $c->url(),
+                        summary         => LJ::Widget::CategorySummary->render( category => $c ),
+                        level           => $level,
+                        is_expanded     => $is_current,
+                        is_current      => $is_current,
+                        "level$level"   => [ _build_tree($c->catid, $level, $test_uri, $vertical, @categories) ],
+                    };
+            }
             --$level;
         }
     return @tree;
@@ -103,7 +122,7 @@
 
     my $cat = LJ::Browse->load_by_url($uri, $vertical); # Currently selected category
 
-    my @categories = sort { lc $a->display_name cmp lc $b->display_name } LJ::Browse->load_all($vertical);
+    my @categories = $vertical ? sort { lc $a->display_name cmp lc $b->display_name } LJ::Browse->load_all($vertical) : LJ::Vertical->load_all;
 
     my $test_uri = $uri;
     $test_uri =~ s/^\/(browse|vertical)//;
@@ -163,7 +182,9 @@
     my $post_skip = ($post_page-1) * $post_page_size;
     my $post_last = $post_skip + $post_page_size;
 
-    $$title = $vertical ? "<a class=\"appwidget-browse-header\" href='".$vertical->url."'>".$vertical->name."</a>" : $class->ml('widget.browse.windowtitle');
+    $$title = $vertical
+        ? "<div class=\"appwidget-browse-header-wrapper\"><a class=\"appwidget-browse-header\" href='".$vertical->url."'>".$vertical->name."</a> <a href='/browse' class=\"appwidget-browse-back\">Return to Community Directory</a></div>"
+        : $class->ml('widget.browse.windowtitle');
 
     my $search_str = undef;
     if ($opts{'post_vars'}->{'do_search'}) {

Modified: trunk/htdocs/admin/browse/load_all_structure.bml
===================================================================
--- trunk/htdocs/admin/browse/load_all_structure.bml	2011-02-18 05:17:04 UTC (rev 18350)
+++ trunk/htdocs/admin/browse/load_all_structure.bml	2011-02-18 07:47:42 UTC (rev 18351)
@@ -37,10 +37,10 @@
             my @columns = 
                     map { 
                         $_ =~ s/(?:^"|"$)//g;           ## remove trailing "
-                        $_ =~ s#\\"#"#;                 ## unescape "
+                        $_ =~ s#""#"#;                 ## unescape "
                         $_ 
                     }    
-                    split /,[^\s]/, $line;              ## split line by ,
+                    split /;[\s]?/, $line;              ## split line by ,
 
             ## Community name
             my $comm_name = $columns[0];
@@ -49,6 +49,8 @@
             my $vert_name = $columns[1];
             my $vert_url  = $columns[2];
 
+            $ret .= "Ups. May be something wrong in file?" unless $vert_name;
+
             my $v = LJ::Vertical->load_by_url ("/vertical" . $vert_url)
                 || LJ::Vertical->create (name => $vert_name, url => $vert_url);
 

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