[vhffs-dev] [1783] No more HTML::Template in bazaar/prefs.

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


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

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

Removed Paths:
-------------
    trunk/vhffs-panel/templates/bazaar/prefs.tmpl

Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am	2011-05-20 11:13:38 UTC (rev 1782)
+++ trunk/vhffs-panel/Makefile.am	2011-05-20 11:13:44 UTC (rev 1783)
@@ -911,7 +911,6 @@
 	mercurial/index.pl \
 	mercurial/prefs.pl \
 	bazaar/create.pl \
-	bazaar/delete.pl \
 	bazaar/index.pl \
 	bazaar/prefs.pl \
 	user/delete.pl \

Modified: trunk/vhffs-panel/bazaar/prefs.pl
===================================================================
--- trunk/vhffs-panel/bazaar/prefs.pl	2011-05-20 11:13:38 UTC (rev 1782)
+++ trunk/vhffs-panel/bazaar/prefs.pl	2011-05-20 11:13:44 UTC (rev 1783)
@@ -32,7 +32,6 @@
 
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use CGI;
@@ -40,12 +39,10 @@
 use strict;
 
 use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Main;
+use Vhffs::Group;
+use Vhffs::Constants;
+use Vhffs::Functions;
 use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Panel::Object;
-use Vhffs::Panel::Template;
 use Vhffs::Services::Bazaar;
 
 my $panel = new Vhffs::Panel::Main();
@@ -65,72 +62,25 @@
 my $bazaar = Vhffs::Services::Bazaar::get_by_reponame( $vhffs , $repo_name );
 my $group = Vhffs::Group::get_by_gid( $vhffs , $bazaar->{'owner_gid'} );
 
-unless( defined $repo_name )
-{
-	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-	$template->param( MESSAGE => gettext( 'CGI Error !' ) );
-}
-elsif( !defined $bazaar )
-{
-	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-	$template->param( MESSAGE => gettext( 'Cannot get informations on this object' ) );
-}
-elsif( !$user->can_view( $bazaar ) )
-{
-	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-	$template->param( MESSAGE => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) );
-}
-else
-{
+unless( defined $repo_name ) {
+    $panel->render('misc/message.tt', { message => gettext( 'CGI Error !' ) } );
+} elsif( !defined $bazaar ) {
+    $panel->render('misc/message.tt', { message => gettext( 'Cannot get informations on this object' ) } );
+} elsif( !$user->can_view( $bazaar ) ) {
+    $panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) } );
+} else {
 	if(defined $cgi->param('save_prefs_submit') ) {
-		if(save_prefs()) {
-			exit;
-		}
+		save_prefs();
 	}
 
-	$template = new Vhffs::Panel::Template( filename => $templatedir."/panel/bazaar/prefs.tmpl" );
-
-	$panel->set_title( gettext("Admin Bazaar Repository") );    
-    
-	$template->param( TEXT_REPONAME => $bazaar->get_reponame );
-	$template->param( TITLE_PUBLIC => gettext("Public") );
-	$template->param( TEXT_PUBLIC => gettext("Is this a public repository ?") );
-	$template->param( PUBLIC_YES => gettext("Yes") );
-	$template->param( PUBLIC_NO => gettext("No") );
-	$template->param( TEXT_SEND => gettext("Modify") );
-	$template->param( TEXT_DELETE_CVS => gettext("Delete this repository") );
-	$template->param( TEXT_BEFORE_DELETE => gettext("This action is non-reversible. This bazaar repository will be DESTROYED.") );
-	$template->param( ASK_DELETE_CVS => gettext("Are you SURE you want DELETE this bazaar repository?") );
-	$template->param( YES => gettext("Yes I'm sure of what I do") );
-	$template->param( NO => gettext("No, I'm not sure, I prefer to keep this project.") );
-	$template->param( TEXT_DELETE => gettext("Delete") );
-
-	$template->param( VALUE_OID => $bazaar->get_oid );
-	$template->param( TEXT_ACL_ADMIN => gettext('Admin Rights on this object (ACL)') );
-	$template->param( EXPLAIN_ADMIN_ACL => gettext('You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it.') );
-	$template->param( ADMIN_ACL => gettext('Ok, go to ACL admin') );
-
-	$template->param( TITLE_OPT => gettext('Options') );
-	$template->param( TEXT_OPT_ML => gettext('Notify changes on mailing-list :'));
-	$template->param( TEXT_OPT_ML_REMINDER => sprintf( gettext('Don\'t forget to subscribe %s to your mailing list if you are filtering posts') , $vhffs->get_config->get_service('bazaar')->{notify_from} ) );
-	$template->param( TEXT_ML_NAME => $bazaar->{ml_name} );
-    
-	if( $bazaar->is_public == 1 )
-	{
-		$template->param( YES_SELECTED => "selected" );
-	}
-	else
-	{
-		$template->param( NO_SELECTED => "selected" );
-	}
-
-	my $adminpart = Vhffs::Panel::Object::admin_part( $panel, $bazaar );
-	$template->param( ADMIN_PART => $adminpart->output ) if( defined $adminpart );
+    $panel->set_title( gettext("Modify Bazaar repository") );
+    my $vars = {};
+    $vars->{repository} = $bazaar;
+    $vars->{notify_from} = 'Please finish bazaar implementation'; # $vhffs->get_config->get_service('bazaar')->{notify_from};
+    $vars->{type} = 'bazaar';
+    $panel->render( 'scm/prefs.tt', $vars );
 }
 
