2 # (c) Petr Baudis <pasky@suse.cz>
14 my $gcgi = Girocco
::CGI
->new('Project Registration');
17 my $name = $cgi->param('name');
20 my $fork = $cgi->param('fork');
26 if ($cgi->param('mail')) {
27 print "<p>Go away, bot.</p>";
31 if ($cgi->param('mode')) {
32 # submitted, let's see
33 # FIXME: racy, do a lock
34 my $name = $gcgi->wparam('name');
35 Girocco
::Project
::valid_name
($name)
36 and Girocco
::Project
::does_exist
($name)
37 and $gcgi->err("Project with the name '$name' already exists.");
39 and $gcgi->err("Project name should not end with <tt>.git</tt> - I'll add that automagically.");
41 my $mirror = $cgi->param('mode') eq 'mirror';
42 my $proj = Girocco
::Project
->ghost($name, $mirror);
43 if ($proj->cgi_fill($gcgi)) {
45 unless ($Girocco::Config
::mirror
) {
46 $gcgi->err("Mirroring mode is not enabled at this site.");
50 print "<p>Initiated mirroring. You will be notified about the result by mail.</p>\n";
52 unless ($Girocco::Config
::push) {
53 $gcgi->err("Push mode is not enabled at this site.");
59 Project <a href="/w/$name.git">$name</a> successfuly set up.</p>
61 print "<p>The push URL for the project is <tt>$Girocco::Config::pushurl/$name.git</tt>.</p>";
62 print "<p>The read-only URL for the project is <tt>" .
63 join("/$name.git</tt>, <tt>", $Girocco::Config
::gitpullurl
, $Girocco::Config
::httppullurl
) .
64 "/$name.git</tt>.</p>" if $Girocco::Config
::gitpullurl
or $Girocco::Config
::httppullurl
;
66 if ($Girocco::Config
::manage_users
) {
68 Everyone who wants to push must <a href="reguser.cgi">register himself as a user</a> first.
69 (One user can have push access to multiple projects and multiple users can have push access to one project.)
73 <p>You can <a href="editproj.cgi?name=$name">assign users</a> now
74 - don't forget to assign yourself as a user as well if you want to push!
77 <p>Note that you cannot clone an empty repository since it contains no branches; you need to make the first push from an existing repository.</p>
78 <p>You may experience permission problems if you try to push right now.
79 If so, that should get fixed automagically in few minutes, please be patient.</p>
80 <p>Enjoy yourself, and have a lot of fun!</p>
89 desc
=> 'our dedicated git monkeys will check another repository at a given URL every hour and mirror any new updates',
90 pwpurp
=> 'mirroring URL'
94 desc
=> 'registered users with appropriate permissions will be able to push to the repository',
95 pwpurp
=> 'list of users allowed to push'
98 my $me = $Girocco::Config
::mirror ?
$mirror_mode : undef;
99 my $pe = $Girocco::Config
::push ?
$push_mode : undef;
102 <p>At this site, you can host a project in one of two modes: $me->{name} mode and $pe->{name} mode.
103 In the <b>$me->{name} mode</b>, $me->{desc}.
104 In the <b>$pe->{name} mode</b>, $pe->{desc}.
105 You currently cannot switch freely between those two modes;
106 if you want to switch from mirroring to push mode, just delete and recreate
107 the project. If you want to switch the other way, please contact the administrator.</p>
110 my $mode = $me ?
$me : $pe;
111 print "<p>This site will host your project in a <b>$mode->{name} mode</b>: $mode->{desc}.</p>\n";
115 push @pwpurp, $me->{pwpurp
} if $me;
116 push @pwpurp, $pe->{pwpurp
} if $pe;
117 my $pwpurp = join(', ', @pwpurp);
120 <p>You will need the admin password to adjust the project settings later
121 ($pwpurp, project description, ...).</p>
124 unless ($name =~ m
#/#) {
126 <p>Note that if your project is a <strong>fork of an existing project</strong>
127 (this does not mean anything socially bad), please instead go to the project's
128 gitweb page and click the 'fork' link in the top bar. This way, all of us
129 will save bandwidth and more importantly, your project will be properly categorized.
132 If your project is a fork but the existing project is not registered here yet, please
133 consider registering it first; you do not have to be involved in the project
134 in order to register it here as a mirror.</p>
137 my $xname = $name; $xname =~ s
#/$#.git#; #
138 my ($pushnote1, $pushnote2);
139 $pushnote1 = " and you will need to push only the data <em>you</em> created, not the whole project" if $pe;
140 $pushnote2 = "(That will be done automagically, you do not need to specify any extra arguments during the push.)" if $pe;
142 <p>Great, your project will be created as a subproject of the '$xname' project.
143 This means that it will be properly categorized$pushnote1. $pushnote2</p>
148 my $mirrorentry = 'Repository URL: <input type="text" name="url" />';
150 $modechooser = <<EOT;
151 <p>Hosting mode:</p><ul>
152 <li><input type="radio" name="mode" value="mirror" />Mirror mode. $mirrorentry</li>
153 <li><input type="radio" name="mode" value="push" />Push mode.</li></ul>
156 $modechooser = '<input type="hidden" name="mode" value="'.($me ?
$me->{name
} : $pe->{name
}).'">';
157 $me and $modechooser .= "<p>$mirrorentry</p>";
161 $Girocco::Config::legalese
163 <p>Project name (w/o the .git suffix): <input type="text" name="name" value="$name" /></p>
164 <p>Admin password (twice): <input type="password" name="pwd" /> <input type="password" name="pwd2" /></p>
165 <p>E-mail contact: <input type="text" name="email" /></p>
167 <p>Description: <input type="text" name="desc" /></p>
168 <p>Homepage URL: <input type="text" name="hp" /></p>
169 <p>README (HTML, lt 8kb): <textarea name="README" rows="5" cols="80"></textarea></p>
170 <p style="display:none">Anti-captcha (leave empty!): <input type="text" name="mail" /></p>
171 <p><input type="submit" name="y0" value="Register" /></p>