<& '/widgets/search/search.mc', object => 'media', type => 'media', field => 'title', use_form_tag => 0 &>

<& /widgets/listManager/listManager.mc, object => 'media', title => 'Choose Related Media', sortBy => 'name', select => undef, profile => $related_profile, featured => $relate_id ? [$relate_id] : undef, exclude => $excl_sub, fields => [(USE_THUMBNAILS ? 'thumb' : ()), qw(id name uri cover_date)], addition => '', behavior => 'expand', field_values => $thumburi, field_titles => { thumb => $lang->maketext('Thumb')}, &>

<%args> $widget <%init>; # The tile object. my $tile = get_state_data($widget, 'tile'); my $relate_id = $tile->get_related_media_id; my $excl_sub; warn $tile->get_object_type, $/; if ($tile->get_object_type eq 'media') { my $asset_id = get_state_data('media_prof', 'media')->get_id; $excl_sub = sub { return 1 if $_[0]->get_id == $asset_id; return !chk_authz($_[0], READ, 1); }; } else { $excl_sub = sub { return !chk_authz($_[0], READ, 1) }; } <%once>; my $related_profile = sub { my ($o,$flags) = @_; unless ($flags->{featured}) { return ['Relate', $r->uri, "container_prof|relate_media_cb=".$o->get_id]; } else { return ['Un-relate', $r->uri, "container_prof|unrelate_media_cb=".$o->get_id]; } }; my $thumburi = sub { my ($selfobj, $fieldname) = @_; return unless $fieldname 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 = $selfobj->thumbnail_uri or return ' '; return qq{ }; };