[vhffs-dev] [svn] commit: r99 - in /trunk: vhffs-api/src/Vhffs/Panel/ vhffs-panel/admin/cvs/ vhffs-panel/cvs/ vhffs-panel/svn/ vhffs-panel/templates/admin/user/ vhffs-panel/templates/cvs/ vhffs-panel/templates/svn/ vhffs-robots/src/ vhffs-tools/src/

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


Author: soda
Date: Tue Dec  6 21:55:31 2005
New Revision: 99

Log:
Clean du code pour les menus
Ajout d'une fonction pour fixer les permissions sans
changer le statut d'un repository pour svn et cvs


Added:
    trunk/vhffs-panel/templates/admin/user/group-part.tmpl
Modified:
    trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
    trunk/vhffs-panel/admin/cvs/list.pl
    trunk/vhffs-panel/cvs/prefs.pl
    trunk/vhffs-panel/cvs/prefs_save.pl
    trunk/vhffs-panel/svn/prefs.pl
    trunk/vhffs-panel/svn/prefs_save.pl
    trunk/vhffs-panel/templates/cvs/prefs.tmpl
    trunk/vhffs-panel/templates/svn/prefs.tmpl
    trunk/vhffs-robots/src/svn_users.pl
    trunk/vhffs-tools/src/vhffs-usermod

Modified: trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
==============================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm (original)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm Tue Dec  6 21:55:31 2005
@@ -109,32 +109,14 @@
 		$subtemplate->param( CVSWEBURL => $vhffs->get_config->get_cvsweburl . "/" . $group->get_groupname . "/".$cvs->get_cvsroot );
 		$output .= $subtemplate->output;
 	    }
-	    elsif( $cvs->get_status == Vhffs::Constants::WAITING_FOR_VALIDATION )
+	    else
 	    {
 			$subtemplate = new HTML::Template( filename => "$templatesdir/cvs/menu_sub_wait.tmpl" );
 			$subtemplate->param( NAME => $cvs->get_cvsroot );
-			$subtemplate->param( REASON => gettext( "Waiting for validation" ) );
+			$subtemplate->param( REASON => gettext( Vhffs::Functions::status_string_from_status_id( $cvs->get_status ) ) );
 			$subtemplate->param( HISTORY => gettext("History"));
 			$subtemplate->param( OID => $cvs->get_oid );
 			$output .= $subtemplate->output;
-	    }
-	    elsif( $cvs->get_status == Vhffs::Constants::WAITING_FOR_CREATION )
-	    {
-		$subtemplate = new HTML::Template( filename => "$templatesdir/cvs/menu_sub_wait.tmpl" );
-		$subtemplate->param( NAME => $cvs->get_cvsroot);
-		$subtemplate->param( REASON => gettext( "Waiting for creation" ) );
-		$subtemplate->param( HISTORY => gettext("History"));
-		$subtemplate->param( OID => $cvs->get_oid );
-		$output .= $subtemplate->output;
-	    }
-	    elsif( $cvs->get_status == Vhffs::Constants::VALIDATION_REFUSED )
-	    {
-		$subtemplate = new HTML::Template( filename => "$templatesdir/cvs/menu_sub_wait.tmpl" );
-		$subtemplate->param( NAME => $cvs->get_cvsroot);
-		$subtemplate->param( REASON => gettext( "Validation refused" ) );
-		$subtemplate->param( HISTORY => gettext("History"));
-		$subtemplate->param( OID => $cvs->get_oid );
-		$output .= $subtemplate->output;
 	    }
 	}
 	

Modified: trunk/vhffs-panel/admin/cvs/list.pl
==============================================================================
--- trunk/vhffs-panel/admin/cvs/list.pl (original)
+++ trunk/vhffs-panel/admin/cvs/list.pl Tue Dec  6 21:55:31 2005
@@ -53,14 +53,15 @@
 		$template->param( TITLE => gettext("List of all CVS repositories") );
 	}
 
-	use Vhffs::Panel::Web;
+	use Vhffs::Services::Cvs;
 
