[vhffs-dev] [1752] No more HTML::Template in mysql/create.

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


Revision: 1752
Author:   beuss
Date:     2011-05-16 08:14:34 +0200 (Mon, 16 May 2011)
Log Message:
-----------
No more HTML::Template in mysql/create.

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

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

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

Modified: trunk/vhffs-panel/mysql/create.pl
===================================================================
--- trunk/vhffs-panel/mysql/create.pl	2011-05-15 15:42:00 UTC (rev 1751)
+++ trunk/vhffs-panel/mysql/create.pl	2011-05-16 06:14:34 UTC (rev 1752)
@@ -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,10 @@
 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::Mysql;
+use Vhffs::Services::Mysql;
 
 my $panel = new Vhffs::Panel::Main();
 exit 0 unless $panel;
@@ -53,23 +50,18 @@
 exit 0 unless $session;
 
 my $vhffs = $panel->{vhffs};
-my $templatedir = $panel->{templatedir};
 my $cgi = $panel->{cgi};
 my $user = $panel->{user};
 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('mysql_submit'));
 	my $dbsuffix = '';
 	my $description = '';
 	my $dbpass = '';
+    my $vars = {};
 
 	if( $submitted ) {
 		$dbsuffix = $cgi->param('db_suffix');
@@ -92,25 +84,10 @@
 		} else {
 			$panel->add_error( 'An error occured while creating the object.' );
 		}
+        $vars->{db_suffix} = $dbsuffix;
+        $vars->{description} = $description;
 	}
+    $vars->{group} = $group;
 
-	if( !$submitted || $panel->has_errors() ) {
-		my $template = new HTML::Template( filename => $templatedir.'/panel/mysql/create.tmpl' );
-
-		$panel->set_title( gettext('Create a MySQL database') );
-
-		$template->param( INFOS => sprintf( gettext('The database name is prefixed by your groupname followed by an underscore (%s_dbname). The database user is the database full name (%s_dbname).') , $group->get_groupname, $group->get_groupname) );
-		$template->param( GROUP_NAME => gettext('Group owning this database') );
-		$template->param( DB_PREFIX => $group->get_groupname.'_' );
-		$template->param( DB_SUFFIX => gettext('MySQL database name ') );
-		$template->param( DB_SUFFIX_VALUE => $dbsuffix );
-		$template->param( DB_PASS => gettext('MySQL password for this database ') );
-		$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;
-	}
+    $panel->render('mysql/create.tt', $vars);
 }

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-05-15 15:42:00 UTC (rev 1751)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-16 06:14:34 UTC (rev 1752)
@@ -88,7 +88,6 @@
 	misc/infos.tmpl \
 	misc/service_index.tmpl \
 	misc/simplemsg.tmpl \
-	mysql/create.tmpl \
 	mysql/prefs.tmpl \
 	git/create.tmpl \
 	git/prefs.tmpl \
@@ -127,6 +126,7 @@
 	misc/message.tt \
 	misc/service-index.tt \
 	misc/welcome.tt \
+	mysql/create.tt \
 	object/delete.tt \
 	object/resubmit.tt \
 	pgsql/create.tt \

Deleted: trunk/vhffs-panel/templates/mysql/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/mysql/create.tmpl	2011-05-15 15:42:00 UTC (rev 1751)
+++ trunk/vhffs-panel/templates/mysql/create.tmpl	2011-05-16 06:14:34 UTC (rev 1752)
@@ -1,31 +0,0 @@
-<form method="post" action="#" class="largeLabel" accept-charset="utf-8">
-    <p class="info"><TMPL_VAR ESCAPE=1 NAME="INFOS"></p>
-	<p>
-		<label>		
-			<TMPL_VAR ESCAPE=1 NAME="GROUP_NAME">: 
-		</label>
-		<TMPL_VAR ESCAPE=1 NAME="GROUP">
-	</p>
-	<p>
-        <label for="db_suffix">
-            <TMPL_VAR ESCAPE=1 NAME="DB_SUFFIX">: 
-        </label>
-		<TMPL_VAR ESCAPE=1 NAME="DB_PREFIX"><input type="text" name="db_suffix" id="db_suffix" value="<TMPL_VAR ESCAPE=1 NAME="DB_SUFFIX_VALUE">"/>
-	</p>
-	<p>
-		<label for="db_pass">
-			<TMPL_VAR ESCAPE=1 NAME="DB_PASS">: 
-		</label>
-		<input type="PASSWORD" name="db_pass" id="db_pass"/>
-	</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="mysql_submit"/>
-	</p>
-</form>

Added: trunk/vhffs-panel/templates/mysql/create.tt
===================================================================
--- trunk/vhffs-panel/templates/mysql/create.tt	                        (rev 0)
+++ trunk/vhffs-panel/templates/mysql/create.tt	2011-05-16 06:14:34 UTC (rev 1752)
@@ -0,0 +1,23 @@
+<form method="post" action="#" class="largeLabel" accept-charset="utf-8">
+    <p class="info">[% 'The database name is prefixed by your groupname followed by an underscore (%s_dbname). The database user is the database full name (%s_dbname).' | i18n | pretty_print(group.get_groupname, group.get_groupname) | html %]</p>
+	<p>
+		<label>[% 'Group owning this database:' | i18n | html %]</label>
+		[% group.get_groupname | html %]
+	</p>
+	<p>
+        <label for="db_suffix">[% 'MySQL database name:' | i18n | html %]</label>
+		[% group.get_groupname | html %]_<input type="text" name="db_suffix" id="db_suffix" value="[% db_suffix | html %]"/>
+	</p>
+	<p>
+		<label for="db_pass">[% 'MySQL password for this database:' | i18n | html %]</label>
+		<input type="password" name="db_pass" id="db_pass"/>
+	</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="[% 'Send' | i18n | html %]" name="mysql_submit"/>
+	</p>
+</form>


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