[svn r21701] Add or remove answer in survey to IE 6 see FS#4371

skala
Arthur Portugal 16 years ago
parent 654bb13332
commit 0afb1cf3c0
  1. 25
      main/survey/question.php
  2. 16
      main/survey/survey.lib.php

@ -23,7 +23,7 @@
* @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: question.php 20470 2009-05-11 09:46:59Z ivantcholakov $
* @version $Id: question.php 21701 2009-07-01 19:12:25Z aportugal $
*/
// name of the language file that needs to be included
@ -36,6 +36,15 @@ require ('../inc/global.inc.php');
//require_once (api_get_path(LIBRARY_PATH)."/survey.lib.php");
require_once('survey.lib.php');
$htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready( function() {
//Allow dokeos install in IE
$("button").click(function() {
$("#is_executable").attr("value",$(this).attr("name"));
});
} ); </script>';
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!api_is_allowed_to_edit(false,true)) {
Display :: display_header();
@ -44,6 +53,20 @@ if (!api_is_allowed_to_edit(false,true)) {
exit;
}
//Is valid request
$is_valid_request=$_REQUEST['is_executable'];
foreach ($_POST as $request_index=>$request_value) {
if ($request_index<>$is_valid_request) {
if ($request_index=='save_question') {
unset($_POST[$request_index]);
} elseif ($request_index=='add_answer') {
unset($_POST[$request_index]);
} elseif($request_index=='remove_answer') {
unset($_POST[$request_index]);
}
}
}
// Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);

@ -24,7 +24,7 @@
* @package dokeos.survey
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
@author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: survey.lib.php 21173 2009-06-01 20:58:59Z jhp1411 $
* @version $Id: survey.lib.php 21701 2009-07-01 19:12:25Z aportugal $
*
* @todo move this file to inc/lib
* @todo use consistent naming for the functions (save vs store for instance)
@ -585,7 +585,7 @@ class survey_manager
$icon_question = array
(
'yesno' => 'yesno.gif',
'personality' => 'yesno.gif',
'personality' => 'yesno.gif',
'multiplechoice' => 'mcua.gif',
'multipleresponse' => 'mcma.gif',
'open' => 'open_answer.gif',
@ -1581,17 +1581,10 @@ class question
$return .= ' <div class="label">';
$return .= ' </div>';
$return .= ' <div class="formw">';
$return .= ' <input type="hidden" name="is_executable" id="is_executable" value="-" />';
$return .= ' <button class="minus" type="submit" name="remove_answer" "'.$remove_answer_attribute.'">'.get_lang('RemoveAnswer').' </button>';
$return .= ' <button class="plus" type="submit" name="add_answer">'.get_lang('AddAnswer').'</button>';
/*
$return .= ' <tr>';
$return .= ' <td align="right">&nbsp;</td>';
$return .= ' <td colspan="2">';
$return .= ' <button class="minus" type="submit" name="remove_answer" "'.$remove_answer_attribute.'">'.get_lang('RemoveAnswer').' </button>';
$return .= ' <button class="plus" type="submit" name="add_answer">'.get_lang('AddAnswer').'</button>';
$return .= ' </td>';
$return .= ' </tr>';*/
return $return;
}
@ -2633,8 +2626,7 @@ class SurveyUtil {
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
";
</script>";
echo get_lang('SelectUserWhoFilledSurvey').'<br />';
echo '<select name="user" onchange="jumpMenu(\'parent\',this,0)">';
echo '<option value="reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.get_lang('SelectUser').'</option>';

Loading…
Cancel
Save