Committer: gprochaev
LJSUP-7052.U trunk/cgi-bin/LJ/Browse.pm U trunk/cgi-bin/LJ/Vertical.pm U trunk/htdocs/admin/browse/index.bml
Modified: trunk/cgi-bin/LJ/Browse.pm =================================================================== --- trunk/cgi-bin/LJ/Browse.pm 2010-11-16 05:26:08 UTC (rev 17691) +++ trunk/cgi-bin/LJ/Browse.pm 2010-11-16 05:38:10 UTC (rev 17692) @@ -355,7 +355,8 @@ $url =~ /^(?:$LJ::SITEROOT)?(\/.+)$/; my $path = $1; - $path =~ s/tag?.*?\/?(?:\?.*)?$//; # remove search string, trailing slash and any get args + $path =~ s/\/?(?:\?.*)?$//; # trailing slash and any get args + $path =~ s/tag\/.*$//; # remove search string $path =~ s/\/index\.bml$//; # remove bml page # 4 possibilities: @@ -793,7 +794,7 @@ $p = $c->parent->url_path . $p; $p = path($c->parent) . $p; } else { - $v = LJ::Vertical->load_by_id ($c->vert_id); + $v = $c->vert_id ? LJ::Vertical->load_by_id ($c->vert_id) : undef; } return $v ? $v->uri . $p : $p; } @@ -847,7 +848,7 @@ my @found_posts = (); foreach my $post (@$posts) { my $post_ids = $dbh->selectall_arrayref ("SELECT journalid, jitemid FROM category_recent_posts WHERE journalid IN ($comm_list) AND journalid = ? AND jitemid = ? AND is_deleted = 0 ORDER BY timecreate DESC LIMIT $limit", { Slice => {} }, $post->{journalid}, $post->{jitemid}); - push @found_posts, @$post_ids; + push @found_posts, @$post_ids if $post_ids; } @entries = map { LJ::Entry->new ($_->{journalid}, jitemid => $_->{jitemid}) } ## Create LJ::Entry object @@ -966,16 +967,17 @@ my $self = shift; my $key = shift; - if (@_) { # setter case + if ($_[0]) { # setter case # TODO enable setting values - return; + my $val = shift; my $dbh = LJ::get_db_writer() or die "unable to contact global db master to load category"; $dbh->do("UPDATE category SET $key=? WHERE catid=?", - undef, $self->{catid}, $val); + undef, $val, $self->{catid}); + die $dbh->errstr if $dbh->err; $self->clear_memcache; @@ -993,7 +995,7 @@ sub display_name { shift->_get_set('pretty_name') } sub url_path { shift->_get_set('url_path') } sub parentid { shift->_get_set('parentcatid') } -sub vert_id { shift->_get_set('vert_id') } +sub vert_id { shift->_get_set('vert_id' => $_[0] ) } # Community Moderation Modified: trunk/cgi-bin/LJ/Vertical.pm =================================================================== --- trunk/cgi-bin/LJ/Vertical.pm 2010-11-16 05:26:08 UTC (rev 17691) +++ trunk/cgi-bin/LJ/Vertical.pm 2010-11-16 05:38:10 UTC (rev 17692) @@ -1418,7 +1418,7 @@ sub url { my $self = shift; - return "$LJ::SITEROOT/browse" . $self->uri . "/"; + return "$LJ::SITEROOT/browse" . $self->uri; } # checks to see if the given URL is the canonical URL so that we can redirect if it's not Modified: trunk/htdocs/admin/browse/index.bml =================================================================== --- trunk/htdocs/admin/browse/index.bml 2010-11-16 05:26:08 UTC (rev 17691) +++ trunk/htdocs/admin/browse/index.bml 2010-11-16 05:38:10 UTC (rev 17692) @@ -21,7 +21,6 @@ $ret .= "<p><a href='./add_verticals.bml'>Add Verticals</a></p>"; $ret .= "<p><a href='./edit_verticals.bml'>Edit Verticals</a></p>"; $ret .= "<p><a href='./remove_verticals.bml'>Remove Verticals</a></p>"; - $ret .= "<p><a href='./upload_verticals.bml'>Upload Verticals</a></p>"; $ret .= "<p><a href='./recent_posts.bml'>Manage Recent Posts</a></p>"; $ret .= "<p><a href='./top_entries_vertical.bml'>Top Entries in communities</a></p>"; $ret .= "<p><a href='./featured_communities.bml'>Featured Communities</a></p>"; @@ -41,6 +40,8 @@ $ret .= "<p><a href='./remove_category.bml'>Remove Category</a></p>"; $ret .= "</blockquote>"; + $ret .= "<p><a href='./load_all_structure.bml'>Load All Structure</a></p>"; + return "<body>$ret</body>"; } _code?>