[vhffs-dev] [1770] No more HTML::Template in git/prefs

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


Revision: 1770
Author:   beuss
Date:     2011-05-17 22:51:06 +0200 (Tue, 17 May 2011)
Log Message:
-----------
No more HTML::Template in git/prefs

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

Removed Paths:
-------------
    trunk/vhffs-panel/git/delete.pl
    trunk/vhffs-panel/templates/git/prefs.tmpl

Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am	2011-05-17 20:50:55 UTC (rev 1769)
+++ trunk/vhffs-panel/Makefile.am	2011-05-17 20:51:06 UTC (rev 1770)
@@ -907,7 +907,6 @@
 	svn/index.pl \
 	svn/prefs.pl \
 	git/create.pl \
-	git/delete.pl \
 	git/index.pl \
 	git/prefs.pl \
 	mercurial/create.pl \

Deleted: trunk/vhffs-panel/git/delete.pl
===================================================================
--- trunk/vhffs-panel/git/delete.pl	2011-05-17 20:50:55 UTC (rev 1769)
+++ trunk/vhffs-panel/git/delete.pl	2011-05-17 20:51:06 UTC (rev 1770)
@@ -1,110 +0,0 @@
-#!%PERL% -w
-# Copyright (c) vhffs project and its contributors
-# Copyright (c) 2007 Julien Danjou <julien@xxxxxxxxxxx>
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-use utf8;
-use POSIX qw(locale_h);
-use HTML::Template;
-use locale;
-use Locale::gettext;
-use CGI;
-use CGI::Session;
-use strict;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Main;
-use Vhffs::Group;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Panel::Group;
-use Vhffs::Services::Cvs;
-
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
-
-my $vhffs = $panel->{'vhffs'};
-my $maintemplate = $panel->{'template'};
-my $user = $panel->{'user'};
-my $cgi = $panel->{'cgi'};
-my $message;
-my $owner = $cgi->param("PROJECT_OWNER");
-
-my $repo = $cgi->param( "name" );
-my $sure = $cgi->param( "DELETE" );
-
-my $git = Vhffs::Services::Git::get_by_reponame( $vhffs , $repo );
-
-my $templatedir = $vhffs->get_config->get_templatedir;
-
-if( ( ! defined $repo ) || ( ! defined $sure ) )
-{
-    $message = gettext("CGI Error !");
-}
-elsif( ! defined $git )
-{
-	$message = gettext( "Cannot retrieve informations about this repository" );
-}
-elsif( !$user->can_delete( $git ) )
-{
-	$message = gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' );
-}
-elsif( $git->get_status != Vhffs::Constants::ACTIVATED )
-{
-    $message = gettext( "This object is not functionnal yet. Please wait creation or moderation.");
-}
-elsif( $sure == 0 )
-{
-	$message = gettext( "This git repository will NOT be deleted" );
-}
-else
-{
-	$git->set_status( Vhffs::Constants::TO_DELETE );
-
-	# Commit all the changes for the current user
-	if( $git->commit < 0 )
-	{
-	        $message = gettext("An error occured while deleting the git repository");
-	}  
-	else  
-	{
-        $message = gettext("This repository will be deleted");
-	}
-}
-
-my $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-$template->param( MESSAGE => $message );
-
-$panel->build( $template );
-$panel->display;

Modified: trunk/vhffs-panel/git/prefs.pl
===================================================================
--- trunk/vhffs-panel/git/prefs.pl	2011-05-17 20:50:55 UTC (rev 1769)
+++ trunk/vhffs-panel/git/prefs.pl	2011-05-17 20:51:06 UTC (rev 1770)
@@ -33,7 +33,6 @@
 
 use utf8;
 use POSIX qw(locale_h);
-use HTML::Template;
 use locale;
 use Locale::gettext;
 use CGI;
@@ -41,12 +40,7 @@
 use strict;
 
 use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Main;
 use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Panel::Object;
-use Vhffs::Panel::Template;
 use Vhffs::Services::Git;
 
 my $panel = new Vhffs::Panel::Main();
@@ -57,81 +51,31 @@
 my $vhffs = $panel->{'vhffs'};
 my $user = $panel->{'user'};
 my $cgi = $panel->{'cgi'};
-my $templatedir = $panel->{'templatedir'};
 
 my $repo_name = $cgi->param('name');
 
-my $template;
-
 my $git = Vhffs::Services::Git::get_by_reponame( $vhffs , $repo_name );
 my $group = Vhffs::Group::get_by_gid( $vhffs , $git->{'owner_gid'} );
 
-unless( defined $repo_name )
-{
-	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-	$template->param( MESSAGE => gettext( 'CGI Error !' ) );
-}
-elsif( !defined $git )
-{
-	$template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
-	$template->param( MESSAGE => gettext( 'Cannot get informations on this object' ) );
-}
-elsif( !$user->can_view( $git ) )
-{
-	$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 $git ) {
+    $panel->render('misc/message.tt', { message => gettext( 'Cannot get informations on this object' ) } );
+} elsif( !$user->can_view( $git ) ) {
+    $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/git/prefs.tmpl" );
-
-	$panel->set_title( gettext("Admin Git Repository") );    
-    
-	$template->param( TEXT_REPONAME => $git->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 git repository will be DESTROYED.") );
-	$template->param( ASK_DELETE_CVS => gettext("Are you SURE you want DELETE this git 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 => $git->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('git')->{notify_from} ) );
-	$template->param( TEXT_ML_NAME => $git->{ml_name} );
-    
-	if( $git->is_public == 1 )
-	{
-		$template->param( YES_SELECTED => "selected" );
-	}
-	else
-	{
-		$template->param( NO_SELECTED => "selected" );
-	}
-
-	my $adminpart = Vhffs::Panel::Object::admin_part( $panel, $git );
-	$template->param( ADMIN_PART => $adminpart->output ) if( defined $adminpart );
+    $panel->set_title( gettext('Modify Git repository') );
+    my $vars = {};
+    $vars->{repository} = $git;
+    $vars->{notify_from} = $vhffs->get_config->get_service('git')->{notify_from};
+    $vars->{type} = 'git';
+    $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-17 20:50:55 UTC (rev 1769)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-17 20:51:06 UTC (rev 1770)
@@ -81,7 +81,6 @@
 	misc/infos.tmpl \
 	misc/service_index.tmpl \
 	misc/simplemsg.tmpl \
-	git/prefs.tmpl \
 	bazaar/create.tmpl \
 	bazaar/prefs.tmpl \
 	cron/create.tmpl \

Deleted: trunk/vhffs-panel/templates/git/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/git/prefs.tmpl	2011-05-17 20:50:55 UTC (rev 1769)
+++ trunk/vhffs-panel/templates/git/prefs.tmpl	2011-05-17 20:51:06 UTC (rev 1770)
@@ -1,70 +0,0 @@
-<h2><TMPL_VAR ESCAPE=1 NAME="TITLE_PUBLIC"></h2>
-
-
-<form method="post" action="/git/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/