<& '/widgets/search/search.mc', object => $class_key, type => $class_key, field => 'name', use_form_tag => 0 &> <& '/widgets/wrappers/sharky/table_top.mc', caption => $lang->maketext("Find a $class_key to alias"), &> <& /widgets/listManager/listManager.mc, object => $class_key, sortBy => 'name', select => undef, profile => $related_alias, exclude => $excl_sub, fields => @$sites > 1 ? $fields : [ grep $_ ne 'site', @{ $fields } ], field_values => $field_values, field_titles => { thumb => $lang->maketext('Thumb') }, addition => '', cx_filter => 0, behavior => 'expand', &> <& '/widgets/wrappers/sharky/table_bottom.mc' &> <%args> $widget $class_key $wf_id <%init>; $link_key = $class_key; my $site_id = Bric::Biz::Workflow->lookup({ id => $wf_id })->get_site_id; my $sites = $c->get('__SITES__') || Bric::Biz::Site->list({ active => 1 }); my %elems = map { $_ => 1 } Bric::Biz::ElementType->list_ids ({ site_id => $site_id }); # Hack: It'd be good to be able to exclude these in the SQL query, but the # query building interface can't currently handle that sort of thing. So' # we'll have to do it on a case-by-case basis for now. In general, this # shouldn't be a big deal, as the permissions check is already done on a # case-by-case bassis to limit most things. my $excl_sub = sub { not chk_authz($_[0], READ, 1) && not $_[0]->get_alias_id }; my $fields = [qw(id title uri site cover_date)]; unshift @$fields, 'thumb' if USE_THUMBNAILS && $class_key ne 'story'; <%once>; my $link_key; my $field_values = sub { my ($o, $field) = @_; if ($field eq 'title') { return $m->comp('/widgets/profile/preview_link.mc', type => $o->key_name, value => '' . $o->get_title . '', doc => $o); } elsif ($field eq 'thumb') { # If we get a thumbnail URI, we have an image. Otherwise, simply return # a space to fill the column properly because we aren't an image object # but USE_THUMBNAILS is on. my $thumb_uri = $o->thumbnail_uri or return ' '; return qq{ }; } }; my $related_alias = sub { [$lang->maketext('Alias'), $r->uri, "alias|make_alias_cb=" . $_[0]->get_id]; };