<& '/widgets/search/search.mc', object => 'story', state_key => 'rel_story', type => 'story', field => 'title', use_form_tag => 0 &> <& '/widgets/wrappers/sharky/table_top.mc', caption => 'Choose a Related Story' &> <& /widgets/listManager/listManager.mc, object => 'story', state_key => 'rel_story', sortBy => 'name', select => undef, profile => $related_profile, featured => $relate_id ? [$relate_id] : undef, exclude => $excl_sub, fields => [qw(id title uri cover_date)], field_values => $field_values, addition => '', behavior => 'expand', &> <& '/widgets/wrappers/sharky/table_bottom.mc' &> <& '/widgets/buttons/submit.mc', disp => 'Return', widget => $widget, cb => 'related_up_cb', button => 'return_dgreen', value => 'Return', useTable => 0, &> <%args> $widget <%init>; # The element object my $element = get_state_data($widget, 'element'); my $relate_id = $element->get_related_story_id; my $excl_sub; if ($element->get_object_type eq 'story') { my $asset_id = get_state_data('story_prof', 'story')->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 $field_values = sub { my ($o, $field) = @_; return unless $field eq 'title'; my $html = '' . $o->get_title . ''; return $html; }; my $related_profile = sub { my ($o, $flags) = @_; return ['Relate', $r->uri, "container_prof|relate_story_cb=".$o->get_id] unless $flags->{featured}; return ['Un-relate', $r->uri, "container_prof|unrelate_story_cb=".$o->get_id]; };