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

[livejournal] r17702: LJSUP-7364. dont working "Add Category"

Committer: gprochaev
LJSUP-7364. dont working "Add Category"

U   trunk/htdocs/admin/browse/add_category.bml
U   trunk/htdocs/admin/browse/manage_category.bml
Modified: trunk/htdocs/admin/browse/add_category.bml
===================================================================
--- trunk/htdocs/admin/browse/add_category.bml	2010-11-16 10:07:37 UTC (rev 17701)
+++ trunk/htdocs/admin/browse/add_category.bml	2010-11-16 10:18:32 UTC (rev 17702)
@@ -29,10 +29,12 @@
         push @errors, "Invalid form submission" unless LJ::check_form_auth();
         {
             # Check for required data
+=head
             unless ($parentcaturl) {
                 push @errors, "Please select a parent category";
                 next;
             }
+=cut
             unless ($newcat) {
                 push @errors, "Please enter new category display name";
                 next;
@@ -48,7 +50,7 @@
 
             # Has a valid parent category been chosen
             my $pcategory = LJ::Browse->load_by_url("/browse" . $parentcaturl);
-            push @errors, "Invalid category" unless $pcategory;
+#            push @errors, "Invalid category" unless $pcategory;
 
             # Does a category with the same URL path and parent already exist?
             my $existcat = LJ::Browse->load_by_url("/browse" . $parentcaturl . $newcaturl);
@@ -59,7 +61,7 @@
             # Add category
             if (LJ::Browse->create( pretty_name => $newcat,
                                     url_path => $newcaturl,
-                                    parentcatid => $pcategory->catid,
+                                    parentcatid => $pcategory ? $pcategory->catid : 0,
                                     topcat => $POST{topcat} ) ) {
                 $ret .= "<span class='super notice'>New category created.</span>";
             } else {
@@ -80,7 +82,7 @@
     my @caturls = map { { text => $_->{pretty_name}, value => $_->uri } } @categories;
     #@caturls = sort { $a cmp $b } @caturls;
 
-    $ret .= "<p>Add to Category:<br />";
+    $ret .= "<p>Add to Vertical/Category:<br />";
     $ret .= LJ::html_select({
                 name => 'parentcaturl',
                 selected => $parentcaturl },
@@ -108,13 +110,6 @@
             );
     $ret .= "<br /><i>example: '\/monkey_bars'</i></td></tr>\n";
 
-    $ret .= "<tr><td class='label'>Top Category:</td><td>";
-    $ret .= LJ::html_check( {
-                name => 'topcat',
-                value => $POST{'topcat'} || '/'}
-            );
-    $ret .= " <i>Display on top-level directory page, even when containing category is reduced.</i></td></tr>\n";
-
     $ret .= "</table></p>\n";
 
     $ret .= "<p>" . LJ::html_submit('add', 'Add') . "</p>";

Modified: trunk/htdocs/admin/browse/manage_category.bml
===================================================================
--- trunk/htdocs/admin/browse/manage_category.bml	2010-11-16 10:07:37 UTC (rev 17701)
+++ trunk/htdocs/admin/browse/manage_category.bml	2010-11-16 10:18:32 UTC (rev 17702)
@@ -68,7 +68,8 @@
             push @errors, "Invalid vertical" unless $vertical;
 
             # Has a valid category been chosen
-            my $category = LJ::Browse->load_by_url("/browse" . $vert_url . $cat_url);
+            my $category = LJ::Browse->load_by_url("/browse" . $cat_url);                   ## category already moved?
+            $category = LJ::Browse->load_by_url("/browse" . $vert_url . $cat_url) unless $category;     ## no, find without vertical
             push @errors, "Invalid category" unless $category;
 
             next if @errors;

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