<%doc> This is to display the page after you click Clone in My Workspace. It was mostly copied from edit_new.html and gets called through story_prof.mc. It lets you modify the category, slug, and cover date of the cloned story, using the current values by default. <%perl>; # Display the properties $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Properties", number => 1); $m->out($ieSpacer, '
'); # Title $m->comp('/widgets/profile/displayFormElement.mc', key => 'title', vals => $tmeth ); $m->out($ieSpacer); # Slug $m->comp('/widgets/profile/displayFormElement.mc', key => 'slug', vals => $smeth ); $m->out($ieSpacer); # Category $m->comp('/widgets/select_object/select_object.mc', object => 'category', selected => $cat_id, disp => 'Primary Category', name => 'desk_asset|new_category_id', constrain => { site_id => $site_id }, exclude => $excl_sub, req => 1, field => 'uri', localize => 0, useTable => 1 ); $m->out($ieSpacer); # Output Channel $m->comp('/widgets/select_object/select_object.mc', object => 'output_channel', selected => $oc_id, disp => 'Primary Output Channel', name => 'desk_asset|new_oc_id', ojbs => [$elem->get_output_channels], constrain => { site_id => $site_id }, req => 1, field => 'name', localize => 0, useTable => 1 ); $m->out($ieSpacer); # Cover date $m->comp('/widgets/profile/displayFormElement.mc', key => 'cover_date', vals => $cmeth, ); $m->out($ieSpacer, '
'); $m->comp('/widgets/wrappers/sharky/table_bottom.mc'); # Button at bottom $m->comp('/widgets/wrappers/sharky/table_top.mc', caption => 'Submit', number => 2, ghostly => 1 ); # Have to use a separate hidden field as IE only sent desk_asset|clone_cb.x # and .y, but not desk_asset|clone_cb with value=$sid $m->comp('/widgets/profile/hidden.mc', name => 'desk_asset|clone_cb', value => $sid); $m->comp('/widgets/profile/create_button.html', widget => '', cb => ''); # (implicit table_bottom...) <%args> $widget <%once>; my $spkg = 'Bric::Biz::Asset::Business::Story'; # Title, Slug, and Cover Date my_meths my $tmeth = { %{ $spkg->my_meths->{title} } }; my $smeth = { %{ $spkg->my_meths->{slug} } }; my $cmeth = { %{ $spkg->my_meths->{cover_date} } }; # listManager exclude my $excl_sub = sub { ! chk_authz($_[0], READ, 1) }; <%init>; my $w_id = get_state_data($widget, 'work_id'); my $wf = Bric::Biz::Workflow->lookup({ id => $w_id }); my $site_id = $wf->get_site_id; # (used pnotes in clone/dhandler because story_prof.mc messes with state_data) my $story = $r->pnotes('cloned_story'); my $sid = $story->get_id; # Default values $tmeth->{value} = 'Clone of ' . $story->get_title; $smeth->{value} = $story->get_slug; $cmeth->{value} = $story->get_cover_date; my $cat_id = $story->get_primary_category->get_id; my $oc_id = $story->get_primary_oc_id; my $elem = Bric::Biz::AssetType->lookup({id => $story->get_element__id}); my $agent = detect_agent(); my $ieSpacer = $agent->ie ? qq{

} : '';