<%perl>; my $wf = Bric::Biz::Workflow->lookup ({ id => get_state_data($widget, 'work_id')}); my $site_id = $wf->get_site_id; $m->comp('/widgets/wrappers/sharky/table_top.mc', 'caption' => 'Properties', 'number' => 1); $m->out($ieSpacer); $m->comp('/widgets/profile/displayFormElement.mc', key => 'site', readOnly => 1, objref => $wf ); $m->out($ieSpacer); if ($param->{tplate_type}) { # Output a hidden field for the template type. $m->comp('/widgets/profile/hidden.mc', name => 'tplate_type', value => $param->{tplate_type}); if ($param->{tplate_type} == Bric::Biz::Asset::Formatting::ELEMENT_TEMPLATE) { # It's an element template. Offer them a list of elements to # choose from. Get the top-level elements for this site, and then # all of the subelements. $m->comp('/widgets/select_object/select_object.mc', object => 'element', name => $widget.'|at_id', field => 'name', reset_key => $rk, exclude => $excl_media_sub, objs => $get_elems->($site_id), disp => 'Element'); } elsif ($param->{tplate_type} == Bric::Biz::Asset::Formatting::UTILITY_TEMPLATE) { # It's a utiltiy template. Offer a name field. $m->comp('/widgets/profile/text.mc', disp => 'Name', req => 1, name => "$widget|name"); } else { # Do nothing for a category template. This should never happen. } } else { # Let them decide what type of template they want. $m->comp('/widgets/profile/displayFormElement.mc', vals => Bric::Biz::Asset::Formatting->my_meths->{tplate_type}, key => 'tplate_type' ); } $m->out($ieSpacer); $m->comp('/widgets/profile/displayFormElement.mc', key => "file_type", vals => { disp => "File Type", value => 'mc', props => { type => 'select', vals => Bric::Util::Burner->list_file_types } }); $m->out($ieSpacer); $m->comp('/widgets/select_object/select_object.mc', 'object' => 'output_channel', 'name' => $widget.'|oc_id', 'field' => 'name', 'reset_key' => $rk, selected => $param->{"$widget|oc_id"}, constrain => { active => 1 , site_id => $site_id}, req => 1, 'disp' => 'Output Channel'); $m->out($ieSpacer); $m->comp('/widgets/select_object/select_object.mc', 'object' => 'category', 'name' => $widget.'|cat_id', selected => $param->{"$widget|cat_id"}, 'reset_key' => $rk, 'field' => 'uri', sort_field => 'uri', constrain => { site_id => $site_id }, exclude => $excl_sub, req => 1, 'disp' => 'Category'); $m->out($ieSpacer); $m->comp('/widgets/profile/displayFormElement.mc', key => "priority", vals => $pmeth); $m->out($ieSpacer . "
"); $m->comp('/widgets/wrappers/sharky/table_bottom.mc'); $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Submit", number => 2, ghostly => 1); $m->comp('/widgets/profile/create_button.html', widget => $widget, button => $button, cb => $cb); <%args> $widget $param <%init>; my $rk = get_state_data($widget, 'reset_key'); # browser spacing stuff my $agent = detect_agent(); my $ieSpacer = ($agent->ie) ? qq{
} : ''; my $infoIndent = $agent->nav4 ? FIELD_INDENT - 7 : FIELD_INDENT; my ($button, $cb); ($button, $cb, $pmeth->{value}) = $param->{tplate_type} ? ('create_red', 'create_cb', $param->{priority}) : ('next_dkgreen', 'create_next_cb', 3); <%once>; my $pmeth = { %{ Bric::Biz::Asset::Formatting->my_meths->{priority} } }; $pmeth->{value} = 3; my $excl_sub = sub { ! chk_authz($_[0], READ, 1) }; my $excl_media_sub = sub { $_[0]->is_media || ! chk_authz($_[0], READ, 1) }; my $get_subs; $get_subs = sub { my ($elem, $seen) = @_; my @objs; for my $e ($elem->get_containers) { push @objs, ($e, $get_subs->($e, $seen)) unless $seen->{$e->get_id}++; } return @objs; }; my $get_elems = sub { my $site_id = shift; my ($seen, @tops, @objs) = ({}); for my $e (Bric::Biz::AssetType->list({ site_id => $site_id, top_level => 1 })) { push @tops, $e; push @objs, $get_subs->($e, $seen); } unshift @objs, @tops; return \@objs; };