>
 <% uc $caption %>     <%$lang->maketext('Sort By')%>: <& '/widgets/profile/select.mc', value => $sort_by_val, useTable => 0, indent => 70, width => 100, options => $sort_by->{$class}, name => $class . '_sort_by', js => qq{onChange="location.href='} . $r->uri . "?${class}_sort_by=' + " . qq{escape(this.options[this.selectedIndex].value)"}, &>   % if ($link1) { % } if ($link2) { % }

<%args> $class => 'story' $caption => '' $sort_by_val => undef $others => {} <%init>; $caption ||= $pl_names->{$class}; my ($link1, $link2, $lab1, $lab2); if ($class eq 'story') { ($link1, $lab1) = ('#media', $pl_names->{media}) if $others->{media}; ($link2, $lab2) = ('#formatting', $pl_names->{formatting}) if $others->{formatting}; } elsif ($class eq 'media') { ($link1, $lab1) = ('#story', $pl_names->{story}) if $others->{story}; ($link2, $lab2) = ('#formatting', $pl_names->{formatting}) if $others->{formatting}; } else { ($link1, $lab1) = ('#story', $pl_names->{story}) if $others->{story}; ($link2, $lab2) = ('#media', $pl_names->{media}) if $others->{media}; } $sort_by_val = get_pref('Default Asset Sort') unless defined $sort_by_val; <%once>; my $sort_by = { story => [ [ cover_date => 'Cover Date' ], [ priority => 'Priority' ], [ name => 'Title' ], [ category_name => 'Category' ], [ site_id => 'Site' ], [ element => 'Story Type' ], [ id => 'ID' ], ], media => [ [ cover_date => 'Cover Date' ], [ priority => 'Priority' ], [ name => 'Title' ], [ category_name => 'Category' ], [ site_id => 'Site' ], [ element => 'Media Type' ], [ id => 'ID' ], ], formatting => [ [ deploy_date => 'Cover Date' ], [ priority => 'Priority' ], [ file_name => 'File Name' ], [ category_name => 'Category' ], [ site_id => 'Site' ], [ element => 'Asset Type' ], [ id => 'ID' ], ] }; my $pl_names = { story => get_class_info('story')->get_plural_name, media => get_class_info('media')->get_plural_name, formatting => 'templates' #get_class_info('formatting')->get_plural_name };