%perl>; my $order_vals = [ map { [ $_ => $_ ] } 1..@contribs ]; my ($i, @sort_array); my $order_sub = sub { return unless $_[1] eq 'order'; my $id = $_[0]->get_id; push @sort_array, qq{"$widget|reorder_$id"}; $m->scomp('/widgets/profile/select.mc', name => "$widget|reorder_$id", disp => '', value => ++$i, options => $order_vals, useTable => 0, js => qq{onChange="reorder(this, 'theForm')"} ) }; my $uri = $r->uri; my $role_sub = sub { my ($val, $c) = @_; my $role = $story->get_contributor_role($c); $val .= qq{ (Role: $role)} if $role; $val; }; $m->comp('/widgets/listManager/listManager.mc', object => 'contrib', userSort => 0, def_sort_field => 'order', title => 'Current Contributors', objs => \@contribs, profile => undef, alter => { type => $role_sub }, fields => [qw(lname fname type order)], field_titles => { order => 'Order' }, field_values => $order_sub, select => ['Delete', "$widget|delete_id"], addition => '' ); %perl>
<& /widgets/search/search.mc, object => 'contrib', field => 'lname', type => 'dual', use_form_tag => 0 &> <& /widgets/listManager/listManager.mc, object => 'contrib', title => 'Choose Contributors', select => undef, profile => $contrib_profile, exclude => \@existing_contribs, fields => [qw(lname fname type)], constrain => { no_grp_id => Bric::Biz::Person->INSTANCE_GROUP_ID }, addition => '', behavior => 'expand', &> <%args> $widget %args> <%init> my $story = get_state_data($widget, 'story'); my @existing_contribs = map { $_->get_id } $story->get_contributors; my @contribs = $story->get_contributors(); %init> <%once> my $contrib_profile = sub { my ($o,$flags) = @_; unless ($flags->{'featured'}) { return ['Associate', $r->uri, "story_prof|assoc_contrib_cb=".$o->get_id]; } else { return ['Un-Associate', $r->uri, "story_prof|unassoc_contrib_cb=".$o->get_id]; } }; %once>