2 # (c) Petr Baudis <pasky@suse.cz>
14 my $gcgi = Girocco
::CGI
->new('Project Removal');
17 my $name = $cgi->param('name');
19 unless (defined $name) {
20 print "<p>I need the project name as an argument now.</p>\n";
24 if (!Girocco
::Project
::valid_name
($name)) {
25 print "<p>Invalid project name. Go away, sorcerer.</p>\n";
29 if (!Girocco
::Project
::does_exist
($name)) {
30 print "<p>Sorry but this project does not exist. Now, how did you <em>get</em> here?!</p>\n";
34 my $proj = Girocco
::Project
->load($name);
35 $proj or die "not found project $name, that's really weird!";
36 $proj->{cpwd
} = $cgi->param('cpwd');
38 if (!$proj->{mirror
} && !$proj->is_empty) {
39 print "<p>Sorry but you can remove only mirrored or empty projects. Pushed projects cannot be removed. Please tell the administrator if you really want to.</p>\n";
43 if ($proj->has_forks()) {
44 print "<p>Sorry but this project has forks associated. Such projects cannot be removed. Please tell the administrator if you really want to.</p>\n";
48 if ($cgi->param('y0')) {
50 if (not $proj->authenticate($gcgi)) {
54 print "<p>Project successfully deleted. Have a nice day.</p>\n";
58 my $url = $proj->{url
};
59 my $type = $proj->{mirror
} ?
"mirrored" : "empty";
62 <p>Please confirm that you are going to remove $type project
63 $name ($url) from the site.</p>
65 <input type="hidden" name="name" value="$name" />
67 if ($Girocco::Config
::project_passwords
) {
69 <p>Admin password: <input type="password" name="cpwd" /> <sup><a href="pwproj.cgi?name=$name">(forgot password?)</a></sup></p>
73 <p><input type="submit" name="y0" value="Remove" /></p>