-$panel->build( $template );
-$panel->display;
-
 sub save_prefs {
     my $public = $cgi->param('public');
     my $ml_name = $cgi->param('ml_name');

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-05-20 11:13:38 UTC (rev 1782)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-20 11:13:44 UTC (rev 1783)
@@ -70,7 +70,6 @@
 	misc/infos.tmpl \
 	misc/service_index.tmpl \
 	misc/simplemsg.tmpl \
-	bazaar/prefs.tmpl \
 	acl/form.tt \
 	acl/view.tt \
 	admin/object/edit.tt \

Deleted: trunk/vhffs-panel/templates/bazaar/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/bazaar/prefs.tmpl	2011-05-20 11:13:38 UTC (rev 1782)
+++ trunk/vhffs-panel/templates/bazaar/prefs.tmpl	2011-05-20 11:13:44 UTC (rev 1783)
@@ -1,70 +0,0 @@
-<h2><TMPL_VAR ESCAPE=1 NAME="TITLE_PUBLIC"></h2>
-
-
-<form method="post" action="/bazaar/prefs.pl" accept-charset="utf-8">
-	<p>
-		<label for="public">
-			<TMPL_VAR ESCAPE=1 NAME="TEXT_PUBLIC"> :
-		</label>
-		<select name="public" id="public">
-			<option value="1" <TMPL_VAR ESCAPE=1 NAME="YES_SELECTED">><TMPL_VAR ESCAPE=1 NAME="PUBLIC_YES"></option>
-			<option value="0" <TMPL_VAR ESCAPE=1 NAME="NO_SELECTED">><TMPL_VAR ESCAPE=1 NAME="PUBLIC_NO"></option>
-		</select>
-	</p>
-<h2><TMPL_VAR ESCAPE=1 NAME="TITLE_OPT"></h2>
-	<p>
-		<label for="ml_name"><TMPL_VAR ESCAPE=1 NAME="TEXT_OPT_ML"></label>
-                <input type="text" name="ml_name" id="ml_name" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_ML_NAME">" />
-		<br/>
-		<TMPL_VAR ESCAPE=1 NAME="TEXT_OPT_ML_REMINDER">
-	</p>
-	<p class="button">
-		<input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_REPONAME">" />
-		<input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_SEND">" name="save_prefs_submit"/>
-	</p>
-</form>
-
-
-<h2><TMPL_VAR ESCAPE=1 NAME="TEXT_ACL_ADMIN"></h2>
-		
-<form method="post" action="../acl/view.pl" accept-charset="utf-8">
-	<p><TMPL_VAR ESCAPE=1 NAME="EXPLAIN_ADMIN_ACL"></p>
-
-	<input type="hidden" name="target_oid" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_OID">" />
-	<p class="button" id="buttonAclAdmin">
-		<input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="ADMIN_ACL">" />
-	</p>
-</form>
-
-
-<h2><TMPL_VAR ESCAPE=1 NAME="TEXT_DELETE_CVS"></h2>
-
-<form method="post" action="delete.pl" accept-charset="utf-8">
-	<fieldset class="delete">
-		<legend>
-			<TMPL_VAR ESCAPE=1 NAME="ASK_DELETE_CVS">:
-		</legend>
-
-		<p class="warning"><TMPL_VAR ESCAPE=1 NAME="TEXT_BEFORE_DELETE"></p>
-		<p>
-			<input type="radio" name="DELETE" id="DELETE_NO"  value="0" checked="checked" />
-			<label for="DELETE_NO">
-				<TMPL_VAR ESCAPE=1 NAME="NO">
-			</label>
-		</p>
-		<p>
-			<input type="radio" name="DELETE" id="DELETE_YES" value="1" />
-			<label for="DELETE_YES">
-				<TMPL_VAR ESCAPE=1 NAME="YES">
-			</label>
-		</p>
-	</fieldset>
-	
-	<p class="button" id="buttonDelete">
-		<input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_REPONAME">" />
-		<input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_DELETE">" />
-	</p>
-				
-</form>
-
-<TMPL_VAR ESCAPE=0 NAME="ADMIN_PART">


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