[vhffs-dev] [1610] Added Bazaar support to VHFFS. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1610
Author: guillaumito
Date: 2010-06-06 23:10:08 +0200 (Sun, 06 Jun 2010)
Log Message:
-----------
Added Bazaar support to VHFFS. Everything should be working
except mail notifications (will add them later...).
This time I even updated the compat script... guess I'm getting
better with age.
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Constants.pm
trunk/vhffs-api/src/Vhffs/Functions.pm
trunk/vhffs-api/src/Vhffs/Makefile.am
trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
trunk/vhffs-api/src/Vhffs/Panel/Admin.pm
trunk/vhffs-api/src/Vhffs/Panel/Main.pm
trunk/vhffs-api/src/Vhffs/Panel/Menu.pm
trunk/vhffs-backend/src/pgsql/initdb.sql.in
trunk/vhffs-compat/from-4.2-to-4.3.sql
trunk/vhffs-panel/Makefile.am
trunk/vhffs-panel/templates/Makefile.am
trunk/vhffs-robots/Makefile.am
Added Paths:
-----------
trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm
trunk/vhffs-panel/admin/bazaar/
trunk/vhffs-panel/admin/bazaar/index.pl
trunk/vhffs-panel/admin/bazaar/list.pl
trunk/vhffs-panel/admin/bazaar/search.pl
trunk/vhffs-panel/bazaar/
trunk/vhffs-panel/bazaar/create.pl
trunk/vhffs-panel/bazaar/delete.pl
trunk/vhffs-panel/bazaar/index.pl
trunk/vhffs-panel/bazaar/prefs.pl
trunk/vhffs-panel/templates/admin/bazaar/
trunk/vhffs-panel/templates/admin/bazaar/part.tmpl
trunk/vhffs-panel/templates/admin/bazaar/search.tmpl
trunk/vhffs-panel/templates/bazaar/
trunk/vhffs-panel/templates/bazaar/create.tmpl
trunk/vhffs-panel/templates/bazaar/prefs.tmpl
trunk/vhffs-panel/templates/bazaar/user_part.tmpl
trunk/vhffs-robots/src/bazaar_create.pl
trunk/vhffs-robots/src/bazaar_delete.pl
trunk/vhffs-robots/src/bazaar_public.pl
Modified: trunk/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Constants.pm 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-api/src/Vhffs/Constants.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -73,6 +73,7 @@
TYPE_SVN => 41,
TYPE_GIT => 42,
TYPE_MERCURIAL => 43,
+ TYPE_BAZAAR => 44,
TYPE_DNS => 50,
TYPE_MAIL => 60,
TYPE_ML => 61,
Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -82,6 +82,7 @@
$TYPES_STRINGS[Vhffs::Constants::TYPE_SVN] = 'SVN Repository';
$TYPES_STRINGS[Vhffs::Constants::TYPE_GIT] = 'GIT Repository';
$TYPES_STRINGS[Vhffs::Constants::TYPE_MERCURIAL] = 'Mercurial Repository';
+$TYPES_STRINGS[Vhffs::Constants::TYPE_BAZAAR] = 'Bazaar Repository';
$TYPES_STRINGS[Vhffs::Constants::TYPE_DNS] = 'Domain Name';
$TYPES_STRINGS[Vhffs::Constants::TYPE_MAIL] = 'Mail Domain';
$TYPES_STRINGS[Vhffs::Constants::TYPE_ML] = 'Mailing List';
Modified: trunk/vhffs-api/src/Vhffs/Makefile.am
===================================================================
--- trunk/vhffs-api/src/Vhffs/Makefile.am 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-api/src/Vhffs/Makefile.am 2010-06-06 21:10:08 UTC (rev 1610)
@@ -22,6 +22,7 @@
User.pm \
Panel/Admin.pm \
Panel/Avatar.pm \
+ Panel/Bazaar.pm \
Panel/Commons.pm \
Panel/Cvs.pm \
Panel/DNS.pm \
@@ -43,6 +44,7 @@
Panel/Web.pm \
Panel/Template.pm \
Panel/Cron.pm \
+ Robots/Bazaar.pm \
Robots/Cvs.pm \
Robots/Group.pm \
Robots/Mail.pm \
@@ -56,6 +58,7 @@
Robots/User.pm \
Robots/Web.pm \
Robots/Cron.pm \
+ Services/Bazaar.pm \
Services/Cvs.pm \
Services/DNS.pm \
Services/Web.pm \
Modified: trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/ObjectFactory.pm 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-api/src/Vhffs/ObjectFactory.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -64,6 +64,7 @@
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_SVN] = 'Vhffs::Services::Svn';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_GIT] = 'Vhffs::Services::Git';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_MERCURIAL] = 'Vhffs::Services::Mercurial';
+$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_BAZAAR] = 'Vhffs::Services::Bazaar';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_DNS] = 'Vhffs::Services::DNS';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_MAIL] = 'Vhffs::Services::Mail';
$OBJECTS_BY_TYPE[Vhffs::Constants::TYPE_ML] = 'Vhffs::Services::MailingList';
Modified: trunk/vhffs-api/src/Vhffs/Panel/Admin.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Admin.pm 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-api/src/Vhffs/Panel/Admin.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -101,6 +101,24 @@
return { CATNAME => gettext( 'General' ), ITEMS => $items, CATTYPE => 'general' };
}
+
+=head2 get_bazaar_category
+
+ Vhffs::Panel::Admin::get_bazaar_category;
+
+Returns a hashref (CATNAME, ITEM) containing bazaar's administration
+items.
+
+=cut
+
+sub get_bazaar_category {
+ my $items = [
+ { LINK => '/admin/bazaar/list.pl', LABEL => gettext( 'List all Bazaar repos' ) },
+ { LINK => '/admin/bazaar/search.pl', LABEL => gettext( 'Search for a Bazaar repository' ) }
+ ];
+ return { CATNAME => gettext( 'Bazaar Admin' ), ITEMS => $items, CATTYPE => 'bazaar' };
+}
+
=head2 get_user_category
Vhffs::Panel::Admin::get_user_category;
@@ -391,6 +409,7 @@
push @$categories, get_dns_category if($config->get_service_availability('dns'));
push @$categories, get_git_category if($config->get_service_availability('git'));
push @$categories, get_mercurial_category if($config->get_service_availability('mercurial'));
+ push @$categories, get_bazaar_category if($config->get_service_availability('bazaar'));
push @$categories, get_mail_category if($config->get_service_availability('mail'));
push @$categories, get_mailing_category if($config->get_service_availability('mailinglist'));
push @$categories, get_repo_category if($config->get_service_availability('repository'));
@@ -425,6 +444,7 @@
push @$categories, get_svn_category if($config->get_service_availability('svn'));
push @$categories, get_git_category if($config->get_service_availability('git'));
push @$categories, get_mercurial_category if($config->get_service_availability('mercurial'));
+ push @$categories, get_bazaar_category if($config->get_service_availability('bazaar'));
push @$categories, get_dns_category if($config->get_service_availability('dns'));
push @$categories, get_mail_category if($config->get_service_availability('mail'));
push @$categories, get_mailing_category if($config->get_service_availability('mailinglist'));
Added: trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Panel/Bazaar.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,140 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+use utf8;
+
+package Vhffs::Panel::Bazaar;
+
+use DBI;
+use POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+use Vhffs::User;
+use Vhffs::Main;
+use Vhffs::Acl;
+use Vhffs::Services::Bazaar;
+use Vhffs::Panel::Main;
+use Vhffs::Constants;
+use Vhffs::Functions;
+
+
+=pod
+
+=head2 getall_per_group
+
+ $bazaar = Vhffs::Panel::Bazaar::getall_per_group($vhffs, $gid);
+
+Returns an array of hashrefs (oid, displayname, active, state (localized string)) of all bazaar repos owned by
+a given group.
+
+=cut
+
+
+sub getall_per_group
+{
+ my ( $main, $gid ) = @_;
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT s.object_id AS oid, s.reponame AS displayname, o.state FROM vhffs_bazaar s INNER JOIN vhffs_object o ON s.object_id = o.object_id WHERE o.owner_gid = ? ORDER BY s.reponame';
+ my $sth = $dbh->prepare($sql) or return -1;
+ $sth->execute($gid) or return -2;
+ my $bazaar = [];
+ while(my $s = $sth->fetchrow_hashref) {
+ $s->{active} = ($s->{state} == Vhffs::Constants::ACTIVATED);
+ $s->{refused} = ($s->{state} == Vhffs::Constants::VALIDATION_REFUSED);
+ $s->{state} = Vhffs::Functions::status_string_from_status_id($s->{state});
+ push @$bazaar, $s;
+ }
+ return $bazaar;
+}
+
+sub get_repos_per_group {
+ my ($main, $gid, $public_only) = @_;
+ $public_only = 1 unless(defined $public_only);
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT g.reponame, o.description FROM vhffs_bazaar g INNER JOIN vhffs_object o ON o.object_id = g.object_id '.
+ 'WHERE '.($public_only ? 'public = 1 AND ' : '').'o.owner_gid = ? AND o.state = ?';
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, $gid, Vhffs::Constants::ACTIVATED);
+}
+
+
+sub search {
+ my ($main, $name) = @_;
+
+ my $sql;
+ my @params;
+ my $bazaars = [];
+
+ if( defined $name ) {
+ $sql = 'SELECT s.reponame AS bazaarroot, g.groupname, o.state FROM vhffs_bazaar s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid WHERE s.reponame LIKE ?';
+ push(@params, '%'.lc($name).'%');
+ } else {
+ $sql = 'SELECT s.reponame AS bazaarroot, g.groupname, o.state FROM vhffs_bazaar s INNER JOIN vhffs_object o ON o.object_id=s.object_id INNER JOIN vhffs_groups g ON g.gid = o.owner_gid';
+ }
+
+ my $dbh = $main->get_db_object();
+ my $sth = $dbh->prepare($sql) or return undef;
+
+ return undef unless($sth->execute(@params));
+
+ while(my $s = $sth->fetchrow_hashref('NAME_lc')) {
+ $s->{state} = Vhffs::Functions::status_string_from_status_id($s->{state});
+ push(@$bazaars, $s);
+ }
+
+ return $bazaars;
+}
+
+
+
+sub create_bazaar
+{
+ my ($main, $repo, $description, $user, $group) = @_;
+
+ return -1 unless( defined $user );
+ return -2 unless( defined $group );
+
+ my $bazaar = Vhffs::Services::Bazaar::create( $main, $repo, $description, $user, $group );
+
+ return -1 unless( defined $bazaar );
+
+ return ( -3 ) if ( Vhffs::Acl::add_acl( $user , $bazaar , Vhffs::Constants::ACL_DELETE , $main ) < 0 );
+ return ( -3 ) if( Vhffs::Acl::add_acl( $group , $bazaar , Vhffs::Constants::ACL_VIEW , $main ) < 0 );
+
+ return $bazaar;
+}
+
+1;
Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -34,6 +34,7 @@
use Vhffs::Panel::Svn;
use Vhffs::Panel::Git;
use Vhffs::Panel::Mercurial;
+use Vhffs::Panel::Bazaar;
use Vhffs::Panel::Web;
use Vhffs::Panel::Cron;
@@ -591,6 +592,11 @@
$services_list .= $panel->create_service_index('mercurial', $mercurial)->output;
}
+ if($config->get_service_availability('bazaar')) {
+ my $bazaar = Vhffs::Panel::Bazaar::getall_per_group( $vhffs, $gid );
+ $services_list .= $panel->create_service_index('bazaar', $bazaar)->output;
+ }
+
if($config->get_service_availability('mailinglist')) {
my $ml = Vhffs::Panel::MailingList::getall_per_group( $vhffs, $gid );
$services_list .= $panel->create_service_index('mailinglist', $ml)->output;
@@ -792,6 +798,7 @@
svn => 'SVN repositories',
git => 'Git repositories',
mercurial => 'Mercurial repositories',
+ bazaar => 'Bazaar repositories',
web => 'Webareas',
cron => 'Cron jobs',
);
Modified: trunk/vhffs-api/src/Vhffs/Panel/Menu.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Menu.pm 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-api/src/Vhffs/Panel/Menu.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -71,6 +71,7 @@
push @$items, {path => 'svn', label => gettext('SVN') } if( $config->get_service_availability('svn') );
push @$items, {path => 'git', label => gettext('GIT') } if( $config->get_service_availability('git') );
push @$items, {path => 'mercurial', label => gettext('Mercurial') } if( $config->get_service_availability('mercurial') );
+ push @$items, {path => 'bazaar', label => gettext('Bazaar') } if( $config->get_service_availability('bazaar') );
push @$items, {path => 'dns', label => gettext('Domain names') } if( $config->get_service_availability('dns') );
push @$items, {path => 'repository', label => gettext('Dl repos') } if( $config->get_service_availability('repository') );
push @$items, {path => 'mail', label => gettext('Mail') } if( $config->get_service_availability('mail') );
@@ -122,6 +123,7 @@
push @$items, {path => 'admin/svn', label => gettext('SVN') } if( $config->get_service_availability('svn') );
push @$items, {path => 'admin/git', label => gettext('GIT') } if( $config->get_service_availability('git') );
push @$items, {path => 'admin/mercurial', label => gettext('Mercurial') } if( $config->get_service_availability('mercurial') );
+ push @$items, {path => 'admin/bazaar', label => gettext('Bazaar') } if( $config->get_service_availability('bazaar') );
push @$items, {path => 'admin/dns', label => gettext('Domain names') } if( $config->get_service_availability('dns') );
push @$items, {path => 'admin/repository', label => gettext('Dl repos') } if( $config->get_service_availability('repository') );
push @$items, {path => 'admin/mail', label => gettext('Mail') } if( $config->get_service_availability('mail') );
Added: trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Robots/Bazaar.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,110 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+use utf8;
+
+package Vhffs::Robots::Bazaar;
+
+use Vhffs::Services::Bazaar;
+use Vhffs::Constants;
+use Vhffs::Functions;
+
+sub create_repo
+{
+ my $bazaar = shift;
+ return -1 unless defined $bazaar;
+ return -1 if $bazaar->get_status != Vhffs::Constants::WAITING_FOR_CREATION;
+
+ my $dir = $bazaar->get_dir;
+
+ if( -e $dir ) {
+ $bazaar->set_status( Vhffs::Constants::CREATING_ERROR );
+ $bazaar->commit();
+ $bazaar->add_history('Error, directory of this bazaar repository already exists! Administrators must fix the problem.');
+ return -1;
+ }
+
+ Vhffs::Functions::create_dir( $dir );
+ Vhffs::Functions::chmod_recur( $dir , 0664 , 02775 );
+ Vhffs::Functions::change_owner_recur( $dir , $bazaar->get_owner_uid , $bazaar->get_owner_gid );
+ $bazaar->add_history('Ok, robots find the empty directory and will create bazaar repository');
+
+ system('cd '.$dir.' && bzr init > /dev/null');
+
+ unless( -d $dir.'/.bzr' ) {
+ $bazaar->set_status( Vhffs::Constants::CREATING_ERROR );
+ $bazaar->commit();
+ $bazaar->add_history('Error, nothing was created after calling the bazaar binary, something is wrong.');
+ return -1;
+ }
+
+ Vhffs::Functions::chmod_recur( $dir , 0664 , 02775 );
+ Vhffs::Functions::change_owner_recur( $dir , $bazaar->get_owner_uid , $bazaar->get_owner_gid );
+
+ $bazaar->add_history('The Robots created the bazaar repository');
+ $bazaar->set_status( Vhffs::Constants::ACTIVATED );
+ $bazaar->commit;
+
+ return 0;
+}
+
+sub change_conf {
+ my $bazaar = shift;
+ return -1 unless defined $bazaar;
+
+ my $dir = $bazaar->get_dir;
+ my $mail_from = $bazaar->get_main->get_config->get_service('bazaar')->{notify_from};
+
+ if( $bazaar->get_ml_name !~ /^\s*$/ ) {
+ }
+
+ return 0;
+}
+
+sub delete_repo
+{
+ use File::Path;
+ use File::Basename;
+ my $bazaar = shift;
+ return -1 unless defined $bazaar;
+
+ # Remove Bazaar dir and group dir if empty
+ my $dir = $bazaar->get_dir;
+ File::Path::rmtree($dir) if(-d $dir);
+ my $groupdir = dirname($dir);
+ rmdir($groupdir);
+
+ return 0;
+}
+
+
+1;
Added: trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm (rev 0)
+++ trunk/vhffs-api/src/Vhffs/Services/Bazaar.pm 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,264 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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.
+
+# This file is a part of VHFFS4 Hosting Platform
+# Please respect the licence of this file and the whole software
+
+use strict;
+use utf8;
+
+package Vhffs::Services::Bazaar;
+
+use base qw(Vhffs::Object);
+use Vhffs::Group;
+use DBI;
+
+sub check_name($) {
+ my $name = shift;
+ return ($name =~ /^[a-z0-9]+\/[a-z0-9]{3,64}$/);
+}
+
+sub delete
+{
+ my $self = shift;
+ my $query;
+ my $request;
+
+ $query = "DELETE FROM vhffs_bazaar WHERE object_id='".$self->{'object_id'}."'";
+ $request = $self->{'db'}->prepare($query);
+ $request->execute or return -1;
+
+ return -1 if( $self->SUPER::delete < 0 );
+}
+
+sub create
+{
+ my ($main, $rname, $description, $user, $group) = @_;
+
+ return undef unless(defined($user) && defined($group));
+ return undef unless(check_name($rname));
+
+ my $bazaar;
+
+ my $dbh = $main->get_db_object();
+ local $dbh->{RaiseError} = 1;
+ local $dbh->{PrintError} = 0;
+ $dbh->begin_work;
+
+ eval {
+ my $parent = Vhffs::Object::create($main, $user->get_uid, $group->get_gid, $description, undef, Vhffs::Constants::TYPE_BAZAAR);
+
+ die('Unable to create parent object') unless(defined $parent);
+
+ my $sql = 'INSERT INTO vhffs_bazaar(reponame, public, ml_name, object_id) VALUES(?, 1, \'\', ?)';
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($rname, $parent->get_oid) or return undef;
+
+ $dbh->commit;
+ $bazaar = get_by_reponame($main, $rname);
+ };
+
+ if($@) {
+ warn "Unable to create bazaar repository $rname: $@\n";
+ $dbh->rollback;
+ }
+
+ return $bazaar;
+}
+
+sub get_by_reponame($$) {
+ my ($main, $reponame) = @_;
+ my @params;
+
+ my $sql = 'SELECT s.bazaar_id, s.reponame, o.owner_uid, o.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_bazaar s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE s.reponame = ?';
+
+ my $dbh = $main->get_db_object();
+
+ return undef unless(@params = $dbh->selectrow_array($sql, undef, $reponame));
+
+ return _new Vhffs::Services::Bazaar($main, @params);
+
+}
+
+=head2 fill_object
+
+See C<Vhffs::Object::fill_object>.
+
+=cut
+
+sub fill_object {
+ my ($class, $obj) = @_;
+ my $sql = q{SELECT bazaar_id, reponame, public, ml_name FROM vhffs_bazaar
+ WHERE object_id = ?};
+ return $class->SUPER::_fill_object($obj, $sql);
+}
+
+sub _new
+{
+ my ($class, $main, $bazaar_id, $reponame, $owner_uid, $owner_gid, $public, $ml_name, $oid, $date_creation, $description, $state) = @_;
+
+ my $self = $class->SUPER::_new($main, $oid, $owner_uid, $owner_gid, $date_creation, $description, '', $state, Vhffs::Constants::TYPE_BAZAAR);
+ return undef unless(defined $self);
+
+ $self->{bazaar_id} = $bazaar_id;
+ $self->{reponame} = $reponame;
+ $self->{public} = $public;
+ $self->{ml_name} = $ml_name;
+
+ return $self;
+}
+
+sub commit
+{
+ my $self = shift;
+
+ my $dbh = $self->get_db_object;
+ my $sql = 'UPDATE vhffs_bazaar SET public = ?, ml_name = ? WHERE bazaar_id = ?';
+ $dbh->do($sql, undef, $self->{public}, $self->{ml_name}, $self->{bazaar_id});
+
+ $self->SUPER::commit;
+}
+
+sub set_public
+{
+ my $self = shift;
+ $self->{'public'} = 1;
+}
+
+sub set_private
+{
+ my $self = shift;
+ $self->{'public'} = 0;
+}
+
+sub set_ml_name {
+ my ($self, $ml_name) = @_;
+ return -1 unless(Vhffs::Functions::valid_mail($ml_name) || $ml_name =~ /^\s*$/);
+ $self->{ml_name} = $ml_name;
+}
+
+sub is_public
+{
+ my $self = shift;
+
+ return -1 if( ! defined $self->{'public'} );
+
+ if( $self->{'public'} == 1 ) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub get_ml_name {
+ my $self = shift;
+ return $self->{ml_name};
+}
+
+sub get_reponame
+{
+ my $self = shift;
+ return $self->{'reponame'};
+}
+
+sub get_label
+{
+ my $self = shift;
+ return $self->{reponame};
+}
+
+sub getall
+{
+ my ($vhffs, $state, $name, $group) = @_;
+
+ my $bazaar = [];
+ my @params;
+
+ my $sql = 'SELECT s.bazaar_id, s.reponame, o.owner_uid, o.owner_gid, s.public, s.ml_name, o.object_id, o.date_creation, o.description, o.state FROM vhffs_bazaar s, vhffs_object o WHERE o.object_id = s.object_id';
+
+
+ if(defined $state) {
+ $sql .= ' AND o.state = ?';
+ push(@params, $state);
+ }
+ if(defined $name) {
+ $sql .= ' AND s.name = ?';
+ push(@params, $name);
+ }
+ if(defined($group)) {
+ $sql .= ' AND o.owner_gid = ?';
+ push(@params, $group->get_gid);
+ }
+ $sql .= ' ORDER BY s.reponame';
+
+ my $dbh = $vhffs->get_db_object();
+
+ my $sth = $dbh->prepare($sql);
+ $sth->execute(@params) or die($sql) ; #return undef;
+
+ while(my $s = $sth->fetchrow_arrayref()) {
+ push(@$bazaar, _new Vhffs::Services::Bazaar($vhffs, @$s));
+ }
+ return $bazaar;
+}
+
+sub getall_by_group
+{
+ my ($vhffs, $group) = @_;
+
+ my $bazaar = [];
+ my @params;
+
+ return undef unless( defined $group );
+
+ my $sql = 'SELECT s.bazaar_id, s.reponame, o.owner_uid, o.owner_gid, s.public, o.object_id, o.date_creation, o.description, o.state FROM vhffs_bazaar s INNER
+ JOIN vhffs_object o ON o.object_id = s.object_id WHERE o.owner_gid = ? ORDER BY s.reponame';
+
+ my $dbh = $vhffs->get_db_object();
+
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($group->get_gid) or return undef;
+
+ while(my $s = $sth->fetchrow_arrayref()) {
+ push(@$bazaar, _new Vhffs::Services::Bazaar($vhffs, @$s));
+ }
+ return $bazaar;
+}
+
+sub get_dir
+{
+ my $self = shift;
+ return undef if( ! defined $self );
+
+ return( $self->{'main'}->get_config->get_datadir . "/bazaar/bazaarroot/" . $self->get_reponame );
+}
+
+1;
Modified: trunk/vhffs-backend/src/pgsql/initdb.sql.in
===================================================================
--- trunk/vhffs-backend/src/pgsql/initdb.sql.in 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-backend/src/pgsql/initdb.sql.in 2010-06-06 21:10:08 UTC (rev 1610)
@@ -426,6 +426,22 @@
CONSTRAINT vhffs_mercurial_pkey PRIMARY KEY( mercurial_id )
) WITH OIDS;
+-- Bazaar repositories
+
+CREATE TABLE vhffs_bazaar
+(
+ bazaar_id SERIAL,
+-- Name of the repo
+ reponame varchar NOT NULL,
+-- Is the repo public or not
+ public int4 NOT NULL,
+-- Mailing list to which send commit mails
+ ml_name varchar,
+-- Object representing this Git repository
+ object_id int4 NOT NULL,
+ CONSTRAINT vhffs_bazaar_pkey PRIMARY KEY( bazaar_id )
+) WITH OIDS;
+
-- Cron tasks
CREATE TABLE vhffs_cron
@@ -543,6 +559,7 @@
ALTER TABLE vhffs_svn ADD CONSTRAINT vhffs_svn_unique_reponame UNIQUE (reponame);
ALTER TABLE vhffs_git ADD CONSTRAINT vhffs_git_unique_reponame UNIQUE (reponame);
ALTER TABLE vhffs_mercurial ADD CONSTRAINT vhffs_mercurial_unique_reponame UNIQUE (reponame);
+ALTER TABLE vhffs_bazaar ADD CONSTRAINT vhffs_bazaar_unique_reponame UNIQUE (reponame);
ALTER TABLE vhffs_dns ADD CONSTRAINT vhffs_dns_unique_domain UNIQUE (domain);
ALTER TABLE vhffs_ml ADD CONSTRAINT vhffs_ml_unique_address UNIQUE (local_part, domain);
ALTER TABLE vhffs_ml_subscribers ADD CONSTRAINT vhffs_ml_subscribers_member_list UNIQUE (ml_id, member);
@@ -568,6 +585,8 @@
CREATE INDEX idx_vhffs_git_public ON vhffs_git(public);
-- vhffs_mercurial.public may be used in where clause to display public mercurial
CREATE INDEX idx_vhffs_mercurial_public ON vhffs_mercurial(public);
+-- vhffs_bazaar.public may be used in where clause to display public bazaar
+CREATE INDEX idx_vhffs_bazaar_public ON vhffs_bazaar(public);
-- vhffs_ml.open_archive may be used in where clause to select on public ml
CREATE INDEX idx_vhffs_ml_open_archive ON vhffs_ml(open_archive);
-- vhffs_object.owner_uid and owner_gid is used a lot in where clauses
@@ -598,6 +617,7 @@
CREATE INDEX idx_vhffs_svn_object_id ON vhffs_svn(object_id);
CREATE INDEX idx_vhffs_git_object_id ON vhffs_git(object_id);
CREATE INDEX idx_vhffs_mercurial_object_id ON vhffs_mercurial(object_id);
+CREATE INDEX idx_vhffs_bazaar_object_id ON vhffs_bazaar(object_id);
-- add index on dates, it is used to search old object, ...
CREATE INDEX idx_vhffs_object_date_creation ON vhffs_object(date_creation);
CREATE INDEX idx_vhffs_history_date ON vhffs_history(date);
@@ -658,6 +678,8 @@
ALTER TABLE vhffs_mercurial ADD CONSTRAINT fk_vhffs_mercurial_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+ALTER TABLE vhffs_bazaar ADD CONSTRAINT fk_vhffs_bazaar_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
+
ALTER TABLE vhffs_users ADD CONSTRAINT fk_vhffs_users_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object (object_id) ON DELETE CASCADE;
ALTER TABLE vhffs_user_group ADD CONSTRAINT fk_vhffs_user_group_vhffs_users FOREIGN KEY (uid) REFERENCES vhffs_users (uid) ON DELETE CASCADE;
Modified: trunk/vhffs-compat/from-4.2-to-4.3.sql
===================================================================
--- trunk/vhffs-compat/from-4.2-to-4.3.sql 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-compat/from-4.2-to-4.3.sql 2010-06-06 21:10:08 UTC (rev 1610)
@@ -24,3 +24,19 @@
-- add ircnick in vhffs_users
ALTER TABLE vhffs_users ADD COLUMN ircnick VARCHAR(16) DEFAULT NULL;
ALTER TABLE vhffs_users ADD CONSTRAINT vhffs_users_unique_ircnick UNIQUE (ircnick);
+
+-- add bazaar table
+CREATE TABLE vhffs_bazaar
+(
+ bazaar_id SERIAL,
+ reponame varchar NOT NULL,
+ public int4 NOT NULL,
+ ml_name varchar,
+ object_id int4 NOT NULL,
+ CONSTRAINT vhffs_bazaar_pkey PRIMARY KEY( bazaar_id )
+) WITH OIDS;
+
+ALTER TABLE vhffs_bazaar ADD CONSTRAINT vhffs_bazaar_unique_reponame UNIQUE (reponame);
+CREATE INDEX idx_vhffs_bazaar_public ON vhffs_bazaar(public);
+CREATE INDEX idx_vhffs_bazaar_object_id ON vhffs_bazaar(object_id);
+ALTER TABLE vhffs_bazaar ADD CONSTRAINT fk_vhffs_bazaar_vhffs_object FOREIGN KEY (object_id) REFERENCES vhffs_object(object_id) ON DELETE CASCADE;
Modified: trunk/vhffs-panel/Makefile.am
===================================================================
--- trunk/vhffs-panel/Makefile.am 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-panel/Makefile.am 2010-06-06 21:10:08 UTC (rev 1610)
@@ -31,6 +31,9 @@
subscribe.pl \
acl/view.pl \
admin/index.pl \
+ admin/bazaar/index.pl \
+ admin/bazaar/list.pl \
+ admin/bazaar/search.pl \
admin/cvs/index.pl \
admin/cvs/list.pl \
admin/cvs/search.pl \
@@ -145,6 +148,10 @@
mercurial/delete.pl \
mercurial/index.pl \
mercurial/prefs.pl \
+ bazaar/create.pl \
+ bazaar/delete.pl \
+ bazaar/index.pl \
+ bazaar/prefs.pl \
user/delete.pl \
user/prefs.pl \
web/create.pl \
Added: trunk/vhffs-panel/admin/bazaar/index.pl
===================================================================
--- trunk/vhffs-panel/admin/bazaar/index.pl (rev 0)
+++ trunk/vhffs-panel/admin/bazaar/index.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,61 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Admin;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+$panel->check_admin;
+
+my $templatedir = $panel->{templatedir};
+
+my $template = new HTML::Template(filename => $templatedir.'/panel/admin/index.tmpl');
+
+$panel->set_title( gettext('Bazaar repositories\' administration') );
+
+$template->param( CATEGORIES => [ Vhffs::Panel::Admin::get_bazaar_category ] );
+
+$panel->build( $template );
+$panel->display;
Property changes on: trunk/vhffs-panel/admin/bazaar/index.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-panel/admin/bazaar/list.pl
===================================================================
--- trunk/vhffs-panel/admin/bazaar/list.pl (rev 0)
+++ trunk/vhffs-panel/admin/bazaar/list.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,90 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+use utf8;
+use HTML::Template;
+use Locale::gettext;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Bazaar;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{'vhffs'};
+my $user = $panel->{'user'};
+my $cgi = $panel->{'cgi'};
+my $templatedir = $panel->{'templatedir'};
+my $template;
+
+if( ($user->is_moderator != 1 ) && ( $user->is_admin != 1 ) )
+{
+ $template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
+ $template->param( MESSAGE => gettext('You are not allowed to see it') );
+}
+else
+{
+ $template = new HTML::Template( filename => $templatedir.'/panel/admin/misc/list.tmpl' );
+ my $name = $cgi->param('NAME');
+
+ if( defined( $name ) )
+ {
+ $template->param( TITLE => gettext('Search result for bazaar repository').': '.$name );
+ }
+ else
+ {
+ $template->param( TITLE => gettext('All bazaar repositories lists') );
+ }
+
+ $template->param(TEXT_TITLE1 => gettext('Bazaar root'));
+ $template->param(TEXT_TITLE2 => gettext('Group'));
+ $template->param(TEXT_TITLE3 => gettext('State'));
+
+ my $repos = Vhffs::Panel::Bazaar::search( $vhffs, $name );
+ if( defined $repos )
+ {
+ my $subtemplate = new HTML::Template( filename => $templatedir.'/panel/admin/bazaar/part.tmpl', global_vars => 1 );
+ if( $user->is_admin == 1 ) {
+ $subtemplate->param( ACTION => gettext('Modify') );
+ } else {
+ $subtemplate->param( ACTION => gettext('Show') );
+ }
+ $subtemplate->param( BAZAARREPOS => $repos);
+ $template->param( LIST => $subtemplate->output );
+ }
+}
+
+$panel->build( $template );
+$panel->display;
Property changes on: trunk/vhffs-panel/admin/bazaar/list.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-panel/admin/bazaar/search.pl
===================================================================
--- trunk/vhffs-panel/admin/bazaar/search.pl (rev 0)
+++ trunk/vhffs-panel/admin/bazaar/search.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,84 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# 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::Group;
+use Vhffs::Main;
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Menu;
+use Vhffs::Stats;
+use Vhffs::Constants;
+
+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 $servername = $cgi->param("name");
+my $template;
+
+
+my $templatesdir = $vhffs->get_config->get_templatedir;
+
+if( ($user->is_moderator != 1 ) && ( $user->is_admin != 1 ) )
+{
+
+ $template = new HTML::Template( filename => $templatesdir."/panel/misc/simplemsg.tmpl" );
+ my $message = gettext( "You are not allowed to see it");
+ $template->param( MESSAGE => $message );
+}
+else
+{
+ $template = new HTML::Template( filename => $templatesdir."/panel/admin/bazaar/search.tmpl" );
+
+ $template->param( TITLE => gettext("Search for a Bazaar repository") );
+
+}
+
+$panel->build( $template );
+$panel->display;
+
Property changes on: trunk/vhffs-panel/admin/bazaar/search.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-panel/bazaar/create.pl
===================================================================
--- trunk/vhffs-panel/bazaar/create.pl (rev 0)
+++ trunk/vhffs-panel/bazaar/create.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,107 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+use utf8;
+use POSIX qw(locale_h);
+use HTML::Template;
+use locale;
+use Locale::gettext;
+use CGI;
+use CGI::Session;
+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;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{vhffs};
+my $templatedir = $panel->{templatedir};
+my $cgi = $panel->{cgi};
+my $user = $panel->{user};
+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 {
+ my $submitted = $cgi->param('bazaar_submit');
+ my $reponame = '';
+ my $description = '';
+
+ if( $submitted ) {
+ $reponame = $cgi->param('reponame');
+ my $fullreponame = $group->get_groupname.'/'.$reponame;
+ $description = Encode::decode_utf8( $cgi->param('description') );
+ unless( defined $reponame && defined $description ) {
+ $panel->add_error( gettext('CGI Error !') );
+ } elsif( !Vhffs::Services::Bazaar::check_name($fullreponame) ) {
+ $panel->add_error( gettext('Invalid reponame. It must contain between 3 and 64 characters, only lowercase letters and numbers') );
+ } elsif( $description =~ /^\s*$/) {
+ $panel->add_error( gettext('You must enter a description') );
+ } elsif( defined Vhffs::Panel::Bazaar::create_bazaar( $vhffs, $fullreponame, $description, $user, $group ) ) {
+ my $url = '/group/view.pl?group='.$group->get_groupname.'&msg='.gettext('The Bazaar object was successfully created !');
+ $panel->redirect($url);
+ } else {
+ $panel->add_error( gettext('An error occured while creating the bazaar repository') );
+ }
+ }
+
+ 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;
+ }
+}
Property changes on: trunk/vhffs-panel/bazaar/create.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-panel/bazaar/delete.pl
===================================================================
--- trunk/vhffs-panel/bazaar/delete.pl (rev 0)
+++ trunk/vhffs-panel/bazaar/delete.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,108 @@
+#!%PERL% -w
+# Copyright (c) vhffs project and its contributors
+# 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;
+
+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 $bazaar = Vhffs::Services::Bazaar::get_by_reponame( $vhffs , $repo );
+
+my $templatedir = $vhffs->get_config->get_templatedir;
+
+if( ( ! defined $repo ) || ( ! defined $sure ) )
+{
+ $message = gettext("CGI Error !");
+}
+elsif( ! defined $bazaar )
+{
+ $message = gettext( "Cannot retrieve informations about this repository" );
+}
+elsif( !$user->can_delete( $bazaar ) )
+{
+ $message = gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' );
+}
+elsif( $bazaar->get_status != Vhffs::Constants::ACTIVATED )
+{
+ $message = gettext( "This object is not functionnal yet. Please wait creation or moderation.");
+}
+elsif( $sure == 0 )
+{
+ $message = gettext( "This bazaar repository will NOT be deleted" );
+}
+else
+{
+ $bazaar->set_status( Vhffs::Constants::TO_DELETE );
+
+ # Commit all the changes for the current user
+ if( $bazaar->commit < 0 )
+ {
+ $message = gettext("An error occured while deleting the bazaar 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;
Property changes on: trunk/vhffs-panel/bazaar/delete.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-panel/bazaar/index.pl
===================================================================
--- trunk/vhffs-panel/bazaar/index.pl (rev 0)
+++ trunk/vhffs-panel/bazaar/index.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,72 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Panel::Main;
+use Vhffs::Panel::Bazaar;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+my $vhffs = $panel->{vhffs};
+my $cgi = $panel->{'cgi'};
+my $group = Vhffs::Group::get_by_groupname( $vhffs , $cgi->param('group') );
+
+if( ! defined($group) ) {
+ $panel->set_title( gettext('Error') );
+ $panel->add_error( gettext('You have to select a group first') );
+ $panel->build;
+ $panel->display;
+} else {
+ # Group is in session => access is granted for user and group is activated
+ # no need to check
+ $panel->set_title( sprintf(gettext('Bazaar repositories for %s'), $group->get_groupname) );
+ my $bazaar = Vhffs::Panel::Bazaar::getall_per_group( $vhffs, $group->get_gid );
+ if($bazaar < 0) {
+ $panel->add_error( gettext('Unable to get Bazaar repositories') );
+ $panel->build;
+ $panel->display;
+ } else {
+ $panel->build( $panel->create_service_index('bazaar', $bazaar) );
+ $panel->display;
+ }
+}
+
Property changes on: trunk/vhffs-panel/bazaar/index.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-panel/bazaar/prefs.pl
===================================================================
--- trunk/vhffs-panel/bazaar/prefs.pl (rev 0)
+++ trunk/vhffs-panel/bazaar/prefs.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,178 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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::Panel::Main;
+use Vhffs::Panel::Menu;
+use Vhffs::Panel::Object;
+use Vhffs::Panel::Template;
+
+my $panel = new Vhffs::Panel::Main();
+exit 0 unless $panel;
+my $session = $panel->get_session;
+exit 0 unless $session;
+
+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 $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
+{
+ if(defined $cgi->param('save_prefs_submit') ) {
+ if(save_prefs()) {
+ exit;
+ }
+ }
+
+ $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->build( $template );
+$panel->display;
+
+sub save_prefs {
+ my $public = $cgi->param('public');
+ my $ml_name = $cgi->param('ml_name');
+
+ if(!$user->can_modify($bazaar)) {
+ $panel->add_error( gettext('You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights') );
+ return 0;
+ }
+
+ if(!defined($public) || !defined($ml_name)) {
+ $panel->add_error( gettext('CGI error !') );
+ return 0;
+ }
+
+ if($public != $bazaar->is_public) {
+ if($public == 1) {
+ $bazaar->set_public();
+ } else {
+ $bazaar->set_private();
+ }
+ $bazaar->set_status(Vhffs::Constants::WAITING_FOR_MODIFICATION);
+ }
+
+ if(($ml_name =~ /^\s*$/ || Vhffs::Functions::valid_mail($ml_name))) {
+ if($ml_name ne $bazaar->get_ml_name) {
+ $bazaar->set_ml_name($ml_name);
+ $bazaar->set_status( Vhffs::Constants::WAITING_FOR_MODIFICATION );
+ }
+ } else {
+ $panel->add_error( gettext('Invalid mailing list address') );
+ return 0;
+ }
+
+ if($bazaar->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION) {
+ if($bazaar->commit < 0) {
+ $panel->add_error( gettext('Unable to apply modifications') );
+ return 0;
+ } else {
+ my $url = '/group/view.pl?group='.$group->get_groupname.'&msg='.gettext('Modifications applied. Please wait while your repository is being updated');
+ $panel->redirect($url);
+ return 1;
+ }
+ }
+
+ return 0;
+}
Property changes on: trunk/vhffs-panel/bazaar/prefs.pl
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-panel/templates/Makefile.am 2010-06-06 21:10:08 UTC (rev 1610)
@@ -2,6 +2,8 @@
nobase_dist_paneltemplates_DATA = \
acl/view.tmpl \
admin/index.tmpl \
+ admin/bazaar/part.tmpl \
+ admin/bazaar/search.tmpl \
admin/cvs/part.tmpl \
admin/cvs/search.tmpl \
admin/dns/part.tmpl \
@@ -123,6 +125,9 @@
mercurial/create.tmpl \
mercurial/prefs.tmpl \
mercurial/user_part.tmpl \
+ bazaar/create.tmpl \
+ bazaar/prefs.tmpl \
+ bazaar/user_part.tmpl \
user/admin.tmpl \
user/create_complete.tmpl \
user/create.tmpl \
Added: trunk/vhffs-panel/templates/admin/bazaar/part.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/bazaar/part.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/admin/bazaar/part.tmpl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,16 @@
+<TMPL_LOOP NAME="BAZAARREPOS">
+<tr>
+ <td>
+ <TMPL_VAR ESCAPE=1 NAME="BAZAARROOT">
+ </td>
+ <td>
+ <TMPL_VAR ESCAPE=1 NAME="GROUPNAME">
+ </td>
+ <td>
+ <TMPL_VAR ESCAPE=1 NAME="STATE">
+ </td>
+ <td>
+ <a href="/bazaar/prefs.pl?admin_menu=1&name=<TMPL_VAR ESCAPE=1 NAME="BAZAARROOT">"><TMPL_VAR ESCAPE=1 NAME="ACTION"></a>
+ </td>
+</tr>
+</TMPL_LOOP>
Added: trunk/vhffs-panel/templates/admin/bazaar/search.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/bazaar/search.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/admin/bazaar/search.tmpl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,4 @@
+ <h1><TMPL_VAR ESCAPE=1 NAME="TITLE"></h1>
+ <form method="post" action="list.pl" accept-charset="utf-8">
+ <input type="text" name="NAME" value=""/>
+ </form>
Added: trunk/vhffs-panel/templates/bazaar/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/bazaar/create.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/bazaar/create.tmpl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,24 @@
+<form method="post" action="#" accept-charset="utf-8">
+ <p>
+ <label>
+ <TMPL_VAR ESCAPE=1 NAME="GROUP_NAME">:
+ </label>
+ <TMPL_VAR ESCAPE=1 NAME="GROUP">
+ </p>
+ <p>
+ <label for="reponame">
+ <TMPL_VAR ESCAPE=1 NAME="REPOSITORY_NAME">:
+ </label>
+ <TMPL_VAR ESCAPE=1 NAME="GROUP">/<input type="text" name="reponame" id="reponame" value="<TMPL_VAR ESCAPE=1 NAME="REPOSITORY_VALUE">"/>
+ </p>
+ <p>
+ <label for="PROJECT_USAGE">
+ <TMPL_VAR ESCAPE=1 NAME="description">:
+ </label>
+ <textarea name="description" id="description" cols="45" rows="7"><TMPL_VAR ESCAPE=1 NAME="DESCRIPTION_VALUE"></textarea>
+ </p>
+ <p class="button" id="buttonSend">
+ <input type="hidden" name="group" value="<TMPL_VAR ESCAPE=1 NAME="GROUP">" />
+ <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="SEND">" name="bazaar_submit"/>
+ </p>
+</form>
Added: trunk/vhffs-panel/templates/bazaar/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/bazaar/prefs.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/bazaar/prefs.tmpl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,70 @@
+<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">
Added: trunk/vhffs-panel/templates/bazaar/user_part.tmpl
===================================================================
--- trunk/vhffs-panel/templates/bazaar/user_part.tmpl (rev 0)
+++ trunk/vhffs-panel/templates/bazaar/user_part.tmpl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,21 @@
+
+<tr>
+ <td><TMPL_VAR ESCAPE=1 NAME="VALUE_USERNAME"></td>
+ <td>
+ <form method="post" action="bazaar_chpwd.pl" accept-charset="utf-8">
+ <input type="text" name="PASSWORD" value="" />
+ <input type="hidden" name="REPO" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_REPONAME">" />
+ <input type="hidden" name="USERNAME" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_USERNAME">" />
+ <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_BUTTON_CHANGEPWD">" />
+ </form>
+ </td>
+ <td>
+ <form method="post" action="bazaar_deleteuser.pl" accept-charset="utf-8">
+ <input type="hidden" name="REPO" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_REPONAME">" />
+ <input type="hidden" name="USERNAME" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_USERNAME">" />
+ <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_BUTTON_DELETE">" />
+ </form>
+ </td>
+</tr>
+
+
Modified: trunk/vhffs-robots/Makefile.am
===================================================================
--- trunk/vhffs-robots/Makefile.am 2010-06-01 22:32:02 UTC (rev 1609)
+++ trunk/vhffs-robots/Makefile.am 2010-06-06 21:10:08 UTC (rev 1610)
@@ -65,6 +65,9 @@
src/mercurial_create.pl \
src/mercurial_delete.pl \
src/mercurial_public.pl \
+ src/bazaar_create.pl \
+ src/bazaar_delete.pl \
+ src/bazaar_public.pl \
src/user_create.pl \
src/user_delete.pl \
src/user_group.pl \
Added: trunk/vhffs-robots/src/bazaar_create.pl
===================================================================
--- trunk/vhffs-robots/src/bazaar_create.pl (rev 0)
+++ trunk/vhffs-robots/src/bazaar_create.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,59 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+use utf8;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Robots::Bazaar;
+use Vhffs::Services::Bazaar;
+use Vhffs::Constants;
+
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , 'bazaar' );
+
+my $repos = Vhffs::Services::Bazaar::getall( $vhffs , Vhffs::Constants::WAITING_FOR_CREATION);
+foreach my $bazaar ( @{$repos} )
+{
+ if( Vhffs::Robots::Bazaar::create_repo( $bazaar ) != 0 ) {
+ Vhffs::Robots::vhffs_log( sprintf( 'Cannot create Bazaar %s' , $bazaar->get_reponame ), $vhffs);
+ } else {
+ Vhffs::Robots::vhffs_log( sprintf( 'Created Bazaar %s' , $bazaar->get_reponame ), $vhffs);
+ }
+}
+
+
+Vhffs::Robots::unlock( $vhffs , 'bazaar' );
+exit 0;
Property changes on: trunk/vhffs-robots/src/bazaar_create.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-robots/src/bazaar_delete.pl
===================================================================
--- trunk/vhffs-robots/src/bazaar_delete.pl (rev 0)
+++ trunk/vhffs-robots/src/bazaar_delete.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,64 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+use utf8;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Robots::Bazaar;
+use Vhffs::Services::Bazaar;
+use Vhffs::Constants;
+
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , 'bazaar' );
+
+my $repos = Vhffs::Services::Bazaar::getall( $vhffs , Vhffs::Constants::TO_DELETE );
+foreach my $bazaar ( @{$repos} )
+{
+ if( Vhffs::Robots::Bazaar::delete_repo( $bazaar ) != 0 ) {
+ Vhffs::Robots::vhffs_log( sprintf( 'Cannot delete files from Bazaar repository %s' , $bazaar->get_reponame ), $vhffs);
+ } else {
+ Vhffs::Robots::vhffs_log( sprintf( 'Delete files from Bazaar repository %s' , $bazaar->get_reponame ), $vhffs);
+ }
+
+ if( $bazaar->delete < 0 ) {
+ Vhffs::Robots::vhffs_log( sprintf( 'Cannot delete Bazaar repository object %s' , $bazaar->get_reponame ), $vhffs);
+ } else {
+ Vhffs::Robots::vhffs_log( sprintf( 'Delete Bazaar repository object %s' , $bazaar->get_reponame ), $vhffs);
+ }
+}
+
+Vhffs::Robots::unlock( $vhffs , 'bazaar' );
+exit 0;
Property changes on: trunk/vhffs-robots/src/bazaar_delete.pl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/vhffs-robots/src/bazaar_public.pl
===================================================================
--- trunk/vhffs-robots/src/bazaar_public.pl (rev 0)
+++ trunk/vhffs-robots/src/bazaar_public.pl 2010-06-06 21:10:08 UTC (rev 1610)
@@ -0,0 +1,71 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# 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 strict;
+use utf8;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Main;
+use Vhffs::Robots;
+use Vhffs::Robots::Bazaar;
+use Vhffs::Services::Bazaar;
+use Vhffs::Constants;
+
+
+my $vhffs = init Vhffs::Main;
+
+Vhffs::Robots::lock( $vhffs , 'bazaar' );
+
+my $repos = Vhffs::Services::Bazaar::getall( $vhffs , Vhffs::Constants::WAITING_FOR_MODIFICATION );
+foreach my $bazaar ( @{$repos} )
+{
+ if( $bazaar->is_public == 1 ) {
+ chmod 02775 , $bazaar->get_dir;
+ Vhffs::Robots::vhffs_log( sprintf( 'Bazaar status %s is now public' , $bazaar->get_dir ) , $vhffs);
+ } else {
+ chmod 02770 , $bazaar->get_dir;
+ Vhffs::Robots::vhffs_log( sprintf( 'Bazaar status %s is now private' , $bazaar->get_dir ) , $vhffs);
+ }
+
+ Vhffs::Robots::Bazaar::change_conf( $bazaar );
+ $bazaar->set_status( Vhffs::Constants::ACTIVATED );
+
+ if( $bazaar->commit < 0 ) {
+ $bazaar->add_history( 'Error while updating repository configuration' );
+ } else {
+ $bazaar->add_history( 'Successfully modify repository configuration' );
+ }
+}
+
+
+Vhffs::Robots::unlock( $vhffs , 'bazaar' );
+
+exit 0;
Property changes on: trunk/vhffs-robots/src/bazaar_public.pl
___________________________________________________________________
Added: svn:executable
+ *