% # Do paging % if ($num_pages) { % unless ($show_all) { % } % } # if $num_pages
<% $colspan %>> <% $prev_link %> % foreach my $page (0 .. $num_pages) { % my $off = $page * $limit; <% $page + 1 %> % } <% $next_link %> >Show All
_assets_<% $color1 %>.gif" border="0" name="<% "$widget|$chk_cb" %>_cb" value="<% $chk_label %>"> .gif" border="0" name="<% "$widget|$act_cb" %>_cb" value="<% $act_label %>">
<%args> $widget $wf => undef $desk => undef $w_id => undef $d_id => undef $offset => 0 $show_all => undef <%init> # desk_asset matches Callback/Desk.pm class_key my $d = $r->pnotes('desk_asset.objs'); # from desk.mc $d->{story} ||= []; $d->{media} ||= []; $d->{formatting} ||= []; my $num_objs = @{$d->{story}} + @{$d->{media}} + @{$d->{formatting}}; return unless $num_objs; $wf ||= Bric::Biz::Workflow->lookup({ id => $w_id }) if defined $w_id; $desk ||= Bric::Biz::Workflow::Parts::Desk->lookup({ id => $d_id }) if defined $d_id; my ($chk_label, $chk_cb, $act_label, $act_cb); if ($desk) { $chk_label = 'Move Assets'; $chk_cb = 'move'; } else { $chk_label = 'Check In Assets'; $chk_cb = 'checkin'; } if ($desk && $desk->can_publish) { if ($wf && $wf->get_type == TEMPLATE_WORKFLOW) { $act_label = 'deploy_checked_red'; $act_cb = 'deploy'; } else { $act_label = 'publish_checked_red'; $act_cb = 'publish'; } } else { $act_label = 'delete_checked_red'; $act_cb = 'delete'; } my $color1 = ($chk_cb eq 'move') ? 'lgreen' : 'red'; my $color2 = ($act_cb) ? 'red' : 'red'; my $mod = ($chk_cb eq 'move') ? 'assets': 'checked'; my $checkbox_name = $act_cb eq 'delete' ? '_delete_ids' : 'desk_asset|'; # Paging my $limit = get_pref('Search Results / Page'); my $num_pages = ($num_objs <= $limit) ? 0 : $limit ? int($num_objs / $limit) : 0; my $style = q{style="border-style:solid; border-color:#cccc99;"}; my $colspan = $show_all ? '' : 'colspan="2"'; my $url = $r->uri; my $prev_offset = $offset ? $offset - $limit : 0; my $next_offset = $offset + $limit; $next_offset = $num_pages * $limit if $next_offset > $num_objs; my ($prev_link, $next_link) = ('', ''); if ($offset) { $prev_link = qq{«}; } unless ($offset == $num_pages * $limit) { $next_link = qq{»}; }