Mailing List Archive

story profile Add Category button lists all cats?
[.note: I'm probably overlooking something
because I'm frantically fixing things before
I leave WHO.]

In comp/widgets/story_prof/list_categories.html ,
where the 'Add Category' button is added, there is this:

% my $all_cats = [.
% grep { ! $curr_cats->{$_->get_id} && chk_authz($_, READ, 1) }
% $cat_pkg->list({ site_id => $story->get_site_id })
% ];
% if (scalar @$all_cats) {
<div class="actions">
<& '/widgets/profile/button.mc',
disp => $lang->maketext("Add Category"),
name => 'add_category_button',
button => 'add_category_lgreen',
useTable => 0,
js => qq{onclick="catListMan.add('new_category_uri'); return false"}
&>
....

If I'm reading that correctly, it does a list
of ALL CATEGORIES for the current site in order
to check if it should display the button, right?

(Users were reporting that the UI was slow,
maybe this was it, hmm...)
Re: story profile Add Category button lists all cats? [ In reply to ]
On Apr 15, 2009, at 6:57 AM, Scott Lanning wrote:

> [.note: I'm probably overlooking something
> because I'm frantically fixing things before
> I leave WHO.]
>
> In comp/widgets/story_prof/list_categories.html ,
> where the 'Add Category' button is added, there is this:
>
> % my $all_cats = [.
> % grep { ! $curr_cats->{$_->get_id} && chk_authz($_, READ, 1) }
> % $cat_pkg->list({ site_id => $story->get_site_id })
> % ];
> % if (scalar @$all_cats) {
> <div class="actions">
> <& '/widgets/profile/button.mc',
> disp => $lang->maketext("Add Category"),
> name => 'add_category_button',
> button => 'add_category_lgreen',
> useTable => 0,
> js => qq{onclick="catListMan.add('new_category_uri');
> return false"}
> &>
> ....
>
> If I'm reading that correctly, it does a list
> of ALL CATEGORIES for the current site in order
> to check if it should display the button, right?
>
> (Users were reporting that the UI was slow,
> maybe this was it, hmm...)

Yeah, pretty stupid. It should probably be

if (Bric::Biz::Category->list_ids({ not_id => ANY( map { $_->get_id }
$story->get_categories)) {
....
}

You'd have to add not_id, I think, but it should be a cinch.

Best,

David