<%args> $new_category_autocomplete => "/" $site_id => undef <%init> my $story = get_state_data('story_prof', 'story'); (my $parent_cat_uri = $new_category_autocomplete) =~ s|/[^/]*$|/|; # strip off the incomplete directory on the end my @categories; if ( FULL_SEARCH ) { @categories = Bric::Biz::Category->list({ uri => "%" . $new_category_autocomplete . "%", site_id => $site_id || $story->get_site_id, }); } else { ( my $parent_cat ) = Bric::Biz::Category->list({ uri => $parent_cat_uri, site_id => $site_id || $story->get_site_id, }); @categories = Bric::Biz::Category->list({ uri => $new_category_autocomplete . "%", site_id => $site_id || $story->get_site_id, parent_id => (defined $parent_cat ? $parent_cat->get_id : 0) }); # Show the parent if that's exactly what was typed unshift @categories, $parent_cat if defined $parent_cat && $parent_cat_uri eq $new_category_autocomplete; } # Strip out those categories we don't have permission to see my $cats = [ grep { chk_authz($_, READ, 1) } @categories ];