You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(486) |
Jul
(201) |
Aug
(194) |
Sep
(87) |
Oct
(72) |
Nov
(72) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(41) |
Mar
(22) |
Apr
(4) |
May
(12) |
Jun
|
Jul
|
Aug
(42) |
Sep
(21) |
Oct
(14) |
Nov
(10) |
Dec
|
2007 |
Jan
(14) |
Feb
(34) |
Mar
(61) |
Apr
(54) |
May
(140) |
Jun
(184) |
Jul
(164) |
Aug
(130) |
Sep
(241) |
Oct
(175) |
Nov
(148) |
Dec
(96) |
2008 |
Jan
(5) |
Feb
(38) |
Mar
(30) |
Apr
(46) |
May
(25) |
Jun
(22) |
Jul
(5) |
Aug
(17) |
Sep
(2) |
Oct
(100) |
Nov
(83) |
Dec
(33) |
2009 |
Jan
(127) |
Feb
(43) |
Mar
(86) |
Apr
(34) |
May
(50) |
Jun
(168) |
Jul
(48) |
Aug
(66) |
Sep
(38) |
Oct
(75) |
Nov
(113) |
Dec
(72) |
2010 |
Jan
(123) |
Feb
(68) |
Mar
(26) |
Apr
(11) |
May
(39) |
Jun
(131) |
Jul
(56) |
Aug
(79) |
Sep
(69) |
Oct
(17) |
Nov
(166) |
Dec
(32) |
2011 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(8) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Chris S. <san...@us...> - 2005-06-16 04:11:46
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13332 Modified Files: Tag: frontend_dev editquiz.php question_bank.php Log Message: Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.10.2.4 retrieving revision 1.10.2.5 diff -C2 -d -r1.10.2.4 -r1.10.2.5 *** editquiz.php 14 Jun 2005 17:54:52 -0000 1.10.2.4 --- editquiz.php 16 Jun 2005 04:11:38 -0000 1.10.2.5 *************** *** 53,58 **** // action = quiz_edit_addqs Add questions to the quiz. // action = filter Re-display the list of questions, filtered. - - // show_array($_POST); --- 53,56 ---- *************** *** 73,82 **** } ! if ('filter' == $action) { if (array_key_exists('quizID',$_POST)){ ! $quizID = $_POST['quizID']; ! $filter = $_POST['filter']; ! $action = 'quiz_edit_addqs'; } } --- 71,86 ---- } ! $question_bank_filter = ''; ! if (array_key_exists('bank_filter',$_SESSION)) { ! $question_bank_filter = $_SESSION['bank_filter']; ! } ! ! if ('filter' == $action) { if (array_key_exists('quizID',$_POST)){ ! $quizID = $_POST['quizID']; ! $question_bank_filter = $_POST['bank_filter']; ! $action = 'quiz_edit_addqs'; ! $_SESSION['bank_filter'] = $question_bank_filter; } } *************** *** 179,185 **** echo "<a href=\"javascript:takeaction('filter',{$quizID});\">Filter</a> "; ! echo "<input type='text' name='filter' value='$filter' />"; ! stack_db_listquestions_quiz($filter); echo '<input type="hidden" name="action" value="quiz_edit" />'; --- 183,190 ---- echo "<a href=\"javascript:takeaction('filter',{$quizID});\">Filter</a> "; ! echo "Name = <input type='text' name='bank_filter[name]' value='{$question_bank_filter['name']}' />"; ! echo " Keyword = <input type='text' name='bank_filter[kw]' value='{$question_bank_filter['kw']}' />"; ! stack_db_listquestions_quiz($question_bank_filter); echo '<input type="hidden" name="action" value="quiz_edit" />'; Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.12 retrieving revision 1.3.2.13 diff -C2 -d -r1.3.2.12 -r1.3.2.13 *** question_bank.php 15 Jun 2005 20:07:09 -0000 1.3.2.12 --- question_bank.php 16 Jun 2005 04:11:38 -0000 1.3.2.13 *************** *** 124,151 **** if (array_key_exists('bank_filter',$_POST)) { $question_bank_filter = $_POST['bank_filter']; ! } else { ! $question_bank_filter = ''; } ! // (2.4) Uploaded file. if ('upload_xml_file' == $action) { include('upload_questions.php'); $action = 'questionbank_screen'; } ! // End (2.4) ! // (2.5) Export a whole list of questions. include('qb_export.php'); ! ! ! // (2.6) Filter questions in the question bank, based upon a regular expression. ! ! ! // (2.7) action = edit_metadata ! include('qb_metadata.php'); ////////////////////////////////////////////////// --- 124,151 ---- + // (2.2) Work out the correct value for any filter to be applied to the + // question bank. + $question_bank_filter = ''; + if (array_key_exists('bank_filter',$_SESSION)) { + $question_bank_filter = $_SESSION['bank_filter']; + } if (array_key_exists('bank_filter',$_POST)) { $question_bank_filter = $_POST['bank_filter']; ! $_SESSION['bank_filter'] = $question_bank_filter; } ! // (2.3) Uploaded file. if ('upload_xml_file' == $action) { include('upload_questions.php'); $action = 'questionbank_screen'; } ! // End (2.3) ! // (2.4) Export a whole list of questions. include('qb_export.php'); ! // (2.5) action = edit_metadata ! include('qb_metadata.php'); ////////////////////////////////////////////////// |
From: Chris S. <san...@us...> - 2005-06-15 20:33:23
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12379/scripts Modified Files: Tag: frontend_dev stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.16.2.2 retrieving revision 1.16.2.3 diff -C2 -d -r1.16.2.2 -r1.16.2.3 *** stackDatabase.php 15 Jun 2005 20:07:09 -0000 1.16.2.2 --- stackDatabase.php 15 Jun 2005 20:33:14 -0000 1.16.2.3 *************** *** 119,126 **** if (is_array($filter)) { if (array_key_exists('kw',$filter)) { ! $filter_kw = $filter['kw']; } if (array_key_exists('name',$filter)) { ! $filter_name = $filter['name']; } } --- 119,126 ---- if (is_array($filter)) { if (array_key_exists('kw',$filter)) { ! $filter_kw = trim($filter['kw']); } if (array_key_exists('name',$filter)) { ! $filter_name = trim($filter['name']); } } *************** *** 169,176 **** $dispQ = TRUE; if ('' != $filter_kw) { ! $dispQ = strpos($qkeywords,$filter_kw); ! } ! if ('' != $filter_name) { ! $dispQ = $dispQ OR strpos($qname,$filter_name); } --- 169,179 ---- $dispQ = TRUE; if ('' != $filter_kw) { ! if ('' != $filter_name) { ! $dispQ = max(strpos($qkeywords,$filter_kw),strpos($qname,$filter_name)); ! } else { ! $dispQ = strpos($qkeywords,$filter_kw); ! } ! } else if ('' != $filter_name) { ! $dispQ = strpos($qname,$filter_name); } |
From: Chris S. <san...@us...> - 2005-06-15 20:17:32
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4328 Modified Files: Tag: frontend_dev question_bank_util.php Log Message: Index: question_bank_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/question_bank_util.php,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** question_bank_util.php 15 Jun 2005 20:07:09 -0000 1.1.2.5 --- question_bank_util.php 15 Jun 2005 20:17:08 -0000 1.1.2.6 *************** *** 28,31 **** --- 28,33 ---- function stack_get_question_from_session() { + global $stackQuestion; + $question = NULL; // Get any $question from the current $_SESSION |
From: Chris S. <san...@us...> - 2005-06-15 20:07:18
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30180/scripts Modified Files: Tag: frontend_dev stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.16.2.1 retrieving revision 1.16.2.2 diff -C2 -d -r1.16.2.1 -r1.16.2.2 *** stackDatabase.php 15 Jun 2005 16:39:53 -0000 1.16.2.1 --- stackDatabase.php 15 Jun 2005 20:07:09 -0000 1.16.2.2 *************** *** 109,116 **** global $_PHP_SELF; if ('try' == $action) { ! $filter = 'demo'; } $query = 'SELECT questionID, questionName, questionDescription, questionKeywords, DATE_FORMAT(questionDateLastEdited,"%k:%i, %d/%m/%y"), questionGUID --- 109,131 ---- global $_PHP_SELF; + // Sort out how we are going to filter questions. + $filter_kw = ''; + $filter_name = ''; + if ('try' == $action) { ! $filter_kw = 'demo'; ! $filter_name = ''; ! } else { ! if (is_array($filter)) { ! if (array_key_exists('kw',$filter)) { ! $filter_kw = $filter['kw']; ! } ! if (array_key_exists('name',$filter)) { ! $filter_name = $filter['name']; ! } ! } } + // Build the query to the database. $query = 'SELECT questionID, questionName, questionDescription, questionKeywords, DATE_FORMAT(questionDateLastEdited,"%k:%i, %d/%m/%y"), questionGUID *************** *** 137,141 **** echo "<th><a href=\"javascript:SelectQs('questionbank_screen');\">Filter</a></th>"; } ! echo "<th></th><th></th> <th> <input type='text' name='bank_filter' value='$filter' /> </th></tr></thead><tbody>"; } --- 152,157 ---- echo "<th><a href=\"javascript:SelectQs('questionbank_screen');\">Filter</a></th>"; } ! echo "<th></th><th><input type='text' name='bank_filter[name]' value='$filter_name' /> ! </th> <th> <input type='text' name='bank_filter[kw]' value='$filter_kw' /> </th></tr></thead><tbody>"; } *************** *** 144,160 **** $qkeywords = stripslashes($row[3]); $dispQ = TRUE; ! if ('' != $filter) { ! $dispQ = strpos($qkeywords,$filter); } if (FALSE !== $dispQ) { - if ('' == $row[1]) { - $qname = ''; - } - else - { - $qname = stripslashes($row[1]); - } $guid = $row[5]; --- 160,180 ---- $qkeywords = stripslashes($row[3]); + if ('' == $row[1]) { + $qname = ''; + } else { + $qname = stripslashes($row[1]); + } + + // Decide how to filter questions $dispQ = TRUE; ! if ('' != $filter_kw) { ! $dispQ = strpos($qkeywords,$filter_kw); } + if ('' != $filter_name) { + $dispQ = $dispQ OR strpos($qname,$filter_name); + } + if (FALSE !== $dispQ) { $guid = $row[5]; |
From: Chris S. <san...@us...> - 2005-06-15 20:07:18
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30180 Modified Files: Tag: frontend_dev qb_display.php question_bank.php question_bank_util.php Log Message: Index: qb_display.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/qb_display.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** qb_display.php 15 Jun 2005 17:40:04 -0000 1.1.2.1 --- qb_display.php 15 Jun 2005 20:07:09 -0000 1.1.2.2 *************** *** 1,9 **** <?php ! function print_question_bank_screen($admin, $question_bank_filter) { global $stack_root; $options = ''; include("{$stack_root}/html/qselectform.php"); ! if (!$admin) { stack_db_listquestions('edit',$question_bank_filter); --- 1,10 ---- <?php ! ! function stack_print_question_bank_screen($admin, $question_bank_filter) { global $stack_root; $options = ''; include("{$stack_root}/html/qselectform.php"); ! if ($admin) { stack_db_listquestions('edit',$question_bank_filter); *************** *** 17,21 **** } ! function print_edit_screen($question, $errors) { global $stack_root; include_once("{$stack_root}/scripts/stackAuthor.php"); --- 18,22 ---- } ! function stack_print_edit_screen($question, $errors) { global $stack_root; include_once("{$stack_root}/scripts/stackAuthor.php"); Index: question_bank_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/question_bank_util.php,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** question_bank_util.php 15 Jun 2005 16:58:36 -0000 1.1.2.4 --- question_bank_util.php 15 Jun 2005 20:07:09 -0000 1.1.2.5 *************** *** 44,48 **** } ! function getQuestionInst() { $questionInst = NULL; // Get any $questionInst from the current $_SESSION --- 44,48 ---- } ! function stack_get_questionInst() { $questionInst = NULL; // Get any $questionInst from the current $_SESSION *************** *** 58,61 **** --- 58,62 ---- function stack_get_question_from_post() { + global $stackQuestion; $question = NULL; *************** *** 106,108 **** --- 107,111 ---- + + ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.11 retrieving revision 1.3.2.12 diff -C2 -d -r1.3.2.11 -r1.3.2.12 *** question_bank.php 15 Jun 2005 17:40:04 -0000 1.3.2.11 --- question_bank.php 15 Jun 2005 20:07:09 -0000 1.3.2.12 *************** *** 82,86 **** $database = FALSE; if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { ! $database = TRUE; } --- 82,86 ---- $database = FALSE; if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { ! $database = TRUE; } *************** *** 99,110 **** $get_question = FALSE; ! if ('edit' == $action ! or 'mark' == $action or 'validate' == $action ! or 'store_in_db' == $action or 'store_new_db' == $action ! or 'try' == $action or 'new_version' == $action ! or 'export_xml' == $action) { $get_question = TRUE; $source = 'default'; --- 99,110 ---- $get_question = FALSE; ! if ('edit' == $action ! or 'mark' == $action or 'validate' == $action ! or 'store_in_db' == $action or 'store_new_db' == $action ! or 'try' == $action or 'new_version' == $action ! or 'export_xml' == $action) { $get_question = TRUE; $source = 'default'; *************** *** 119,130 **** // There should be a question in the $POST or $SESSION if ($get_question) { ! $question = stack_get_question($source); ! $questionInst = getQuestionInst(); } ! if (array_key_exists('bank_filter',$_POST)) { ! $question_bank_filter = trim($_POST['bank_filter']); } else { ! $question_bank_filter = ''; } --- 119,131 ---- // There should be a question in the $POST or $SESSION if ($get_question) { ! $question = stack_get_question($source); ! $questionInst = stack_get_questionInst(); } ! ! if (array_key_exists('bank_filter',$_POST)) { ! $question_bank_filter = $_POST['bank_filter']; } else { ! $question_bank_filter = ''; } *************** *** 138,142 **** // (2.5) Export a whole list of questions. ! include('qb_export.php'); --- 139,143 ---- // (2.5) Export a whole list of questions. ! include('qb_export.php'); *************** *** 193,210 **** session_unregister('questionInst'); ! print_question_bank_screen($admin, $question_bank_filter); } //(4.2) Edit questions if ('edit' == $action) { ! print_edit_screen($question, $errors); } - - - - - include('html/pagefoot.php'); --- 194,206 ---- session_unregister('questionInst'); ! stack_print_question_bank_screen($admin, $question_bank_filter); } //(4.2) Edit questions if ('edit' == $action) { ! stack_print_edit_screen($question, $errors); } include('html/pagefoot.php'); |
From: Juliette W. <jv...@us...> - 2005-06-15 17:40:13
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10568 Modified Files: Tag: frontend_dev question_bank.php Added Files: Tag: frontend_dev qb_display.php Log Message: Started to try and move all display code into one file for question bank. --- NEW FILE: qb_display.php --- <?php function print_question_bank_screen($admin, $question_bank_filter) { global $stack_root; $options = ''; include("{$stack_root}/html/qselectform.php"); if (!$admin) { stack_db_listquestions('edit',$question_bank_filter); } else { stack_db_listquestions('try',$question_bank_filter); } echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Export selected as XML</a> "; echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; } function print_edit_screen($question, $errors) { global $stack_root; include_once("{$stack_root}/scripts/stackAuthor.php"); include("{$stack_root}/html/qselectform.php"); stack_question_edit_form($question,$errors); echo "<p><a href=\"javascript:HelpPopup('all','stackQuestion');\">Help with question fields.</a>\n <a href=\"javascript:HelpPopup('all','stackOptions');\">Help with options.</a>\n <a href=\"javascript:HelpPopup('all','stackAnswerTest');\">Help with answer tests.</a>\n <a href=\"javascript:HelpPopup('all','stackQuestionPotResp');\">Help with potential responses.</a></p>"; } ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.10 retrieving revision 1.3.2.11 diff -C2 -d -r1.3.2.10 -r1.3.2.11 *** question_bank.php 15 Jun 2005 17:30:43 -0000 1.3.2.10 --- question_bank.php 15 Jun 2005 17:40:04 -0000 1.3.2.11 *************** *** 36,39 **** --- 36,40 ---- include('html/inputtool.html'); include('question_bank_util.php'); + include('qb_display.php'); $question = ''; *************** *** 185,234 **** // Deal with actions connected with previewing questions include('qb_preview.php'); - //////////////////////////////////////////////// - // (4) Go somewhere next. - //////////////////////////////////////////////// - - // include javascript and form (all pages) - - - - // (4.1) Starting - - - if ('questionbank_screen'==$action) { session_unregister('question'); session_unregister('questionInst'); ! ! $options = ''; ! include("{$stack_root}/html/qselectform.php"); ! ! if (!$admin) { ! stack_db_listquestions('edit',$question_bank_filter); ! ! } else { ! stack_db_listquestions('try',$question_bank_filter); ! } ! ! echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Export selected as XML</a> "; ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! } //(4.2) Edit questions if ('edit' == $action) { ! // Edit the $question ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! include("{$stack_root}/html/qselectform.php"); ! stack_question_edit_form($question,$errors); ! ! echo "<p><a href=\"javascript:HelpPopup('all','stackQuestion');\">Help with question fields.</a>\n ! <a href=\"javascript:HelpPopup('all','stackOptions');\">Help with options.</a>\n ! <a href=\"javascript:HelpPopup('all','stackAnswerTest');\">Help with answer tests.</a>\n ! <a href=\"javascript:HelpPopup('all','stackQuestionPotResp');\">Help with potential responses.</a></p>"; ! } --- 186,205 ---- // Deal with actions connected with previewing questions include('qb_preview.php'); + if ('questionbank_screen'==$action) { session_unregister('question'); session_unregister('questionInst'); ! ! print_question_bank_screen($admin, $question_bank_filter); } //(4.2) Edit questions if ('edit' == $action) { ! print_edit_screen($question, $errors); } + + |
From: Juliette W. <jv...@us...> - 2005-06-15 17:31:04
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5079 Modified Files: Tag: frontend_dev question_bank.php Added Files: Tag: frontend_dev qb_metadata.php Log Message: Extracted metadata stuff from question bank. --- NEW FILE: qb_metadata.php --- <?php if ('edit_metadata' == $action ) { if (!$admin) { echo "<p><font color='red'>Warning!</font> You are not the admin user and any changes will not be stored in the database.</p>"; } else { // If needed update the database if (array_key_exists('edit_metadata',$_POST)) { $edit_metadata = $_POST['edit_metadata']; if (is_array($edit_metadata)) { stack_db_edit_metadata($edit_metadata); } } } session_unregister('question'); session_unregister('questionInst'); $options = ''; include("{$stack_root}/html/qselectform.php"); stack_db_listquestions('edit_metadata',$question_bank_filter); // This line appears to be broken - it doesn't save the metadata! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; } ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.9 retrieving revision 1.3.2.10 diff -C2 -d -r1.3.2.9 -r1.3.2.10 *** question_bank.php 15 Jun 2005 17:19:28 -0000 1.3.2.9 --- question_bank.php 15 Jun 2005 17:30:43 -0000 1.3.2.10 *************** *** 76,79 **** --- 76,80 ---- if ('start_new' == $action) { $new_question = TRUE; + $action = 'edit'; } *************** *** 104,109 **** or 'try' == $action or 'new_version' == $action ! or 'export_xml' == $action ! or 'start_new' == $action) { $get_question = TRUE; $source = 'default'; --- 105,109 ---- or 'try' == $action or 'new_version' == $action ! or 'export_xml' == $action) { $get_question = TRUE; $source = 'default'; *************** *** 144,161 **** ! // (2.7) action = edit_metadata ! if ('edit_metadata' == $action ) { ! if (!$admin) { ! echo "<p><font color='red'>Warning!</font> You are not the admin user and any changes will not be stored in the database.</p>"; ! } else { ! // If needed update the database ! if (array_key_exists('edit_metadata',$_POST)) { ! $edit_metadata = $_POST['edit_metadata']; ! if (is_array($edit_metadata)) { ! stack_db_edit_metadata($edit_metadata); ! } ! } ! } ! } // END (2.7) ////////////////////////////////////////////////// --- 144,149 ---- ! // (2.7) action = edit_metadata ! include('qb_metadata.php'); ////////////////////////////////////////////////// *************** *** 202,222 **** // include javascript and form (all pages) - include("{$stack_root}/html/qselectform.php"); - // (4.1) Starting - - if ('edit_metadata'==$action) - { - session_unregister('question'); - session_unregister('questionInst'); - - $options = ''; ! stack_db_listquestions('edit_metadata',$question_bank_filter); - echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; - } --- 190,199 ---- // include javascript and form (all pages) ! // (4.1) Starting *************** *** 227,230 **** --- 204,208 ---- $options = ''; + include("{$stack_root}/html/qselectform.php"); if (!$admin) { *************** *** 241,255 **** //(4.2) Edit questions ! if ('edit' == $action or 'start_new'==$action) ! {// Edit the $question ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! ! //show_array($errors); ! //show_array($question); ! //echo stack_question_errstr($errors); ! ! stack_question_edit_form($question,$errors); ! ! echo "<p><a href=\"javascript:HelpPopup('all','stackQuestion');\">Help with question fields.</a>\n <a href=\"javascript:HelpPopup('all','stackOptions');\">Help with options.</a>\n <a href=\"javascript:HelpPopup('all','stackAnswerTest');\">Help with answer tests.</a>\n --- 219,229 ---- //(4.2) Edit questions ! if ('edit' == $action) { ! // Edit the $question ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! include("{$stack_root}/html/qselectform.php"); ! stack_question_edit_form($question,$errors); ! ! echo "<p><a href=\"javascript:HelpPopup('all','stackQuestion');\">Help with question fields.</a>\n <a href=\"javascript:HelpPopup('all','stackOptions');\">Help with options.</a>\n <a href=\"javascript:HelpPopup('all','stackAnswerTest');\">Help with answer tests.</a>\n *************** *** 258,282 **** } - //(4.3) Try the questions - if ('mark' == $action or 'validate' == $action) { - - $_SESSION['questionInst'] = $questionInst; - $_SESSION['question'] = $questionInst; - - echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'> - <td align='left'> - - <b>Question: ".sf($questionInst,'questionName')."</b> (".sf($questionInst,'questionID'); - echo ")</td><td align='right'>"; - echo "<a href=\"javascript:HelpPopup('student','');\">Help</a></td></tr></table></center>"; - - - //show_array($questionInst); - stack_question_inst_try_test($questionInst,$this_attempt,$options,$errors); - //stack_question_inst_try($questionInst,$this_attempt,$options,$errors); - //stack_question_inst_show_sol($questionInst,$errors); - - } --- 232,236 ---- |
From: Juliette W. <jv...@us...> - 2005-06-15 17:19:40
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31663 Modified Files: Tag: frontend_dev qb_preview.php question_bank.php Added Files: Tag: frontend_dev qb_export.php Log Message: Put export code into a separate file. It's a bit hard to test the preview code as it generates a whole host of warnings with the original clean version of STACK on my server. --- NEW FILE: qb_export.php --- <?php if ('export_xml_list'==$action) { $quiz = NULL; if (array_key_exists('checked',$_POST)) { if (is_array($_POST['checked'])) { foreach ($_POST['checked'] as $quID => $val) { if ('ticked' == $val) { $quiz[] = $quID; } } } } if (NULL == $quiz) { echo "<p>Could not get any ticked questions! Please try again.</p>"; $action = 'questionbank_screen'; } include_once("{$stack_root}/scripts/stackXML.php"); $name = stack_xml_write_quiz_file($quiz, "{$stack_root}/tmp/"); echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; } if ('export_xml'==$action) { echo "export_xml"; stack_question_validate($question,$errors); include_once("{$stack_root}/scripts/stackXML.php"); $name = stack_xml_write_question_file($question, "{$stack_root}/tmp/"); echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; } ?> Index: qb_preview.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/qb_preview.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** qb_preview.php 15 Jun 2005 16:58:36 -0000 1.1.2.1 --- qb_preview.php 15 Jun 2005 17:19:22 -0000 1.1.2.2 *************** *** 92,94 **** --- 92,116 ---- } + + //(4.3) Try the questions + if ('mark' == $action or 'validate' == $action) { + + $_SESSION['questionInst'] = $questionInst; + $_SESSION['question'] = $questionInst; + + echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'> + <td align='left'> + + <b>Question: ".sf($questionInst,'questionName')."</b> (".sf($questionInst,'questionID'); + echo ")</td><td align='right'>"; + echo "<a href=\"javascript:HelpPopup('student','');\">Help</a></td></tr></table></center>"; + + + //show_array($questionInst); + stack_question_inst_try_test($questionInst,$this_attempt,$options,$errors); + + //stack_question_inst_try($questionInst,$this_attempt,$options,$errors); + //stack_question_inst_show_sol($questionInst,$errors); + + } ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.8 retrieving revision 1.3.2.9 diff -C2 -d -r1.3.2.8 -r1.3.2.9 *** question_bank.php 15 Jun 2005 16:58:36 -0000 1.3.2.8 --- question_bank.php 15 Jun 2005 17:19:28 -0000 1.3.2.9 *************** *** 121,124 **** --- 121,130 ---- $questionInst = getQuestionInst(); } + + if (array_key_exists('bank_filter',$_POST)) { + $question_bank_filter = trim($_POST['bank_filter']); + } else { + $question_bank_filter = ''; + } *************** *** 131,160 **** // (2.5) Export a whole list of questions. ! if ('export_xml_list'==$action) { ! ! $quiz = NULL; ! if (array_key_exists('checked',$_POST)) { ! if (is_array($_POST['checked'])) { ! foreach ($_POST['checked'] as $quID => $val) { ! if ('ticked' == $val) { ! $quiz[] = $quID; ! } ! } ! } ! } ! ! if (NULL == $quiz) { ! echo "<p>Could not get any ticked questions! Please try again.</p>"; ! $action = 'questionbank_screen'; ! } ! } // (2.6) Filter questions in the question bank, based upon a regular expression. ! if (array_key_exists('bank_filter',$_POST)) { ! $question_bank_filter = trim($_POST['bank_filter']); ! } else { ! $question_bank_filter = ''; ! } // (2.7) action = edit_metadata --- 137,146 ---- // (2.5) Export a whole list of questions. ! include('qb_export.php'); ! // (2.6) Filter questions in the question bank, based upon a regular expression. ! // (2.7) action = edit_metadata *************** *** 191,195 **** // These branches need the question to be validated ! if ('edit' == $action or 'export_xml'==$action) { stack_question_validate($question,$errors); } --- 177,181 ---- // These branches need the question to be validated ! if ('edit' == $action) { stack_question_validate($question,$errors); } *************** *** 294,312 **** } - if ('export_xml' == $action) { - include_once("{$stack_root}/scripts/stackXML.php"); - - $name = stack_xml_write_question_file($question, "{$stack_root}/tmp/"); - - echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; - } - - if ('export_xml_list'==$action) { - include_once("{$stack_root}/scripts/stackXML.php"); - - $name = stack_xml_write_quiz_file($quiz, "{$stack_root}/tmp/"); - echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; - } include('html/pagefoot.php'); --- 280,284 ---- |
From: Juliette W. <jv...@us...> - 2005-06-15 16:58:46
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19335 Modified Files: Tag: frontend_dev question_bank.php question_bank_util.php Added Files: Tag: frontend_dev qb_preview.php Log Message: Separated out some of the preview code from the question bank. There are quite a few errors still to fix. Index: question_bank_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/question_bank_util.php,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** question_bank_util.php 15 Jun 2005 16:01:30 -0000 1.1.2.3 --- question_bank_util.php 15 Jun 2005 16:58:36 -0000 1.1.2.4 *************** *** 85,88 **** --- 85,89 ---- // $source should be 'from database', 'new' or 'default' function stack_get_question($source) { + $question = NULL; *************** *** 95,99 **** $questionID = $_POST['questionID']; $question=stack_db_getquestion($questionID); ! } else if ('new' == $source) { $question['questionID']='0'; $question['questionAnsKey']='ans1'; --- 96,102 ---- $questionID = $_POST['questionID']; $question=stack_db_getquestion($questionID); ! } ! ! if ('new' == $source or NULL == $question) { $question['questionID']='0'; $question['questionAnsKey']='ans1'; --- NEW FILE: qb_preview.php --- <?php if ('new_version' == $action) { foreach ($stackQuestion as $qfield => $val) { if (array_key_exists($qfield,$questionInst)) { $question[$qfield] = $questionInst[$qfield]; } } unset($questionInst); $action = 'try'; } // These branches need the question to be validated if ('edit' == $action or 'try'==$action or 'export_xml'==$action) { stack_question_validate($question,$errors); } // Have the questions been marked? if ('mark' == $action or 'validate' == $action) { if (array_key_exists('RawAns',$_POST) ){ $RawAns=$_POST['RawAns']; } else { $error['RawAns'] = '<font color="red">You have not entered an answer!</font>'; } } if ('try'==$action && $database) { if (''==$errors) { $action='validate'; if (array_key_exists('seed',$_POST)) { $seed=$_POST['seed']; } else { // HACK: this should involve the concept of a user! $seed = time(); } $questionInst = stack_question_inst($question,$seed,$options,$errors); // For the purposes of this test, fill in the correct answer // Which must exist! // $RawAns = $questionInst['questionAnsInst']['value']; if (array_key_exists('RawAns',$_POST)) { $RawAns=$_POST['RawAns']; } if (''!=$errors) { $action='edit'; } } else { echo "Could not instantiate the question, because of errors. <br />Try to edit the question instead."; $action='edit'; } } // If we have just taken a question from the edit from, we need to instantiate it. if ('try'==$action) { if (''==$errors) { $action='mark'; $seed = time(); // HACK: this should involve the concept of a user! $questionInst = stack_question_inst($question,$seed,$options,$errors); // For the purposes of this test, fill in the correct answer // Which must exist! $RawAns = $questionInst['questionAnsInst']['value']; } if (''!=$errors) { $action='edit'; echo '<p>Could not instantiate the question, because of errors. <br />Try to edit the question instead.</p>'; //show_array($errors); } } // Now deal with a student's answer if ('mark'==$action or 'validate'==$action) { $this_attempt = stack_question_inst_mark($questionInst,$options,$RawAns,$errors); $this_attempt['Action']=$action; stack_question_add_attempt($questionInst,$this_attempt,$errors); } ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.7 retrieving revision 1.3.2.8 diff -C2 -d -r1.3.2.7 -r1.3.2.8 *** question_bank.php 15 Jun 2005 16:39:53 -0000 1.3.2.7 --- question_bank.php 15 Jun 2005 16:58:36 -0000 1.3.2.8 *************** *** 189,210 **** } - // Change the $questionInst, to a $question - if ('new_version' == $action) { - - foreach ($stackQuestion as $qfield => $val) - { - if (array_key_exists($qfield,$questionInst)) - { - $question[$qfield] = $questionInst[$qfield]; - } - } - unset($questionInst); - - $action = 'try'; - } - // These branches need the question to be validated ! if ('edit' == $action or 'try'==$action or 'export_xml'==$action) { stack_question_validate($question,$errors); } --- 189,195 ---- } // These branches need the question to be validated ! if ('edit' == $action or 'export_xml'==$action) { stack_question_validate($question,$errors); } *************** *** 224,299 **** } ! // Have the questions been marked? ! if ('mark' == $action or 'validate' == $action) { ! ! if (array_key_exists('RawAns',$_POST) ){ ! $RawAns=$_POST['RawAns']; ! } ! else { ! $error['RawAns'] = '<font color="red">You have not entered an answer!</font>'; } ! } ! ! // If we have just taken a question from the db, we need to instantiate it. ! if ('try'==$action && $database) { ! if (''==$errors) { ! $action='validate'; ! ! if (array_key_exists('seed',$_POST)) { ! $seed=$_POST['seed']; ! } else { ! // HACK: this should involve the concept of a user! ! $seed = time(); ! } ! ! $questionInst = stack_question_inst($question,$seed,$options,$errors); ! // For the purposes of this test, fill in the correct answer ! // Which must exist! ! // $RawAns = $questionInst['questionAnsInst']['value']; ! ! if (array_key_exists('RawAns',$_POST)) { ! $RawAns=$_POST['RawAns']; ! } ! ! if (''!=$errors) { ! $action='edit'; ! } ! ! } ! else { ! echo "Could not instantiate the question, because of errors. ! <br />Try to edit the question instead."; ! $action='edit'; ! } ! } ! ! // If we have just taken a question from the edit from, we need to instantiate it. ! if ('try'==$action) { ! if (''==$errors) { ! $action='mark'; ! $seed = time(); // HACK: this should involve the concept of a user! ! $questionInst = stack_question_inst($question,$seed,$options,$errors); ! // For the purposes of this test, fill in the correct answer ! // Which must exist! ! $RawAns = $questionInst['questionAnsInst']['value']; ! } ! ! if (''!=$errors) { ! $action='edit'; ! echo '<p>Could not instantiate the question, because of errors. ! <br />Try to edit the question instead.</p>'; ! //show_array($errors); ! } ! ! } ! ! // Now deal with a student's answer ! if ('mark'==$action or 'validate'==$action) { ! ! $this_attempt = stack_question_inst_mark($questionInst,$options,$RawAns,$errors); ! $this_attempt['Action']=$action; ! stack_question_add_attempt($questionInst,$this_attempt,$errors); ! ! } ! //////////////////////////////////////////////// // (4) Go somewhere next. --- 209,214 ---- } ! // Deal with actions connected with previewing questions ! include('qb_preview.php'); //////////////////////////////////////////////// // (4) Go somewhere next. |
From: Juliette W. <jv...@us...> - 2005-06-15 16:40:07
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9092 Modified Files: Tag: frontend_dev question_bank.php Log Message: Minor changes Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.6 retrieving revision 1.3.2.7 diff -C2 -d -r1.3.2.6 -r1.3.2.7 *** question_bank.php 15 Jun 2005 16:01:30 -0000 1.3.2.6 --- question_bank.php 15 Jun 2005 16:39:53 -0000 1.3.2.7 *************** *** 68,93 **** include('html/pagehead.php'); ! if ('admin' == $user['username']) { $admin = TRUE; } ! if ('startover' == $action) { ! $action = 'questionbank_screen'; } ! $get_question = FALSE; ! if ('edit' == $action or 'mark' == $action ! or 'validate' == $action or 'store_in_db' == $action ! or 'store_new_db' == $action or 'try' == $action ! or 'new_version' == $action or 'export_xml' == $action) { $get_question = TRUE; $source = 'default'; ! } else if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { ! $source = 'database'; ! $get_question = TRUE; ! } else if ('start_new' == $action) { ! $get_question = TRUE; ! $source = 'new'; } --- 68,116 ---- include('html/pagehead.php'); ! $admin = FALSE; ! if ('admin' == $user['username']) { $admin = TRUE; } ! $new_question = FALSE; ! if ('start_new' == $action) { ! $new_question = TRUE; } ! ! $database = FALSE; ! if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { ! $database = TRUE; ! } ! ! if ('edit_from_db' == $action or 'edit_new' == $action) { ! $action = 'edit'; ! } ! ! if ('try_from_db' == $action) { ! $action = 'try'; ! } ! ! if ('export_xml_db' == $action) { ! $action = 'export_xml'; ! } ! $get_question = FALSE; ! if ('edit' == $action ! or 'mark' == $action ! or 'validate' == $action ! or 'store_in_db' == $action ! or 'store_new_db' == $action ! or 'try' == $action ! or 'new_version' == $action ! or 'export_xml' == $action ! or 'start_new' == $action) { $get_question = TRUE; $source = 'default'; ! if ($database) { ! $source = 'database'; ! } else if ($new_question) { ! $source = 'new'; ! } } *************** *** 155,161 **** // Change 'edit_from_db' to 'edit'. We are done here. ! if ('edit_from_db'==$action) { ! $action='edit'; ! } // Delete a $question --- 178,182 ---- // Change 'edit_from_db' to 'edit'. We are done here. ! // Delete a $question *************** *** 185,189 **** // These branches need the question to be validated ! if ('edit' == $action or 'try_from_db' == $action or 'try'==$action or 'export_xml_db'==$action or 'export_xml'==$action) { stack_question_validate($question,$errors); } --- 206,210 ---- // These branches need the question to be validated ! if ('edit' == $action or 'try'==$action or 'export_xml'==$action) { stack_question_validate($question,$errors); } *************** *** 214,218 **** // If we have just taken a question from the db, we need to instantiate it. ! if ('try_from_db'==$action) { if (''==$errors) { $action='validate'; --- 235,239 ---- // If we have just taken a question from the db, we need to instantiate it. ! if ('try'==$action && $database) { if (''==$errors) { $action='validate'; *************** *** 358,362 **** } ! if ('export_xml_db' == $action or 'export_xml' == $action) { include_once("{$stack_root}/scripts/stackXML.php"); --- 379,383 ---- } ! if ('export_xml' == $action) { include_once("{$stack_root}/scripts/stackXML.php"); |
From: Juliette W. <jv...@us...> - 2005-06-15 16:40:06
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9092/scripts Modified Files: Tag: frontend_dev stackDatabase.php Log Message: Minor changes Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -C2 -d -r1.16 -r1.16.2.1 *** stackDatabase.php 10 Jun 2005 18:40:25 -0000 1.16 --- stackDatabase.php 15 Jun 2005 16:39:53 -0000 1.16.2.1 *************** *** 135,139 **** echo "<th><a href=\"javascript:SelectQs('edit_metadata');\">Filter</a></th>"; } else { ! echo "<th><a href=\"javascript:SelectQs('startover');\">Filter</a></th>"; } echo "<th></th><th></th> <th> <input type='text' name='bank_filter' value='$filter' /> --- 135,139 ---- echo "<th><a href=\"javascript:SelectQs('edit_metadata');\">Filter</a></th>"; } else { ! echo "<th><a href=\"javascript:SelectQs('questionbank_screen');\">Filter</a></th>"; } echo "<th></th><th></th> <th> <input type='text' name='bank_filter' value='$filter' /> |
From: Juliette W. <jv...@us...> - 2005-06-15 16:40:06
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9092/html Modified Files: Tag: frontend_dev admin-menu.txt Log Message: Minor changes Index: admin-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/admin-menu.txt,v retrieving revision 1.8.2.5 retrieving revision 1.8.2.6 diff -C2 -d -r1.8.2.5 -r1.8.2.6 *** admin-menu.txt 14 Jun 2005 18:12:02 -0000 1.8.2.5 --- admin-menu.txt 15 Jun 2005 16:39:52 -0000 1.8.2.6 *************** *** 2,6 **** // level // text // link // target // ! .Questions|question_bank.php ..New|question_bank.php?action=start_new ..Import|import_question_screen.php?action=upload_xml_file --- 2,6 ---- // level // text // link // target // ! .Questions|question_bank.php?action=questionbank_screen ..New|question_bank.php?action=start_new ..Import|import_question_screen.php?action=upload_xml_file |
From: Juliette W. <jv...@us...> - 2005-06-15 16:01:38
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18735 Modified Files: Tag: frontend_dev question_bank.php question_bank_util.php Added Files: Tag: frontend_dev upload_questions.php Log Message: Minor changes --- NEW FILE: upload_questions.php --- <?php if (array_key_exists('xmlfile',$_FILES)) { if (is_uploaded_file($_FILES['xmlfile']['tmp_name'])) { $pq = file_get_contents($_FILES['xmlfile']['tmp_name']); include_once("{$stack_root}/scripts/stackXML.php"); $qu = stack_xml_parse_question_string($pq); // Sort out what has been uploaded. // (0) a single question. Edit this. if (array_key_exists('assessmentItem',$qu)) { $question = $qu['assessmentItem']; $action = 'edit'; // (1) a quiz of questions. Store each in the database. } else if (array_key_exists('mathQuiz',$qu)) { $quiz = $qu['mathQuiz']['assessmentItem']; echo "<h2>Details of questions uploaded</h2>"; echo '<table><thead><tr>'; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; $errs = NULL; foreach ($quiz as $key => $qu) { stack_question_validate($quiz[$key],$errs[$key]); $qu['questionID'] = stack_db_addquestion($qu); echo "<tr>\n <td>".sf($qu,'questionID')."</td> <td>".sf($qu,'questionName')." </td> <td>".sf($qu,'questionDescription')." </td> <td>".sf($qu,'questionKeywords')." </td>"; $errc = FALSE; if (nsf($errs,$key)) { if (is_array($errs[$key])) { $errc = TRUE; } } if ($errc) { echo "<td><font color=\"red\">Invalid question</font></td>"; } else { echo "<td><font color=\"greed\">Valid question</font></td>"; } echo "</tr>\n"; } // HACK: we need error trapping here. // HACK: we should return to the user details of what has been uploaded! echo "</tbody></table>\n"; echo "<h2>Current database of questions</h2>"; } else { $error['upload_xml_file']='<p>Could not extract a question from your uploaded file. Please edit your file carefully and try again.</p>'; } } } ?> Index: question_bank_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/question_bank_util.php,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** question_bank_util.php 15 Jun 2005 13:34:36 -0000 1.1.2.2 --- question_bank_util.php 15 Jun 2005 16:01:30 -0000 1.1.2.3 *************** *** 44,48 **** } ! function stack_get_questionInst() { $questionInst = NULL; // Get any $questionInst from the current $_SESSION --- 44,48 ---- } ! function getQuestionInst() { $questionInst = NULL; // Get any $questionInst from the current $_SESSION Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.5 retrieving revision 1.3.2.6 diff -C2 -d -r1.3.2.5 -r1.3.2.6 *** question_bank.php 15 Jun 2005 13:34:36 -0000 1.3.2.5 --- question_bank.php 15 Jun 2005 16:01:30 -0000 1.3.2.6 *************** *** 29,33 **** /////////////////////////////////////////////////////////////// include('stackstd.php'); ! $default_action = 'startover'; include($stack_root.'/frontend_general/process_input.php'); include('html/trypopupform.html'); --- 29,33 ---- /////////////////////////////////////////////////////////////// include('stackstd.php'); ! $default_action = 'questionbank_screen'; include($stack_root.'/frontend_general/process_input.php'); include('html/trypopupform.html'); *************** *** 64,71 **** // action = edit_metadata Edit all the meta data fields in the question bank. ! // action = startover Begin again. include('html/pagehead.php'); $get_question = FALSE; --- 64,79 ---- // action = edit_metadata Edit all the meta data fields in the question bank. ! // action = questionbank_screen Begin again. include('html/pagehead.php'); + if ('admin' == $user['username']) { + $admin = TRUE; + } + + if ('startover' == $action) { + $action = 'questionbank_screen'; + } + $get_question = FALSE; *************** *** 88,92 **** if ($get_question) { $question = stack_get_question($source); ! $questionInst = stack_get_questionInst(); } --- 96,100 ---- if ($get_question) { $question = stack_get_question($source); ! $questionInst = getQuestionInst(); } *************** *** 94,154 **** // (2.4) Uploaded file. if ('upload_xml_file' == $action) { ! if (array_key_exists('xmlfile',$_FILES)) { ! if (is_uploaded_file($_FILES['xmlfile']['tmp_name'])) { ! $pq = file_get_contents($_FILES['xmlfile']['tmp_name']); ! include_once("{$stack_root}/scripts/stackXML.php"); ! ! $qu = stack_xml_parse_question_string($pq); ! ! // Sort out what has been uploaded. ! // (0) a single question. Edit this. ! if (array_key_exists('assessmentItem',$qu)) { ! $question = $qu['assessmentItem']; ! ! $action = 'edit'; ! // (1) a quiz of questions. Store each in the database. ! } else if (array_key_exists('mathQuiz',$qu)) { ! ! $quiz = $qu['mathQuiz']['assessmentItem']; ! ! echo "<h2>Details of questions uploaded</h2>"; ! echo '<table><thead><tr>'; ! echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; ! echo '</tr></thead><tbody>'; ! ! $errs = NULL; ! ! foreach ($quiz as $key => $qu) { ! ! stack_question_validate($quiz[$key],$errs[$key]); ! $qu['questionID'] = stack_db_addquestion($qu); ! echo "<tr>\n <td>".sf($qu,'questionID')."</td> <td>".sf($qu,'questionName')." </td> <td>".sf($qu,'questionDescription')." </td> <td>".sf($qu,'questionKeywords')." </td>"; ! $errc = FALSE; ! if (nsf($errs,$key)) { ! if (is_array($errs[$key])) { ! $errc = TRUE; ! } ! } ! if ($errc) { ! echo "<td><font color=\"red\">Invalid question</font></td>"; ! } else { ! echo "<td><font color=\"greed\">Valid question</font></td>"; ! } ! echo "</tr>\n"; ! } ! ! // HACK: we need error trapping here. ! // HACK: we should return to the user details of what has been uploaded! ! ! echo "</tbody></table>\n"; ! echo "<h2>Current database of questions</h2>"; ! $action = 'startover'; ! ! } else { ! $error['upload_xml_file']='<p>Could not extract a question from your uploaded file. Please edit your file carefully and try again.</p>'; ! } ! ! } ! } } // End (2.4) --- 102,107 ---- // (2.4) Uploaded file. if ('upload_xml_file' == $action) { ! include('upload_questions.php'); ! $action = 'questionbank_screen'; } // End (2.4) *************** *** 170,174 **** if (NULL == $quiz) { echo "<p>Could not get any ticked questions! Please try again.</p>"; ! $action = 'startover'; } --- 123,127 ---- if (NULL == $quiz) { echo "<p>Could not get any ticked questions! Please try again.</p>"; ! $action = 'questionbank_screen'; } *************** *** 184,188 **** // (2.7) action = edit_metadata if ('edit_metadata' == $action ) { ! if ( 'admin' != $user['username'] ) { echo "<p><font color='red'>Warning!</font> You are not the admin user and any changes will not be stored in the database.</p>"; } else { --- 137,141 ---- // (2.7) action = edit_metadata if ('edit_metadata' == $action ) { ! if (!$admin) { echo "<p><font color='red'>Warning!</font> You are not the admin user and any changes will not be stored in the database.</p>"; } else { *************** *** 209,216 **** if ('delete_from_db' == $action) { $questionID = $_POST['questionID']; ! if ('admin'==$user['username']) { stack_db_dropquestion($questionID); } ! $action = 'startover'; } --- 162,169 ---- if ('delete_from_db' == $action) { $questionID = $_POST['questionID']; ! if (!$admin) { stack_db_dropquestion($questionID); } ! $action = 'questionbank_screen'; } *************** *** 242,251 **** if ('store_in_db' == $action) { stack_db_addquestion($question); ! $action = 'startover'; } if ('store_new_db' == $action) { stack_db_addquestion($question,TRUE); ! $action = 'startover'; } --- 195,204 ---- if ('store_in_db' == $action) { stack_db_addquestion($question); ! $action = 'questionbank_screen'; } if ('store_new_db' == $action) { stack_db_addquestion($question,TRUE); ! $action = 'questionbank_screen'; } *************** *** 346,350 **** ! if ('startover'==$action) { session_unregister('question'); --- 299,303 ---- ! if ('questionbank_screen'==$action) { session_unregister('question'); *************** *** 353,357 **** $options = ''; ! if ('admin'==$user['username']) { stack_db_listquestions('edit',$question_bank_filter); --- 306,310 ---- $options = ''; ! if (!$admin) { stack_db_listquestions('edit',$question_bank_filter); |
From: Juliette W. <jv...@us...> - 2005-06-15 13:35:16
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7216/scripts Modified Files: Tag: frontend_dev stackAuthor.php Log Message: More work on question bank code. Made minor change to question editting form. Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.22.2.1 retrieving revision 1.22.2.2 diff -C2 -d -r1.22.2.1 -r1.22.2.2 *** stackAuthor.php 14 Jun 2005 17:54:52 -0000 1.22.2.1 --- stackAuthor.php 15 Jun 2005 13:34:37 -0000 1.22.2.2 *************** *** 192,202 **** // Buttons to go somewhere next if ($stack_stand_alone) { - echo "<p><a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; if (''==$errors) { ! echo "<a href=\"javascript:EditQ('try')\">Try this question</a> \n"; ! echo "<a href=\"javascript:EditQ('export_xml')\">Export XML</a> \n"; if ('admin'==$user['username']) { ! echo "<a href=\"javascript:EditQ('store_in_db')\">Store question</a>\n ! <a href=\"javascript:EditQ('store_new_db')\">Store as a new question</a>\n"; } } --- 192,201 ---- // Buttons to go somewhere next if ($stack_stand_alone) { if (''==$errors) { ! echo "<a href=\"javascript:EditQ('try')\">Preview Question</a> \n"; ! echo "<a href=\"javascript:EditQ('export_xml')\">Export Question</a> \n"; if ('admin'==$user['username']) { ! echo "<a href=\"javascript:EditQ('store_in_db')\">Save Question</a>\n ! <a href=\"javascript:EditQ('store_new_db')\">Save Question As...</a>\n"; } } |
From: Juliette W. <jv...@us...> - 2005-06-15 13:34:57
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7216 Modified Files: Tag: frontend_dev question_bank.php question_bank_util.php Log Message: More work on question bank code. Made minor change to question editting form. Index: question_bank_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/question_bank_util.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** question_bank_util.php 14 Jun 2005 16:33:56 -0000 1.1.2.1 --- question_bank_util.php 15 Jun 2005 13:34:36 -0000 1.1.2.2 *************** *** 25,38 **** */ ! function stack_question_in_session() { ! if (array_key_exists('question',$_SESSION)) { ! return TRUE; ! } else { ! return FALSE; ! } ! } function stack_get_question_from_session() { ! $question = 'unknown'; // Get any $question from the current $_SESSION if (array_key_exists('question',$_SESSION)) { --- 25,32 ---- */ ! function stack_get_question_from_session() { ! $question = NULL; // Get any $question from the current $_SESSION if (array_key_exists('question',$_SESSION)) { *************** *** 50,55 **** } ! function stack_get_questionInst_from_session() { ! $questionInst = 'unknown'; // Get any $questionInst from the current $_SESSION if (array_key_exists('questionInst',$_SESSION)) { --- 44,49 ---- } ! function stack_get_questionInst() { ! $questionInst = NULL; // Get any $questionInst from the current $_SESSION if (array_key_exists('questionInst',$_SESSION)) { *************** *** 64,75 **** function stack_get_question_from_post() { ! // Get any $_POSTED data // This should over write any $_SESSION data, as it may have been entered in a form. ! foreach( $stackQuestion as $qfield => $attribs) { ! if ( array_key_exists($qfield,$_POST) ) { if ('questionOptions' == $qfield) { --- 58,69 ---- function stack_get_question_from_post() { ! $question = NULL; // Get any $_POSTED data // This should over write any $_SESSION data, as it may have been entered in a form. ! foreach($stackQuestion as $qfield => $attribs) { ! if (array_key_exists($qfield,$_POST) ) { if ('questionOptions' == $qfield) { *************** *** 89,108 **** } ! // $source should be 'from database', 'new', 'session' or 'post' function stack_get_question($source) { ! if ('from_database' == $source) { $questionID = $_POST['questionID']; $question=stack_db_getquestion($questionID); } else if ('new' == $source) { ! $question['questionID']='0'; $question['questionAnsKey']='ans1'; - } else if ('session' == $source) { - $question = stack_get_question_from_session(); - } else if ('post' == $source) { - $stack_get_question_from_post(); - } else { - echo "Invalid arg to stack_get_question"; - // Error! How are we handling these? } } --- 83,103 ---- } ! // $source should be 'from database', 'new' or 'default' function stack_get_question($source) { ! $question = NULL; ! ! // $_POSTED data should over write any $_SESSION data, as it may have been ! // entered in a form. ! if ('default' == $source) { ! $question = stack_get_question_from_session(); ! $question = stack_get_question_from_post(); ! } else if ('database' == $source) { $questionID = $_POST['questionID']; $question=stack_db_getquestion($questionID); } else if ('new' == $source) { ! $question['questionID']='0'; $question['questionAnsKey']='ans1'; } + return $question; } Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.4 retrieving revision 1.3.2.5 diff -C2 -d -r1.3.2.4 -r1.3.2.5 *** question_bank.php 14 Jun 2005 16:33:56 -0000 1.3.2.4 --- question_bank.php 15 Jun 2005 13:34:36 -0000 1.3.2.5 *************** *** 75,89 **** or 'new_version' == $action or 'export_xml' == $action) { $get_question = TRUE; ! } ! ! $get_question_from_database = FALSE; ! ! if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { ! $get_question_from_database = TRUE; ! } ! $get_new_question = FALSE; ! ! if ('start_new' == $action) { ! $get_new_question = TRUE; } --- 75,85 ---- or 'new_version' == $action or 'export_xml' == $action) { $get_question = TRUE; ! $source = 'default'; ! } else if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { ! $source = 'database'; ! $get_question = TRUE; ! } else if ('start_new' == $action) { ! $get_question = TRUE; ! $source = 'new'; } *************** *** 91,117 **** // There should be a question in the $POST or $SESSION if ($get_question) { ! ! // $_POSTED data should over write any $_SESSION data, as it may have been ! // entered in a form. ! $question = stack_get_question_from_session(); ! $questionInst = stack_get_questionInst_from_session(); ! $question = stack_get_question_from_post(); ! } ! ! // End (2.1) ! ! // (2.2) Get a question from the database. ! if ($get_question_from_database) { ! $questionID = $_POST['questionID']; ! $question=stack_db_getquestion($questionID); } - // End (2.2) - // (2.3) Provide a minimal blank question - if ($get_new_question) { - $question['questionID']='0'; - $question['questionAnsKey']='ans1'; - } - // End (2.3) // (2.4) Uploaded file. --- 87,94 ---- // There should be a question in the $POST or $SESSION if ($get_question) { ! $question = stack_get_question($source); ! $questionInst = stack_get_questionInst(); } // (2.4) Uploaded file. |
From: Chris S. <san...@us...> - 2005-06-15 09:38:03
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13451/scripts Modified Files: Tag: frontend_dev en.php Log Message: Index: en.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/en.php,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** en.php 14 Jun 2005 17:54:52 -0000 1.3.2.2 --- en.php 15 Jun 2005 09:37:28 -0000 1.3.2.3 *************** *** 242,248 **** $string[''] = ''; - - - //get_string('ThisSTACKVer','stack','') ?> --- 242,245 ---- |
From: Chris S. <san...@us...> - 2005-06-14 18:12:11
|
Update of /cvsroot/stack/stack-1-0/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18441/doc Added Files: Tag: frontend_dev help_popup.php Log Message: Popup window for help files restored. --- NEW FILE: help_popup.php --- <?php /** * Generates help files. * This file is used in the help popup windows, for individual fields. * * This is used by both the student and teacher. * * @package documentation * @subpackage Stack */ ?> <head> <title>Stack help!</title> <style type="text/css"> @import url(../html/stack.css); </style> <script type="text/javascript"> window.focus(); </script> <?php include('../stackstd.php'); // HACK for now. include('en_doc.php'); include("{$stack_root}/html/htmlstyle.html"); ?> </head> <body> <div id=main> <div id=SectionText> <?php $field = $_POST['field']; $variable = $_POST['variable']; if (array_key_exists('field',$_GET)) { $field = $_GET['field']; } if (array_key_exists('variable',$_GET)) { $variable = $_GET['variable']; } //show_array($_POST); //echo $variable; if ('student'==$field) { include('student_input.php'); } else if('all'==$field) { // Then we would like a lot of documentation. $filename=$variable.'.php'; include($filename); } else { if ('stackQuestion' == $variable) { $q_field = $stackQuestion[$field]; $fn = 'stackQuestion_'.$field;} else if ('stackOptions' == $variable) { $q_field = $stackOptions[$field]; $fn = 'stackOptions_'.$field; } else if ('stackQuestionPotResp' == $variable) { $q_field = $stackQuestionPotResp[$field]; $fn = 'stackQuestion_PR_'.$field; } $fd = get_string($fn,'stack',''); echo "<h3>$fd</h3>"; echo $q_field['doc']; echo "<p>"; echo "Name of field: <font color=orange><tt>$field</tt></font>. Type of field: <font color=orange><tt>{$q_field['type']}</tt></font>."; if (array_key_exists('required',$q_field)) { echo " Required: <font color=orange><tt>{$q_field['required']}</tt></font>."; } } ?> </div><br /></div></div></body></html> |
From: Chris S. <san...@us...> - 2005-06-14 18:12:11
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18441/html Modified Files: Tag: frontend_dev admin-menu.txt helpform.php Log Message: Popup window for help files restored. Index: helpform.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/helpform.php,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** helpform.php 5 Apr 2005 02:44:44 -0000 1.4 --- helpform.php 14 Jun 2005 18:12:02 -0000 1.4.4.1 *************** *** 18,22 **** */ ! echo "<form name=\"stackquestionhelpform\" action=\"{$stack_web_url}doc/stackHelp.php\" method=\"POST\">"; ?> <input type="hidden" name="field" value="" /> <input type="hidden" name="variable" value="" /> --- 18,22 ---- */ ! echo "<form name=\"stackquestionhelpform\" action=\"{$stack_web_url}doc/help_popup.php\" method=\"POST\">"; ?> <input type="hidden" name="field" value="" /> <input type="hidden" name="variable" value="" /> Index: admin-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/admin-menu.txt,v retrieving revision 1.8.2.4 retrieving revision 1.8.2.5 diff -C2 -d -r1.8.2.4 -r1.8.2.5 *** admin-menu.txt 14 Jun 2005 16:01:03 -0000 1.8.2.4 --- admin-menu.txt 14 Jun 2005 18:12:02 -0000 1.8.2.5 *************** *** 6,10 **** ..Import|import_question_screen.php?action=upload_xml_file .Quizzes|editquiz.php?action=quiz_choose ! ..Quiz|editquiz.php?action=quiz_new .Reporting|analysis.php .Logout|index.php?action=logout --- 6,10 ---- ..Import|import_question_screen.php?action=upload_xml_file .Quizzes|editquiz.php?action=quiz_choose ! ..New|editquiz.php?action=quiz_new .Reporting|analysis.php .Logout|index.php?action=logout |
From: Chris S. <san...@us...> - 2005-06-14 17:55:18
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050/scripts Modified Files: Tag: frontend_dev en.php stackAuthor.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** stackAuthor.php 12 Jun 2005 07:47:06 -0000 1.22 --- stackAuthor.php 14 Jun 2005 17:54:52 -0000 1.22.2.1 *************** *** 88,92 **** echo " <td> $descript </td>\n <td>"; ! $sz = max(10,strlen($options[$opt])+2); @stack_question_edit_option_form($name,$opt,$options[$opt],$sz); echo "</td>\n"; --- 88,92 ---- echo " <td> $descript </td>\n <td>"; ! $sz = max(10,@strlen($options[$opt])+2); @stack_question_edit_option_form($name,$opt,$options[$opt],$sz); echo "</td>\n"; Index: en.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/en.php,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** en.php 14 Jun 2005 11:36:06 -0000 1.3.2.1 --- en.php 14 Jun 2005 17:54:52 -0000 1.3.2.2 *************** *** 1,4 **** --- 1,5 ---- <?php + // Strings associated with quizzes. $string['TrySTACKQuiz'] = 'Try a STACK quiz'; $string['STACKHomePage'] = 'STACK home page'; *************** *** 29,32 **** --- 30,35 ---- $string['Help'] = 'Help'; $string['End'] = 'End'; + $string['Quiz_error_q'] = '<font color=\"red\">There were errors in the question.</font><br />Please contact your system administrator about questionID {$a[0]}.<br />'; + // Stack page footer. |
From: Chris S. <san...@us...> - 2005-06-14 17:55:01
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8050 Modified Files: Tag: frontend_dev editquiz.php quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.22.2.1 retrieving revision 1.22.2.2 diff -C2 -d -r1.22.2.1 -r1.22.2.2 *** quiz.php 14 Jun 2005 17:16:52 -0000 1.22.2.1 --- quiz.php 14 Jun 2005 17:54:52 -0000 1.22.2.2 *************** *** 76,91 **** //////////////////////////////////////////////// ! // (2.1) Guest users cannot store information in the DB if ('continue_quiz' == $action and 0 == $user['id']) { $action = 'new_quiz_version'; } ! // (2.2) Sort out focus/unfocus behaviour. if ('focus' == $action) { $focus = TRUE; ! // 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) ){ $focus_on = $_POST['quizID']; --- 76,90 ---- //////////////////////////////////////////////// ! // (4.1) Guest users cannot store information in the DB if ('continue_quiz' == $action and 0 == $user['id']) { $action = 'new_quiz_version'; } ! // (4.2) Sort out focus/unfocus behaviour. if ('focus' == $action) { $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']; *************** *** 94,102 **** } } if ('unfocus' == $action) { $focus = FALSE; } ! // (2.3) construct the $quiz if ('continue_quiz' == $action or 'new_quiz_version' == $action) { // Clear any existing quiz and quizInst from the $_SESSION --- 93,102 ---- } } + if ('unfocus' == $action) { $focus = FALSE; } ! // (4.3) construct the $quiz if ('continue_quiz' == $action or 'new_quiz_version' == $action) { // Clear any existing quiz and quizInst from the $_SESSION *************** *** 124,128 **** } ! // (2.4) At this point we should have a $quiz and $quizInst to work on. // Find out if we have quiz options. $quiz_options = array(); --- 124,128 ---- } ! // (4.4) At this point we should have a $quiz and $quizInst to work on. // Find out if we have quiz options. $quiz_options = array(); *************** *** 131,135 **** } ! // (2.5) Reconstruct $quizInst from previous data if ('continue_quiz' == $action) { // Check for the necessary informtaion incoming. --- 131,135 ---- } ! // (4.5) Reconstruct $quizInst from previous data if ('continue_quiz' == $action) { // Check for the necessary informtaion incoming. *************** *** 142,145 **** --- 142,149 ---- $quiz['seed'] = $seed; + // Check if students have previously asked for solutions. + // If so, they can't do anything else with this version + // of the quiz, but look at the solutions again. + // ie, they can't try again after solutions. if ($userinfo['SolRequest']) { $action = 'solutions'; *************** *** 152,155 **** --- 156,161 ---- $quizInst[]=$qInst; + // Make the $RawAns array equal to the student's last answer, if + // they have tried the quiz before. if (array_key_exists('questionAttempts', $qInst)) { if (is_array($qInst['questionAttempts'])) { *************** *** 164,171 **** } ! // (2.6) Start a new quiz if ('new_quiz_version' == $action) { $focus = FALSE; ! $seed = time()+rand(0,30000); $quiz['seed'] = $seed; // Record the information in the DB --- 170,177 ---- } ! // (4.6) Start a new quiz if ('new_quiz_version' == $action) { $focus = FALSE; ! $seed = time()+rand(0,30000); $quiz['seed'] = $seed; // Record the information in the DB *************** *** 178,193 **** stack_question_validate($question,$errors["qu$key"]); ! $options = stack_options_set($question); if ( '' == $errors["qu$key"] ) { - // HACK: Need a better mechanism $quizInst[] = stack_question_inst($question,$seed,$options,$errors["qu$key"]); } else { $question = NULL; ! $question['questionStemInst'] = "<font color=\"red\">There were errors in the question.</font> ! <br />Please contact your system administrator about questionID $qID.<br />"; ! $question['questionAnsInst'] = 0; ! $question['errors'] = $errors["qu$key"]; ! $quizInst[] = $question; } } --- 184,198 ---- stack_question_validate($question,$errors["qu$key"]); ! $options = stack_options_set($question,$quiz_options); if ( '' == $errors["qu$key"] ) { $quizInst[] = stack_question_inst($question,$seed,$options,$errors["qu$key"]); } else { $question = NULL; ! $a = array($qID); ! $question['questionStemInst'] = get_string('Quiz_error_q','stack',$a); ! $question['questionAnsInst'] = 0; ! $question['errors'] = $errors["qu$key"]; ! $quizInst[] = $question; } } *************** *** 196,203 **** ! // (2.7) Get the information from the $_SESSION if ('new_quiz_version' != $action and 'continue_quiz' != $action and 'choose_quiz' != $action) { ! // (2.6.1) Get the quiz from the $_SESSION if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; --- 201,208 ---- ! // (4.7) Get the information about the quiz from the $_SESSION if ('new_quiz_version' != $action and 'continue_quiz' != $action and 'choose_quiz' != $action) { ! // (4.7.1) Get the quiz from the $_SESSION if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; *************** *** 211,215 **** } ! // (2.6.2) Get the quizInst from the $_SESSION if (array_key_exists('quizInst',$_SESSION)) { $quizInst=$_SESSION['quizInst']; --- 216,220 ---- } ! // (4.7.2) Get the quizInst from the $_SESSION if (array_key_exists('quizInst',$_SESSION)) { $quizInst=$_SESSION['quizInst']; *************** *** 218,236 **** } ! // (2.6.3) Ensure that for each question in the quiz, $RawAns exists. foreach ($quizInst as $key => $q) { $RawAns[] = ''; } ! // (2.6.4) Get the list of answers from $_POST if (array_key_exists('RawAns',$_POST) ){ foreach ($_POST['RawAns'] as $key => $q) { $RawAns[$key] = $q; ! } } } ! // (2.8) Mark just one question in the quiz. if ('mark_question' == $action) { // This is a bit of a HACK! We need to get the number into $_POST, --- 223,241 ---- } ! // (4.7.3) Ensure that for each question in the quiz, $RawAns exists. foreach ($quizInst as $key => $q) { $RawAns[] = ''; } ! // (4.7.4) Get the list of answers from $_POST if (array_key_exists('RawAns',$_POST) ){ foreach ($_POST['RawAns'] as $key => $q) { $RawAns[$key] = $q; ! } } } ! // (4.8) Mark just one question in the quiz. if ('mark_question' == $action) { // This is a bit of a HACK! We need to get the number into $_POST, *************** *** 243,247 **** } ! // (2.8) Process responses. This requires a focus/unfocus top-level split if ( 'new_quiz_version' != $action and 'continue_quiz' != $action --- 248,252 ---- } ! // (4.9) Process responses. This requires a focus/unfocus top-level split if ( 'new_quiz_version' != $action and 'continue_quiz' != $action *************** *** 251,255 **** if ($focus) { ! // (2.8.focus) Process one question in the quiz, and don't loose new answers. $key = $focus_on; --- 256,260 ---- if ($focus) { ! // (4.10.focus) Process one question in the quiz, and don't loose new answers. $key = $focus_on; Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.10.2.3 retrieving revision 1.10.2.4 diff -C2 -d -r1.10.2.3 -r1.10.2.4 *** editquiz.php 14 Jun 2005 15:50:05 -0000 1.10.2.3 --- editquiz.php 14 Jun 2005 17:54:52 -0000 1.10.2.4 *************** *** 164,168 **** if ('quiz_edit' == $action) { ! stack_quiz_edit_form($quiz,&$errors,$PostTo = ''); echo "<p>\n<form name='quizform' action='$PostTo' method='POST'> --- 164,168 ---- if ('quiz_edit' == $action) { ! stack_quiz_edit_form($quiz,$errors,$PostTo = ''); echo "<p>\n<form name='quizform' action='$PostTo' method='POST'> |
From: Chris S. <san...@us...> - 2005-06-14 17:17:09
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19691 Modified Files: Tag: frontend_dev quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** quiz.php 10 Jun 2005 20:23:56 -0000 1.22 --- quiz.php 14 Jun 2005 17:16:52 -0000 1.22.2.1 *************** *** 11,14 **** --- 11,35 ---- include('stackstd.php'); + $default_action = 'choose_quiz'; + include($stack_root.'/frontend_general/process_input.php'); + + + ///////////////////////////////////////////////////////////// + // (1) For a quiz, the admin user should behave like a guest. + // We don't want lots of admin user quizzes to be stored. + // The user is not stored in the session, so it lasts only + // for this script. + ///////////////////////////////////////////////////////////// + + if ($user['id'] <= 0 or !$user['loggedin']) { + include_once($stack_root."/scripts/stackUser.php"); + $user = stack_user_guest(); + } + + + ////////////////////////////////////////////////////////// + // (2) Assign default values to quiz specific variables. + ////////////////////////////////////////////////////////// + $errors = ''; $options = ''; *************** *** 20,83 **** $focus = FALSE; $focus_on = NULL; - - //////////////////////////////////////////////////// - // Process incoming data, and check for any errors. - /////////////////////////////////////////////////// - ! if (get_magic_quotes_gpc()) { ! /** ! * Automatically removes slashes deeply from arrays. ! * ! * @param $value incoming array. ! * @return $value the array with slashed removed. ! */ ! function stripslashes_deep($value) ! { ! $value = is_array($value) ? ! array_map('stripslashes_deep', $value) : ! stripslashes($value); ! ! return $value; ! } ! ! $_POST = array_map('stripslashes_deep', $_POST); ! $_GET = array_map('stripslashes_deep', $_GET); ! $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } ! ! //////////////////////////////////////////////// ! // (1) Establish the user. ! //////////////////////////////////////////////// ! ! if (array_key_exists('user',$_SESSION)) { ! $user = $_SESSION['user']; ! } else { ! // Make sure the user is logged in as a Guest. ! include_once($stack_root."/scripts/stackUser.php"); ! $user = stack_user_guest(); ! } ! ! ! $implied_guest = FALSE; ! if (is_array($user)) { ! if (array_key_exists('id',$user)) { ! if ($user['id'] <= 0 or !$user['loggedin']) { ! $implied_guest = TRUE; ! } ! } else { ! $implied_guest = TRUE; ! } ! } else { ! $implied_guest = TRUE; } - if ( $implied_guest) { - include_once($stack_root."/scripts/stackUser.php"); - $user = stack_user_guest(); - } - //////////////////////////////////////////////// ! // (2) Decide what we are trying to do. //////////////////////////////////////////////// --- 41,54 ---- $focus = FALSE; $focus_on = NULL; ! if (array_key_exists('focus',$_SESSION)) { ! $focus = $_SESSION['focus']; } ! if (array_key_exists('focus_on',$_SESSION)) { ! $focus_on = $_SESSION['focus_on']; } //////////////////////////////////////////////// ! // (3) Decide what we are trying to do. //////////////////////////////////////////////// *************** *** 85,101 **** // action = unfocus See all questions at once. // action = continue_quiz Continue a quiz, from $user information // action = new_quiz_version Start a new quiz version ! // actopn = validate Validate the response to *every question* // action = mark Mark the response to *every question* // action = mark_question Mark the response only to question in the field questiono // action = solutions Mark the response to *every question* then show the solutions // This prevents further attempts ! ! if (array_key_exists('action',$_POST)) { ! $action = $_POST['action']; ! } else { ! $action = 'choose_quiz'; ! } ! if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; --- 56,69 ---- // action = unfocus See all questions at once. // action = continue_quiz Continue a quiz, from $user information + // (default_action) // action = new_quiz_version Start a new quiz version ! // actoin = validate Validate the response to *every question* // action = mark Mark the response to *every question* // action = mark_question Mark the response only to question in the field questiono // action = solutions Mark the response to *every question* then show the solutions // This prevents further attempts ! ! // If there is a quiz stored in the $_SESSION, we should use this. ! // Otherwise we need to generate one. if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; *************** *** 104,117 **** } - - if (array_key_exists('focus',$_SESSION)) { - $focus = $_SESSION['focus']; - } - if (array_key_exists('focus_on',$_SESSION)) { - $focus_on = $_SESSION['focus_on']; - } - //////////////////////////////////////////////// ! // (2) Take some action //////////////////////////////////////////////// --- 72,77 ---- } //////////////////////////////////////////////// ! // (4) Take some action //////////////////////////////////////////////// |
From: Chris S. <san...@us...> - 2005-06-14 17:17:09
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19691/scripts Modified Files: Tag: frontend_dev stackWin.php Log Message: Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** stackWin.php 13 Jun 2005 16:27:31 -0000 1.2.2.1 --- stackWin.php 14 Jun 2005 17:17:00 -0000 1.2.2.2 *************** *** 88,118 **** fwrite($pipes[0], $strin); fwrite($pipes[0], $stack_cas['closeCommand']."\n\n"); $ret = ''; // read output from stdout $start_time = stack_microtime_float(); - $continue = TRUE; while (!feof($pipes[1])) { $out = fgets($pipes[1], 1024); $ret .= $out; //echo $out; $now = stack_microtime_float(); ! if (($now-$start_time) > 0.3) { ! if ($continue) { ! $continue = FALSE; ! } ! // CTRL+C should be ASCII 3. ! //fwrite($pipes[0], chr(3)); ! fwrite($pipes[0], chr(27)."[13~"); ! fflush($pipes[0]); ! } } fclose($pipes[0]); - - //$end_time = stack_microtime_float(); - //$time_taken = $end_time - $start_time; - //echo "<br />Time taken: ".$time_taken; - fclose($pipes[1]); } else { --- 88,117 ---- fwrite($pipes[0], $strin); fwrite($pipes[0], $stack_cas['closeCommand']."\n\n"); + fflush($pipes[0]); $ret = ''; // read output from stdout $start_time = stack_microtime_float(); while (!feof($pipes[1])) { $out = fgets($pipes[1], 1024); + if ('' == $out) { + // PAUSE + usleep(1000); + } $ret .= $out; //echo $out; $now = stack_microtime_float(); ! // if (($now-$start_time) > 0.3) { ! // // CTRL+C should be ASCII 3. ! // //fwrite($pipes[0], chr(3)); ! // fwrite($pipes[0], chr(27)."[13~"); ! // fflush($pipes[0]); ! // } } fclose($pipes[0]); fclose($pipes[1]); + //$time_taken = $now-$start_time; + //echo "Start: $start_time<br >End: $now<br >Taken = $time_taken"; + } else { |
From: Juliette W. <jv...@us...> - 2005-06-14 16:34:06
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30619 Modified Files: Tag: frontend_dev question_bank.php Added Files: Tag: frontend_dev question_bank_util.php Log Message: Refactored some of the question bank code. Incomplete and could do with more testing. --- NEW FILE: question_bank_util.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * @author Laura Naismith L.N...@bh... * * * This file contains the logic of interactions with the site as * an editor of questions and the question bank. * * @package frontend * @subpackage Stack */ function stack_question_in_session() { if (array_key_exists('question',$_SESSION)) { return TRUE; } else { return FALSE; } } function stack_get_question_from_session() { $question = 'unknown'; // Get any $question from the current $_SESSION if (array_key_exists('question',$_SESSION)) { foreach ($stackQuestion as $qfield => $val) { if (array_key_exists($qfield,$_SESSION['question'])) { if ('' != $_SESSION['question'][$qfield]) { $question[$qfield] = $_SESSION['question'][$qfield]; } } } unset($_SESSION['question']); } return $question; } function stack_get_questionInst_from_session() { $questionInst = 'unknown'; // Get any $questionInst from the current $_SESSION if (array_key_exists('questionInst',$_SESSION)) { $questionInst=$_SESSION['questionInst']; unset($_SESSION['questionInst']); } return $questionInst; } function stack_get_question_from_post() { // Get any $_POSTED data // This should over write any $_SESSION data, as it may have been entered in a form. foreach( $stackQuestion as $qfield => $attribs) { if ( array_key_exists($qfield,$_POST) ) { if ('questionOptions' == $qfield) { $question[$qfield] = $_POST[$qfield]; } else if ('questionPotResp' == $qfield ) { $question[$qfield] = $_POST[$qfield]; } else if ( '' !=trim($_POST[$qfield]) ) { // We need this: all fields on form will be present in $_POST. $question[$qfield] = $_POST[$qfield]; } } } return $question; } // $source should be 'from database', 'new', 'session' or 'post' function stack_get_question($source) { if ('from_database' == $source) { $questionID = $_POST['questionID']; $question=stack_db_getquestion($questionID); } else if ('new' == $source) { $question['questionID']='0'; $question['questionAnsKey']='ans1'; } else if ('session' == $source) { $question = stack_get_question_from_session(); } else if ('post' == $source) { $stack_get_question_from_post(); } else { echo "Invalid arg to stack_get_question"; // Error! How are we handling these? } } ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.3 retrieving revision 1.3.2.4 diff -C2 -d -r1.3.2.3 -r1.3.2.4 *** question_bank.php 14 Jun 2005 16:01:04 -0000 1.3.2.3 --- question_bank.php 14 Jun 2005 16:33:56 -0000 1.3.2.4 *************** *** 35,38 **** --- 35,39 ---- include('html/javascripthead.html'); include('html/inputtool.html'); + include('question_bank_util.php'); $question = ''; *************** *** 65,123 **** // action = startover Begin again. - - include('html/pagehead.php'); ! ! // (2.1) edit, try or store. ! // There should be a question in the $POST or $SESSION if ('edit' == $action or 'mark' == $action or 'validate' == $action or 'store_in_db' == $action or 'store_new_db' == $action or 'try' == $action ! or 'new_version' == $action or 'export_xml' == $action) { ! ! // Get any $question from the current $_SESSION ! if (array_key_exists('question',$_SESSION)) ! { ! foreach ($stackQuestion as $qfield => $val) ! { ! if (array_key_exists($qfield,$_SESSION['question'])) ! { if ('' != $_SESSION['question'][$qfield]) ! { $question[$qfield] = $_SESSION['question'][$qfield];} ! } ! } ! unset($_SESSION['question']); ! } ! ! // Get any $questionInst from the current $_SESSION ! if (array_key_exists('questionInst',$_SESSION)) { ! $questionInst=$_SESSION['questionInst']; ! unset($_SESSION['questionInst']); ! } ! ! // Get any $_POSTED data ! // This should over write any $_SESSION data, as it may have been entered in a form. ! foreach( $stackQuestion as $qfield => $attribs) ! { ! if ( array_key_exists($qfield,$_POST) ) ! { ! if ('questionOptions' == $qfield) { ! $question[$qfield] = $_POST[$qfield]; ! } ! else if ('questionPotResp' == $qfield ) { ! $question[$qfield] = $_POST[$qfield]; ! } ! else if ( '' !=trim($_POST[$qfield]) ) { ! // We need this: all fields on form will be present in $_POST. ! $question[$qfield] = $_POST[$qfield]; ! } ! } ! } } // End (2.1) // (2.2) Get a question from the database. ! if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { $questionID = $_POST['questionID']; $question=stack_db_getquestion($questionID); --- 66,106 ---- // action = startover Begin again. include('html/pagehead.php'); ! ! $get_question = FALSE; ! if ('edit' == $action or 'mark' == $action or 'validate' == $action or 'store_in_db' == $action or 'store_new_db' == $action or 'try' == $action ! or 'new_version' == $action or 'export_xml' == $action) { ! $get_question = TRUE; ! } ! ! $get_question_from_database = FALSE; ! ! if ('edit_from_db'==$action or 'try_from_db'==$action or 'export_xml_db'==$action) { ! $get_question_from_database = TRUE; ! } ! $get_new_question = FALSE; ! ! if ('start_new' == $action) { ! $get_new_question = TRUE; ! } ! // (2.1) edit, try or store. ! // There should be a question in the $POST or $SESSION ! if ($get_question) { + // $_POSTED data should over write any $_SESSION data, as it may have been + // entered in a form. + $question = stack_get_question_from_session(); + $questionInst = stack_get_questionInst_from_session(); + $question = stack_get_question_from_post(); } + // End (2.1) // (2.2) Get a question from the database. ! if ($get_question_from_database) { $questionID = $_POST['questionID']; $question=stack_db_getquestion($questionID); *************** *** 126,130 **** // (2.3) Provide a minimal blank question ! if ('start_new' == $action) { $question['questionID']='0'; $question['questionAnsKey']='ans1'; --- 109,113 ---- // (2.3) Provide a minimal blank question ! if ($get_new_question) { $question['questionID']='0'; $question['questionAnsKey']='ans1'; |
From: Juliette W. <jv...@us...> - 2005-06-14 16:01:19
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127 Modified Files: Tag: frontend_dev question_bank.php Added Files: Tag: frontend_dev import_question_screen.php Log Message: Separated off import question screen into another file. --- NEW FILE: import_question_screen.php --- <?php /* * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * @author Laura Naismith L.N...@bh... * * @package Stack */ /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, $user and $username /////////////////////////////////////////////////////////////// include('stackstd.php'); $default_action = ''; include($stack_root.'/frontend_general/process_input.php'); ////////////////////////////////////////////////////////////// // (2) Print the page. ////////////////////////////////////////////////////////////// include('html/pagehead.php'); if ('upload_xml_file' == $action) { echo nsf($errors,'upload_xml_file'); echo "Select a file to upload and edit: <br /> <form enctype='multipart/form-data' action=\"question_bank.php\"' method='POST'><br />\n <input type ='file' name='xmlfile' />\n <input type ='hidden' name='action' value='upload_xml_file' /> <input type ='submit' name='go' value='Upload'> </form>\n\n"; } include('html/pagefoot.php'); ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** question_bank.php 14 Jun 2005 15:50:05 -0000 1.3.2.2 --- question_bank.php 14 Jun 2005 16:01:04 -0000 1.3.2.3 *************** *** 65,74 **** // action = startover Begin again. ! if (isset($_POST['action'])) ! {$action=$_POST['action'];} ! else if (isset($_GET['action'])) ! {$action=$_GET['action'];} ! else ! {$action='startover';} include('html/pagehead.php'); --- 65,69 ---- // action = startover Begin again. ! include('html/pagehead.php'); *************** *** 466,483 **** } - if ('upload_xml_file' == $action) { - echo nsf($errors,'upload_xml_file'); - - $PostTo=$_PHP_SELF; - echo "Select a file to upload and edit: - <br /> - <form enctype='multipart/form-data' action='$_PHP_SELF' method='POST'><br />\n - <input type ='file' name='xmlfile' />\n - <input type ='hidden' name='action' value='upload_xml_file' /> - <input type ='submit' name='go' value='Upload'> - </form>\n\n"; - } - - include('html/pagefoot.php'); --- 461,464 ---- |
From: Juliette W. <jv...@us...> - 2005-06-14 16:01:18
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127/html Modified Files: Tag: frontend_dev admin-menu.txt Log Message: Separated off import question screen into another file. Index: admin-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/admin-menu.txt,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -C2 -d -r1.8.2.3 -r1.8.2.4 *** admin-menu.txt 14 Jun 2005 15:11:39 -0000 1.8.2.3 --- admin-menu.txt 14 Jun 2005 16:01:03 -0000 1.8.2.4 *************** *** 4,8 **** .Questions|question_bank.php ..New|question_bank.php?action=start_new ! ..Import|question_bank.php?action=upload_xml_file .Quizzes|editquiz.php?action=quiz_choose ..Quiz|editquiz.php?action=quiz_new --- 4,8 ---- .Questions|question_bank.php ..New|question_bank.php?action=start_new ! ..Import|import_question_screen.php?action=upload_xml_file .Quizzes|editquiz.php?action=quiz_choose ..Quiz|editquiz.php?action=quiz_new |