package HTML::Mason::Commands; use strict; use vars qw($m $r); my $_escape = \&HTML::Mason::Parser::_escape_perl_expression; 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 $widget = (!exists $ARGS{'widget'} ? die "no value sent for required parameter 'widget'" : $ARGS{'widget'}); my $wf = (!exists $ARGS{'wf'} ? undef : $ARGS{'wf'}); my $desk = (!exists $ARGS{'desk'} ? undef : $ARGS{'desk'}); my $w_id = (!exists $ARGS{'w_id'} ? undef : $ARGS{'w_id'}); my $d_id = (!exists $ARGS{'d_id'} ? undef : $ARGS{'d_id'}); my $_out = $m->current_sink; $m->debug_hook($m->current_comp->path) if (%DB::); my $d = $rc->get("desk.objs"); return unless $d->{story} || $d->{media} || $d->{formatting}; $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) = $desk ? ('Move Assets', 'move', $wf && $wf->get_type == TEMPLATE_WORKFLOW ? ('deploy_checked_red', 'deploy') : ('publish_checked_red', 'publish')) : ('Check In Assets', 'checkin', 'delete_checked_red', 'delete'); my $color1 = ($chk_cb eq 'move') ? 'lgreen' : 'red'; my $color2 = ($act_cb) ? 'red' : 'red'; my $mod = ($chk_cb eq 'move') ? 'assets': 'checked'; $_out->('
('_cb" value="'); $_out->( $chk_label ); $_out->('"> '); if (!$desk || ($desk && $desk->can_publish)) { # _cb" value="<% $act_label %>"> $_out->(' ('_cb" value="'); $_out->( $act_label ); $_out->('"> '); } $_out->(' |