[vhffs-dev] [1757] No more HTML::Template in mercurial/create |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1757
Author: beuss
Date: 2011-05-16 22:50:30 +0200 (Mon, 16 May 2011)
Log Message:
-----------
No more HTML::Template in mercurial/create
Modified Paths:
--------------
trunk/vhffs-panel/mercurial/create.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/mercurial/create.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/mercurial/create.tmpl
Modified: trunk/vhffs-panel/mercurial/create.pl
===================================================================
--- trunk/vhffs-panel/mercurial/create.pl 2011-05-16 20:50:22 UTC (rev 1756)
+++ trunk/vhffs-panel/mercurial/create.pl 2011-05-16 20:50:30 UTC (rev 1757)
@@ -32,7 +32,6 @@
use strict;
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
@@ -42,10 +41,8 @@
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::Mercurial;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -59,16 +56,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 = $cgi->param('mercurial_submit');
my $reponame = '';
my $description = '';
+ my $vars = {};
if( $submitted ) {
$reponame = $cgi->param('reponame');
@@ -77,7 +70,7 @@
unless( defined $reponame && defined $description ) {
$panel->add_error( gettext('CGI Error !') );
} elsif( !Vhffs::Services::Mercurial::check_name($fullreponame) ) {
- $panel->add_error( gettext('Invalid reponame. It must contain between 3 and 64 characters, only lowercase letters and numbers') );
+ $panel->add_error( gettext('Invalid repository name. It must contain between 3 and 64 characters, only lowercase letters and numbers') );
} elsif( $description =~ /^\s*$/) {
$panel->add_error( gettext('You must enter a description') );
} elsif( defined Vhffs::Panel::Mercurial::create_mercurial( $vhffs, $fullreponame, $description, $user, $group ) ) {
@@ -86,22 +79,10 @@
} else {
$panel->add_error( gettext('An error occured while creating the mercurial repository') );
}
+ $vars->{reponame} = $reponame;
+ $vars->{description} = $description;
}
- if( !$submitted || $panel->has_errors ) {
- my $template = new HTML::Template( filename => $templatedir.'/panel/mercurial/create.tmpl' );
-
- $panel->set_title( gettext('Create a mercurial Repository') );
- $template->param( REPOSITORY_NAME => gettext('Repository Name') );
- $template->param( REPOSITORY_VALUE => $reponame );
- $template->param( GROUP_NAME => gettext('Group owning this mercurial repository') );
-
- $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;
+ $panel->render('mercurial/create.tt', $vars);
}
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-16 20:50:22 UTC (rev 1756)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-16 20:50:30 UTC (rev 1757)
@@ -90,7 +90,6 @@
misc/simplemsg.tmpl \
git/create.tmpl \
git/prefs.tmpl \
- mercurial/create.tmpl \
mercurial/prefs.tmpl \
bazaar/create.tmpl \
bazaar/prefs.tmpl \
@@ -126,6 +125,7 @@
misc/message.tt \
misc/service-index.tt \
misc/welcome.tt \
+ mercurial/create.tt \
mysql/create.tt \
object/delete.tt \
object/resubmit.tt \
Deleted: trunk/vhffs-panel/templates/mercurial/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/mercurial/create.tmpl 2011-05-16 20:50:22 UTC (rev 1756)
+++ trunk/vhffs-panel/templates/mercurial/create.tmpl 2011-05-16 20:50:30 UTC (rev 1757)
@@ -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="reponame">
- <TMPL_VAR ESCAPE=1 NAME="REPOSITORY_NAME">:
- </label>
- <TMPL_VAR ESCAPE=1 NAME="GROUP">/<input type="text" name="reponame" id="reponame" value="<TMPL_VAR ESCAPE=1 NAME="REPOSITORY_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" 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="mercurial_submit"/>
- </p>
-</form>
Added: trunk/vhffs-panel/templates/mercurial/create.tt
===================================================================
--- trunk/vhffs-panel/templates/mercurial/create.tt (rev 0)
+++ trunk/vhffs-panel/templates/mercurial/create.tt 2011-05-16 20:50:30 UTC (rev 1757)
@@ -0,0 +1,18 @@
+<form method="post" action="#" accept-charset="utf-8">
+ <p>
+ <label>[% 'Owner group for this Mercurial repository:' | i18n | html %]</label>
+ [% group.get_groupname | html %]
+ </p>
+ <p>
+ <label for="reponame">[% 'Repository name: '%]</label>
+ [% group.get_groupname | html %]/<input type="text" name="reponame" id="reponame" value="[% reponame | 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" id="buttonSend">
+ <input type="hidden" name="group" value="[% group.get_groupname | html %]" />
+ <input type="submit" value="[% 'Send' | i18n | html %]" name="mercurial_submit"/>
+ </p>
+</form>