[vhffs-dev] [1765] No more HTML::Template in mail/create.pl

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1765
Author:   beuss
Date:     2011-05-17 13:23:19 +0200 (Tue, 17 May 2011)
Log Message:
-----------
No more HTML::Template in mail/create.pl

Modified Paths:
--------------
    trunk/vhffs-panel/mail/create.pl
    trunk/vhffs-panel/templates/Makefile.am

Added Paths:
-----------
    trunk/vhffs-panel/templates/mail/create.tt

Removed Paths:
-------------
    trunk/vhffs-panel/templates/mail/create.tmpl

Modified: trunk/vhffs-panel/mail/create.pl
===================================================================
--- trunk/vhffs-panel/mail/create.pl	2011-05-17 11:23:12 UTC (rev 1764)
+++ trunk/vhffs-panel/mail/create.pl	2011-05-17 11:23:19 UTC (rev 1765)
@@ -32,7 +32,6 @@
 use strict;
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use CGI;
@@ -40,7 +39,6 @@
 use Encode;
 
 use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
 use Vhffs::Group;
 use Vhffs::Panel::Main;
 use Vhffs::Functions;
@@ -57,16 +55,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('message/misc.tt', { message => gettext( 'You\'re not allowed to do this (ACL rights)' ) } );
+} else {
 	my $submitted = defined($cgi->param('mail_submit'));
 	my $domain = '';
 	my $description = '';
+    my $vars = {};
 
 	if( $submitted ) {
 		$domain = $cgi->param('domain');
@@ -83,22 +77,11 @@
 		} else {
 			$panel->add_error( gettext('An error occured while creating the mail area') );
 		}
+        $vars->{domain} = $domain;
+        $vars->{description} = $description;
 	}
 
-	if( !$submitted || $panel->has_errors() ) {
-		my $template = new HTML::Template( filename => $templatedir.'/panel/mail/create.tmpl' );
-
-		$panel->set_title( gettext('Create a mail space') );
-		$template->param( DOMAIN_TEXT => gettext('Domain') );
-		$template->param( DOMAIN_VALUE => $domain );
-		$template->param( GROUP_NAME => gettext('Group owning this mail domain') );
-
-		$template->param( GROUP => $group->get_groupname );
-		$template->param( SEND => gettext('Send') );
-		$template->param( DESCRIPTION_TEXT => gettext('Tell us for what purpose you want to create this mail domain') );
-		$template->param( DESCRIPTION_VALUE => CGI::escapeHTML($description) );
-
-		$panel->build( $template );
-		$panel->display;
-	}
+    $vars->{group} = $group;
+    $panel->set_title( gettext('Create a mail space') );
+    $panel->render('mail/create.tt', $vars);
 }

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-05-17 11:23:12 UTC (rev 1764)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-17 11:23:19 UTC (rev 1765)
@@ -68,7 +68,6 @@
 	dns/list_srv_sub.tmpl \
 	dns/list_txt_sub.tmpl \
 	dns/prefs.tmpl \
-	mail/create.tmpl \
 	mail/prefs_boxes.tmpl \
 	mail/prefs_forwards.tmpl \
 	mail/prefs.tmpl \
@@ -107,6 +106,7 @@
 	group/tags.tt \
 	layouts/anonymous.tt \
 	layouts/panel.tt \
+	mail/create.tt \
 	mailinglist/create.tt \
 	mailinglist/prefs.tt \
 	menu/admin.tt \

Deleted: trunk/vhffs-panel/templates/mail/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/mail/create.tmpl	2011-05-17 11:23:12 UTC (rev 1764)
+++ trunk/vhffs-panel/templates/mail/create.tmpl	2011-05-17 11:23:19 UTC (rev 1765)
@@ -1,24 +0,0 @@
-<form method="post" action="#" accept-charset="utf-8">
-	<p>
-		<label>		
-			<TMPL_VAR ESCAPE=1 NAME="GROUP_NAME">: 
-		</label>
-		<TMPL_VAR ESCAPE=1 NAME="GROUP">
-	</p>
-	<p>
-		<label for="domain">
-			<TMPL_VAR ESCAPE=1 NAME="DOMAIN_TEXT">: 
-		</label>	
-		<input type="text" name="domain" id="domain" value="<TMPL_VAR ESCAPE=1 NAME="DOMAIN_VALUE">"/>
-	</p>
-	<p>
-		<label for="description">
-			<TMPL_VAR ESCAPE=1 NAME="DESCRIPTION_TEXT">:
-		</label>	
-		<textarea name="description" id="description" cols="45" rows="7"><TMPL_VAR ESCAPE=1 NAME="DESCRIPTION_VALUE"></textarea>
-	</p>
-	<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="mail_submit"/>
-	</p>
-</form>

Added: trunk/vhffs-panel/templates/mail/create.tt
===================================================================
--- trunk/vhffs-panel/templates/mail/create.tt	                        (rev 0)
+++ trunk/vhffs-panel/templates/mail/create.tt	2011-05-17 11:23:19 UTC (rev 1765)
@@ -0,0 +1,18 @@
+<form method="post" action="#" accept-charset="utf-8">
+	<p>
+		<label>[% 'Group owning this mail domain:' | i18n | html %]</label>
+        [% group.get_groupname | html %]
+	</p>
+	<p>
+		<label for="domain">[% 'Domain:' | i18n | html %]</label>	
+		<input type="text" name="domain" id="domain" value="[% domain | html %]"/>
+	</p>
+	<p>
+		<label for="description">[% 'Tell us for what purpose you want to create this mail domain:' | i18n | html %]</label>
+		<textarea name="description" id="description" cols="45" rows="7">[% description | html %]</textarea>
+	</p>
+	<p class="button" id="buttonSend">
+		<input type="hidden" name="group" value="[% group.get_groupname | html %]" />
+		<input type="submit" value="[% 'Send' | i18n | html %]" name="mail_submit"/>
+	</p>
+</form>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/