<%perl>;
# Output the header and other necessities.
$m->comp('/widgets/wrappers/sharky/header.mc',
         title => "$disp Profile",
	 context => "Admin | Profile | $disp | &quot;" . $job->get_name . "&quot"
);
$m->out(qq{<form method="post" name="job_profile" action="} . $r->uri
        . qq{" onSubmit="return confirmChanges(this)">\n});
$m->comp('/javascripts/profile/formValidator.js', id => $id);

# Output a hidden field with the ID, if we have one.
$m->comp('/widgets/profile/hidden.mc', value => $id, name => 'job_id')
  if defined $id;

# Display the Basics.
$m->comp("/widgets/wrappers/sharky/table_top.mc",
  	 caption => "Properties",
	 number  => 1);

# Dump out the fields for display.
$m->comp('/widgets/profile/dumpRemainingFields.mc',
	 readOnly => $no_edit,
	 objref => $job,
	 fieldsUsed => { comp_time => 1,
		         sched_time => 1
		       }
	);

$m->comp("/widgets/select_time/select_time.mc",
	 base_name => 'sched_time' ,
	 def_date  => $job->get_sched_time(ISO_8601_FORMAT),
	 useTable  => 1,
	 disp      => "Scheduled Time"
	);

$m->comp("/widgets/wrappers/sharky/table_bottom.mc");

# Show a list of the Distribution Profiles.
$m->comp("/widgets/wrappers/sharky/table_top.mc",
  	 caption => "Destinations",
	 number => 2);
$m->out("<table border=0 cellpadding=0 cellspacing=0 width=575>");
foreach my $st ($job->get_server_types) {
    $m->out(qq{<tr><td width="20" height="25"></td><td width="555">&nbsp;} . $st->get_name . "</td></tr>\n");
}
$m->out("</table>\n");
$m->comp("/widgets/wrappers/sharky/table_bottom.mc");

# Show a list of the Resources.
$m->comp("/widgets/wrappers/sharky/table_top.mc",
  	 caption => "Resources",
	 number => 3
	);
$m->out("<table border=0 cellpadding=0 cellspacing=0 width=575>");
foreach my $st ($job->get_resources) {
    $m->out(qq{<tr><td width="20" height="25"></td><td width="555">&nbsp;} . $st->get_uri . "</td></tr>\n");
}
$m->out("</table>\n");
$m->comp("/widgets/wrappers/sharky/table_bottom.mc");


# Add the form buttons and other necessities.
$m->comp("/widgets/profile/formButtons.mc", type => $type, section => $widget,
	 no_del => $no_del, no_save => $no_edit, chk_label => 'Cancel this Job',
	 ret_val => 'return_dgreen');
$m->out("</form>\n");
$m->comp('/widgets/wrappers/sharky/footer.mc', param => \%ARGS );
</%perl>

%#-- Once Section --#
<%once>;
my $class = "Bric::Dist::Job";
my $widget = 'profile';
my $type = 'job';
my $disp = get_disp_name($type);
</%once>

%#-- Args Section --#
<%args>
$id => undef
</%args>

<%init>;
# Do any redirects first.
do_queued_redirect();

# Instantiate an object.
my $job = $ARGS{obj} ? $ARGS{obj} : defined $id ? $class->lookup({ id => $id})
  : $class->new;
$id ||= $job->get_id;

# Check authorization.
chk_authz($job, $id ? READ : CREATE);
my $no_edit = !chk_authz($job, ($id ? EDIT : CREATE), 1);
my $no_del = !$id || $no_edit;
</%init>

<%doc>
###############################################################################

=head1 NAME

=head1 VERSION

$Revision: 1.5 $

=head1 DATE

$Date: 2001/12/04 18:17:38 $

=head1 SYNOPSIS

/admin/profile/job/dhandler - Distribution Job Profile.

=head1 DESCRIPTION

This element displays Distribution Job profiles for editing.

</%doc>
