Link to about.html
[girocco/test-forks.git] / cgi / regproj.cgi
blob1258f1b035c22e85a82c82f403931cdb8c5ae8ad
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 every 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 from mirroring to push mode, delete and recreate
53 the project. If you want to switch the other way, please contact the administrator.</p>
54 <p>You will need the admin password to adjust project settings later
55 (mirroring URL, list of users allowed to push, project description, ...).
56 Use the project name as the username when asked by the browser.</p>
57 <p>By submitting this form, you are confirming that the repository contains only free software
58 and redistributing it does not violate any law of Czech Republic. Read <a href="/about.html">more details</a>
59 about the hosting and terms and conditions.</p>
60 <p>Have fun!</p>
61 <form method="post">
62 <p>Project name (w/o the .git suffix): <input type="text" name="name" /></p>
63 <p>Admin password: <input type="password" name="pwd" /></p>
64 <p>E-mail contact: <input type="text" name="email" /></p>
65 <p>Description: <input type="text" name="desc" /></p>
66 <p>Homepage URL: <input type="text" name="hp" /></p>
67 <p>README (HTML, lt 8kb): <textarea name="README" rows=20 cols=80></textarea></p>
68 <p>Hosting mode:</p><ul>
69 <li><input type="radio" name="mode" value="mirror" />Mirror mode. Repository URL: <input type="text" name="url" /></li>
70 <li><input type="radio" name="mode" value="push" />Push mode.</li></ul>
71 <p><input type="submit" name="y0" value="Register" /></p>
72 </form>
73 EOT