-	my $cvs = Vhffs::Panel::Cvs::getall_cvs( $vhffs , $name );
+	my $cvs = Vhffs::Services::Cvs::getall( $vhffs , undef , undef , undef );
+	my $c;
+	my $output = "";
 
 	if( defined $cvs )
 	{
-		my $output = "";
-		foreach( sort ( keys %{$cvs} ) )
+		foreach $c ( @{$cvs} )
 		{
 			my $subtemplate;
 			if( $user->is_admin == 1 )  {
@@ -69,26 +70,10 @@
 				$subtemplate = new HTML::Template( filename => "$templatesdir/admin/cvs/part-modo.tmpl" );
 			}
 
-			$subtemplate->param( CVSROOT => $cvs->{$_}{'cvsroot'} ) if( defined $cvs->{$_}{'cvsroot'} );
-			$subtemplate->param( GROUP => Vhffs::Group::get_name_by_gid( $vhffs , $cvs->{$_}{'owner_gid'} ) ) if( defined $cvs->{$_}{'owner_gid'} );
-			$subtemplate->param( OID => $cvs->{$_}{'object_id'} ) if( defined $cvs->{$_}{'object_id'} );
-
-			if( $cvs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_CREATION )
-			{
-				$subtemplate->param( STATE => gettext("Waiting for creation") );
-			}
-			elsif( $cvs->{$_}{'state'} == Vhffs::Constants::ACTIVATED )
-			{
-				$subtemplate->param( STATE => gettext("Activated") );
-			}
-			elsif( $cvs->{$_}{'state'} == Vhffs::Constants::TO_DELETE )
-			{
-				$subtemplate->param( STATE => gettext("Waiting for delete") );
-			}
-			elsif( $cvs->{$_}{'state'} == Vhffs::Constants::WAITING_FOR_VALIDATION )
-			{
-				$subtemplate->param( STATE => gettext("Waiting for validation") );
-			}
+			$subtemplate->param( CVSROOT => $c->get_cvsroot );
+			$subtemplate->param( GROUP => $c->get_group->get_groupname );
+			$subtemplate->param( OID => $c->get_oid );
+			$subtemplate->param( STATE => gettext( Vhffs::Functions::status_string_from_status_id( $c->get_status ) ) );
 			
 			if( $user->is_admin == 1 )  {
 				$subtemplate->param( SEND => gettext("Modify this CVS repository") );

Modified: trunk/vhffs-panel/cvs/prefs.pl
==============================================================================
--- trunk/vhffs-panel/cvs/prefs.pl (original)
+++ trunk/vhffs-panel/cvs/prefs.pl Tue Dec  6 21:55:31 2005
@@ -55,7 +55,7 @@
 	$message = gettext( "You're not allowed to do this (ACL rights)");
 	$template->param( MESSAGE => $message );
 }
-elsif( $cvs->get_status != Vhffs::Constants::ACTIVATED )
+elsif( ( $cvs->get_status != Vhffs::Constants::ACTIVATED ) && ( $user->is_admin != 1 ) )
 {
 	$template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
     $message = gettext( "This object is not functionnal yet. Please wait creation, moderation or modification.");
@@ -82,6 +82,9 @@
     $template->param( TEXT_ACL_ADMIN => "Admin Rights on this object (ACL)" );
     $template->param( EXPLAIN_ADMIN_ACL => "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it." );
     $template->param( ADMIN_ACL => "Ok, go to ACL admin" );
+    $template->param( PERM_TITLE => "Fix permissions" );
+    $template->param( PERM_TEXT => "Fixing permissions on a repository solve permission access on the repository. Can be helpful if you encounter problems" );
+    $template->param( PERM_BUTTON => "Fix it" );
 
 
 	if( $cvs->is_public == 1 )

Modified: trunk/vhffs-panel/cvs/prefs_save.pl
==============================================================================
--- trunk/vhffs-panel/cvs/prefs_save.pl (original)
+++ trunk/vhffs-panel/cvs/prefs_save.pl Tue Dec  6 21:55:31 2005
@@ -38,7 +38,7 @@
 
 my $cvs = new Vhffs::Services::Cvs( $vhffs , $repo , $user , $group );
 
-if( ( ! defined $repo ) || ( ! defined $cvs ) || ( ! defined $public ) )
+if( ( ! defined $repo ) || ( ! defined $cvs ) )
 {
     $message = sprintf( gettext("CGI Error ! %s"), $repo );
 }
@@ -46,7 +46,7 @@
 {
 	$message = gettext( "Cannot retrieve informations about this Cvs" );
 }
-elsif( ( Vhffs::Acl::what_perm_for_user( $user , $cvs , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) )
+elsif( ( Vhffs::Acl::what_perm_for_user( $user , $cvs , $vhffs ) != Vhffs::Constants::ACL_VIEW ) && ( $user->is_admin != 1 ) )
 {
 	$message = gettext( "You're not allowed to do this (ACL rights)" );
 }
@@ -56,29 +56,39 @@
 }
 else
 {
-	if( $public == 1 )
+
+	#If public is defined, the user want change the CVS
+	#permission status
+	#Else, he just want update rights, so, we update the status
+	#with WAITING_FOR_MODIFICATION to leave the robots modify permissions
+	if( defined $public )
 	{
-	    $cvs->set_public;
+		if( $public == 1 )
+		{
+		    $cvs->set_public;
+		}
+		else
+		{
+		    $cvs->set_private;
+		}
 	}
-	else
-	{
-	    
-	    $cvs->set_private;
-	}
+
 	$cvs->set_status( Vhffs::Constants::WAITING_FOR_MODIFICATION );	
-	# Commit all the changes for the current user
+
+
+	#Commit what we modify on the current object
 	if( $cvs->commit < 0 )
 	{
 	        $message .= gettext("Error occured while updating CVS repository");
 	}  
 	else  
 	{
-        $message .= gettext("CVS repository successfully modified");
+        $message .= gettext("CVS repository updated");
 	}
 }
 
 my $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
 $template->param( MESSAGE => $message );
 
-set_refresh_url Vhffs::Panel::Main($panel, "/cvs/prefs.pl?name=$repo", 0);
+set_refresh_url Vhffs::Panel::Main($panel, "/panel.pl?project=".$cvs->get_group->get_groupname, 0);
 display Vhffs::Panel::Main($panel, $template->output);

Modified: trunk/vhffs-panel/svn/prefs.pl
==============================================================================
--- trunk/vhffs-panel/svn/prefs.pl (original)
+++ trunk/vhffs-panel/svn/prefs.pl Tue Dec  6 21:55:31 2005
@@ -99,6 +99,9 @@
     $template->param( TEXT_ACL_ADMIN => "Admin Rights on this object (ACL)" );
     $template->param( EXPLAIN_ADMIN_ACL => "You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it." );
     $template->param( ADMIN_ACL => "Ok, go to ACL admin" );
+    $template->param( TITLE_PERM => "Fix permissions in this repository" );
+    $template->param( PERM_TEXT => "Fixing permissions on a repository solve permission access on the repository. Can be helpful if you encounter problems" );
+    $template->param( TEXT_BUTTON_PERM => "Fix them !" );
 
 
 	

Modified: trunk/vhffs-panel/svn/prefs_save.pl
==============================================================================
--- trunk/vhffs-panel/svn/prefs_save.pl (original)
+++ trunk/vhffs-panel/svn/prefs_save.pl Tue Dec  6 21:55:31 2005
@@ -38,7 +38,7 @@
 
 my $templatedir = $vhffs->get_config->get_templatedir;
 
-if( ( ! defined $repo ) || ( ! defined $svn ) || ( ! defined $public ) )
+if( ( ! defined $repo ) || ( ! defined $svn ) )
 {
     $message = sprintf( gettext("CGI Error ! %s"), $repo );
 }
@@ -56,14 +56,19 @@
 }
 else
 {
-	if( $public == 1 )
+
+	if( defined $public )
 	{
-		$svn->set_public;
+		if( $public == 1 )
+		{
+			$svn->set_public;
+		}
+		else
+		{
+			$svn->set_private;
+		}
 	}
-	else
-	{
-		$svn->set_private;
-	}
+
 	$svn->set_status( Vhffs::Constants::WAITING_FOR_MODIFICATION );
 	
 	if( $svn->commit < 0 )
@@ -72,12 +77,12 @@
 	}  
 	else  
 	{
-        $message = gettext("Subversion repository Successfully modified");
+        $message = gettext("Repository updated");
 	}
 }
 
 my $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" );
 $template->param( MESSAGE => $message );
 
-set_refresh_url Vhffs::Panel::Main($panel, "/svn/prefs.pl?name=$repo", 0);
+set_refresh_url Vhffs::Panel::Main($panel, "/panel.pl?project=".$svn->get_group->get_groupname, 0);
 display Vhffs::Panel::Main($panel, $template->output);

Modified: trunk/vhffs-panel/templates/cvs/prefs.tmpl
==============================================================================
--- trunk/vhffs-panel/templates/cvs/prefs.tmpl (original)
+++ trunk/vhffs-panel/templates/cvs/prefs.tmpl Tue Dec  6 21:55:31 2005
@@ -18,6 +18,21 @@
 		<input type="submit" value="<tmpl_var name="TEXT_SEND">" />
 	</p>
 </form>
+
+
+<h2><tmpl_var name="PERM_TITLE"></h2>
+<form method="post" action="/cvs/prefs_save.pl">
+	<p>
+		<label>
+			<tmpl_var name="PERM_TEXT">
+		</label>
+	</p>
+	    <p class="button" id="buttonSend">
+		<input type="hidden" name="REPO_NAME" value="<tmpl_var name="TEXT_REPONAME">" />
+		<input type="submit" value="<tmpl_var name="PERM_BUTTON">" />
+	</p>
+</form>
+
 
 <h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
 

Modified: trunk/vhffs-panel/templates/svn/prefs.tmpl
==============================================================================
--- trunk/vhffs-panel/templates/svn/prefs.tmpl (original)
+++ trunk/vhffs-panel/templates/svn/prefs.tmpl Tue Dec  6 21:55:31 2005
@@ -3,7 +3,6 @@
 
 
 <form method="post" action="/svn/prefs_save.pl">
-
 	<p>
 		<label for="PUBLIC">
 			<tmpl_var name="TEXT_PUBLIC"> :
@@ -19,6 +18,19 @@
 	</p>
 </form>
 
+
+<h2><tmpl_var name="TITLE_PERM"></h2>
+<form method="post" action="/svn/prefs_save.pl">
+	<p>
+		<label for="PUBLIC">
+			<tmpl_var name="PERM_TEXT">
+		</label>
+	</p>
+	<p class="button" id="buttonModify">
+		<input type="hidden" name="REPO_NAME" value="<tmpl_var name="TEXT_REPONAME">" />
+		<input type="submit" value="<tmpl_var name="TEXT_BUTTON_PERM">" />
+	</p>
+</form>
 
 <h2><tmpl_var name="TEXT_ACL_ADMIN"></h2>
 		

Modified: trunk/vhffs-robots/src/svn_users.pl
==============================================================================
--- trunk/vhffs-robots/src/svn_users.pl (original)
+++ trunk/vhffs-robots/src/svn_users.pl Tue Dec  6 21:55:31 2005
@@ -8,11 +8,11 @@
 my $vhffs = init Vhffs::Main;
 my $repos = Vhffs::Services::Svn::getall( $vhffs , Vhffs::Constants::ACTIVATED);
 my $svn;
-foreach $svn ( @{$repos} )
-{
-	if( $svn->fetch >= 0)
-	{
-		Vhffs::Robots::Svn::update_users( $vhffs , $svn );
-	}
-}
+#foreach $svn ( @{$repos} )
+#{
+#	if( $svn->fetch >= 0)
+#	{
+#		Vhffs::Robots::Svn::update_users( $vhffs , $svn );
+#	}
+#}
 

Modified: trunk/vhffs-tools/src/vhffs-usermod
==============================================================================
--- trunk/vhffs-tools/src/vhffs-usermod (original)
+++ trunk/vhffs-tools/src/vhffs-usermod Tue Dec  6 21:55:31 2005
@@ -19,10 +19,11 @@
 
 if( ( defined $user ) && ( $user->fetch == 1 ) )
 {
-	if( $mod =~ /shell|firstname|lastname|city/ )
+	if( $mod =~ /shell|firstname|lastname|city|admin/ )
 	{
 		$user->set_fistname( $value )if( $mod eq "firstname");
 		$user->set_lastname( $value )if( $mod eq "lastname");
+		$user->set_admin( $value )if( $mod eq "admin");
 		$user->set_shell( $value )if( $mod eq "shell");
 		if( $user->commit <= 0 )
 		{




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