<%perl>
$m->comp("/widgets/wrappers/sharky/table_top.mc",
  	 caption => "Properties",
	 number  => 1);

my $wf = Bric::Biz::Workflow->lookup
  ({ id => get_state_data($widget, 'work_id')});
my $site_id = $wf->get_site_id;

$m->comp('/widgets/profile/displayFormElement.mc',
         key => 'site',
         readOnly => 1,
         objref => $wf
        );
$m->out($ieSpacer);

$m->comp('/widgets/profile/displayFormElement.mc',
	 key => 'title',
	 vals => $nmeth
	);
</%perl>

<% $ieSpacer %>

<& '/widgets/select_object/select_object.mc',
	disp => 'Media Type',
	name => "$widget|at_id",
	object => 'element',
	field => 'name',
        req => 1,
        constrain  => { top_level => 1,
			media => 1,
                        site_id => $site_id },
        exclude  => $excl_sub,
	useTable   => 1
&>
<% $ieSpacer %>
<& '/widgets/select_object/select_object.mc',
	disp => 'Source',
	object => 'source',
	name => "$widget|source__id",
	field => 'source_name',
	useTable => 1
&>
<% $ieSpacer %>
<& '/widgets/select_object/select_object.mc',
	object		=> 'category',
	disp		=> 'Category',
	name		=> "$widget|category__id",
	field		=> 'uri',
        req             => 1,
	sort_field      => 'uri',
        constrain       => { site_id => $site_id },
        exclude         => $excl_sub,
	useTable	=> 1
&>
		
<% $ieSpacer %>
<&'/widgets/profile/displayFormElement.mc',
	 key => "priority",
	 vals => $pmeth,
&>
<% $ieSpacer %>
<&'/widgets/profile/displayFormElement.mc',
	 key => "cover_date",
	 vals => $cdate,
&>
<% $ieSpacer %><br />

<%perl>

$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);
</%perl>

%#-- Once --#
<%once>;
my $pmeth = { %{ Bric::Biz::Asset::Business::Media->my_meths->{priority} } };
$pmeth->{value} = 3;
my $cdate = { %{ Bric::Biz::Asset::Business::Media->my_meths->{cover_date} } };
my $nmeth = Bric::Biz::Asset::Business::Media->my_meths->{title};
my $excl_sub = sub { ! chk_authz($_[0], READ, 1) };
</%once>

%#-- Args --#
<%args>
$widget
</%args>


%#-- Init --#%#-- Begin HTML --#
<%init>;
$cdate->{value} = strfdate();
# browser spacing stuff
my $agent = detect_agent();
my $ieSpacer = $agent->ie ? qq{<table><tr><td><img src="/media/images/spacer.gif" width=570 height=5 /></td></tr></table>} : '';
</%init>
