#!/usr/bin/perl -wT

# vim: ts=4 sw=4 et:
#----------------------------------------------------------------------
# heading     : Configuration
# description : DOMAINS
# navigation  : 6000 6600
#----------------------------------------------------------------------
#----------------------------------------------------------------------
# copyright (C) 1999-2005 Mitel Networks Corporation
# Copyright 2005 Gordon Rowell <gordonr@gormand.com.au>
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
#----------------------------------------------------------------------

use strict;
use esmith::TestUtils;
use esmith::FormMagick::Panel::domains;

my $fm = esmith::FormMagick::Panel::domains->new();

$fm->display();

=pod

=head1 NAME

domains -- create/modify/delete domains

=head2 DESCRIPTION

This screen allows the administrator to create, modify or delete 
domains.

=begin testing

=end testing

=cut


__DATA__
<form title="FORM_TITLE" 
    header="/etc/e-smith/web/common/head.tmpl" 
    footer="/etc/e-smith/web/common/foot.tmpl">

    <page name="First" pre-event="print_status_message()">

        <description>FORM_DESCRIPTION</description>

        <subroutine src="print_domains_table()" />

        <field type="literal" >
          <description>DESC_CORPORATE_DNS_CURRENT</description>
        </field>

        <field type="literal" id="Forwarder"
              value="get_prop('dnscache', 'Forwarder')" 
              display="get_prop('dnscache', 'Forwarder')" >
          <label>LABEL_CORPORATE_DNS_PRIMARY</label>
        </field>

        <field type="literal" id="Forwarder2"
              value="get_prop('dnscache', 'Forwarder2')" 
              display="get_prop('dnscache', 'Forwarder2')" >
          <label>LABEL_CORPORATE_DNS_SECONDARY</label>
        </field>

        <field type="literal" value="" id="button_corporate_dns" >
          <description>BUTTON_CORPORATE_DNS</description>
        </field>

    </page>

    <page name="DOMAINS_PAGE_CREATE"
            pre-event="turn_off_buttons()"
            post-event="create_modify_domain('create')" >

        <description>CREATE_TITLE</description>

        <field type="text" id="Domain" validation="validate_Domain">
            <label>DOMAIN_NAME</label>
        </field>

        <field type="text" id="Description" validation="nonblank">
            <label>DESCRIPTION_BRIEF</label>
        </field>

        <field type="select" id="Content"
                options="get_content_options()"
                value="get_content_value()">

            <label>CONTENT</label>
            <description>CONTENT_FIELD_DESCRIPTION</description>
        </field>

        <field type="select" id="Nameservers"
                options="get_nameserver_options()"
                value="get_nameserver_value()">

            <label>LABEL_NAMESERVERS</label>
            <description>DESC_NAMESERVERS</description>
        </field>

        <subroutine src="print_button('ADD')" />
    </page>

    <page name="DOMAINS_PAGE_MODIFY"
            pre-event="turn_off_buttons()"
            post-event="create_modify_domain('modify')" >

        <description>MODIFY_TITLE</description>

        <field type="literal" id="Domain" >
            <label>DOMAIN_NAME</label>
        </field>

        <field type="text" id="Description" 
            value="get_description_value()"
            validation="nonblank">
            <label>DESCRIPTION_BRIEF</label>
        </field>

        <field type="select" id="Content"
                options="get_content_options()"
                value="get_content_value()">

            <label>CONTENT</label>
            <description>CONTENT_FIELD_DESCRIPTION</description>
        </field>

        <field type="select" id="Nameservers"
                options="get_nameserver_options()"
                value="get_nameserver_value()" >

            <label>LABEL_NAMESERVERS</label>
            <description>DESC_NAMESERVERS</description>
        </field>

        <subroutine src="print_button('MODIFY')" />
    </page>

    <page name="DOMAINS_PAGE_REMOVE"
            pre-event="turn_off_buttons()"
            post-event="delete_domain()" >

        <description>REMOVE_TITLE</description>

<subroutine src="print_page_description('remove')" />

        <subroutine src="print_button('REMOVE')" />
    </page>

    <page name="DOMAINS_PAGE_CORPORATE_DNS"
            pre-event="turn_off_buttons()"
            post-event="modify_dns" >

        <field type="text" id="Forwarder" size="15"
              value="get_prop('dnscache', 'Forwarder')"
              validation="ip_number_or_blank">
          <label>LABEL_CORPORATE_DNS_PRIMARY</label>
          <description>DESC_CORPORATE_DNS</description>
        </field>

        <field type="text" id="Forwarder2" size="15"
              value="get_prop('dnscache', 'Forwarder2')"
              validation="ip_number_or_blank">
          <label>LABEL_CORPORATE_DNS_SECONDARY</label>
        </field>

        <subroutine src="print_button('SAVE')" />
    </page>

</form>
