From 00009a41779d9327acd8afc9e40dc7c52fbbf3ab Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 12 Sep 2008 21:33:05 +0200 Subject: [PATCH] Girocco::Config::project_owners: Introduce configuration variable The current default is 'email', the new method 'source' will auto-determine the owner from the source URL given while mirroring. --- Girocco/Config.pm | 5 +++++ Girocco/Project.pm | 8 +++++--- cgi/editproj.cgi | 6 ++++-- cgi/regproj.cgi | 6 +++++- mirroring/clone.sh | 5 +++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Girocco/Config.pm b/Girocco/Config.pm index 3fa2fc6..549c4e0 100644 --- a/Girocco/Config.pm +++ b/Girocco/Config.pm @@ -39,6 +39,11 @@ our $mob = "mob"; # projects you have set a password on. our $project_passwords = 1; +# How to determine project owner; 'email' adds a form item asking for their +# email contact, 'source' takes realname of owner of source repository if it +# is a local path (and empty string otherwise). +our $project_owners = 'email'; + ## Paths diff --git a/Girocco/Project.pm b/Girocco/Project.pm index 194e667..b1f1e84 100644 --- a/Girocco/Project.pm +++ b/Girocco/Project.pm @@ -286,9 +286,11 @@ sub cgi_fill { $self->{cpwd} = $cgi->param('cpwd'); - $self->{email} = $gcgi->wparam('email'); - valid_email($self->{email}) - or $gcgi->err("Your email sure looks weird...?"); + if ($Girocco::Config::project_owners eq 'email') { + $self->{email} = $gcgi->wparam('email'); + valid_email($self->{email}) + or $gcgi->err("Your email sure looks weird...?"); + } $self->{url} = $gcgi->wparam('url'); if ($self->{url}) { diff --git a/cgi/editproj.cgi b/cgi/editproj.cgi index 42bad1d..f2a157a 100755 --- a/cgi/editproj.cgi +++ b/cgi/editproj.cgi @@ -35,7 +35,7 @@ if (!Girocco::Project::does_exist($name)) { my $proj = Girocco::Project->load($name); $proj or die "not found project $name, that's really weird!"; -if ($cgi->param('email')) { +if ($cgi->param('submit')) { # submitted, let's see if ($proj->cgi_fill($gcgi) and $proj->authenticate($gcgi) and $proj->update) { print "

Project successfuly updated.

\n"; @@ -84,9 +84,11 @@ if ($Girocco::Config::project_passwords) { EOT } -print <E-mail contact: EOT +} if ($proj->{mirror}) { print "Repository URL:\n"; diff --git a/cgi/regproj.cgi b/cgi/regproj.cgi index 16dfa75..667a4cb 100755 --- a/cgi/regproj.cgi +++ b/cgi/regproj.cgi @@ -242,8 +242,12 @@ if ($Girocco::Config::project_passwords) { Admin password (twice):
EOT } -print <E-mail contact: +EOT +} +print <Homepage URL: diff --git a/mirroring/clone.sh b/mirroring/clone.sh index fbc73d4..5c37926 100755 --- a/mirroring/clone.sh +++ b/mirroring/clone.sh @@ -12,6 +12,11 @@ proj="${projdir%.git}" cd "$cfg_reporoot/$projdir" trap "echo '@OVER@'; touch .clone_failed" EXIT url="$(cat base_url)" + +if [ "$cfg_project_owners" = "source" ]; then + echo "$(stat -c %U "$url" 2>/dev/null)" >owner +fi + mail="$(cat owner)" # Configure -- 2.11.4.GIT