%#-- Begin HTML --#
<& '/widgets/wrappers/sharky/header.mc',
   title => "$disp Profile",
   context => "Admin | Profile | $disp | $crumb"
&>
<form method="post" action="<% $r->uri %>" name="server_profile" onsubmit="return confirmChanges(this)" autocomplete="off">
<%perl>;
$m->comp('/widgets/profile/hidden.mc', value => $id, name => 'server_id')
  if defined $id;
$m->comp('/widgets/profile/hidden.mc', name => 'dest_id', value => $dest_id);

# Output the key properties.
$m->comp("/widgets/wrappers/sharky/table_top.mc", caption => "Properties",
	 number => 1);
$m->comp('/widgets/profile/dumpRemainingFields.mc', objref => $s,
	 readOnly => $no_edit);
$m->comp("/widgets/wrappers/sharky/table_bottom.mc");

</%perl>
<& '/widgets/profile/formButtons.mc', type => $type, section => $section,
   no_del => $no_del, no_save => $no_edit, widget => $type,
   return => "/admin/profile/dest?id=$dest_id" &>

</form>
<& '/widgets/wrappers/sharky/footer.mc', param => \%ARGS &>

%#-- End HTML --#

%#-- Once Section --#
<%once>;
my $widget = 'profile';
my $section = 'admin';
my $type = 'server';
my $class = get_package_name($type);
my $disp = get_disp_name($type);
my $dest_key = 'dest';
my $dest_class = get_package_name($dest_key);
</%once>

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

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

$id ||= $ARGS{server_id};

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

# Get the server type (destination profile) ID and instantiate the destination
# object.
$dest_id ||= get_state_data($widget, $dest_key) || $s->get_server_type_id;
my $dest = $dest_class->lookup({ id => $dest_id });

# Check authorization.
chk_authz($dest, EDIT);
my $no_edit = !chk_authz($dest, EDIT, 1);
my $no_del = !$id || $no_edit;

# Get the name for the breadcrumb trail.
my $crumb = $s->get_name;
$crumb = $crumb ? "&quot;$crumb&quot;" : 'New';
</%init>

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

=head1 NAME

/admin/profile/server/dhandler - Interface for managing servers.

=head1 VERSION

$LastChangedRevision$

=head1 DATE

$LastChangedDate$

=head1 DESCRIPTION

This element handles the display for editing distribution servers.

</%doc>
