4 * Project Registration: Project Information.
6 * This page is used to request data required for project registration:
7 * o Project Public Name
8 * o Project Registartion Purpose
10 * o Project Public Description
12 * All these data are more or less strictly validated.
14 * This is last page in registartion sequence. Its successful subsmission
15 * leads to creation of new group with Pending status, suitable for approval.
17 * Portions Copyright 1999-2001 (c) VA Linux Systems
18 * Portions Copyright 2002-2004 (c) GForge Team
19 * Portions Copyright 2002-2009 (c) Roland Mas
20 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
21 * http://fusionforge.org/
23 * This file is part of FusionForge.
25 * FusionForge is free software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License as published by
27 * the Free Software Foundation; either version 2 of the License, or
28 * (at your option) any later version.
30 * FusionForge is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public License
36 * along with FusionForge; if not, write to the Free Software
37 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41 require_once('../env.inc.php');
42 require_once $gfcommon.'include/pre.php';
43 require_once $gfcommon.'scm/SCMFactory.class.php';
45 // Test if restricted project registration
47 if (forge_get_config('project_registration_restricted')) {
48 session_require_global_perm ('approve_projects', '',
49 sprintf (_('Project registration is restricted on %s, and only administrators can create new projects.'),
50 forge_get_config ('forge_name')));
51 } elseif (!session_loggedin()) {
55 $template_projects = group_get_template_projects() ;
56 sortProjectList ($template_projects) ;
57 $full_name = trim(getStringFromRequest('full_name'));
58 $purpose = trim(getStringFromRequest('purpose'));
59 $description = trim(getStringFromRequest('description'));
60 $unix_name = trim(strtolower(getStringFromRequest('unix_name')));
61 $scm = getStringFromRequest('scm');
62 $built_from_template = getIntFromRequest('built_from_template');
66 if (getStringFromRequest('submit')) {
67 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
68 exit_form_double_submit('my');
75 $template_project = group_get_object ($built_from_template) ;
77 && !$template_project->isError()
78 && $template_project->isTemplate()) {
79 // Valid template selected, nothing to do
80 } elseif (forge_get_config('allow_project_without_template')) {
81 // Empty projects allowed
82 $built_from_template = 0 ;
83 } elseif (count($template_projects) == 0) {
84 // No empty projects allowed, but no template available
85 $built_from_template = 0 ;
87 // No empty projects allowed, picking the first available template
88 $built_from_template = $template_projects[0]->getID() ;
91 if (forge_get_config('use_scm')) {
94 if (forge_get_config('use_scm') && $scm && $scm != 'noscm') {
95 $plugin = plugin_get_object($scm);
97 $scm_host = $plugin->getDefaultServer();
101 if ( !$purpose && forge_get_config ('project_auto_approval') ) {
102 $purpose = 'No purpose given, autoapprove was on';
105 $send_mail = ! forge_get_config ('project_auto_approval') ;
107 $group = new Group();
108 $u = session_get_user();
109 $res = $group->create(
121 if ($res && forge_get_config('use_scm') && $plugin) {
122 $group->setUseSCM (true) ;
123 $res = $group->setPluginUse ($scm, true);
125 $group->setUseSCM (false) ;
129 form_release_key(getStringFromRequest("form_key"));
130 $error_msg .= $group->getErrorMessage();
132 $HTML->header(array('title'=>_('Registration complete')));
134 if ( ! forge_get_config ('project_auto_approval') ) {
135 printf(_('<p>Your project has been submitted to the %1$s administrators. Within 72 hours, you will receive notification of their decision and further instructions.<p/>Thank you for choosing %1$s</p>'), forge_get_config ('forge_name'));
136 } else if ($group->isError()) {
137 printf(_('<div class="error">ERROR: %1$s</div>'), $group->getErrorMessage() );
139 printf(_('Approving Project: %1$s'), $group->getUnixName()).'<br />';
141 if (!$group->approve( user_get_object_by_name ( forge_get_config ('project_auto_approval_user') ) ) ) {
142 printf(_('<div class="error">Approval ERROR: %1$s</div>'), $group->getErrorMessage() );
144 printf(_('<p>Your project has been automatically approved. You should receive an email containing further information shortly.<p/>Thank you for choosing %1$s</p>'), forge_get_config ('forge_name'));
148 $HTML->footer(array());
152 } else if (getStringFromRequest('i_disagree')) {
153 session_redirect("/");
156 site_header(array('title'=>_('Register Project')));
160 <?php echo _('To apply for project registration, you should fill in basic information about it. Please read descriptions below carefully and provide complete and comprehensive data. All fields below are mandatory.') ?>
163 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
164 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
165 <h2><?php echo $index++.'. '._('Project full name') ?></h2>
167 <?php echo _('You should start with specifying the name of your project. The "Full Name" is descriptive, and has no arbitrary restrictions (except a 40 character limit).') ?>
170 <?php echo _('Full Name:') ?><br/>
171 <input size="40" maxlength="40" type="text" name="full_name" value="<?php echo htmlspecialchars($full_name); ?>"/>
175 // Don't display Project purpose if auto approval is on, because it won't be used.
176 if ( !forge_get_config ('project_auto_approval') ) {
177 echo '<h2>'.$index++.'. '._('Project Purpose And Summarization').'</h2>';
179 printf(_('Please provide detailed, accurate description of your project and what %1$s resources and in which way you plan to use. This description will be the basis for the approval or rejection of your project\'s hosting on %1$s, and later, to ensure that you are using the services in the intended way. This description will not be used as a public description of your project. It must be written in English.'), forge_get_config ('forge_name'));
181 echo '<textarea name="purpose" cols="70" rows="10">';
182 echo htmlspecialchars($purpose);
187 <h2><?php echo $index++.'. '. _('Project Public Description') ?></h2>
189 <?php echo _('This is the description of your project which will be shown on the Project Summary page, in search results, etc. Maximum length is 255 chars.') ?>
192 <textarea name="description" cols="70" rows="5">
193 <?php echo htmlspecialchars($description); ?>
196 <h2><?php echo $index++.'. '._('Project Unix Name') ?></h2>
197 <p><?php echo _('In addition to full project name, you will need to choose short, "Unix" name for your project.') ?></p>
198 <p><?php echo _('The "Unix Name" has several restrictions because it is used in so many places around the site. They are:') ?></p>
200 <li><?php echo _('cannot match the unix name of any other project;') ?></li>
201 <li><?php echo _('must be between 3 and 15 characters in length;') ?></li>
202 <li><?php echo _('must be in lower case (upper case letters will be converted to lower case);') ?></li>
203 <li><?php echo _('can only contain characters, numbers, and dashes;') ?></li>
204 <li><?php echo _('must be a valid Unix username;') ?></li>
205 <li><?php echo _('cannot match one of our reserved domains;') ?></li>
206 <li><?php echo _('Unix name will never change for this project;') ?></li>
208 <p><?php echo _('Your unix name is important, however, because it will be used for many things, including:') ?></p>
210 <li><?php printf(_('a web site at <tt>unixname.%1$s</tt>,'), forge_get_config('web_host')) ?></li>
211 <li><?php echo _('the URL of your source code repository,') ?></li>
212 <?php if (forge_get_config('use_shell')) { ?>
213 <li><?php printf(_('shell access to <tt>unixname.%1$s</tt>,'), forge_get_config('web_host')) ?></li>
215 <li><?php echo _('search engines throughout the site.') ?></li>
218 <?php echo _('Unix Name:') ?>
220 <input type="text" maxlength="15" size="15" name="unix_name" value="<?php echo htmlspecialchars($unix_name); ?>"/>
224 $SCMFactory = new SCMFactory() ;
225 $scm_plugins=$SCMFactory->getSCMs() ;
226 if (forge_get_config('use_scm') && count($scm_plugins) > 0) {
227 echo '<h2>'.$index++.'. '._('Source Code').'</h2>';
228 echo '<p>' . _('You can choose among different SCM for your project, but just one (or none at all). Please select the SCM system you want to use.')."</p>\n";
229 echo '<table><tbody><tr><td><strong>'._('SCM Repository').':</strong></td>';
231 echo '<td><input type="radio" name="scm" value="noscm" checked="checked" />'._('No SCM').'</td>';
233 echo '<td><input type="radio" name="scm" value="noscm" />'._('No SCM').'</td>';
235 foreach($scm_plugins as $plugin) {
236 $myPlugin= plugin_get_object($plugin);
237 echo '<td><input type="radio" name="scm" ';
238 echo 'value="'.$myPlugin->name.'"';
239 if ($scm && strcmp($scm, $myPlugin->name) == 0) {
240 echo ' checked="checked"';
242 echo ' />'.$myPlugin->text.'</td>';
244 echo '</tr></tbody></table>'."\n";
247 echo '<h2>'.$index++.'. '._('Project template'). '</h2>';
249 if (count ($template_projects) >= 1) {
250 $tpv_arr = array () ;
251 $tpn_arr = array () ;
253 if (forge_get_config('allow_project_without_template')) {
254 printf(_('You can either start from an empty project, or pick a project that will act as a template for yours. Your project will initially have the same configuration as the template (same roles and permissions, same trackers, same set of enabled plugins, and so on).')) ;
256 $tpn_arr[] = _('Start from empty project') ;
258 printf(_('Please pick a project that will act as a template for yours. Your project will initially have the same configuration as the template (same roles and permissions, same trackers, same set of enabled plugins, and so on).')) ;
261 foreach ($template_projects as $tp) {
262 $tpv_arr[] = $tp->getID() ;
263 $tpn_arr[] = $tp->getPublicName() ;
265 echo html_build_select_box_from_arrays ($tpv_arr, $tpn_arr, 'built_from_template', $template_projects[0]->getID(),
266 false, '', false, '') ;
267 } elseif (count ($template_projects) == 1) {
269 if (forge_get_config('allow_project_without_template')) {
270 printf(_('You can either start from an empty project, or use the %s project as a template for yours. Your project will initially have the same configuration as the template (same roles and permissions, same trackers, same set of enabled plugins, and so on).'),
271 $template_projects[0]->getPublicName()) ;
273 $tpv_arr = array () ;
274 $tpn_arr = array () ;
276 $tpn_arr[] = _('Start from empty project') ;
277 $tpv_arr[] = $template_projects[0]->getID() ;
278 $tpn_arr[] = $template_projects[0]->getPublicName() ;
279 echo html_build_select_box_from_arrays ($tpv_arr, $tpn_arr, 'built_from_template', $template_projects[0]->getID(),
280 false, '', false, '') ;
282 printf(_('Your project will initially have the same configuration as the %s project (same roles and permissions, same trackers, same set of enabled plugins, and so on).'),
283 $template_projects[0]->getPublicName()) ;
284 echo '<input type="hidden" name="built_from_template" value="'.$template_projects[0]->getID().'" />' ;
289 printf(_('Since no template project is available, your project will start empty.')) ;
290 echo '<input type="hidden" name="built_from_template" value="0" />' ;
295 <p style="text-align: center">
296 <input type="submit" name="submit" value="<?php echo _('Submit') ?>"/>
297 <input type="submit" name="i_disagree" value="<?php echo _('Cancel') ?>"/>
304 site_footer(array());
308 // c-file-style: "bsd"