Fix links to other CGIs
[girocco.git] / cgi / regproj.cgi
blobfbc38ed5a73964e5efd2ed0b4848297f7cf3b873
1 #!/usr/bin/perl
2 # (c) Petr Baudis <pasky@suse.cz>
3 # GPLv2
5 use strict;
6 use warnings;
8 use lib qw(/home/repo/repomgr/cgi);
9 use Git::RepoCGI;
11 my $repo = Git::RepoCGI->new('Project Registration');
12 my $cgi = $repo->cgi;
14 if ($cgi->param('name')) {
15 # submitted, let's see
16 # FIXME: racy, do a lock
17 my $name = $repo->wparam('name');
18 valid_name($name)
19 and Git::RepoCGI::Project::does_exist($name)
20 and $repo->err("Project with that name already exists.");
22 my $mirror = $cgi->param('mode') eq 'mirror';
23 my $proj = Git::RepoCGI::Project->ghost($name, $mirror);
24 if ($proj->cgi_fill($repo)) {
25 if ($mirror) {
26 $proj->premirror;
27 print "<p>Initiated mirroring. You will be notified by mail about results.</p>\n";
28 } else {
29 $proj->conjure;
30 print <<EOT;
31 <p>
32 Project successfuly set up.
33 You can <a href="p/editproj.cgi">assign users</a> now (use project name as username, admin password as password).
34 You need to <a href="reguser.cgi">register a user</a> first if you have not done so yet.
35 (One user can have push access to multiple projects and multiple users can have push access to one project.)
36 </p>
37 <p>You may experience permission problems if you try to push right now.
38 If so, that should get fixed automagically in few minutes.</p>
39 <p>Enjoy yourself!</p>
40 EOT
42 exit;
46 print <<EOT;
47 <p>Here you can register a project.
48 It can be hosted in two modes: mirror mode and push mode.
49 In the first mode, we will check another repository at a given URL each hour and mirror any new updates.
50 In the second mode, registered users with appropriate permissions will be able to push to the repository.
51 You currently cannot switch freely between those two modes;
52 if you want to switch an existing project, please contact the administrator.</p>
53 <p>You will need the admin password to adjust project settings later
54 (mirroring URL, list of users allowed to push, project description, ...).
55 Use the project name as the username when asked by the browser.</p>
56 <p>By submitting this form, you are confirming that the repository contains only free software
57 and redistributing it does not violate any law of Czech Republic. Have fun!</p>
58 <form method="post">
59 <p>Project name (w/o the .git suffix): <input type="text" name="name" /></p>
60 <p>Admin password: <input type="password" name="pwd" /></p>
61 <p>E-mail contact: <input type="text" name="email" /></p>
62 <p>Description: <input type="text" name="desc" /></p>
63 <p>Homepage URL: <input type="text" name="hp" /></p>
64 <p>README (lt 8kb): <textarea name="README" rows=20 cols=80></textarea></p>
65 <p>Hosting mode:</p><ul>
66 <li><input type="radio" name="mode" value="mirror" />Mirror mode. Repository URL: <input type="text" name="url" /></li>
67 <li><input type="radio" name="mode" value="push" />Push mode.</li></ul>
68 <p><input type="submit" name="y0" value="Register" /></p>
69 </form>
70 EOT