From: Juliette W. <jv...@us...> - 2005-06-17 10:55:00
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15612 Modified Files: Tag: frontend_dev editquiz.php index.php quiz.php Log Message: Fixed one of the problems. Changed quizID to quizid everywhere because I thought this might be the problem, need to decide on how to name things consistently. Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.10.2.7 retrieving revision 1.10.2.8 diff -C2 -d -r1.10.2.7 -r1.10.2.8 *** editquiz.php 16 Jun 2005 16:50:49 -0000 1.10.2.7 --- editquiz.php 17 Jun 2005 10:54:51 -0000 1.10.2.8 *************** *** 26,34 **** $default_action = 'quiz_choose'; include('frontend_general/process_input.php'); ! include('frontend_general/frontend_util.php'); ! include('frontend_general/edit_quiz_util.php'); $PostTo = 'editquiz.php'; $filter = ''; ! $quizID = NULL; include('html/pagehead.php'); --- 26,34 ---- $default_action = 'quiz_choose'; include('frontend_general/process_input.php'); ! ! include_once('frontend_general/edit_quiz_util.php'); $PostTo = 'editquiz.php'; $filter = ''; ! $quizid = NULL; include('html/pagehead.php'); *************** *** 52,57 **** // show_array($_POST); ! echo "Action is $action"; $quizid_source = ''; if ('quiz_delete' == $action or 'filter' == $action) { --- 52,63 ---- // show_array($_POST); + + //////////////////////////////////////////////// + // Set $quizid and $quiz if necessary + //////////////////////////////////////////////// ! ! ! $quiz = ''; $quizid_source = ''; if ('quiz_delete' == $action or 'filter' == $action) { *************** *** 62,83 **** $quizid_source = 'database'; } - - $quizID = stack_get_quizID($quizid_source); - - if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! if (array_key_exists('quiz',$_POST)) { ! $quiz = $_POST['quiz']; ! $quizID = $quiz['quizID']; ! } else if (array_key_exists('quizID',$_POST)){ ! // We have just chosen a quiz, or selected new questions, so had better fetch it. ! $quizID = $_POST['quizID']; ! $quiz = stack_db_quiz_get($quizID); ! } ! } ! echo $quizID; ! if ('filter' == $action) { $filter_source = 'post'; --- 68,86 ---- $quizid_source = 'database'; } ! if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! $quiz_source = 'post'; ! $quiz = stack_get_quiz('post', $quizid); ! if ('' == $quiz) { ! $quizid_source = 'post'; ! } ! } ! $quizid = stack_get_quizid($quizid_source, $quiz); ! if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { ! $quiz = stack_get_quiz('database', $quizid); ! } ! if ('filter' == $action) { $filter_source = 'post'; *************** *** 86,104 **** } ! $question_bank_filter = stack_get_question_bank_filter($filter_source); ! if ('quiz_delete' == $action and $quizID != NULL) { ! stack_db_quiz_delete($quizID); $action = 'quiz_choose'; } ! if ('filter' == $action and $quizID != NULL) { $action = 'quiz_edit_addqs'; stack_set_session_question_bank_filter($question_bank_filter); } - if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { - $quiz = stack_get_quiz(); - } if ('quiz_edit' == $action) { --- 89,104 ---- } ! $question_bank_filter = stack_get_qb_filter($filter_source); ! if ('quiz_delete' == $action and $quizid != '') { ! stack_db_quiz_delete($quizid); $action = 'quiz_choose'; } ! if ('filter' == $action and $quizid != '') { $action = 'quiz_edit_addqs'; stack_set_session_question_bank_filter($question_bank_filter); } if ('quiz_edit' == $action) { *************** *** 114,118 **** if ('quiz_new' == $action) { ! $quiz['quizID'] = $quizID; $action = 'quiz_edit'; } --- 114,118 ---- if ('quiz_new' == $action) { ! $quiz['quizid'] = $quizid; $action = 'quiz_edit'; } *************** *** 133,137 **** break; case 'quiz_edit_addqs': ! stack_add_questions_screen($PostTo, $quizID, $question_bank_filter); break; } --- 133,137 ---- break; case 'quiz_edit_addqs': ! stack_add_questions_screen($PostTo, $quizid, $question_bank_filter); break; } Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.22.2.4 retrieving revision 1.22.2.5 diff -C2 -d -r1.22.2.4 -r1.22.2.5 *** quiz.php 17 Jun 2005 06:28:55 -0000 1.22.2.4 --- quiz.php 17 Jun 2005 10:54:51 -0000 1.22.2.5 *************** *** 85,92 **** $focus = TRUE; // This is a bit of a HACK, since we need to get the number into $_POST, ! // And the javascript function takeaction('mark_question',no) inserts into quizID, so ..... ! if (array_key_exists('quizID',$_POST) ){ ! $focus_on = $_POST['quizID']; } else { $focus_on = 1; --- 85,92 ---- $focus = TRUE; // This is a bit of a HACK, since we need to get the number into $_POST, ! // And the javascript function takeaction('mark_question',no) inserts into quizid, so ..... ! if (array_key_exists('quizid',$_POST) ){ ! $focus_on = $_POST['quizid']; } else { $focus_on = 1; *************** *** 104,111 **** session_unregister('quiz'); ! if (array_key_exists('quizID',$_POST)) { ! $quizID = $_POST['quizID']; // Get the particular quiz, without hidden questions. ! $quiz = stack_db_quiz_get($quizID,FALSE); // Get a list of questionIDs in this quiz $quiz_questions = NULL; --- 104,111 ---- session_unregister('quiz'); ! if (array_key_exists('quizid',$_POST)) { ! $quizid = $_POST['quizid']; // Get the particular quiz, without hidden questions. ! $quiz = stack_db_quiz_get($quizid,FALSE); // Get a list of questionIDs in this quiz $quiz_questions = NULL; *************** *** 135,139 **** // Check for the necessary informtaion incoming. ! $userinfo = stack_db_quiz_quizattempt_getlast($quizID,$user['id']); if (is_array($userinfo)) { --- 135,139 ---- // Check for the necessary informtaion incoming. ! $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$user['id']); if (is_array($userinfo)) { *************** *** 177,181 **** // Record the information in the DB if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_store($quiz['quizID'],$user['id'],$seed); } --- 177,181 ---- // Record the information in the DB if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_store($quiz['quizid'],$user['id'],$seed); } *************** *** 207,211 **** if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; ! $quizID = $quiz['quizID']; $quiz_options = array(); if (array_key_exists('quizOptions',$quiz)){ --- 207,211 ---- if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; ! $quizid = $quiz['quizid']; $quiz_options = array(); if (array_key_exists('quizOptions',$quiz)){ *************** *** 240,246 **** if ('mark_question' == $action) { // This is a bit of a HACK! We need to get the number into $_POST, ! // And the javascript function takeaction('mark_question',no) inserts into quizID, so ..... ! if (array_key_exists('quizID',$_POST) ){ ! $q_no=$_POST['quizID']; } else { $errors['questionno'] = 'Could not get question number from $_POST'; --- 240,246 ---- if ('mark_question' == $action) { // This is a bit of a HACK! We need to get the number into $_POST, ! // And the javascript function takeaction('mark_question',no) inserts into quizid, so ..... ! if (array_key_exists('quizid',$_POST) ){ ! $q_no=$_POST['quizid']; } else { $errors['questionno'] = 'Could not get question number from $_POST'; *************** *** 398,404 **** // (2.9.1) record the fact we have asked for solutions if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_seensol($quiz['quizID'],$user['id'],$quiz['seed']); } ! $quizID = $quiz['quizID']; // (2.9.2) make sure we mark the last non-empty different attempt. --- 398,404 ---- // (2.9.1) record the fact we have asked for solutions if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_seensol($quiz['quizid'],$user['id'],$quiz['seed']); } ! $quizid = $quiz['quizid']; // (2.9.2) make sure we mark the last non-empty different attempt. *************** *** 613,617 **** echo "\n<a name ='quizend'><hr /></a>\n\n"; echo "<input type='hidden' name='action' value='' />\n ! <input type='hidden' name='quizID' value='-1' /> <input type='hidden' name='questionno' value='' />\n </form>\n\n\n"; // form in which questions are entered. --- 613,617 ---- echo "\n<a name ='quizend'><hr /></a>\n\n"; echo "<input type='hidden' name='action' value='' />\n ! <input type='hidden' name='quizid' value='-1' /> <input type='hidden' name='questionno' value='' />\n </form>\n\n\n"; // form in which questions are entered. *************** *** 638,642 **** if (('mark' == $action or 'mark_question' == $action) and '0' != $user['id']) { ! stack_db_quiz_quizattempt_updatemark($quiz['quizID'],$user['id'],$quiz['seed'],$totm,$tot); } --- 638,642 ---- if (('mark' == $action or 'mark_question' == $action) and '0' != $user['id']) { ! stack_db_quiz_quizattempt_updatemark($quiz['quizid'],$user['id'],$quiz['seed'],$totm,$tot); } *************** *** 662,666 **** <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n <tr><td></td><td>".get_string('SolutionsExplain2','stack','')."</td></tr> ! <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('new_quiz_version',$quizID);\">".get_string('NewVersion','stack','')."</a></td> <td>".get_string('NewVersionExplain','stack','')."</td></tr>"; echo "<tr><td nowrap='nowrap'><a href=\"index.php?action=choose_quiz\">".get_string('ChooseQuiz','stack','')."</a></td> --- 662,666 ---- <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n <tr><td></td><td>".get_string('SolutionsExplain2','stack','')."</td></tr> ! <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('new_quiz_version',$quizid);\">".get_string('NewVersion','stack','')."</a></td> <td>".get_string('NewVersionExplain','stack','')."</td></tr>"; echo "<tr><td nowrap='nowrap'><a href=\"index.php?action=choose_quiz\">".get_string('ChooseQuiz','stack','')."</a></td> Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.17.2.8 retrieving revision 1.17.2.9 diff -C2 -d -r1.17.2.8 -r1.17.2.9 *** index.php 16 Jun 2005 16:50:49 -0000 1.17.2.8 --- index.php 17 Jun 2005 10:54:51 -0000 1.17.2.9 *************** *** 43,46 **** --- 43,50 ---- include('frontend_general/loginregister.php'); + $err = stack_get_err($errors); + $errun = stack_get_errun($err); + $errps = stack_get_errps($err); + ////////////////////////////////////////////////////////////// *************** *** 62,69 **** if ('loginscreen' == $action) { - $err = stack_get_err($errors); - $errun = stack_get_errun($err); - $errps = stack_get_errps($err); - $username = stack_get_username($user); stack_login_screen($username, $errun, $errps); } --- 66,69 ---- *************** *** 71,76 **** if ('registration_screen' == $action) { include_once($stack_root."/scripts/stackUser.php"); - $err = stack_get_err($errors); - $username = stack_get_username($user); stack_registration_screen($username, $user, $errors, $err); } --- 71,74 ---- |