* Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
- * This file is part of FusionForge.
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
* FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// Test if restricted project registration
//
if (forge_get_config('project_registration_restricted')) {
- session_require_global_perm ('approve_projects', '',
+ session_require_global_perm ('approve_projects', '',
sprintf (_('Project registration is restricted on %s, and only administrators can create new projects.'),
forge_get_config ('forge_name')));
} elseif (!session_loggedin()) {
$description = trim(getStringFromRequest('description'));
$unix_name = trim(strtolower(getStringFromRequest('unix_name')));
$scm = getStringFromRequest('scm');
-$is_public = getIntFromRequest('is_public', 1);
$built_from_template = getIntFromRequest('built_from_template');
$index = 1;
$built_from_template = $template_projects[0]->getID() ;
}
+ $scm_host = '';
if (forge_get_config('use_scm')) {
- $scm_host = '';
$plugin = false ;
if (forge_get_config('use_scm') && $scm && $scm != 'noscm') {
$plugin = plugin_get_object($scm);
$scm_host = $plugin->getDefaultServer();
}
}
+ }
- if ( !$purpose && forge_get_config ('project_auto_approval') ) {
- $purpose = 'No purpose given, autoapprove was on';
- }
-
- $send_mail = ! forge_get_config ('project_auto_approval') ;
+ if ( !$purpose && forge_get_config ('project_auto_approval') ) {
+ $purpose = 'No purpose given, autoapprove was on';
+ }
- $group = new Group();
- $u = session_get_user();
- $res = $group->create(
- $u,
- $full_name,
- $unix_name,
- $description,
- $purpose,
- 'shell1',
- $scm_host,
- $is_public,
- $send_mail,
- $built_from_template
+ $send_mail = ! forge_get_config ('project_auto_approval') ;
+
+ $group = new Group();
+ $u = session_get_user();
+ $res = $group->create(
+ $u,
+ $full_name,
+ $unix_name,
+ $description,
+ $purpose,
+ 'shell1',
+ $scm_host,
+ 0,
+ $send_mail,
+ $built_from_template
);
- if ($res && forge_get_config('use_scm') && $plugin) {
- $group->setUseSCM (true) ;
- $res = $group->setPluginUse ($scm, true);
- } else {
- $group->setUseSCM (false) ;
- }
+ if ($res && forge_get_config('use_scm') && $plugin) {
+ $group->setUseSCM (true) ;
+ $res = $group->setPluginUse ($scm, true);
+ } else {
+ $group->setUseSCM (false) ;
+ }
+
+ if (!$res) {
+ form_release_key(getStringFromRequest("form_key"));
+ $error_msg .= $group->getErrorMessage();
+ } else {
+ $HTML->header(array('title'=>_('Registration complete')));
- if (!$res) {
- form_release_key(getStringFromRequest("form_key"));
- $error_msg .= $group->getErrorMessage();
+ if ( ! forge_get_config ('project_auto_approval') ) {
+ 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><p>Thank you for choosing %1$s</p>'), forge_get_config ('forge_name'));
+ } else if ($group->isError()) {
+ printf(_('<div class="error">ERROR: %1$s</div>'), $group->getErrorMessage() );
} else {
- $HTML->header(array('title'=>_('Registration complete')));
+ printf(_('Approving Project: %1$s'), $group->getUnixName()).'<br />';
- if ( ! forge_get_config ('project_auto_approval') ) {
- 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'));
- } else if ($group->isError()) {
- printf(_('<div class="error">ERROR: %1$s</div>'), $group->getErrorMessage() );
+ if (!$group->approve( user_get_object_by_name ( forge_get_config ('project_auto_approval_user') ) ) ) {
+ printf(_('<div class="error">Approval ERROR: %1$s</div>'), $group->getErrorMessage() );
} else {
- printf(_('Approving Project: %1$s'), $group->getUnixName()).'<br />';
-
- if (!$group->approve( user_get_object_by_name ( forge_get_config ('project_auto_approval_user') ) ) ) {
- printf(_('<div class="error">Approval ERROR: %1$s</div>'), $group->getErrorMessage() );
- } else {
- 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'));
- }
+ printf(_('<p>Your project has been automatically approved. You should receive an email containing further information shortly.</p><p>Thank you for choosing %1$s</p>'), forge_get_config ('forge_name'));
}
-
- $HTML->footer(array());
- exit();
}
+
+ $HTML->footer(array());
+ exit();
}
} else if (getStringFromRequest('i_disagree')) {
session_redirect("/");
<h2><?php echo $index++.'. '. _('Project Public Description') ?></h2>
<p>
-<?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.') ?>
+<?php echo _('This is the description of your project which will be shown on the Project Summary page, in search results, etc.') ?>
</p>
<textarea name="description" cols="70" rows="5">
</textarea>
<h2><?php echo $index++.'. '._('Project Unix Name') ?></h2>
-<p><?php echo _('In addition to full project name, you will need to choose short, "Unix" name for your project.') ?></p>
+<p><?php echo _('In addition to full project name, you will need to choose short, "Unix" name for your project.') ?></p>
<p><?php echo _('The "Unix Name" has several restrictions because it is used in so many places around the site. They are:') ?></p>
<ul>
<li><?php echo _('cannot match the unix name of any other project;') ?></li>
</p>
<?php
- $SCMFactory = new SCMFactory() ;
-$scm_plugins=$SCMFactory->getSCMs() ;
-if (forge_get_config('use_scm') && count($scm_plugins) > 0) {
+$SCMFactory = new SCMFactory();
+$scm_plugins=$SCMFactory->getSCMs();
+if (forge_get_config('use_scm') && count($scm_plugins) > 0) {
echo '<h2>'.$index++.'. '._('Source Code').'</h2>';
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";
echo '<table><tbody><tr><td><strong>'._('SCM Repository').':</strong></td>';
echo '<h2>'.$index++.'. '._('Project template'). '</h2>';
-if (count ($template_projects) > 1) {
+if (count ($template_projects) >= 1) {
$tpv_arr = array () ;
$tpn_arr = array () ;
echo '<p>';
echo '<input type="hidden" name="built_from_template" value="0" />' ;
echo '</p>';
}
-
-if (forge_get_config('use_private_project')) {
- echo '<h2>'.$index++.'. '._('Visibility'). '</h2>';
- echo '<p>' . _('If you make your project private, it won\'t be visible in the project list and can\'t be accessed by non members of the project.')."</p>\n";
- echo '<table><tbody><tr><td><strong>'._('Visibility').':</strong></td>';
- echo '<td><input type="radio" name="is_public" value="1" ';
- if (!isset($is_public) || $is_public) {
- echo 'checked="checked" ';
- }
- echo '/>'. _('Public').'</td>';
-
- echo '<td><input type="radio" name="is_public" value="0" ';
- if (isset ($is_public) && !$is_public) {
- echo 'checked="checked"';
- }
- echo '/>'. _('Private').'</td> ';
- echo '</tr></tbody></table>'."\n";
-}
?>
-<p style="text-align: center">
-<input type="submit" name="submit" value="<?php echo _('Submit') ?>"/>
-<input type="submit" name="i_disagree" value="<?php echo _('Cancel') ?>"/>
+<p class="align-center">
+<input type="submit" name="submit" value="<?php echo _('Submit') ?>" />
+<input type="submit" name="i_disagree" value="<?php echo _('Cancel') ?>" />
</p>
</form>