package HTML::Mason::Commands; use strict; use vars qw($m $r); my $_escape = \&HTML::Mason::Parser::_escape_perl_expression; # outputs a 1x1 pixel table cell. The first argument determines value of the # colspan tag, while the second determines the height of the image. my $onePixCell = sub { my ($colspan, $h, $w) = @_; $h ||= 1; $w ||= 1; $colspan = $colspan ? qq{ colspan="$colspan"} : ''; return qq {} . qq{}; }; ; my $priors = Bric::Biz::Asset->list_priorities; HTML::Mason::Component::FileBased->new ( 'code'=>sub { my %ARGS; if (@_ % 2 == 0) { %ARGS = @_ } else { die "Odd number of parameters passed to component expecting name/value pairs" } my $mlabel = (!exists $ARGS{'mlabel'} ? 'Move to Desk' : $ARGS{'mlabel'}); my $widget = (!exists $ARGS{'widget'} ? 'desk' : $ARGS{'widget'}); my $obj = (!exists $ARGS{'obj'} ? die "no value sent for required parameter 'obj'" : $ARGS{'obj'}); my $highlight = (!exists $ARGS{'highlight'} ? die "no value sent for required parameter 'highlight'" : $ARGS{'highlight'}); my $can_edit = (!exists $ARGS{'can_edit'} ? die "no value sent for required parameter 'can_edit'" : $ARGS{'can_edit'}); my $elink = (!exists $ARGS{'elink'} ? die "no value sent for required parameter 'elink'" : $ARGS{'elink'}); my $vlabel = (!exists $ARGS{'vlabel'} ? 'View' : $ARGS{'vlabel'}); my $desk_val = (!exists $ARGS{'desk_val'} ? die "no value sent for required parameter 'desk_val'" : $ARGS{'desk_val'}); my $desk_opts = (!exists $ARGS{'desk_opts'} ? die "no value sent for required parameter 'desk_opts'" : $ARGS{'desk_opts'}); my $ppage = (!exists $ARGS{'ppage'} ? die "no value sent for required parameter 'ppage'" : $ARGS{'ppage'}); my $disp = (!exists $ARGS{'disp'} ? die "no value sent for required parameter 'disp'" : $ARGS{'disp'}); my $type = (!exists $ARGS{'type'} ? die "no value sent for required parameter 'type'" : $ARGS{'type'}); my $pub = (!exists $ARGS{'pub'} ? '' : $ARGS{'pub'}); my $aid = (!exists $ARGS{'aid'} ? die "no value sent for required parameter 'aid'" : $ARGS{'aid'}); my $class = (!exists $ARGS{'class'} ? 'story' : $ARGS{'class'}); my $did = (!exists $ARGS{'did'} ? die "no value sent for required parameter 'did'" : $ARGS{'did'}); my $desk_type = (!exists $ARGS{'desk_type'} ? die "no value sent for required parameter 'desk_type'" : $ARGS{'desk_type'}); my $_out = $m->current_sink; $m->debug_hook($m->current_comp->path) if (%DB::); ; # Get the ID. my $id = $obj->get_id; # Determine the status. my $status = $obj->get_publish_status ? '' : ' '; my $cats = $rc->get("desk.cats") || {}; my ($name, $date, $date_label, $cat); if ($class eq 'formatting') { $date = $obj->get_deploy_date || ' '; $date_label = 'Deployed Date'; $name = $obj->get_uri; my $cat_id = $obj->get_category_id; if (defined $cat_id) { unless ($cat = $cats->{$cat_id}) { $cat = Bric::Biz::Category->lookup({ id => $cat_id })->get_name; $cats->{$cat_id} = $cat; $rc->set("desk.cats", $cats); } } else { $cat = ' '; } } else { $name = $obj->get_name; $date = $obj->get_cover_date; $date_label = 'Cover Date'; my $c = $highlight eq 'name' ? 'whiteMedUnderlinedLink' : 'blackMedUnderlinedLink'; if ($class eq 'media') { if (my $uri = $obj->get_local_uri) { $name = qq{$name}; } $cat = $cats->{$obj->get_category__id} ||= $obj->get_category_object; $cat = $cat->get_name if $cat; } else { $name = qq{$name}; $cat = $obj->get_primary_category; $cat = $cat->get_name if $cat; $cat ||= ' '; } } $cat ||= ' '; my $classes = $highlight ? { $highlight => ' class="tealHighlight"' } : {}; my $rowspan = 4; #-- Begin HTML --# $_out->(' '); $_out->(' '); $_out->( &$onePixCell(0, 22) ); $_out->(' '); $_out->( &$onePixCell() ); $_out->('
( $classes->{id} || '' ); $_out->(' align="right">'); $_out->( $id ); $_out->(' V.'); $_out->( $obj->get_version ); $_out->('( $classes->{name} || $classes->{file_name} || '' ); $_out->('> '); $_out->( $name ); $_out->(' ( $classes->{name} || $classes->{file_name} || '' ); $_out->('>'); $_out->( $status ); $_out->('
'); $_out->( &$onePixCell(undef, 1, 100) ); $_out->(' '); $_out->( &$onePixCell(2, 1, 241) ); $_out->(' '); $_out->( &$onePixCell(1) ); $_out->(' ( $classes->{category_name} || $classes->{location} || '' ); $_out->(' width="240"> '); $_out->( $cat ); $_out->(' '); $_out->( &$onePixCell(3) ); $_out->(' '); $_out->( &$onePixCell(0, 20) ); $_out->(' ( $classes->{element} || '' ); $_out->('> '); $_out->( $type ); $_out->(' '); $_out->( &$onePixCell(3) ); $_out->(' '); $_out->( &$onePixCell(0, 20) ); $_out->(' ( $classes->{cover_date} || '' ); $_out->('> '); $_out->( $date || ' ' ); $_out->(' '); $_out->( &$onePixCell(3) ); $_out->(' '); $_out->( &$onePixCell(0, 18) ); $_out->(' ( $classes->{priority} || '' ); $_out->('> '); $_out->( $priors->{$obj->get_priority} || ' ' ); $_out->('
Category: '); $_out->( &$onePixCell(0, 20) ); $_out->(' '); $_out->( &$onePixCell(0, 43) ); $_out->(' '); $_out->( &$onePixCell(0, 18) ); $_out->('
'); $_out->( $elink ); $_out->('
'); if ($can_edit && $desk_opts) { $_out->(' '); $_out->( $mlabel ); $_out->(': '); $m->comp('/widgets/profile/select.mc', name => $widget . '|next_desk', value => $desk_val, options => $desk_opts, useTable => 0); $_out->(' '); } else { $_out->('   '); } $_out->('
Notes   Trail   '); my $link = $ppage . '/' . $aid; if ($desk_type eq 'workflow') { $link .= '?return=' . $did; if ($vlabel eq 'Edit') { $link .= '&checkout=1'; } } else { if ($vlabel eq 'Edit') { $link .= '?checkout=1'; } } $_out->(' '); $_out->( $vlabel ); $_out->('   Log   '); $_out->( $pub ); $_out->('
'); $_out->( $class eq 'formatting' ? 'Asset' : $disp ); $_out->(' Type:
'); $_out->( $date_label || ' ' ); $_out->(':
Priority:
'); #-- End HTML --# $_out->(' '); #-- Once Section --# $_out->(' '); #-- Args Section --# $_out->(' '); #-- Init Section --# $_out->(' '); return undef; }, 'create_time'=>1001670213, 'declared_args'=> { '$vlabel' => { 'default' => ' \'View\'' }, '$highlight' => { 'default' => undef }, '$can_edit' => { 'default' => undef }, '$aid' => { 'default' => undef }, '$type' => { 'default' => undef }, '$disp' => { 'default' => undef }, '$class' => { 'default' => ' \'story\'' }, '$elink' => { 'default' => undef }, '$desk_type' => { 'default' => undef }, '$obj' => { 'default' => undef }, '$pub' => { 'default' => ' \'\'' }, '$desk_val' => { 'default' => undef }, '$mlabel' => { 'default' => ' \'Move to Desk\'' }, '$widget' => { 'default' => ' \'desk\'' }, '$did' => { 'default' => undef }, '$desk_opts' => { 'default' => undef }, '$ppage' => { 'default' => undef } }, 'object_size'=>10875, 'parser_version'=>0.8 ) ;