[vhffs-dev] [1771] No more HTML::Template in dns/create |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1771
Author: beuss
Date: 2011-05-19 07:44:11 +0200 (Thu, 19 May 2011)
Log Message:
-----------
No more HTML::Template in dns/create
Modified Paths:
--------------
trunk/vhffs-panel/dns/create.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/dns/create.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/dns/create.tmpl
Modified: trunk/vhffs-panel/dns/create.pl
===================================================================
--- trunk/vhffs-panel/dns/create.pl 2011-05-17 20:51:06 UTC (rev 1770)
+++ trunk/vhffs-panel/dns/create.pl 2011-05-19 05:44:11 UTC (rev 1771)
@@ -3,7 +3,6 @@
use strict;
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
@@ -11,13 +10,10 @@
use Encode;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
use Vhffs::Group;
-use Vhffs::Main;
use Vhffs::Functions;
use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Panel::Group;
+use Vhffs::Panel::DNS;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -31,16 +27,12 @@
my $group = Vhffs::Group::get_by_groupname( $vhffs , $cgi->param('group') );
unless( defined $group && $user->can_modify( $group ) ) {
- my $template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
- $template->param( MESSAGE => gettext( 'You\'re not allowed to do this (ACL rights)' ) );
-
- $panel->build( $template );
- $panel->display;
-}
-else {
+ $panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this (ACL rights)' ) } );
+} else {
my $submitted = defined($cgi->param('dns_submit'));
my $domain_name = '';
my $description = '';
+ my $vars = {};
if( $submitted ) {
$domain_name = $cgi->param('DOMAIN_NAME');
@@ -61,26 +53,13 @@
$panel->add_error( gettext('An error occured while creating the object. The domain is not correct or aleady exists in Vhffs database') );
}
}
+ $vars->{domain} = $domain_name;
+ $vars->{description} = $description;
}
- if( !$submitted || $panel->has_errors() ) {
- my $template = new HTML::Template( filename => $templatedir.'/panel/dns/create.tmpl' );
-
- $panel->set_title( gettext('Create a DNS') );
-
- $template->param( DOMAIN_NAME => gettext('Domain Name') );
- $template->param( DOMAIN_NAME_VALUE => $domain_name );
-
- $template->param( INFOS_DNS => gettext('Be careful ! You must give the reason why you want to host this domain on our servers.') );
- $template->param( DNS_SERVER => gettext('DNS servers:') );
- $template->param( GROUP_NAME => gettext('Group owning this DNS') );
-
- $template->param( GROUP => $group->get_groupname );
- $template->param( SEND => gettext('Send') );
- $template->param( DESCRIPTION => gettext('Description') );
- $template->param( DESCRIPTION_VALUE => $description );
-
- $panel->build( $template );
- $panel->display;
- }
+ my $conf = $vhffs->get_config->get_service('dns');
+ $vars->{group} = $group;
+ $vars->{ns} = $conf->{init}{ns};
+ $vars->{help_url} = $conf->{url_doc};
+ $panel->render('dns/create.tt', $vars);
}
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-17 20:51:06 UTC (rev 1770)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-19 05:44:11 UTC (rev 1771)
@@ -59,7 +59,6 @@
admin/cron/search.tmpl \
cvs/create.tmpl \
cvs/prefs.tmpl \
- dns/create.tmpl \
dns/list_a_sub.tmpl \
dns/list_aaaa_sub.tmpl \
dns/list_cname_sub.tmpl \
@@ -94,6 +93,7 @@
anonymous/lost-password-ack.tt \
anonymous/subscribe.tt \
database/prefs.tt \
+ dns/create.tt \
git/create.tt \
group/create.tt \
group/index.tt \
Deleted: trunk/vhffs-panel/templates/dns/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/dns/create.tmpl 2011-05-17 20:51:06 UTC (rev 1770)
+++ trunk/vhffs-panel/templates/dns/create.tmpl 2011-05-19 05:44:11 UTC (rev 1771)
@@ -1,33 +0,0 @@
-<form method="post" action="create.pl" accept-charset="utf-8">
- <p>
- <TMPL_VAR ESCAPE=1 NAME="INFOS_DNS">
- </p>
- <p>
- <label>
- <TMPL_VAR ESCAPE=1 NAME="DNS_SERVER">
- </label>
- see FAQ
- </p>
- <p>
- <label>
- <TMPL_VAR ESCAPE=1 NAME="GROUP_NAME">:
- </label>
- <TMPL_VAR ESCAPE=1 NAME="GROUP">
- </p>
- <p>
- <label for="DOMAIN_NAME">
- <TMPL_VAR ESCAPE=1 NAME="DOMAIN_NAME">:
- </label>
- <input type="text" name="DOMAIN_NAME" id="DOMAIN_NAME" value="<TMPL_VAR ESCAPE=1 NAME="DOMAIN_NAME_VALUE">"/>
- </p>
- <p>
- <label for="PROJECT_USAGE">
- <TMPL_VAR ESCAPE=1 NAME="DESCRIPTION">:
- </label>
- <textarea name="DESCRIPTION" id="DESCRIPTION" cols="45" rows="7"><TMPL_VAR ESCAPE=1 NAME="DESCRIPTION_VALUE"></textarea>
- </p>
- <p class="button">
- <input type="hidden" name="group" value="<TMPL_VAR ESCAPE=1 NAME="GROUP">" />
- <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="SEND">" name="dns_submit" />
- </p>
-</form>
Added: trunk/vhffs-panel/templates/dns/create.tt
===================================================================
--- trunk/vhffs-panel/templates/dns/create.tt (rev 0)
+++ trunk/vhffs-panel/templates/dns/create.tt 2011-05-19 05:44:11 UTC (rev 1771)
@@ -0,0 +1,27 @@
+<form method="post" action="create.pl" accept-charset="utf-8">
+ <p>[% 'Be careful ! You must give the reason why you want to host this domain on our servers.' | i18n | html %]</p>
+[% IF help_url %]
+ <p>[% 'Please read the %sdocumentation%s carefully before submitting your request' | i18n | html | pretty_print('<a href="' _ help_url _ '">', '</a>') %]</p>
+[% END %]
+ <p>[% 'First of all, you\'ll have to buy and set up your domain to a registrar.' | i18n | html %]</p>
+ <p>
+ <label>[% 'DNS servers:' | i18n | html %]</label>
+ [% ns.keys().join(', ') | html %]
+ </p>
+ <p>
+ <label>[% 'Group owning this domain:' | i18n | html %]</label>
+ [% group.get_groupname | html %]
+ </p>
+ <p>
+ <label for="DOMAIN_NAME">[% 'Domain name:' | i18n | html %]</label>
+ <input type="text" name="DOMAIN_NAME" id="DOMAIN_NAME" value="[% domain | html %]"/>
+ </p>
+ <p>
+ <label for="PROJECT_USAGE">[% 'Description:' | i18n | html %]</label>
+ <textarea name="DESCRIPTION" id="DESCRIPTION" cols="45" rows="7">[% description | html %]</textarea>
+ </p>
+ <p class="button">
+ <input type="hidden" name="group" value="[% group.get_groupname | html %]" />
+ <input type="submit" value="[% 'Send' | i18n | html %]" name="dns_submit" />
+ </p>
+</form>