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 $story = get_state_data($widget, 'story'); my $tile = $story->get_tile(); my $id = $story->get_id; my $wf_id = get_state_data($widget, 'work_id'); $wf_id = $story->get_workflow_id() unless $wf_id; my $wf = Bric::Biz::Workflow->lookup( { id => $wf_id }); my $desks = $wf->allowed_desks(); my $cd = $story->get_current_desk(); $cd = $wf->get_start_desk() unless $cd; my $agent = $m->comp("/widgets/util/detectAgent.mc"); my $infoIndent = ($agent->{browser} eq "Netscape") ? FIELD_INDENT - 5 : FIELD_INDENT + 8; my $ieSpacer = ($agent->{browser} eq "Internet Explorer") ? qq{
} : ''; my $num = 1; $_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->( $id ); $_out->('
Story Type:   '); $_out->( $story->get_element_name ); $_out->('
URI:   '); $_out->( $story->get_primary_uri ); $_out->('
'); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/select_object/select_object.mc', object => 'source', name => "$widget|source__id", field => 'source_name', selected_id => $story->get_source__id, indent => 0, useTable => 1, disp => "Source"); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $story, key => 'priority',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $story, key => 'title',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $story, key => 'description',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $story, key => 'slug',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $story, key => 'cover_date',); $_out->(' '); $_out->( $ieSpacer ); $_out->(' '); $m->comp('/widgets/profile/displayFormElement.mc', objref => $story, key => 'expire_date',); $_out->(' '); $m->comp("/widgets/wrappers/sharky/table_bottom.mc"); $num = $m->comp('/widgets/container_prof/container_prof.mc', tile => $tile, tile_type => 'story', action => 'edit', title => 'Content', num => $num, start_count => 4 ); $_out->(' '); $_out->(' '); $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Categories", number => $num++); $_out->(' '); my @cat = $story->get_categories; my $primary = $story->get_primary_category(); my $p_id = $primary ? $primary->get_id : ''; my $rowspan = scalar (@cat) + 2; $_out->(' '); # BEGIN FOREACH CAT foreach (@cat) { $_out->(' '); } # END FOREACH CAT $_out->(' '); if (!@cat) { $_out->(' '); } else { $_out->(' '); } $_out->('
Name Primary Delete
'); $_out->( $_->get_name ); $_out->(' ( $_->get_id() eq $p_id ? 'CHECKED' : '' ); $_out->('> '); $m->comp('/widgets/profile/checkbox.mc', name => "$widget|delete_cat", value => $_->get_id); $_out->(' 
This story has not been assigned to a category.
 
'); $m->comp('/widgets/profile/imageSubmit.mc', formName => "theForm", callback => "$widget|add_category_cb", image => "add_category_lgreen", vspace => 3, hspace => 2); $_out->(' '); $m->comp('/widgets/select_object/select_object.mc', object => 'category', name => "$widget|new_category_id", field => 'name', useTable => 0); $_out->('
'); $m->comp("/widgets/wrappers/sharky/table_bottom.mc"); $_out->(' '); $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Associations", number => $num++); $_out->('
Type  Values  Action
Keywords:  '); my @keywords; foreach my $kw ($story->get_keywords) { push @keywords, $kw->get_name; } $m->out(scalar(@keywords) ? join(", ", @keywords) : "No keywords defined."); $_out->(' '); $m->comp('/widgets/profile/imageSubmit.mc', formName => "theForm", callback => "$widget|keywords_cb", image => "edit_lgreen", vspace => 4); $_out->('
Contributors:  '); my @contribs; foreach my $cntr ($story->get_contributors) { push @contribs, $cntr->get_name; } $m->out(scalar(@contribs) ? join(", ", @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 => $story, ); $_out->(' '); $_out->(' '); return undef; }, 'create_time'=>1001676492, 'declared_args'=> { '$widget' => { 'default' => undef } }, 'object_size'=>9864, 'parser_version'=>0.8 ) ;