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 $_out = $m->current_sink; $m->debug_hook($m->current_comp->path) if (%DB::); my $media = get_state_data($widget, 'media'); my $tile = $media->get_tile(); set_state_data('container_prof', 'tile', $tile); my $wf_id = get_state_data($widget, 'work_id'); $wf_id = $media->get_workflow_id() unless $wf_id; my $wf = Bric::Biz::Workflow->lookup( { id => $wf_id }); my $desks = $wf->allowed_desks(); my $cd = $media->get_current_desk(); $cd = $wf->get_start_desk() unless $cd; # Set up a formatting variable my $agent = $m->comp("/widgets/util/detectAgent.mc"); my $infoIndent = ($agent->{browser} eq "Netscape") ? FIELD_INDENT - 5 : FIELD_INDENT + 8; my $num = 1; my $ieSpacer = ($agent->{browser} eq "Internet Explorer") ? qq{
} : ''; $_out->(' '); my $rightText = $m->scomp( '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget . "|notes_cb", image => "view_notes_teal" ); $rightText .= $m->scomp( '/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget . "|trail_cb", image => "view_trail_teal" ); $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Information", number => $num++, rightText => $rightText ); $_out->('
ID:   '); $_out->( $media->get_id() ); $_out->('
Asset Type:   '); $_out->( $media->get_element_name() ); $_out->('
Version:   '); $_out->( $media->get_version() ); $_out->('
'); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $media, key => 'title',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $media, key => 'description',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/select_object/select_object.mc', object => 'source', name => "$widget|source__id", field => 'source_name', selected_id => $media->get_source__id, indent => 0, useTable => 1, disp => "Source"); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/select_object/select_object.mc', object => 'category', name => "$widget|category__id", field => "name", selected_id => $media->get_category__id, indent => 0, useTable => 1, disp => "Category"); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $media, key => 'priority',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $media, key => 'cover_date',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $media, key => 'expire_date',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp("/widgets/wrappers/sharky/table_bottom.mc"); $_out->(' '); $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Upload a file", number => 2 ); $_out->('
File Path:
'); $m->comp('/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget ."|update_pc", image => "upload_red"); $_out->('
Download: '); if (my $uri = $media->get_local_uri()) { $_out->(' '); $_out->( $media->get_file_name ); $_out->(' '); } else { $_out->(' No file has been uploaded '); } $_out->('
'); $m->comp("/widgets/wrappers/sharky/table_bottom.mc"); $m->comp( '/widgets/container_prof/container_prof.mc', tile => $tile, tile_type => 'media', action => 'edit', num => 3, title => 'Content', start_count => 6 ); $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Contributors", number => 4); $_out->('
Contributors: '); my @existing_contribs = map { $_->get_name } $media->get_contributors; $m->out((scalar(@existing_contribs)) ? " " . join(", ", @existing_contribs) : " No contributors defined."); $_out->(' '); $m->comp('/widgets/profile/imageSubmit.mc', formName => "theForm", callback => $widget ."|contributors_cb", image => "edit_lgreen", vspace => 3); $_out->('
'); $m->comp("/widgets/wrappers/sharky/table_bottom.mc"); $m->comp("/widgets/profile/buttonBar.mc", widget => $widget, desks => $desks, cd => $cd, obj => $media, ); $_out->(' '); #-- Args Section --# $_out->(' '); #-- Init Section --# $_out->(' '); return undef; }, 'create_time'=>1001684346, 'declared_args'=> { '$widget' => { 'default' => undef } }, 'object_size'=>6981, 'parser_version'=>0.8 ) ;