[vhffs-dev] [1761] No more HTML::Template in mailinglist/create. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1761
Author: beuss
Date: 2011-05-16 22:51:19 +0200 (Mon, 16 May 2011)
Log Message:
-----------
No more HTML::Template in mailinglist/create.
Modified Paths:
--------------
trunk/vhffs-panel/mailinglist/create.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/mailinglist/create.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/mailinglist/create.tmpl
Modified: trunk/vhffs-panel/mailinglist/create.pl
===================================================================
--- trunk/vhffs-panel/mailinglist/create.pl 2011-05-16 20:51:04 UTC (rev 1760)
+++ trunk/vhffs-panel/mailinglist/create.pl 2011-05-16 20:51:19 UTC (rev 1761)
@@ -32,19 +32,15 @@
use strict;
use utf8;
use POSIX qw(locale_h);
-use HTML::Template::Expr;
use locale;
use Locale::gettext;
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::Mail;
+use Vhffs::Panel::MailingList;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -58,19 +54,15 @@
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 = $cgi->param('mailing_submit');
my $localpart = '';
my $domain = '';
my $description = '';
# Get default domain for list configured in the config file
my $default_domain = $vhffs->get_config->get_service('mailinglist')->{'default_domain'};
+ my $vars = {};
if( $submitted ) {
$localpart = $cgi->param( 'localpart' );
@@ -91,33 +83,19 @@
} else {
$panel->add_error( gettext('An error occured while creating the object.It probably already exists') );
}
+ $vars->{local_part} = $localpart;
+ $vars->{domain} = $domain;
+ $vars->{description} = $description;
}
- if( !$submitted || $panel->has_errors() ) {
- my $domains = Vhffs::Panel::MailingList::getall_mdomains_per_group( $vhffs, $group->get_gid );
- push(@$domains, { domain => $default_domain }) if( defined $default_domain );
+ my $domains = Vhffs::Panel::MailingList::getall_mdomains_per_group( $vhffs, $group->get_gid );
+ if( ( !@$domains ) && ( ! defined $default_domain ) ) {
+ $panel->render('misc/message.tt', { message => gettext('There is no default mail domain on this platform, you have to create a mail domain before creating a mailing list') } );
+ }
- $panel->set_title( gettext('Create a new mailing list') );
+ push(@$domains, { domain => $default_domain }) if( defined $default_domain );
+ $vars->{domains} = $domains;
+ $vars->{group} = $group;
- if( ( !@$domains ) && ( ! defined $default_domain ) ) {
- $panel->add_error( gettext('There is no default mail domain on this platform, you have to create a mail domain before creating a mailing list') );
- } else {
- my $template = new HTML::Template::Expr( filename => $templatedir.'/panel/mailinglist/create.tmpl', global_vars => 1 );
-
- $template->param( LIST_TEXT => gettext('Mail for the list') );
- $template->param( GROUP_NAME => gettext('Group owning this mailing list') );
-
- $template->param( DOMAINS => $domains );
- $template->param( GROUP => $group->get_groupname );
- $template->param( SEND => gettext('Send') );
- $template->param( MOTIVATION => gettext('Tell us what the use of this mailing list will be') );
-
- $template->param( LOCALPART_VALUE => $localpart );
- $template->param( DOMAIN_VALUE => $domain );
- $template->param( DESCRIPTION_VALUE => $description );
-
- $panel->build( $template );
- $panel->display;
- }
- }
+ $panel->render('mailinglist/create.tt', $vars);
}
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-16 20:51:04 UTC (rev 1760)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-16 20:51:19 UTC (rev 1761)
@@ -69,7 +69,6 @@
dns/list_txt_sub.tmpl \
dns/prefs.tmpl \
mail/create.tmpl \
- mailinglist/create.tmpl \
mailinglist/list_part.tmpl \
mailinglist/prefs.tmpl \
mail/prefs_boxes.tmpl \
@@ -110,6 +109,7 @@
group/tags.tt \
layouts/anonymous.tt \
layouts/panel.tt \
+ mailinglist/create.tt \
menu/admin.tt \
menu/context.tt \
menu/group.tt \
Deleted: trunk/vhffs-panel/templates/mailinglist/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/mailinglist/create.tmpl 2011-05-16 20:51:04 UTC (rev 1760)
+++ trunk/vhffs-panel/templates/mailinglist/create.tmpl 2011-05-16 20:51:19 UTC (rev 1761)
@@ -1,28 +0,0 @@
-<form method="post" action="#" class="largeLabel" accept-charset="utf-8">
- <p>
- <TMPL_VAR ESCAPE=1 NAME="GROUP_NAME">:<TMPL_VAR ESCAPE=1 NAME="GROUP">
- </p>
- <p>
- <label for="localpart">
- <TMPL_VAR ESCAPE=1 NAME="LIST_TEXT">:
- </label>
- </p>
- <div class="clear"></div>
- <p>
- <input type="text" name="localpart" id="localpart" value="<TMPL_VAR ESCAPE=1 NAME="LOCALPART_VALUE">"/>@<select name="domain">
-<TMPL_LOOP NAME="DOMAINS">
-<option value="<TMPL_VAR ESCAPE=1 NAME="DOMAIN">"<TMPL_IF EXPR="DOMAIN eq DOMAIN_VALUE"> selected="selected"</TMPL_IF>><TMPL_VAR ESCAPE=1 NAME="DOMAIN"></option>
-</TMPL_LOOP>
-</select>
- </p>
- <p>
- <label for="description">
- <TMPL_VAR ESCAPE=1 NAME="MOTIVATION">:
- </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="mailing_submit"/>
- </p>
-</form>
Added: trunk/vhffs-panel/templates/mailinglist/create.tt
===================================================================
--- trunk/vhffs-panel/templates/mailinglist/create.tt (rev 0)
+++ trunk/vhffs-panel/templates/mailinglist/create.tt 2011-05-16 20:51:19 UTC (rev 1761)
@@ -0,0 +1,24 @@
+<form method="post" action="#" class="largeLabel" accept-charset="utf-8">
+ <p>[% 'Group owning this mailing list:' | i18n | html %]
+ [% group.get_groupname | html %]
+ </p>
+ <p>
+ <label for="localpart">[% 'Mail for the list:' | i18n | html %]</label>
+ </p>
+ <div class="clear"></div>
+ <p>
+ <input type="text" name="localpart" id="localpart" value="[% local_part | html %]"/>@<select name="domain">
+[% FOREACH d IN domains %]
+ <option value="[% d.domain | html %]"[% ' selected="selected"' IF d.domain == domain %]>[% d.domain | html %]</option>
+[% END %]
+ </select>
+ </p>
+ <p>
+ <label for="description">[% 'Tell us what the use of this mailing list will be:' | 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 %]" />
+ <input type="submit" value="[% 'Send' | i18n | html %]" name="mailing_submit"/>
+ </p>
+</form>