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

[livejournal] r17735: LJSUP-7052.

Committer: gprochaev
LJSUP-7052.

U   trunk/htdocs/admin/browse/featured_communities.bml
U   trunk/htdocs/admin/browse/load_all_structure.bml
Modified: trunk/htdocs/admin/browse/featured_communities.bml
===================================================================
--- trunk/htdocs/admin/browse/featured_communities.bml	2010-11-19 08:35:42 UTC (rev 17734)
+++ trunk/htdocs/admin/browse/featured_communities.bml	2010-11-19 09:38:59 UTC (rev 17735)
@@ -62,15 +62,15 @@
 
     }
 
-    if (LJ::did_post() && $POST{'add'}) {
+    if (LJ::did_post() && $vertical && $POST{'add'}) {
         $vertical->add_community ($POST{'url'});
     }
 
-    if (LJ::did_post() && $POST{'delete_comm'}) {
+    if (LJ::did_post() && $vertical && $POST{'delete_comm'}) {
         $vertical->delete_community (comm_id => $POST{'rec_id'});
     }
 
-    if (LJ::did_post()) {
+    if (LJ::did_post() && $vertical) {
         $ret .= "<b><div>Added Communities</div></p>";
         my $comms = $vertical->load_communities( count => '100', is_random => 0 );
 

Modified: trunk/htdocs/admin/browse/load_all_structure.bml
===================================================================
--- trunk/htdocs/admin/browse/load_all_structure.bml	2010-11-19 08:35:42 UTC (rev 17734)
+++ trunk/htdocs/admin/browse/load_all_structure.bml	2010-11-19 09:38:59 UTC (rev 17735)
@@ -49,21 +49,18 @@
             my $vert_name = $columns[1];
             my $vert_url  = $columns[2];
 
-            my $v = LJ::Vertical->load_by_url ("/browse".$vert_url)
+            my $v = LJ::Vertical->load_by_url ("/vertical" . $vert_url)
                 || LJ::Vertical->create (name => $vert_name, url => $vert_url);
 
             ## Category name & url
             my $cat_name = $columns[3];
             my $cat_url = $columns[4];
-            my $cat = LJ::Browse->load_by_url ($v->url.$cat_url);
+            my $cat = LJ::Browse->load_by_url ("/browse" . $cat_url);
 
             unless ($cat) {
-                unless (grep { $_->{pretty_name} eq $cat_name } @{$v->get_categories}) {
-                    $cat = LJ::Browse->create ( pretty_name => $cat_name, url_path => $cat_url );
-                    $cat->vert_id ($v->vert_id);
-                }
-            } else {
-                $cat->vert_id ($v->vert_id);
+                #unless (grep { $_->{pretty_name} eq $cat_name } @{$v->get_categories}) {
+                    $cat = LJ::Browse->create ( pretty_name => $cat_name, url_path => $cat_url, vertical => $v );
+                #}
             }
 
             my ($subcat_name, $subcat_url, $subcat) = ();
@@ -73,15 +70,12 @@
             my $subcat_url = $columns[6];
 
             if ($subcat_name && $subcat_url) {
-                my $subcat = LJ::Browse->load_by_url ($cat->url.$subcat_url);
+                my $subcat = LJ::Browse->load_by_url ("/browse" . $cat->url_path . $subcat_url);
                 unless ($subcat) {
-                    unless (grep { $_->{pretty_name} eq $subcat_name } @{$v->get_categories}) {
-                        $subcat = LJ::Browse->create ( pretty_name => $subcat_name, url_path => $subcat_url, parentcatid => $cat->catid );
-                        $subcat->vert_id ($v->vert_id);
+                #    unless (grep { $_->{pretty_name} eq $subcat_name } @{$v->get_categories($cat)}) {
+                        $subcat = LJ::Browse->create ( pretty_name => $subcat_name, url_path => $subcat_url, parentcatid => $cat->catid, vertical => $cat->vertical );
                     }
-                } else {
-                    $subcat->vert_id ($v->vert_id);
-                }
+                #}
             }
 
             ## #7 - Full path for sanity check 
@@ -95,7 +89,7 @@
             ## Wrong community name?
             next unless $comm_id;
 
-            $subcat_name
+            $subcat
                 ? $subcat->add_community($comm_id, \@tags)
                 : $cat->add_community($comm_id, \@tags);
         }

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