* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2002-2004 (c) GForge Team
* Copyright 2008-2010 (c) FusionForge Team
+ * Copyright (C) 2010 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.
*/
require_once('../../env.inc.php');
$question = getStringFromRequest('question');
$question_type = getStringFromRequest('question_type');
-/* We need a group_id */
+/* We need a group_id */
if (!$group_id) {
exit_no_group();
}
}
$is_admin_page='y';
-$sh = new SurveyHtml();
-$sh->header(array('title'=>_('Add A Question')));
+$sh = new SurveyHtml();
+
+$title = $question_id ? _('Edit a Question') : _('Add a Question');
+$sh->header(array('title'=>$title));
-if (!session_loggedin() || !user_ismember($group_id,'A')) {
+if (!session_loggedin() || !forge_check_perm('project_admin', $group_id)) {
echo '<div class="error">'._('Permission denied').'</div>';
$sh->footer(array());
exit;
exit_form_double_submit();
}
$sq->create($question, $question_type);
- $msg = _('Question Added');
+ $msg = _('Question Added');
}
-
+
/* Error */
if ( $sq->isError()) {
$msg = $sq->getErrorMessage();
$sq = false;
}
-/* Show Add/Modify form
- * If $question is null it is add form, otherwise modify
+/* Show Add/Modify form
+ * If $question is null it is add form, otherwise modify
*/
echo($sh->showAddQuestionForm($sq));
/* Show existing questions (if any)
*/
$sqf = new SurveyQuestionFactory($g);
-$sqs = & $sqf->getSurveyQuestions();
+$sqs = $sqf->getSurveyQuestions();
if (!$sqs) {
- echo (_('No questions found'));
+ echo '<p class="information">';
+ echo (_('No questions found'));
+ echo '</p>';
} else {
- echo($sh->showQuestions($sqs));
+ echo($sh->showQuestions($sqs));
}
$sh->footer(array());