[vhffs-dev] [1777] No more HTML::Template in cron/create. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1777
Author: beuss
Date: 2011-05-19 22:35:09 +0200 (Thu, 19 May 2011)
Log Message:
-----------
No more HTML::Template in cron/create.
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Panel/Main.pm
trunk/vhffs-panel/cron/create.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/cron/create.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/cron/create.tmpl
Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-19 11:10:11 UTC (rev 1776)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-19 20:35:09 UTC (rev 1777)
@@ -659,7 +659,7 @@
Vhffs::Functions::type_string_from_type_id( $_[0] );
}
},
- PRE_CHOMP => 1
+ PRE_CHOMP => 2
};
Modified: trunk/vhffs-panel/cron/create.pl
===================================================================
--- trunk/vhffs-panel/cron/create.pl 2011-05-19 11:10:11 UTC (rev 1776)
+++ trunk/vhffs-panel/cron/create.pl 2011-05-19 20:35:09 UTC (rev 1777)
@@ -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,8 @@
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::Services::Cron;
use Vhffs::Panel::Cron;
@@ -61,18 +56,14 @@
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('cron_submit'));
my $cronpath = '';
my $interval = '';
my $reportmail = '';
my $description = '';
+ my $vars = {};
if( $submitted ) {
$cronpath = $cgi->param('cronpath');
@@ -96,29 +87,14 @@
} else {
$panel->add_error( 'An error occured while creating the object.' );
}
+ $vars->{cronpath} = $cronpath;
+ $vars->{interval} = $interval;
+ $vars->{reportmail} = $reportmail;
+ $vars->{description} = $description;
}
- if( !$submitted || $panel->has_errors() ) {
- my $template = new HTML::Template( filename => $templatedir.'/panel/cron/create.tmpl' );
-
- $panel->set_title( gettext('Create a Cron job') );
-
- $template->param( GROUP_NAME => gettext('Group owning this cron job') );
- $template->param( TEXT_CRONPATH_LABEL => gettext('Path') );
- $template->param( TEXT_CRONPATH_HELP => gettext('Absolute path of the command to run') );
- $template->param( TEXT_INTERVAL_LABEL => gettext('Interval') );
- $template->param( TEXT_INTERVAL_HELP => sprintf(gettext('In minutes, at which interval this cron should be started, the minimum interval is set to %d minutes'), $vhffs->get_config->get_service('cron')->{'minimum_interval'}) );
- $template->param( TEXT_REPORTMAIL_LABEL => gettext('Mail to') );
- $template->param( TEXT_REPORTMAIL_HELP => gettext('Email to which report will be sent if something went wrong') );
- $template->param( CRONPATH_VALUE => $cronpath );
- $template->param( INTERVAL_VALUE => $interval );
- $template->param( REPORTMAIL_VALUE => $reportmail );
- $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;
- }
+ $vars->{group} = $group;
+ $vars->{default_interval} = $vhffs->get_config->get_service('cron')->{minimum_interval};
+ $panel->set_title( gettext('Create a Cron job') );
+ $panel->render('cron/create.tt', $vars);
}
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-19 11:10:11 UTC (rev 1776)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-19 20:35:09 UTC (rev 1777)
@@ -72,7 +72,6 @@
misc/simplemsg.tmpl \
bazaar/create.tmpl \
bazaar/prefs.tmpl \
- cron/create.tmpl \
cron/prefs.tmpl \
acl/form.tt \
acl/view.tt \
@@ -82,6 +81,7 @@
anonymous/lost-password.tt \
anonymous/lost-password-ack.tt \
anonymous/subscribe.tt \
+ cron/create.tt \
cvs/create.tt \
database/prefs.tt \
dns/create.tt \
Deleted: trunk/vhffs-panel/templates/cron/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/cron/create.tmpl 2011-05-19 11:10:11 UTC (rev 1776)
+++ trunk/vhffs-panel/templates/cron/create.tmpl 2011-05-19 20:35:09 UTC (rev 1777)
@@ -1,40 +0,0 @@
-<form method="post" action="#" class="shortLabel" accept-charset="utf-8">
- <p>
- <label>
- <TMPL_VAR ESCAPE=1 NAME="GROUP_NAME">:
- </label>
- <TMPL_VAR ESCAPE=1 NAME="GROUP">
- </p>
- <p>
- <label for="cron_path">
- <TMPL_VAR ESCAPE=1 NAME="TEXT_CRONPATH_LABEL">:
- </label>
- <input type="text" name="cronpath" id="cronpath" value="<TMPL_VAR ESCAPE=1 NAME="CRONPATH_VALUE">"/>
- <TMPL_VAR ESCAPE=1 NAME="TEXT_CRONPATH_HELP">
- </p>
- <p>
- <label for="cron_interval">
- <TMPL_VAR ESCAPE=1 NAME="TEXT_INTERVAL_LABEL">:
- </label>
- <input type="text" name="interval" id="interval" value="<TMPL_VAR ESCAPE=1 NAME="INTERVAL_VALUE">"/>
- <TMPL_VAR ESCAPE=1 NAME="TEXT_INTERVAL_HELP">
- </p>
- <p>
- <label for="cron_reportmail">
- <TMPL_VAR ESCAPE=1 NAME="TEXT_REPORTMAIL_LABEL">:
- </label>
- <input type="text" name="reportmail" id="reportmail" value="<TMPL_VAR ESCAPE=1 NAME="REPORTMAIL_VALUE">"/>
- <TMPL_VAR ESCAPE=1 NAME="TEXT_REPORTMAIL_HELP">
- </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>
- <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="cron_submit"/>
- </p>
-</form>
-
Added: trunk/vhffs-panel/templates/cron/create.tt
===================================================================
--- trunk/vhffs-panel/templates/cron/create.tt (rev 0)
+++ trunk/vhffs-panel/templates/cron/create.tt 2011-05-19 20:35:09 UTC (rev 1777)
@@ -0,0 +1,31 @@
+<form method="post" action="#" class="shortLabel" accept-charset="utf-8">
+ <p>
+ <label>[% 'Group owning this cron job:' | i18n | html %]</label>
+ [% group.get_groupname | html %]
+ </p>
+ <p>
+ <label for="cron_path">[% 'Path:' | i18n | html %]</label>
+ <input type="text" name="cronpath" id="cronpath" value="[% cronpath | html %]"/>
+ [% 'Absolute path of the command to run' | i18n | html %]
+ </p>
+ <p>
+ <label for="cron_interval">[% 'Interval:' | i18n | html %]</label>
+ <input type="text" name="interval" id="interval" value="[% interval | html %]"/>
+ [% 'In minutes, at which interval this cron should be started, the minimum interval is set to %d minutes' | i18n | pretty_print(default_interval) %]
+ </p>
+ <p>
+ <label for="cron_reportmail">[% 'Mail to:' | i18n | html %]</label>
+ <input type="text" name="reportmail" id="reportmail" value="[% reportmail | html %]"/>
+ [% 'Email to which send a report if something goes wrong' | i18n | html %]
+ </p>
+ <p>
+ <label for="description">[% 'Description:' | 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="cron_submit"/>
+ </p>
+</form>
+