Nouvel affichage concernant la création d'une zone.
- Un message indique si la zone a été créée ou non. - Le if/else de la page mapage.tt n'a pas beaucoup d'intérêt dans l'état actuel des choses. Il servira lorsqu'on qu'on voudra faire la mise en page (avec une mise en page différente en case de succès ou d'échec). Suppression de mapage.tt
This commit is contained in:
parent
8ebd61261f
commit
c44fb8653b
@ -67,15 +67,35 @@ get '/home' => sub {
|
|||||||
my %domains = ();
|
my %domains = ();
|
||||||
my %zone_properties = ();
|
my %zone_properties = ();
|
||||||
|
|
||||||
my @d = @{$app->get_domains( session('login') )};
|
# my @d = @{$app->get_domains( session('login') )};
|
||||||
|
|
||||||
template home => {
|
|
||||||
login => session('login')
|
|
||||||
, domains => $app->get_domains(session('login'))
|
|
||||||
, zones_domains => \%domains
|
|
||||||
, zone_properties => \%zone_properties
|
|
||||||
, admin => session('admin') };
|
|
||||||
|
|
||||||
|
if( session('creationSuccess') || session('creationFailure') )
|
||||||
|
{
|
||||||
|
my $cs = session('creationSuccess');
|
||||||
|
session 'creationSuccess' => '';
|
||||||
|
my $cf = session('creationFailure');
|
||||||
|
session 'creationFailure' => '';
|
||||||
|
my $dn = session('domainName');
|
||||||
|
session 'domainName' => '';
|
||||||
|
template home =>
|
||||||
|
{ 'login' => session('login'),
|
||||||
|
'domains' => $app->get_domains(session('login')),
|
||||||
|
'zones_domains' => \%domains,
|
||||||
|
'zone_properties' => \%zone_properties,
|
||||||
|
'admin' => session('admin'),
|
||||||
|
'creationSuccess' => $cs,
|
||||||
|
'creationFailure' => $cf,
|
||||||
|
'domainName' => $dn };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
template home =>
|
||||||
|
{ 'login' => session('login'),
|
||||||
|
'domains' => $app->get_domains(session('login')),
|
||||||
|
'zones_domains' => \%domains,
|
||||||
|
'zone_properties' => \%zone_properties,
|
||||||
|
'admin' => session('admin') };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -137,12 +157,32 @@ prefix '/domain' => sub {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
# Add tld
|
my $creationSuccess = false;
|
||||||
my $domain = param('domain').$cfg->param('tld');
|
my $creationFailure = false;
|
||||||
$domain =~ s/\.{2,}/\./g;
|
if( param('domain') =~ /^[a-zA-Z0-9]+[a-zA-Z0-9-]+[a-zA-Z0-9]+$|^[a-zA-Z0-9]+$/ )
|
||||||
# create domain
|
{
|
||||||
my $app = initco();
|
|
||||||
$app->add_domain( session('login'), param('domain') );
|
my $cfg = new Config::Simple(dirname(__FILE__).'/../conf/config.ini');
|
||||||
|
my $domain = param('domain').$cfg->param('tld');
|
||||||
|
# $domain =~ s/\.{2,}/\./g;
|
||||||
|
# say "domain after sed : $domain";
|
||||||
|
# create domain
|
||||||
|
my $app = initco();
|
||||||
|
# Add tld
|
||||||
|
# create domain
|
||||||
|
$app->add_domain( session('login'), $domain );
|
||||||
|
$creationSuccess = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# say param('domain')." contains a char not valid";
|
||||||
|
$creationFailure = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
session 'creationSuccess' => $creationSuccess;
|
||||||
|
session 'creationFailure' => $creationFailure;
|
||||||
|
session 'domainName' => param('domain');
|
||||||
redirect '/home';
|
redirect '/home';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,17 @@
|
|||||||
|
|
||||||
<div id="page">
|
<div id="page">
|
||||||
|
|
||||||
|
<!-- Permettra une mise en forme plus propre. -->
|
||||||
|
<% IF creationSuccess == 1 %>
|
||||||
|
<p>
|
||||||
|
Le domaine "<% domainName %>" a bien été créée.
|
||||||
|
</p>
|
||||||
|
<% ELSIF creationFailure == 1 %>
|
||||||
|
<p>
|
||||||
|
Le domaine "<% domainName %>" n'a pas été créée.
|
||||||
|
</p>
|
||||||
|
<% END %>
|
||||||
|
|
||||||
<% IF domains && domains.size %>
|
<% IF domains && domains.size %>
|
||||||
<h3>Vos domaines :</h3>
|
<h3>Vos domaines :</h3>
|
||||||
<br />
|
<br />
|
||||||
|
Reference in New Issue
Block a user