[vhffs-dev] MCS patch. |
[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]
Dio!!Voila, le taff sur le MCS (mail commit system (ouai, c'est de moi ;))) est fini.
1) J'ai fixé de l'indentation.2) J'ai ajouté un chmod +x au makefile.am il est nécessaire sinon le commit sera dans un état fuckal!
3) J'ai viré le use_rss pour le moment de tout vhffs, je pondrai ça après. 4) J'ai ajouté les alter et create table pour pgsql dans les fichiers.5) Le robot (vhffs_post_commit.pl) est a mettre dans trunk/vhffs-robots/misc/
Voilà voilà, pour de plus amples question contactez moi :) ++
Index: vhffs-robots/src/create_svn.pl =================================================================== --- vhffs-robots/src/create_svn.pl (révision 577) +++ vhffs-robots/src/create_svn.pl (copie de travail) @@ -46,9 +46,10 @@ foreach $svn ( @{$repos} ) { if( Vhffs::Robots::Svn::create_repo( $vhffs , $svn ) < 0 ) { - Vhffs::Robots::vhffs_log( sprintf( "Cannot create SVN %s" , $svn->get_reponame ), $vhffs); + Vhffs::Robots::vhffs_log( sprintf( "Cannot create SVN %s" , $svn->get_reponame ), $vhffs); } else { Vhffs::Robots::vhffs_log( sprintf( "Create SVN %s" , $svn->get_reponame ), $vhffs); + symlink('%VHFFS_BOTS_DIR%/misc/vhffs_post_commit.pl', $svn->get_dir().'/hooks/post-commit'); } } Index: vhffs-robots/Makefile.am =================================================================== --- vhffs-robots/Makefile.am (révision 577) +++ vhffs-robots/Makefile.am (copie de travail) @@ -8,7 +8,8 @@ misc/repository.awstats_6.5_vhffs.patch \ misc/repository.awstats_htaccess_example \ misc/repository.awstats.sample \ - misc/viewvc.conf.tmpl + misc/viewvc.conf.tmpl \ + misc/vhffs_post_commit.pl bots_SCRIPTS = \ src/create_cvs.pl \ @@ -64,7 +65,8 @@ # Define the substitution we need to point perl script at correct location do_sed = $(SED) --in-place \ -e 's,%PERL%,$(PERL),g' \ - -e 's,'%VHFFS_LIB_DIR%',$(VHFFS_LIBDIR),g' + -e 's,'%VHFFS_LIB_DIR%',$(VHFFS_LIBDIR),g' \ + -e 's,'%VHFFS_BOTS_DIR%',$(botsdir),g' # Because automake, exec-hook is executed before install-scripts # so install-data is after. Here we use a data-hook @@ -76,3 +78,4 @@ nf=`echo $$f | sed 's,^.*/,,'`; \ $(do_sed) $(DESTDIR)$(botsdir)/$$nf; \ done + chmod +x $(DESTDIR)$(botsdir)/misc/vhffs_post_commit.pl Index: vhffs-api/src/Vhffs/Services/Svn.pm =================================================================== --- vhffs-api/src/Vhffs/Services/Svn.pm (révision 577) +++ vhffs-api/src/Vhffs/Services/Svn.pm (copie de travail) @@ -1,4 +1,4 @@ -#!%PERL% +#!/usr/bin/perl # Copyright (c) vhffs project and its contributors # All rights reserved. # @@ -80,7 +80,7 @@ die('Unable to create parent object') unless(defined $parent); - my $sql = 'INSERT INTO vhffs_svn(reponame, owner_uid, owner_gid, public, object_id) VALUES(?, ?, ?, 1, ?)'; + my $sql = 'INSERT INTO vhffs_svn (reponame, owner_uid, owner_gid, public, object_id) VALUES(?, ?, ?, 1, ?)'; my $sth = $dbh->prepare($sql); $sth->execute($rname, $user->get_uid, $group->get_gid, $parent->get_oid) or return undef; @@ -100,7 +100,7 @@ my ($main, $reponame) = @_; my @params; - my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.reponame = ?'; + my $sql = 'SELECT s.svn_id, s.reponame, s.owner_uid, s.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state, s.ml_name FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.reponame = ?'; my $dbh = $main->get_db_object(); @@ -112,7 +112,7 @@ sub _new { - my ($class, $main, $svn_id, $reponame, $owner_uid, $owner_gid, $public, $oid, $date_creation, $description, $state) = @_; + my ($class, $main, $svn_id, $reponame, $owner_uid, $owner_gid, $public, $oid, $date_creation, $description, $state, $ml_name) = @_; my $self = $class->SUPER::_new($main, $oid, $owner_uid, $date_creation, $description, $state, Vhffs::Constants::TYPE_SVN); return undef unless(defined $self); @@ -121,85 +121,96 @@ $self->{reponame} = $reponame; $self->{owner_gid} = $owner_gid; $self->{public} = $public; + $self->{ml_name} = $ml_name; return $self; } sub commit { - my $self = shift; + my $self = shift; - my $query = "UPDATE vhffs_svn SET public= '".$self->{'public'}."' WHERE svn_id=$self->{'svn_id'}"; - my $request = $self->{'db'}->prepare($query); - $request->execute; + my $query = "UPDATE vhffs_svn SET public= '".$self->{'public'}."' WHERE svn_id=$self->{'svn_id'}"; + my $request = $self->{'db'}->prepare($query); + $request->execute; - $self->SUPER::commit; + $self->SUPER::commit; } +sub commit_option +{ + my $self = shift; + my $query = "UPDATE vhffs_svn SET ml_name= '".$self->{'ml_name'}."' WHERE svn_id=$self->{'svn_id'}"; + my $request = $self->{'db'}->prepare($query); + $request->execute; + + $self->SUPER::commit; +} + sub set_public { - my $self = shift; - $self->{'public'} = 1; + my $self = shift; + $self->{'public'} = 1; } sub set_private { - my $self = shift; - $self->{'public'} = 0; + my $self = shift; + $self->{'public'} = 0; } sub is_public { - my $self = shift; - - return -1 if( ! defined $self->{'public'} ); + my $self = shift; + + return -1 if( ! defined $self->{'public'} ); - if( $self->{'public'} == 1 ) - { - return 1; - } - else - { - return 0; - } + if( $self->{'public'} == 1 ) + { + return 1; + } + else + { + return 0; + } } sub set_user { - my ( $self , $user ) = @_; - $self->{'user'} = $user; + my ( $self , $user ) = @_; + $self->{'user'} = $user; } sub set_group { - my ( $self , $group ) = @_; - $self->{'group'} = $group; + my ( $self , $group ) = @_; + $self->{'group'} = $group; } sub get_reponame { - my $self = shift; - return $self->{'reponame'}; + my $self = shift; + return $self->{'reponame'}; } sub get_owneruid { - my( $self ) = @_; - return $self->{'owner_uid'}; + my( $self ) = @_; + return $self->{'owner_uid'}; } sub get_ownergid { - my $self = shift; - return $self->{'owner_gid'}; + my $self = shift; + return $self->{'owner_gid'}; } sub get_title { - my $self = shift; - return $self->{'reponame'}; + my $self = shift; + return $self->{'reponame'}; } Index: vhffs-api/src/Vhffs/Panel/Svn.pm =================================================================== --- vhffs-api/src/Vhffs/Panel/Svn.pm (révision 577) +++ vhffs-api/src/Vhffs/Panel/Svn.pm (copie de travail) @@ -1,4 +1,4 @@ -#!%PERL% +#!/usr/bin/perl # Copyright (c) vhffs project and its contributors # All rights reserved. # Index: vhffs-api/src/Vhffs/Robots/Svn.pm =================================================================== --- vhffs-api/src/Vhffs/Robots/Svn.pm (révision 577) +++ vhffs-api/src/Vhffs/Robots/Svn.pm (copie de travail) @@ -101,30 +101,30 @@ if( ! -e $dir ) { Vhffs::Functions::create_dir( $dir ) if( ! -d $dir ); $svn->add_history("Ok, robots find the empty directory and will create subversion repository"); - system("svnadmin create --fs-type fsfs $dir"); + system("svnadmin create --fs-type fsfs $dir"); Vhffs::Functions::chmod_recur( $dir , 0664 , 02775 ); Vhffs::Functions::change_owner_recur( $dir , $svn->get_owneruid , $svn->get_ownergid ); - change_conf( $svn ); - $svn->add_history("The Robots created the subversion repository"); - } else { - $ok = 0; - #TODO support syslog - $svn->set_status( Vhffs::Constants::CREATING_ERROR ); + change_conf( $svn ); + $svn->add_history("The Robots created the subversion repository"); + } else { + $ok = 0; + #TODO support syslog + $svn->set_status( Vhffs::Constants::CREATING_ERROR ); $svn->commit(); - $svn->add_history("Error, directory of this subversion already exists ! Administrators must fix the problem"); - } - if( $ok == 1 ) { - $svn->set_status( Vhffs::Constants::ACTIVATED ); + $svn->add_history("Error, directory of this subversion already exists ! Administrators must fix the problem"); + } + if( $ok == 1 ) { + $svn->set_status( Vhffs::Constants::ACTIVATED ); - if( $svn->commit < 0 ) { - $svn->add_history( "Cannot commit changes on the object ! "); - } else { - $svn->add_history( "Subversion repository is now active"); + if( $svn->commit < 0 ) { + $svn->add_history( "Cannot commit changes on the object ! "); + } else { + $svn->add_history( "Subversion repository is now active"); } - } else { + } else { $svn->add_history("Object is not created, problem while creating it"); } - } + } } } Index: vhffs-compat/4.0.sql.in =================================================================== --- vhffs-compat/4.0.sql.in (révision 577) +++ vhffs-compat/4.0.sql.in (copie de travail) @@ -209,3 +209,5 @@ FROM vhffs_users users, vhffs_object object WHERE object.object_id=users.object_id; +-- add ml_name to vhffs_svn for commit system. +ALTER TABLE vhffs_svn ADD COLUMN ml_name varchar; Index: vhffs-backend/src/pgsql/initdb.sql.in =================================================================== --- vhffs-backend/src/pgsql/initdb.sql.in (révision 577) +++ vhffs-backend/src/pgsql/initdb.sql.in (copie de travail) @@ -277,6 +277,7 @@ owner_uid int4, owner_gid int4, public int4 NOT NULL, + ml_name vachar; object_id int4, CONSTRAINT vhffs_svn_pkey PRIMARY KEY( reponame , owner_gid) ) WITH OIDS; Index: vhffs-panel/svn/prefs_save.pl =================================================================== --- vhffs-panel/svn/prefs_save.pl (révision 577) +++ vhffs-panel/svn/prefs_save.pl (copie de travail) @@ -1,4 +1,4 @@ -#!%PERL% -w +#!/usr/bin/perl -w # Copyright (c) vhffs project and its contributors # All rights reserved. # @@ -39,7 +39,7 @@ use strict; use Data::Dumper; -use lib '%VHFFS_LIB_DIR%'; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Main; use Vhffs::Group; @@ -64,7 +64,9 @@ my $repo = $cgi->param( "REPO_NAME" ); my $public = $cgi->param( "PUBLIC" ); +my $ml_name = $cgi->param( "ML_NAME" ); + my $svn = Vhffs::Services::Svn::get_by_reponame( $vhffs , $repo ); my $templatedir = $vhffs->get_config->get_templatedir; @@ -75,11 +77,11 @@ } elsif( ! defined($svn) ) { - $message = gettext( "Cannot retrieve informations about this Subversion repository" ); + $message = gettext( "Cannot retrieve informations about this Subversion repository" ); } elsif( ( Vhffs::Acl::what_perm_for_user( $user , $svn , $vhffs ) < Vhffs::Constants::ACL_MODIFY ) && ( $user->is_admin != 1 ) ) { - $message = gettext( "You're not allowed to do this (ACL rights)" ); + $message = gettext( "You're not allowed to do this (ACL rights)" ); } elsif( ( $svn->get_status != Vhffs::Constants::ACTIVATED ) && ( $user->is_admin != 1 ) ) { @@ -88,28 +90,43 @@ else { - if( defined $public ) - { - if( $public == 1 ) - { - $svn->set_public; - } - else - { - $svn->set_private; - } - } + if( defined $public ) + { + if( $public == 1 ) + { + $svn->set_public; + } + else + { + $svn->set_private; + } - $svn->set_status( Vhffs::Constants::WAITING_FOR_MODIFICATION ); - - if( $svn->commit < 0 ) + $svn->set_status( Vhffs::Constants::WAITING_FOR_MODIFICATION ); + if( $svn->commit < 0 ) + { + $message = gettext("An error occured while updating the Subversion repository"); + } + else + { + $message = gettext("Repository updated"); + } + } + + if ( defined $ml_name) + { + if ($ml_name ne 'ml adress here...') { - $message = gettext("An error occured while updating the Subversion repository"); - } - else - { - $message = gettext("Repository updated"); + $svn->{ml_name} = $ml_name; } + if( $svn->commit_option < 0 ) + { + $message = gettext("An error occured while updating the Subversion repository"); + } + else + { + $message = gettext("Repository updated"); + } + } } my $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); Index: vhffs-panel/svn/prefs.pl =================================================================== --- vhffs-panel/svn/prefs.pl (révision 577) +++ vhffs-panel/svn/prefs.pl (copie de travail) @@ -1,4 +1,4 @@ -#!%PERL% +#!/usr/bin/perl # Copyright (c) vhffs project and its contributors # All rights reserved. # @@ -38,7 +38,7 @@ use CGI::Session; use strict; -use lib '%VHFFS_LIB_DIR%'; +use lib "/usr/share/vhffs/api/"; use Vhffs::User; use Vhffs::Group; use Vhffs::Main; @@ -70,7 +70,7 @@ if( defined $cgigroupname ) { - $group = Vhffs::Group::get_by_groupname( $vhffs , $cgigroupname ); + $group = Vhffs::Group::get_by_groupname( $vhffs , $cgigroupname ); } $svn = Vhffs::Services::Svn::get_by_reponame( $vhffs , $repo_name ); @@ -78,53 +78,53 @@ if( ! defined $repo_name ) { - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = gettext( "CGI Error" ); - $template->param( MESSAGE => $message ); + $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); + $message = gettext( "CGI Error" ); + $template->param( MESSAGE => $message ); } elsif( ! defined $group ) { - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $template->param( MESSAGE => gettext("Grant an user access to this repository") ); + $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); + $template->param( MESSAGE => gettext("Grant an user access to this repository") ); } elsif( !defined $svn ) { - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = gettext( "Cannot get informations on this object"); - $template->param( MESSAGE => $message ); + $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); + $message = gettext( "Cannot get informations on this object"); + $template->param( MESSAGE => $message ); } elsif( ( Vhffs::Acl::what_perm_for_user( $user , $svn , $vhffs ) < Vhffs::Constants::ACL_VIEW ) && ( $user->is_admin != 1 ) ) { - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); - $message = gettext( "You're not allowed to do this (ACL rights)"); - $template->param( MESSAGE => $message ); + $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); + $message = gettext( "You're not allowed to do this (ACL rights)"); + $template->param( MESSAGE => $message ); } elsif( ( $svn->get_status != Vhffs::Constants::ACTIVATED ) && ( $user->is_admin != 1 ) ) { - $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); + $template = new HTML::Template( filename => $templatedir."/misc/simplemsg.tmpl" ); $message = gettext( "This object is not functionnal yet. Please wait creation, moderation or modification."); - $template->param( MESSAGE => $message ); + $template->param( MESSAGE => $message ); } else { - $template = new HTML::Template( filename => $templatedir."/svn/prefs.tmpl" ); + $template = new HTML::Template( filename => $templatedir."/svn/prefs.tmpl" ); - $template->param( TEXT_TITLE => gettext("Admin Subversion Repository") ); - - - $template->param( TEXT_REPONAME => $svn->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. All services associated to this project will be DESTROYED.") ); - $template->param( ASK_DELETE_CVS => gettext("Are you SURE you want DELETE this subversion 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( TEXT_TITLE => gettext("Admin Subversion Repository") ); + + + $template->param( TEXT_REPONAME => $svn->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. All services associated to this project will be DESTROYED.") ); + $template->param( ASK_DELETE_CVS => gettext("Are you SURE you want DELETE this subversion 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( 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." ); @@ -133,26 +133,35 @@ $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 !" ); + $template->param( TITLE_OPT => "Options" ); + $template->param( TEXT_OPT_ML => "Notify changes on mailing-list :"); - - - if( $svn->is_public == 1 ) - { - $template->param( YES_SELECTED => "selected" ); - } - else - { - $template->param( NO_SELECTED => "selected" ); - } + if ( $svn->{ml_name} ne '' ) + { + $template->param( TEXT_ML_NAME => $svn->{ml_name}); + } + else + { + $template->param( TEXT_ML_NAME => "ml adress here..."); + } + + if( $svn->is_public == 1 ) + { + $template->param( YES_SELECTED => "selected" ); + } + else + { + $template->param( NO_SELECTED => "selected" ); + } - if( $user->is_admin == 1 ) - { - $subtemplate = new HTML::Template( filename => $templatedir."/admin/misc/opart.tmpl" ); - $subtemplate->param( OID => $svn->get_oid ); - $subtemplate->param( OPART_TEXT => gettext("Go to object-part admin") ); - $subtemplate->param( OPART_TITLE => gettext("Object part") ); - $template->param( OPART => $subtemplate->output ); - } + if( $user->is_admin == 1 ) + { + $subtemplate = new HTML::Template( filename => $templatedir."/admin/misc/opart.tmpl" ); + $subtemplate->param( OID => $svn->get_oid ); + $subtemplate->param( OPART_TEXT => gettext("Go to object-part admin") ); + $subtemplate->param( OPART_TITLE => gettext("Object part") ); + $template->param( OPART => $subtemplate->output ); + } } Index: vhffs-panel/templates/svn/prefs.tmpl =================================================================== --- vhffs-panel/templates/svn/prefs.tmpl (révision 577) +++ vhffs-panel/templates/svn/prefs.tmpl (copie de travail) @@ -18,7 +18,19 @@ </p> </form> +<h2><tmpl_var name="TITLE_OPT"></h2> +<form method="post" action="/svn/prefs_save.pl"> + <p> + <label for="OPTION"><tmpl_var name="TEXT_OPT_ML"></label> + <input type="text" name="ML_NAME" value="<tmpl_var name="TEXT_ML_NAME">" /> + </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_SEND">" /> + </p> +</form> + <h2><tmpl_var name="TITLE_PERM"></h2> <form method="post" action="/svn/prefs_save.pl"> <p>
Attachment:
vhffs_post_commit.pl
Description: Perl program
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |