[vhffs-dev] [1782] No more HTML::Template in bazaar/create.

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


Revision: 1782
Author:   beuss
Date:     2011-05-20 13:13:38 +0200 (Fri, 20 May 2011)
Log Message:
-----------
No more HTML::Template in bazaar/create.

Anyway Bazaar implementation isn't finished?\226?\128?\166

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

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

Modified: trunk/vhffs-panel/bazaar/create.pl
===================================================================
--- trunk/vhffs-panel/bazaar/create.pl	2011-05-20 11:13:31 UTC (rev 1781)
+++ trunk/vhffs-panel/bazaar/create.pl	2011-05-20 11:13:38 UTC (rev 1782)
@@ -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::Services::Bazaar;
+use Vhffs::Panel::Bazaar;
 
 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('message/message.tt', { message => gettext( 'You\'re not allowed to do this (ACL rights)' ) } );
+} else {
 	my $submitted = $cgi->param('bazaar_submit');
 	my $reponame = '';
 	my $description = '';
+    my $vars = {};
 
 	if( $submitted ) {
 		$reponame = $cgi->param('reponame');
@@ -86,22 +79,10 @@
 		} else {
 			$panel->add_error( gettext('An error occured while creating the bazaar repository') );
 		}
+        $vars->{reponame} = $reponame;
+        $vars->{description} = $description;
 	}
 
-	if( !$submitted || $panel->has_errors ) {
-		my $template = new HTML::Template( filename => $templatedir.'/panel/bazaar/create.tmpl' );
-	
-		$panel->set_title( gettext('Create a bazaar Repository') );
-		$template->param( REPOSITORY_NAME => gettext('Repository Name') );
-		$template->param( REPOSITORY_VALUE => $reponame );
-		$template->param( GROUP_NAME => gettext('Group owning this bazaar 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('bazaar/create.tt', $vars);
 }

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-05-20 11:13:31 UTC (rev 1781)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-20 11:13:38 UTC (rev 1782)
@@ -70,7 +70,6 @@
 	misc/infos.tmpl \
 	misc/service_index.tmpl \
 	misc/simplemsg.tmpl \
-	bazaar/create.tmpl \
 	bazaar/prefs.tmpl \
 	acl/form.tt \
 	acl/view.tt \
@@ -80,6 +79,7 @@
 	anonymous/lost-password.tt \
 	anonymous/lost-password-ack.tt \
 	anonymous/subscribe.tt \
+	bazaar/create.tt \
 	cron/create.tt \
 	cron/prefs.tt \
 	cvs/create.tt \

Added: trunk/vhffs-panel/templates/bazaar/create.tt
===================================================================
--- trunk/vhffs-panel/templates/bazaar/create.tt	                        (rev 0)
+++ trunk/vhffs-panel/templates/bazaar/create.tt	2011-05-20 11:13:38 UTC (rev 1782)
@@ -0,0 +1,18 @@
+<form method="post" action="#" accept-charset="utf-8">
+	<p>
+		<label>[% 'Owner group for this Bazaar 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="bazaar_submit"/>
+	</p>
+</form>


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