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 ---- |