[vhffs-dev] [1726] No more HTML::Template in web/create |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1726
Author: beuss
Date: 2011-05-14 13:13:22 +0200 (Sat, 14 May 2011)
Log Message:
-----------
No more HTML::Template in web/create
Modified Paths:
--------------
trunk/vhffs-panel/templates/Makefile.am
trunk/vhffs-panel/web/create.pl
Added Paths:
-----------
trunk/vhffs-panel/templates/web/create.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/web/create.tmpl
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-14 11:13:16 UTC (rev 1725)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-14 11:13:22 UTC (rev 1726)
@@ -108,7 +108,6 @@
bazaar/create.tmpl \
bazaar/prefs.tmpl \
bazaar/user_part.tmpl \
- web/create.tmpl \
web/mailuser.tmpl \
web/prefs.tmpl \
cron/create.tmpl \
@@ -141,4 +140,5 @@
misc/message.tt \
misc/service-index.tt \
misc/welcome.tt \
- user/prefs.tt
+ user/prefs.tt \
+ web/create.tt
Deleted: trunk/vhffs-panel/templates/web/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/web/create.tmpl 2011-05-14 11:13:16 UTC (rev 1725)
+++ trunk/vhffs-panel/templates/web/create.tmpl 2011-05-14 11:13:22 UTC (rev 1726)
@@ -1,32 +0,0 @@
-<form method="post" action="#" class="largeLabel" accept-charset="utf-8">
- <p>
- <label>
- <TMPL_VAR ESCAPE=1 NAME="GROUP_NAME">:
- </label>
- <TMPL_VAR ESCAPE=1 NAME="GROUP">
- </p>
- <p>
- <label for="servername">
- <TMPL_VAR ESCAPE=1 NAME="SERVERNAME_TEXT">:
- </label>
- <input type="text" name="servername" id="servername" value="<TMPL_VAR ESCAPE=0 NAME="SERVERNAME_VALUE">"/>
- </p>
- <p class="warning">
- <TMPL_VAR ESCAPE=1 NAME="SERVERNAME_WARNING">
- </p>
- <p>
- <label for="description">
- <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>
- <TMPL_IF NAME="WARNING_PUBLIC">
- <p>
- <TMPL_VAR ESCAPE=1 NAME="WARNING_PUBLIC">
- </p>
- </TMPL_IF>
- <p class="button" id="buttonSend">
- <input type="hidden" name="group" value="<TMPL_VAR ESCAPE=1 NAME="GROUP">" />
- <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="SEND">" name="web_submit" />
- </p>
-</form>
Added: trunk/vhffs-panel/templates/web/create.tt
===================================================================
--- trunk/vhffs-panel/templates/web/create.tt (rev 0)
+++ trunk/vhffs-panel/templates/web/create.tt 2011-05-14 11:13:22 UTC (rev 1726)
@@ -0,0 +1,24 @@
+<form method="post" action="#" class="largeLabel" accept-charset="utf-8">
+ <p>
+ <label>[% 'Owner group for this web area:' | i18n | html %]</label>
+ [% group.get_groupname %]
+ </p>
+ <p>
+ <label for="servername">'Address (ServerName directive):'</label>
+ <input type="text" name="servername" id="servername" value="[% servername | html %]"/>
+ </p>
+ <p class="warning">
+ [% 'Be careful, if you want create www.domain.tld, you should create a webspace with domain.tld as servername. VHFFS redirect all request from www.domain.tld to domain.tld' | i18n | html %]
+ </p>
+ <p>
+ <label for="description">[% 'How will this web area be used:' | i18n | html %]</label>
+ <textarea name="description" id="description" cols="45" rows="7">[% description | html %]</textarea>
+ </p>
+[% IF has_public_area %]
+ <p>[% 'Please consider that this description is going to be displayed in the public area. So you have to write it in impersonal form. You should take care to write it with correct grammar and tenses. Take all the time you need to fill it with the best content you are able to do.' | i18n | html %]</p>
+[% END %]
+ <p class="button" id="buttonSend">
+ <input type="hidden" name="group" value="[% group.get_groupname | html %]" />
+ <input type="submit" value="[% 'Send' %]" name="web_submit" />
+ </p>
+</form>
Modified: trunk/vhffs-panel/web/create.pl
===================================================================
--- trunk/vhffs-panel/web/create.pl 2011-05-14 11:13:16 UTC (rev 1725)
+++ trunk/vhffs-panel/web/create.pl 2011-05-14 11:13:22 UTC (rev 1726)
@@ -32,7 +32,6 @@
use strict;
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
@@ -40,12 +39,10 @@
use Encode;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
use Vhffs::Group;
use Vhffs::Main;
use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Panel::Group;
+use Vhffs::Panel::Web;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -59,14 +56,10 @@
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('web_submit'));
+ my $vars = {};
my $servername = '';
my $description = '';
@@ -85,14 +78,18 @@
} else {
$panel->add_error( gettext('Error creating webarea.') );
}
+ $vars->{servername} = $servername;
+ $vars->{description} = $description;
} else {
my $webconfig = $vhffs->get_config->get_service('web');
- $servername = '<'.gettext('new site').'>.'.$webconfig->{'default_domain'} if( defined $webconfig->{'default_domain'} );
+ $vars->{servername} = sprintf( gettext('<new site>.%s'), $webconfig->{default_domain} ) if( defined $webconfig->{default_domain} );
}
if( !$submitted || $panel->has_errors() ) {
- my $template = new HTML::Template( filename => $templatedir.'/panel/web/create.tmpl' );
$panel->set_title( gettext('Create a web space') );
+ $vars->{group} = $group;
+ $panel->render('web/create.tt', $vars);
+ my $template = new HTML::Template( filename => $templatedir.'/panel/web/create.tmpl' );
$template->param( SERVERNAME_TEXT => gettext('Address (ServerName directive)') );
$template->param( SERVERNAME_WARNING => gettext('Be careful, if you want create www.domain.tld, you should create a webspace with domain.tld as servername. VHFFS redirect all request from www.domain.tld to domain.tld') );
$template->param( SERVERNAME_VALUE => $servername );