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 * http://fusionforge.org/
22 * This file is part of FusionForge.
24 * FusionForge is free software; you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation; either version 2 of the License, or
27 * (at your option) any later version.
29 * FusionForge is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with FusionForge; if not, write to the Free Software
36 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 require_once('../env.inc.php');
41 require_once $gfcommon.'include/pre.php';
42 require_once $gfcommon.'scm/SCMFactory.class.php';
44 // Test if restricted project registration
46 if (forge_get_config('project_registration_restricted')) {
47 session_require_global_perm ('approve_projects', '',
48 sprintf (_('Project registration is restricted on %s, and only administrators can create new projects.'),
49 forge_get_config ('forge_name')));
50 } elseif (!session_loggedin()) {
54 $template_projects = group_get_template_projects() ;
55 sortProjectList ($template_projects) ;
57 if (getStringFromRequest('submit')) {
58 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
59 exit_form_double_submit('my');
62 $full_name = trim(getStringFromRequest('full_name'));
63 $purpose = trim(getStringFromRequest('purpose'));
64 $description = trim(getStringFromRequest('description'));
65 $unix_name = trim(strtolower(getStringFromRequest('unix_name')));
66 $scm = getStringFromRequest('scm');
67 $is_public = getIntFromRequest('is_public');
68 $built_from_template = getIntFromRequest('built_from_template');
76 $template_project = group_get_object ($built_from_template) ;
78 && !$template_project->isError()
79 && $template_project->isTemplate()) {
80 // Valid template selected, nothing to do
81 } elseif (forge_get_config('allow_project_without_template')) {
82 // Empty projects allowed
83 $built_from_template = 0 ;
84 } elseif (count($template_projects) == 0) {
85 // No empty projects allowed, but no template available
86 $built_from_template = 0 ;
88 // No empty projects allowed, picking the first available template
89 $built_from_template = $template_projects[0]->getID() ;
92 if (forge_get_config('use_scm')) {
95 if (forge_get_config('use_scm') && $scm && $scm != 'noscm') {
96 $plugin = plugin_get_object($scm);
98 $scm_host = $plugin->getDefaultServer();
102 if ( !$purpose && forge_get_config ('project_auto_approval') ) {
103 $purpose = 'No purpose given, autoapprove was on';
106 $send_mail = ! forge_get_config ('project_auto_approval') ;
108 $group = new Group();
109 $u = session_get_user();
110 $res = $group->create(
122 if ($res && forge_get_config('use_scm') && $plugin) {
123 $group->setUsesSCM (true) ;
124 $res = $group->setPluginUse ($scm, true);
126 $group->setUsesSCM (false) ;
130 form_release_key(getStringFromRequest("form_key"));
131 $error_msg .= $group->getErrorMessage();
133 $HTML->header(array('title'=>_('Registration complete')));
135 if ( ! forge_get_config ('project_auto_approval') ) {
136 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'));
137 } else if ($group->isError()) {
138 printf(_('<div class="error">ERROR: %1$s</div>'), $group->getErrorMessage() );
140 printf(_('Approving Project: %1$s'), $group->getUnixName()).'<br />';
142 if (!$group->approve( user_get_object_by_name ( forge_get_config ('project_auto_approval_user') ) ) ) {
143 printf(_('<div class="error">Approval ERROR: %1$s</div>'), $group->getErrorMessage() );
145 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'));
149 $HTML->footer(array());
153 } else if (getStringFromRequest('i_disagree')) {
154 session_redirect("/");
164 site_header(array('title'=>_('Register Project')));
168 <?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.') ?>
171 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
172 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
175 echo '<h3>'.$index.'. '._('Project full name').'</h3>';
176 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).<p/>Full Name:<br/>'); ?>
178 <input size="40" maxlength="40" type="text" name="full_name" value="<?php echo htmlspecialchars($full_name); ?>"/>
181 // Don't display Project purpose if auto approval is on, because it won't be used.
182 if ( !forge_get_config ('project_auto_approval') ) {
184 echo '<h3>'.$index.'. '._('Project Purpose And Summarization').'</h3>';
186 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'));
188 echo '<textarea name="purpose" cols="70" rows="10">';
189 echo htmlspecialchars($purpose);
196 echo '<h3>'.$index.'. '. _('Project Public Description').'</h3>';
198 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.');
201 <textarea name="description" cols="70" rows="5">
202 <?php echo htmlspecialchars($description); ?>
207 echo '<h3>'.$index.'. '._('Project Unix Name').'</h3>';
208 printf(_('In addition to full project name, you will need to choose short,"Unix" name for your project.<p/> The "Unix Name" has several restrictions because it is used in so many places around the site. They are:<ul><li>Cannot match the unix name of any other project</li><li>Must be between 3 and 15 characters in length</li><li>Must be in lower case</li><li>Can only contain characters, numbers, and dashes</li><li>Must be a valid unix username</li><li>Cannot match one of our reserved domains</li><li>Unix name will never change for this project</li></ul><p/>Your unix name is important, however, because it will be used for many things, including:<ul><li>A web site at <tt>unixname.%1$s</tt></li><li>A CVS Repository root of <tt>/cvsroot/unixname</tt> at <tt>cvs.unixname.%1$s</tt></li><li>Shell access to <tt>unixname.%1$s</tt></li><li>Search engines throughout the site</li></ul><p/>Unix Name:<br/>'), forge_get_config('web_host')) ?>
210 <input type="text" maxlength="15" size="15" name="unix_name" value="<?php echo htmlspecialchars($unix_name); ?>"/>
213 $SCMFactory = new SCMFactory() ;
214 $scm_plugins=$SCMFactory->getSCMs() ;
215 if (forge_get_config('use_scm') && count($scm_plugins) > 0) {
217 echo '<h3>'.$index.'. '._('Source Code').'</h3>';
218 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";
219 echo '<table><tbody><tr><td><strong>'._('SCM Repository').':</strong></td>';
220 echo '<td><input type="radio" name="scm" value="noscm" checked="checked">'._('No SCM').'</td>';
221 foreach($scm_plugins as $plugin) {
222 $myPlugin= plugin_get_object($plugin);
223 echo '<td><input type="radio" name="scm" value="'.$myPlugin->name.'">'.$myPlugin->text.'</td>';
225 echo '</tr></tbody></table>'."\n";
229 echo '<h3>'.$index.'. '._('Project template'). '</h3>';
231 if (count ($template_projects) > 1) {
232 $tpv_arr = array () ;
233 $tpn_arr = array () ;
235 if (forge_get_config('allow_project_without_template')) {
236 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).')) ;
238 $tpn_arr[] = _('Start from empty project') ;
240 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).')) ;
243 foreach ($template_projects as $tp) {
244 $tpv_arr[] = $tp->getID() ;
245 $tpn_arr[] = $tp->getPublicName() ;
247 echo html_build_select_box_from_arrays ($tpv_arr, $tpn_arr, 'built_from_template', $template_projects[0]->getID(),
248 false, '', false, '') ;
249 } elseif (count ($template_projects) == 1) {
251 if (forge_get_config('allow_project_without_template')) {
252 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).'),
253 $template_projects[0]->getPublicName()) ;
255 $tpv_arr = array () ;
256 $tpn_arr = array () ;
258 $tpn_arr[] = _('Start from empty project') ;
259 $tpv_arr[] = $template_projects[0]->getID() ;
260 $tpn_arr[] = $template_projects[0]->getPublicName() ;
261 echo html_build_select_box_from_arrays ($tpv_arr, $tpn_arr, 'built_from_template', $template_projects[0]->getID(),
262 false, '', false, '') ;
264 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).'),
265 $template_projects[0]->getPublicName()) ;
266 echo '<input type="hidden" name="built_from_template" value="'.$template_projects[0]->getID().'" />' ;
271 printf(_('Since no template project is available, your project will start empty.')) ;
272 echo '<input type="hidden" name="built_from_template" value="0" />' ;
276 if ($sys_use_private_project) {
278 echo '<h3>'.$index.'. '._('Visibility'). '</h3>';
279 echo '<p><input type="radio" name="is_public" value="1" ';
280 if (!isset($is_public) || $is_public) {
281 echo 'checked="checked" ';
283 echo '/>'. _('Public').'</p>';
285 echo '<p><input type="radio" name="is_public" value="0" ';
286 if (isset ($is_public) && !$is_public) {
287 echo 'checked="checked"';
289 echo '/>'. _('Private').'</p> ';
291 echo '<input type="hidden" name="is_public" value="1" />';
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"