[vhffs-dev] [1739] Converted repository/create.pl to Template::Toolkit. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1739
Author: beuss
Date: 2011-05-15 00:09:49 +0200 (Sun, 15 May 2011)
Log Message:
-----------
Converted repository/create.pl to Template::Toolkit.
Modified Paths:
--------------
trunk/vhffs-panel/repository/create.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/repository/create.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/repository/create.tmpl
Modified: trunk/vhffs-panel/repository/create.pl
===================================================================
--- trunk/vhffs-panel/repository/create.pl 2011-05-14 20:59:45 UTC (rev 1738)
+++ trunk/vhffs-panel/repository/create.pl 2011-05-14 22:09:49 UTC (rev 1739)
@@ -32,7 +32,6 @@
use strict;
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
@@ -41,12 +40,9 @@
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::Repository;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -60,15 +56,11 @@
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('repo_submit');
my $description = '';
+ my $vars = {};
if( $submitted ) {
$description = Encode::decode_utf8( $cgi->param('description') );
@@ -83,22 +75,10 @@
} else {
$panel->add_error( gettext('An error occured while creating the object. Check that this group doesn\'t already have a download repository') );
}
+ $vars->{description} = $description;
}
- if( !$submitted || $panel->has_errors() ) {
- my $template = new HTML::Template( filename => $templatedir.'/panel/repository/create.tmpl' );
-
- $panel->set_title( gettext('Create a Download Repository') );
- $template->param( REPOSITORY_NAME => gettext('Repository Name') );
- $template->param( GROUP_NAME => gettext('Group owning this repository') );
-
- $template->param( GROUP => $group->get_groupname );
- $template->param( NAME => $group->get_groupname );
- $template->param( SEND => gettext('Send') );
- $template->param( DESCRIPTION => gettext('Description') );
- $template->param( DESCRIPTION_VALUE => $description );
-
- $panel->build( $template );
- $panel->display;
- }
+ $panel->set_title( gettext('Create a Download Repository') );
+ $vars->{group} = $group;
+ $panel->render( 'repository/create.tt', $vars );
}
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-14 20:59:45 UTC (rev 1738)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-14 22:09:49 UTC (rev 1739)
@@ -94,7 +94,6 @@
pgsql/create.tmpl \
pgsql/prefs.tmpl \
repository/admin.tmpl \
- repository/create.tmpl \
repository/prefs.tmpl \
git/create.tmpl \
git/prefs.tmpl \
@@ -134,6 +133,7 @@
misc/service-index.tt \
misc/welcome.tt \
object/delete.tt \
+ repository/create.tt \
svn/create.tt \
svn/prefs.tt \
user/prefs.tt \
Deleted: trunk/vhffs-panel/templates/repository/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/repository/create.tmpl 2011-05-14 20:59:45 UTC (rev 1738)
+++ trunk/vhffs-panel/templates/repository/create.tmpl 2011-05-14 22:09:49 UTC (rev 1739)
@@ -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="REPOSITORY_NAME">
- <TMPL_VAR ESCAPE=1 NAME="REPOSITORY_NAME">:
- </label>
- <TMPL_VAR ESCAPE=1 NAME="NAME">
- </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="repo_submit"/>
- </p>
-</form>
Added: trunk/vhffs-panel/templates/repository/create.tt
===================================================================
--- trunk/vhffs-panel/templates/repository/create.tt (rev 0)
+++ trunk/vhffs-panel/templates/repository/create.tt 2011-05-14 22:09:49 UTC (rev 1739)
@@ -0,0 +1,18 @@
+<form method="post" action="#" accept-charset="utf-8">
+ <p>
+ <label>[% 'Group owning this repository:' | i18n | html %]</label>
+ [% group.get_groupname | html %]
+ </p>
+ <p>
+ <label for="REPOSITORY_NAME">[% 'Repository name:' | i18n | html %]</label>
+ [% group.get_groupname | 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 | html %]" />
+ <input type="submit" value="[% 'Create' %]" name="repo_submit"/>
+ </p>
+</form>