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: pkiddie <pk...@us...> - 2005-08-22 17:20:34
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3139/lang/en/doc Modified Files: Tag: development_xmlrqp about_install.php en_doc.php Log Message: Code comments added Schema version checking added to index.php Index: about_install.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/about_install.php,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -C2 -d -r1.2.2.3 -r1.2.2.4 *** about_install.php 3 Aug 2005 17:02:22 -0000 1.2.2.3 --- about_install.php 22 Aug 2005 17:20:18 -0000 1.2.2.4 *************** *** 11,20 **** * @subpackage Stack ! * */ ! //Check to see whether user has moved stackstd.php.dist in the first instance, as we use some variables for this - most notably the home page of the newly set up ! //STACK script if (file_exists('../../../stackstd.php')) { --- 11,23 ---- * @subpackage Stack ! * - Check for the existence of stackstd.php before using any of its variables. ! ! * - Small wording alterations ! ! * - CVS module listed here, as this is important information that may not be retrieved from stackstd.php if it has not been moved */ ! //Check to see whether user has moved stackstd.php.dist in the first instance if (file_exists('../../../stackstd.php')) { *************** *** 24,29 **** $stack_ver['cvsmodule'] = 'stack-1-0'; - - ?> --- 27,30 ---- *************** *** 676,679 **** --- 677,681 ---- <?php + //Does this variable point to a valid web URL? if (isset($stack_web_url)) { Index: en_doc.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/en_doc.php,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -d -r1.6.2.1 -r1.6.2.2 *** en_doc.php 16 Aug 2005 22:43:29 -0000 1.6.2.1 --- en_doc.php 22 Aug 2005 17:20:18 -0000 1.6.2.2 *************** *** 7,10 **** --- 7,14 ---- * + * - Preliminary stackQuestion metadata documentation + + * - Preliminary stackQuiz metadata documentation + * @package documentation |
From: Chris S. <san...@us...> - 2005-08-19 22:13:24
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19854 Modified Files: Tag: development_xmlrqp quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.25.2.4 retrieving revision 1.25.2.5 diff -C2 -d -r1.25.2.4 -r1.25.2.5 *** quiz.php 16 Aug 2005 16:04:08 -0000 1.25.2.4 --- quiz.php 19 Aug 2005 22:13:14 -0000 1.25.2.5 *************** *** 70,73 **** --- 70,75 ---- // action = solutions Mark the response to *every question* then show the solutions // This prevents further attempts + // action = review Review a student's quiz, as the teacher. + // If there is a quiz stored in the $_SESSION, we should use this. *************** *** 106,110 **** // (4.3) construct the $quiz ! if ('continue_quiz' == $action or 'new_quiz_version' == $action) { // Clear any existing quiz and quizInst from the $_SESSION session_unregister('quizInst'); --- 108,112 ---- // (4.3) construct the $quiz ! if ('continue_quiz' == $action or 'new_quiz_version' == $action or 'review' == $action) { // Clear any existing quiz and quizInst from the $_SESSION session_unregister('quizInst'); *************** *** 153,159 **** } } // (4.5) Reconstruct $quizInst from previous data ! if ('continue_quiz' == $action) { $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$user['id']); --- 155,166 ---- } } + + if ('review' == $action) { + $student_user = $_POST['userid']; + $user = stack_db_user_get_ID($student_user); + } // (4.5) Reconstruct $quizInst from previous data ! if ('continue_quiz' == $action or 'review' == $action) { $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$user['id']); *************** *** 498,501 **** --- 505,511 ---- $title = get_string('TrySTACKQuiz','stack','').": {$user['firstname']} {$user['lastname']} ({$user['username']})"; + if ('review' == $action) { + $title = get_string('ReviewSTACKQuiz','stack','').": {$user['firstname']} {$user['lastname']} ({$user['username']})"; + } // TODO : The second argument needs to be 'MathML' when required *************** *** 584,588 **** } else { //unfocus ! if ('solutions' != $action) { echo "<a href=\"javascript:takeaction('focus',$key);\">".get_string('Focus','stack','')."</a> "; } --- 594,598 ---- } else { //unfocus ! if ('solutions' != $action and 'review' != $action) { echo "<a href=\"javascript:takeaction('focus',$key);\">".get_string('Focus','stack','')."</a> "; } *************** *** 597,601 **** } ! if ('solutions' != $action) { echo" <a href=\"javascript:takeaction('validate',0);\">".get_string('Validate','stack','')."</a>  <a href=\"javascript:takeaction('mark_question',$key);\">".get_string('MarkThisQ','stack','')."</a>  "; --- 607,611 ---- } ! if ('solutions' != $action and 'review' != $action) { echo" <a href=\"javascript:takeaction('validate',0);\">".get_string('Validate','stack','')."</a>  <a href=\"javascript:takeaction('mark_question',$key);\">".get_string('MarkThisQ','stack','')."</a>  "; *************** *** 620,624 **** } ! if ('solutions' != $action and TRUE != $duedate_passed) { $RA = $this_attempt['RawAns']; echo stack_question_inst_try_formfrag($RA,"RawAns[$key]"); --- 630,634 ---- } ! if ('solutions' != $action and TRUE != $duedate_passed and 'review' != $action) { $RA = $this_attempt['RawAns']; echo stack_question_inst_try_formfrag($RA,"RawAns[$key]"); *************** *** 629,632 **** --- 639,651 ---- stack_question_inst_show_sol($qInst,$errors); } + + // Show a review table. + if ('review' == $action) { + echo "<p><table bgcolor='#CCCCCC' width='100%' cellpadding='2'><tr><td>"; + stack_question_inst_show_attempts($qInst,$errors); + echo "</td></tr><tr><td><b>".get_string('QTestQuestionNote','stack','')."</b> ".nsf($qInst,'questionNoteInst'); + echo "</td></tr></table></p>"; + stack_question_inst_show_sol($qInst,$errors); + } } // End of feedback & errors *************** *** 666,670 **** echo "<table>\n"; ! if ('solutions' != $action) { if ($focus) { --- 685,689 ---- echo "<table>\n"; ! if ('solutions' != $action and 'review' != $action) { if ($focus) { *************** *** 683,687 **** } ! if ('Practice' == $quizmode) { echo " <tr><td><a href=\"javascript:takeaction('solutions',0);\">".get_string('Solutions','stack','')."</a></td> <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n --- 702,706 ---- } ! if ('Practice' == $quizmode and 'review' != $action) { echo " <tr><td><a href=\"javascript:takeaction('solutions',0);\">".get_string('Solutions','stack','')."</a></td> <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n *************** *** 691,697 **** } ! echo "<tr><td nowrap='nowrap'><a href=\"index.php?action=choose_quiz\">".get_string('ChooseQuiz','stack','')."</a></td> ! <td>".get_string('ClickHereTryQuiz','stack','')."</td></tr>\n ! <tr><td><a href='index.php?action=choose_quiz'>".get_string('Home','stack','')."</a></td> <td>".get_string('STACKHomePage','stack','')."</td></tr>\n"; echo "</table>"; --- 710,714 ---- } ! echo "<tr><td><a href='index.php?action=choose_quiz'>".get_string('Home','stack','')."</a></td> <td>".get_string('STACKHomePage','stack','')."</td></tr>\n"; echo "</table>"; |
From: Chris S. <san...@us...> - 2005-08-19 22:13:24
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19854/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackQuestion.php stackQuiz.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5.2.8 retrieving revision 1.5.2.9 diff -C2 -d -r1.5.2.8 -r1.5.2.9 *** stackQuiz.php 19 Aug 2005 19:49:31 -0000 1.5.2.8 --- stackQuiz.php 19 Aug 2005 22:13:15 -0000 1.5.2.9 *************** *** 231,234 **** --- 231,235 ---- */ function stack_quiz_report($quizid) { + global $stack_web_url; // Get the particular quiz, without hidden questions. *************** *** 283,287 **** $username = $this_user['name']; echo "<tr>\n"; ! echo ' <td>'.$username."</td>\n"; $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$userid); --- 284,288 ---- $username = $this_user['name']; echo "<tr>\n"; ! echo " <td><a href=\"javascript:quizreview('$userid','$quizid');\">$username</a></td>\n"; $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$userid); *************** *** 328,360 **** echo "<h1>Question summary</h1>"; if (is_array($quiz_res)) { // The top level is the question level. ! foreach ($quiz_res as $key => $marks) { $question = $quiz_questions_source[$key]; $qn = $key+1; ! echo "<p><b>Question ".$qn."</b> "; $noatt = count($marks); ! // Mean ! $tot = 0; ! foreach ($marks as $mark) { ! $tot += $mark; ! } ! $average = round($tot/$noatt,4); ! ! // Varience. ! $var = 0; ! foreach ($marks as $mark) { ! $var += pow($average-$mark,2); ! } ! $var = round(pow($var,0.5),4); ! ! echo "Number of attempts: $noatt. mean: $average, variance: $var"; ! echo "<br .>{$question['questionName']}, {$question['questionDescription']}"; echo "</p>\n"; } --- 329,402 ---- + echo "<script language=\"javascript\"> + function quizreview(u,n) { + document.forms.quiztryform.userid.value = u; + document.forms.quiztryform.quizid.value = n; + document.forms.quiztryform.submit(); + } + </script> + <p>\n<form name='quiztryform' action='{$stack_web_url}quiz.php' method='POST'> + <input type='hidden' name='quizid' value='-1' /> + <input type='hidden' name='userid' value='-1' /> + <input type='hidden' name='action' value='review' /> + </form>"; + + echo "<h1>Question summary</h1>"; + echo "<script language=\"javascript\"> + function q_analysis(q) { + document.forms.analysisform.questionID.value = q; + document.forms.analysisform.submit(); + } + </script> + <p>\n<form name='analysisform' action='{$stack_web_url}analysis.php' method='POST'> + <input type='hidden' name='questionID' value='-1' /> + <input type='hidden' name='userID' value='(any)' /> + <input type='hidden' name='actionreq' value='any' /> + <input type='hidden' name='Valid' value='any' /> + <input type='hidden' name='RawMark' value='any' /> + <input type='hidden' name='StartTime' value='' /> + <input type='hidden' name='EndTime' value='' /> + <input type='hidden' name='action' value='Analysis' /> + </form>"; + if (is_array($quiz_res)) { // The top level is the question level. ! foreach ($quiz_questions as $key => $qid) { ! $marks = array(); ! if (array_key_exists($key,$quiz_res)) { ! $marks = $quiz_res[$key]; ! } ! $question = $quiz_questions_source[$key]; $qn = $key+1; ! echo " <b><a href=\"javascript:q_analysis('$qid');\">Question $qn.</a></b>\n"; $noatt = count($marks); ! if ( 0 != $noatt) { ! // Mean ! $tot = 0; ! foreach ($marks as $mark) { ! $tot += $mark; ! } ! $average = round($tot/$noatt,4); ! ! // Varience. ! $var = 0; ! foreach ($marks as $mark) { ! $var += pow($average-$mark,2); ! } ! $var = round(pow($var,0.5),4); ! ! echo "Number of attempts: $noatt. mean: $average, variance: $var"; ! } else { ! echo "Number of attempts: 0"; ! } ! ! echo "<br />{$question['questionName']}, {$question['questionDescription']}"; echo "</p>\n"; } Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.11 retrieving revision 1.29.2.12 diff -C2 -d -r1.29.2.11 -r1.29.2.12 *** stackAuthor.php 19 Aug 2005 14:05:14 -0000 1.29.2.11 --- stackAuthor.php 19 Aug 2005 22:13:15 -0000 1.29.2.12 *************** *** 1,1405 **** <?php - /** - * Functions which deal with authoring questions and quizzes. These only need to be - * loaded when an edit page needs to be generated. - * - [...3257 lines suppressed...] echo "\n</table>\n\n\n"; } /** * Display the name of a quizField, in a link generating a popup window. * * @param string $field The field name * @return string The link to the popup window */ function stack_quiz_edit_dispquizfield($field) { global $stackQuiz; $fd='stackQuiz_'.$field; $fd=get_string($fd,'stack',''); $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuiz');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; return($strout); } ?> Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30.2.15 retrieving revision 1.30.2.16 diff -C2 -d -r1.30.2.15 -r1.30.2.16 *** stackQuestion.php 19 Aug 2005 19:49:31 -0000 1.30.2.15 --- stackQuestion.php 19 Aug 2005 22:13:15 -0000 1.30.2.16 *************** *** 2061,2065 **** $ws=$questionInst['questionSolInst']; } ! echo "<hr /><p>"; print_string('TeacherAnsIs','stack',''); echo $questionInst['questionAnsInst']['display']; --- 2061,2065 ---- $ws=$questionInst['questionSolInst']; } ! echo '<p>'; print_string('TeacherAnsIs','stack',''); echo $questionInst['questionAnsInst']['display']; *************** *** 2079,2083 **** if (array_key_exists('questionAttempts',$questionInst)) { // Print out all attempts at this question. ! echo "<hr /><p><b>".get_string('YourAttemptsWere','stack',''); echo "</b></p>\n\n<p><table border='1' cellpadding='2'><tr>"; --- 2079,2083 ---- if (array_key_exists('questionAttempts',$questionInst)) { // Print out all attempts at this question. ! echo "<p><b>".get_string('YourAttemptsWere','stack',''); echo "</b></p>\n\n<p><table border='1' cellpadding='2'><tr>"; *************** *** 2113,2117 **** echo "</table></p>\n\n"; } else { ! echo "<hr /><p><b>".get_string('NoAttemptsAtQ','stack','')."</b></p>"; } } --- 2113,2117 ---- echo "</table></p>\n\n"; } else { ! echo "<p><b>".get_string('NoAttemptsAtQ','stack','')."</b></p>"; } } |
From: Chris S. <san...@us...> - 2005-08-19 22:13:24
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19854/lang/en Modified Files: Tag: development_xmlrqp stack.php Log Message: Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/stack.php,v retrieving revision 1.16.2.3 retrieving revision 1.16.2.4 diff -C2 -d -r1.16.2.3 -r1.16.2.4 *** stack.php 16 Aug 2005 15:51:35 -0000 1.16.2.3 --- stack.php 19 Aug 2005 22:13:15 -0000 1.16.2.4 *************** *** 12,15 **** --- 12,16 ---- $string['TrySTACKQuiz'] = 'Try a STACK quiz'; + $string['ReviewSTACKQuiz'] = 'Review a STACK quiz'; $string['STACKHomePage'] = 'STACK home page'; $string['Home'] = 'Home'; *************** *** 86,90 **** $string['TeacherAnsIs'] = 'The teacher\'s answer is'; ! $string['ThisCanDisplay'] = 'This can be displayed as'; $string['WorkedSolution'] = 'Worked solution'; $string['NoSolution'] = '[No solution available]'; --- 87,91 ---- $string['TeacherAnsIs'] = 'The teacher\'s answer is'; ! $string['ThisCanDisplay'] = 'This can be entered as'; $string['WorkedSolution'] = 'Worked solution'; $string['NoSolution'] = '[No solution available]'; |
From: Chris S. <san...@us...> - 2005-08-19 19:49:45
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20263/scripts Modified Files: Tag: development_xmlrqp stackCAS.php stackDatabase.php stackQuestion.php stackQuiz.php stackUser.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5.2.7 retrieving revision 1.5.2.8 diff -C2 -d -r1.5.2.7 -r1.5.2.8 *** stackQuiz.php 19 Aug 2005 14:05:14 -0000 1.5.2.7 --- stackQuiz.php 19 Aug 2005 19:49:31 -0000 1.5.2.8 *************** *** 1,450 **** <?php - - /** - * This file contains most functions which deal with quizzes. - * - * @package scripts - * @subpackage Stack - */ - - /** - * - */ - // 'Unique quiz ID - local mySQL value' - $stackQuiz['quizid']['descript'] = 'Quiz ID number'; - $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; - $stackQuiz['quizid']['type'] = 'meta'; - - // 'Quiz name' - $stackQuiz['quizName']['descript'] = 'Quiz name'; - $stackQuiz['quizName']['mysql'] = 'TINYTEXT'; - $stackQuiz['quizName']['type'] = 'meta'; - $stackQuiz['quizName']['metatag'] = 'title'; //dc:title - $stackQuiz['quizName']['metatype'] = 'dublincore'; - - // 'Quiz description' - $stackQuiz['quizDescription']['descript'] = 'Description'; - $stackQuiz['quizDescription']['mysql'] = 'TINYTEXT'; - $stackQuiz['quizDescription']['type'] = 'meta'; - $stackQuiz['quizDescription']['metatag'] = 'description'; //dc:description - $stackQuiz['quizDescription']['metatype'] = 'dublincore'; - - // 'Quiz options' - $stackQuiz['quizOptions']['descript'] = 'Quiz options'; - $stackQuiz['quizOptions']['mysql'] = 'TEXT'; - $stackQuiz['quizOptions']['type'] = 'other'; - - // 'Quiz due date' - $stackQuiz['quizDueDate']['descript'] = 'Due date'; - $stackQuiz['quizDueDate']['mysql'] = 'int(10)'; - $stackQuiz['quizDueDate']['type'] = 'date'; - - // 'Quiz mode' - $stackQuiz['quizMode']['descript'] = 'Mode'; - $stackQuiz['quizMode']['mysql'] = 'TINYTEXT'; - $stackQuiz['quizMode']['type'] = 'string'; - - //<PDK> Quiz Metadata added - database updated - // 'Globally unique quiz ID'; - $stackQuiz['quizGUID']['required'] = 'system'; - $stackQuiz['quizGUID']['mysql'] = 'CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters - $stackQuiz['quizGUID']['type'] = 'meta'; - $stackQuiz['quizGUID']['metatag'] = 'identifier'; - $stackQuiz['quizGUID']['metatype'] = 'dublincore'; - - // 'Keywords'; - $stackQuiz['quizKeywords']['required'] = 'optional'; - $stackQuiz['quizKeywords']['mysql'] = 'TINYTEXT'; - $stackQuiz['quizKeywords']['type'] = 'meta'; - $stackQuiz['quizKeywords']['metatag'] = 'keyword'; //lom:keyword - $stackQuiz['quizKeywords']['metatype'] = 'lom'; ! ! $stackQuiz['quizKeywords']['descript'] = 'Keywords'; //<PDK>Need for display purposes ! ! // 'Last edited by'; - $stackQuiz['quizUserLastEdited']['required']='system'; - $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; - $stackQuiz['quizUserLastEdited']['type']='meta'; - $stackQuiz['quizUserLastEdited']['metatag']='creator'; //dc:creator - $stackQuiz['quizUserLastEdited']['metatype']='dublincore'; - - // 'Last edited on'; - $stackQuiz['quizDateLastEdited']['required']='system'; - $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; - $stackQuiz['quizDateLastEdited']['type']='meta'; - $stackQuiz['quizDateLastEdited']['metatag']='date'; //dc:date - $stackQuiz['quizDateLastEdited']['metatype']='dublincore'; - - //Publisher - $stackQuiz['quizPublisher']['required']='system'; - $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; - $stackQuiz['quizPublisher']['type']='meta'; - $stackQuiz['quizPublisher']['metatag']='publisher'; //dc:publisher - $stackQuiz['quizPublisher']['metatype']='dublincore'; - - //Type: Hidden from user - $stackQuiz['type']['values']=array('quiz','quiz'); //Default to 'type' enumeration in XSD file - $stackQuiz['type']['required']='optional'; - $stackQuiz['type']['mysql']='TINYTEXT'; - $stackQuiz['type']['type']='meta'; - $stackQuiz['type']['metatag']='type'; //dc:type - $stackQuiz['type']['metatype']='dublincore'; - - //Format: Hidden from user, selected by script - $stackQuiz['quizFormat']['values']=array('application','audio','image', - 'message','model','text','video', - 'multipart'); - $stackQuiz['quizFormat']['required']='optional'; - $stackQuiz['quizFormat']['mysql']='TINYTEXT'; - $stackQuiz['quizFormat']['type']='meta'; //dc:format - $stackQuiz['quizFormat']['metatag']='format'; - $stackQuiz['quizFormat']['metatype']='dublincore'; - - //Language: Defaulted to current system language, but user definable - $stackQuiz['quizLanguage']['values']=array('en','fr','nl','es','unspecified'); - $stackQuiz['quizLanguage']['required']='optional'; - $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; - $stackQuiz['quizLanguage']['type']='meta'; - $stackQuiz['quizLanguage']['metatag']='language'; //dc:language - $stackQuiz['quizLanguage']['metatype']='dublincore'; - $stackQuiz['quizLanguage']['default']=$stack_defaultlang; //take the default language; - - //Rights - $stackQuiz['quizRights']['required']='optional'; - $stackQuiz['quizRights']['mysql']='TEXT'; - $stackQuiz['quizRights']['type']='meta'; - $stackQuiz['quizRights']['metatag']='rights'; //dc:rights - $stackQuiz['quizRights']['metatype']='dublincore'; - $stackQuiz['quizRights']['default']='http://www.gnu.org/copyleft/gpl.html'; - - //Learning context: Defaulted to system context, but user definable - $stackQuiz['quizLearningContext']['values']=array('Primary Education','Secondary Education','Higher Education', - 'University First Cycle','University Second Cycle','University Post Grade', - 'Technical School First Cycle','Technical School Second Cycle','Professional Formation', - 'Continuous Formation','Vocational Training','unspecified'); - $stackQuiz['quizLearningContext']['required']='optional'; - $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; - $stackQuiz['quizLearningContext']['type']='meta'; - $stackQuiz['quizLearningContext']['metatag']='context'; //lom:context - $stackQuiz['quizLearningContext']['metatype']='lom'; - $stackQuiz['quizLearningContext']['default']='unspecified'; - - //Difficulty: Default to null - up to user to specify this - $stackQuiz['quizDifficulty']['values']=array('Very Easy','Easy','Medium', - 'Difficult','Very Difficult','unspecified'); - $stackQuiz['quizDifficulty']['required']='optional'; - $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; - $stackQuiz['quizDifficulty']['type']='meta'; - $stackQuiz['quizDifficulty']['metatag']='difficulty'; //lom:difficulty - $stackQuiz['quizDifficulty']['metatype']='lom'; - $stackQuiz['quizDifficulty']['default']='unspecified'; - - //Competency: Default to solve - then up to user - $stackQuiz['quizCompetency']['values']=array('think','argue','solve', - 'represent','language','communicate', - 'tools','unspecified'); - $stackQuiz['quizCompetency']['required']='optional'; - $stackQuiz['quizCompetency']['mysql']='TINYTEXT'; - $stackQuiz['quizCompetency']['type']='meta'; - $stackQuiz['quizCompetency']['metatag']='competency'; - $stackQuiz['quizCompetency']['metatype']='stack'; //competency - $stackQuiz['quizCompetency']['default']='unspecified'; - - //CompetencyLevel: Default to null - then up to user - $stackQuiz['quizCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', - 'complex','unspecified'); - $stackQuiz['quizCompetencyLevel']['required']='optional'; - $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; - $stackQuiz['quizCompetencyLevel']['type']='meta'; - $stackQuiz['quizCompetencyLevel']['metatag']='competencylevel'; //competencylevel - $stackQuiz['quizCompetencyLevel']['metatype']='stack'; - $stackQuiz['quizCompetencyLevel']['default']='unspecified'; - - //Time to allocate: Default to null - then up to user - $stackQuiz['quizTimeAllocated']['required']='optional'; - $stackQuiz['quizTimeAllocated']['mysql']='TIME'; - $stackQuiz['quizTimeAllocated']['type']='meta'; - $stackQuiz['quizTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime - $stackQuiz['quizTimeAllocated']['metatype']='lom'; - $stackQuiz['quizTimeAllocated']['default']="00:00:00"; - - //Type of quiz: Default to algebraicExpression as that is only type of quiz atm, but provides extensibility - $stackQuiz['quizExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', - 'fillInBlank','unspecified'); - $stackQuiz['quizExcerciseType']['required']='optional'; - $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; - $stackQuiz['quizExcerciseType']['type']='meta'; - $stackQuiz['quizExcerciseType']['metatag']='excercisetype'; //excercisetype - $stackQuiz['quizExcerciseType']['metatype']='stack'; - $stackQuiz['quizExcerciseType']['default']='unspecified'; - - /** - * Displays the student quiz selection screen - * @param array $quize_store The list of quizzes - * @param $user - * @return void - */ - function stack_quiz_student_select($quiz_store, $user) { - global $stack_root; - - require_once("{$stack_root}/html/quizjava.html"); - echo "<h1>Please choose a quiz to try</h1>"; - global $stackQuiz; - if (is_array($quiz_store)) { - echo "<p>\n<form name='quizform' action='quiz.php' method='POST'> - <input type='hidden' name='quizid' value='-1'> - <input type='hidden' name='action' value='continue_quiz'>"; - echo "\n<table cellpadding='2'>\n"; - echo "\n<tr><th>{$stackQuiz['quizName']['descript']}</th><th>{$stackQuiz['quizDescription']['descript']}</th><th>Last mark (%)</th><th>{$stackQuiz['quizDueDate']['descript']}</th></tr>"; - foreach ($quiz_store as $qs => $quiz) { - $qname = $quiz['quizName']; - $qID = $quiz['quizid']; - $mark = '-'; - if (is_array($user)) { - if (array_key_exists('id',$user)) { - $userinfo = stack_db_quiz_quizattempt_getlast($qID,$user['id']); - if (is_array($userinfo)) { - if (NULL != $userinfo['mark']) { - $mark = round(100*$userinfo['mark']/$userinfo['maxmark'],2); - } - } - } - } - - echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; - echo "<td>".$quiz['quizDescription']."</td><td align='center'>$mark</td>\n"; - if ('' != $quiz['quizDueDate']) { - echo "<td>".stack_time_display($quiz['quizDueDate'])."</td>"; - } - echo "</tr>\n"; - } - echo "\n</table>\n</form>\n</p>"; } else { - echo "<p>You have no quizzes available to try.</p>"; } } //<TODO: to be implemented> /** --- 1,370 ---- <?php /** * This file contains most functions which deal with quizzes. * * @package scripts * @subpackage Stack */ /** * */ // 'Unique quiz ID - local mySQL value' $stackQuiz['quizid']['descript'] = 'Quiz ID number'; $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; $stackQuiz['quizid']['type'] = 'meta'; // 'Quiz name' $stackQuiz['quizName']['descript'] = 'Quiz name'; $stackQuiz['quizName']['mysql'] = 'TINYTEXT'; $stackQuiz['quizName']['type'] = 'meta'; $stackQuiz['quizName']['metatag'] = 'title'; //dc:title $stackQuiz['quizName']['metatype'] = 'dublincore'; // 'Quiz description' $stackQuiz['quizDescription']['descript'] = 'Description'; $stackQuiz['quizDescription']['mysql'] = 'TINYTEXT'; $stackQuiz['quizDescription']['type'] = 'meta'; $stackQuiz['quizDescription']['metatag'] = 'description'; //dc:description $stackQuiz['quizDescription']['metatype'] = 'dublincore'; // 'Quiz options' $stackQuiz['quizOptions']['descript'] = 'Quiz options'; $stackQuiz['quizOptions']['mysql'] = 'TEXT'; $stackQuiz['quizOptions']['type'] = 'other'; // 'Quiz due date' $stackQuiz['quizDueDate']['descript'] = 'Due date'; $stackQuiz['quizDueDate']['mysql'] = 'int(10)'; $stackQuiz['quizDueDate']['type'] = 'date'; // 'Quiz mode' $stackQuiz['quizMode']['descript'] = 'Mode'; $stackQuiz['quizMode']['mysql'] = 'TINYTEXT'; $stackQuiz['quizMode']['type'] = 'string'; //<PDK> Quiz Metadata added - database updated // 'Globally unique quiz ID'; $stackQuiz['quizGUID']['required'] = 'system'; $stackQuiz['quizGUID']['mysql'] = 'CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters $stackQuiz['quizGUID']['type'] = 'meta'; $stackQuiz['quizGUID']['metatag'] = 'identifier'; $stackQuiz['quizGUID']['metatype'] = 'dublincore'; // 'Keywords'; $stackQuiz['quizKeywords']['required'] = 'optional'; $stackQuiz['quizKeywords']['mysql'] = 'TINYTEXT'; $stackQuiz['quizKeywords']['type'] = 'meta'; $stackQuiz['quizKeywords']['metatag'] = 'keyword'; //lom:keyword $stackQuiz['quizKeywords']['metatype'] = 'lom'; ! $stackQuiz['quizKeywords']['descript'] = 'Keywords'; //<PDK>Need for display purposes // 'Last edited by'; $stackQuiz['quizUserLastEdited']['required']='system'; $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; $stackQuiz['quizUserLastEdited']['type']='meta'; $stackQuiz['quizUserLastEdited']['metatag']='creator'; //dc:creator $stackQuiz['quizUserLastEdited']['metatype']='dublincore'; // 'Last edited on'; $stackQuiz['quizDateLastEdited']['required']='system'; $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; $stackQuiz['quizDateLastEdited']['type']='meta'; $stackQuiz['quizDateLastEdited']['metatag']='date'; //dc:date $stackQuiz['quizDateLastEdited']['metatype']='dublincore'; //Publisher $stackQuiz['quizPublisher']['required']='system'; $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; $stackQuiz['quizPublisher']['type']='meta'; $stackQuiz['quizPublisher']['metatag']='publisher'; //dc:publisher $stackQuiz['quizPublisher']['metatype']='dublincore'; //Type: Hidden from user $stackQuiz['type']['values']=array('quiz','quiz'); //Default to 'type' enumeration in XSD file $stackQuiz['type']['required']='optional'; $stackQuiz['type']['mysql']='TINYTEXT'; $stackQuiz['type']['type']='meta'; $stackQuiz['type']['metatag']='type'; //dc:type $stackQuiz['type']['metatype']='dublincore'; //Format: Hidden from user, selected by script $stackQuiz['quizFormat']['values']=array('application','audio','image', 'message','model','text','video', 'multipart'); $stackQuiz['quizFormat']['required']='optional'; $stackQuiz['quizFormat']['mysql']='TINYTEXT'; $stackQuiz['quizFormat']['type']='meta'; //dc:format $stackQuiz['quizFormat']['metatag']='format'; $stackQuiz['quizFormat']['metatype']='dublincore'; //Language: Defaulted to current system language, but user definable $stackQuiz['quizLanguage']['values']=array('en','fr','nl','es','unspecified'); $stackQuiz['quizLanguage']['required']='optional'; $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; $stackQuiz['quizLanguage']['type']='meta'; $stackQuiz['quizLanguage']['metatag']='language'; //dc:language $stackQuiz['quizLanguage']['metatype']='dublincore'; $stackQuiz['quizLanguage']['default']=$stack_defaultlang; //take the default language; //Rights $stackQuiz['quizRights']['required']='optional'; $stackQuiz['quizRights']['mysql']='TEXT'; $stackQuiz['quizRights']['type']='meta'; $stackQuiz['quizRights']['metatag']='rights'; //dc:rights $stackQuiz['quizRights']['metatype']='dublincore'; $stackQuiz['quizRights']['default']='http://www.gnu.org/copyleft/gpl.html'; //Learning context: Defaulted to system context, but user definable $stackQuiz['quizLearningContext']['values']=array('Primary Education','Secondary Education','Higher Education', 'University First Cycle','University Second Cycle','University Post Grade', 'Technical School First Cycle','Technical School Second Cycle','Professional Formation', 'Continuous Formation','Vocational Training','unspecified'); $stackQuiz['quizLearningContext']['required']='optional'; $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; $stackQuiz['quizLearningContext']['type']='meta'; $stackQuiz['quizLearningContext']['metatag']='context'; //lom:context $stackQuiz['quizLearningContext']['metatype']='lom'; $stackQuiz['quizLearningContext']['default']='unspecified'; //Difficulty: Default to null - up to user to specify this $stackQuiz['quizDifficulty']['values']=array('Very Easy','Easy','Medium', 'Difficult','Very Difficult','unspecified'); $stackQuiz['quizDifficulty']['required']='optional'; $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; $stackQuiz['quizDifficulty']['type']='meta'; $stackQuiz['quizDifficulty']['metatag']='difficulty'; //lom:difficulty $stackQuiz['quizDifficulty']['metatype']='lom'; $stackQuiz['quizDifficulty']['default']='unspecified'; //Competency: Default to solve - then up to user $stackQuiz['quizCompetency']['values']=array('think','argue','solve', 'represent','language','communicate', 'tools','unspecified'); $stackQuiz['quizCompetency']['required']='optional'; $stackQuiz['quizCompetency']['mysql']='TINYTEXT'; $stackQuiz['quizCompetency']['type']='meta'; $stackQuiz['quizCompetency']['metatag']='competency'; $stackQuiz['quizCompetency']['metatype']='stack'; //competency $stackQuiz['quizCompetency']['default']='unspecified'; //CompetencyLevel: Default to null - then up to user $stackQuiz['quizCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', 'complex','unspecified'); $stackQuiz['quizCompetencyLevel']['required']='optional'; $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; $stackQuiz['quizCompetencyLevel']['type']='meta'; $stackQuiz['quizCompetencyLevel']['metatag']='competencylevel'; //competencylevel $stackQuiz['quizCompetencyLevel']['metatype']='stack'; $stackQuiz['quizCompetencyLevel']['default']='unspecified'; //Time to allocate: Default to null - then up to user $stackQuiz['quizTimeAllocated']['required']='optional'; $stackQuiz['quizTimeAllocated']['mysql']='TIME'; $stackQuiz['quizTimeAllocated']['type']='meta'; $stackQuiz['quizTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime $stackQuiz['quizTimeAllocated']['metatype']='lom'; $stackQuiz['quizTimeAllocated']['default']="00:00:00"; //Type of quiz: Default to algebraicExpression as that is only type of quiz atm, but provides extensibility $stackQuiz['quizExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', 'fillInBlank','unspecified'); $stackQuiz['quizExcerciseType']['required']='optional'; $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; $stackQuiz['quizExcerciseType']['type']='meta'; $stackQuiz['quizExcerciseType']['metatag']='excercisetype'; //excercisetype $stackQuiz['quizExcerciseType']['metatype']='stack'; $stackQuiz['quizExcerciseType']['default']='unspecified'; /** * Displays the student quiz selection screen * @param array $quize_store The list of quizzes * @param $user * @return void */ function stack_quiz_student_select($quiz_store, $user) { global $stack_root; require_once("{$stack_root}/html/quizjava.html"); echo "<h1>Please choose a quiz to try</h1>"; global $stackQuiz; if (is_array($quiz_store)) { echo "<p>\n<form name='quizform' action='quiz.php' method='POST'> <input type='hidden' name='quizid' value='-1'> <input type='hidden' name='action' value='continue_quiz'>"; echo "\n<table cellpadding='2'>\n"; echo "\n<tr><th>{$stackQuiz['quizName']['descript']}</th><th>{$stackQuiz['quizDescription']['descript']}</th><th>Last mark (%)</th><th>{$stackQuiz['quizDueDate']['descript']}</th></tr>"; foreach ($quiz_store as $qs => $quiz) { $qname = $quiz['quizName']; $qID = $quiz['quizid']; $mark = '-'; if (is_array($user)) { if (array_key_exists('id',$user)) { $userinfo = stack_db_quiz_quizattempt_getlast($qID,$user['id']); if (is_array($userinfo)) { if (NULL != $userinfo['mark']) { $mark = round(100*$userinfo['mark']/$userinfo['maxmark'],2); } } } } echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; echo "<td>".$quiz['quizDescription']."</td><td align='center'>$mark</td>\n"; if ('' != $quiz['quizDueDate']) { echo "<td>".stack_time_display($quiz['quizDueDate'])."</td>"; } echo "</tr>\n"; } echo "\n</table>\n</form>\n</p>"; + } else { + echo "<p>You have no quizzes available to try.</p>"; + } + } + + /** + * Displays on the screen the results of this quiz. + * @param int $quizID + * @return void + */ + function stack_quiz_report($quizid) { + + // Get the particular quiz, without hidden questions. + $quiz = stack_db_quiz_get($quizid,FALSE); + $quiz_options = $quiz['quizOptions']; + + echo "<h1>Quiz results: {$quiz['quizName']}</h1>"; + // Print a summary of the context of this quiz. + + // Get a list of questionIDs in this quiz + $quiz_questions = NULL; + if (array_key_exists('questions',$quiz)) { + if (is_array($quiz['questions'])) { + foreach ($quiz['questions'] as $key => $val) { + $quiz_questions[] = $val['questionID']; + $quiz_questions_source[] = stack_db_getquestion($val['questionID']); + } + } + } + if (NULL == $quiz_questions) { + echo 'There are no questions in this quiz! Please contact your administrator.'; + return NULL; + } + + // Obtain a list of users. + $stack_users = stack_user_listall(); + + if (is_array($stack_users)) { + + echo "\n<table border='1' cellpadding='2'>\n"; + echo " <tr>\n <th></th>\n"; + foreach ($quiz_questions as $key => $qID) { + $qn = $key+1; + echo " <th width='30'>".$qn."</th>\n"; + } // end foreach + echo " <th>Total</th>\n"; + echo " <th>%</th>\n</tr>\n"; + + echo " <tr>\n <th>Marks:</th>\n"; + $qtot = 0; + foreach ($quiz_questions as $key => $qID) { + $options = stack_options_set($quiz_questions_source[$key],$quiz_options); + $qn = $options['QuVal']; + echo ' <th>'.$qn."</th>\n"; + $qtot = $qtot + $qn; + } // end foreach + echo " <th>$qtot</th>\n</tr>\n"; + + + foreach ($stack_users as $user_no => $this_user) { + $userid = $this_user['id']; + $username = $this_user['name']; + echo "<tr>\n"; + echo ' <td>'.$username."</td>\n"; + $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$userid); + + if (is_array($userinfo)) { + // We have attempted the quiz before with + $seed = $userinfo['seed']; + + // Check if students have previously asked for solutions. + if ($userinfo['SolRequest']) { + + } + + // Now reconstruct the actual $quizInst + $quiz_attempts = array(); + $tot = 0; + foreach ($quiz_questions as $key => $qID) { + $options = stack_options_set($quiz_questions_source[$key],$quiz_options); + $question_attempts[$key] = stack_db_attempt_get($qID,$seed+$key,$userid,$errors); + if (is_array($question_attempts[$key])) { + $mark = stack_question_inst_calcmark($question_attempts[$key],$options['QuVal'],$options['MarkModMethod']); + $tot += $mark; + $quiz_res[$key][$user_no] = $mark; + } else { + $mark = '-'; + } + // Print out a row in the table. + + echo " <td align='center'>".$mark."</td>\n"; + } // end foreach + $percent = round(100*$tot/$qtot,2); + echo " <td align='center'>".$tot."</td>\n"; + echo " <td align='center'>".$percent."</td>\n"; + echo "</tr>\n"; + } + + + //show_array($question_attempts); + } + + echo "\n</table>\n"; } else { + echo "<p>You have no users in your database.</p>"; + } + echo "<h1>Question summary</h1>"; + + if (is_array($quiz_res)) { + + // The top level is the question level. + foreach ($quiz_res as $key => $marks) { + $question = $quiz_questions_source[$key]; + + $qn = $key+1; + + echo "<p><b>Question ".$qn."</b> "; + $noatt = count($marks); + + // Mean + $tot = 0; + foreach ($marks as $mark) { + $tot += $mark; + } + $average = round($tot/$noatt,4); + + // Varience. + $var = 0; + foreach ($marks as $mark) { + $var += pow($average-$mark,2); + } + $var = round(pow($var,0.5),4); + + echo "Number of attempts: $noatt. mean: $average, variance: $var"; + echo "<br .>{$question['questionName']}, {$question['questionDescription']}"; + echo "</p>\n"; } + + + } } + + //<TODO: to be implemented> /** *************** *** 462,469 **** if (is_array($quiz)) { ! //Perform quiz field level validation here } else { // $quiz is not an array $errors['quiz']=get_string('QValidquestionnotar','stack',''); } } --- 382,394 ---- if (is_array($quiz)) { ! //Perform quiz field level validation here ! if (array_key_exists('quizOptions',$quiz)) { ! stack_options_validate($quiz['quizOptions']); ! } } else { // $quiz is not an array $errors['quiz']=get_string('QValidquestionnotar','stack',''); } + + } *************** *** 471,473 **** ?> - --- 396,397 ---- Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.34.2.7 retrieving revision 1.34.2.8 diff -C2 -d -r1.34.2.7 -r1.34.2.8 *** stackDatabase.php 19 Aug 2005 14:05:14 -0000 1.34.2.7 --- stackDatabase.php 19 Aug 2005 19:49:31 -0000 1.34.2.8 *************** *** 588,598 **** $qu_data .= ',"'.$qu_add.'" '; } ! ! $qu_fields = substr($qu_fields, 1); //Strip initial comma ! $qu_data = substr($qu_data, 1); // Build the query $query .= ' ('.$qu_fields.') VALUES ('.$qu_data.')'; ! //print_r($query); } else {// update question --- 588,598 ---- $qu_data .= ',"'.$qu_add.'" '; } ! ! $qu_fields = substr($qu_fields, 1); //Strip initial comma ! $qu_data = substr($qu_data, 1); // Build the query $query .= ' ('.$qu_fields.') VALUES ('.$qu_data.')'; ! //print_r($query); } else {// update question *************** *** 1204,1212 **** $user[$stackUserKeys[$key]] = stripslashes($val); } - } ! if (array_key_exists('options',$user)) { ! $user['options'] = base64_unserialize($user['options']); ! } return $user; --- 1204,1212 ---- $user[$stackUserKeys[$key]] = stripslashes($val); } ! if (array_key_exists('options',$user)) { ! $user['options'] = base64_unserialize($user['options']); ! } ! } return $user; *************** *** 1472,1478 **** unset($quiz['quizDateLastEdited']); } ! if ($new_quiz) { ! $qu = ''; $quv = ''; --- 1472,1478 ---- unset($quiz['quizDateLastEdited']); } ! if ($new_quiz) { ! $qu = ''; $quv = ''; Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -C2 -d -r1.12 -r1.12.2.1 *** stackUser.php 25 Jul 2005 14:11:25 -0000 1.12 --- stackUser.php 19 Aug 2005 19:49:31 -0000 1.12.2.1 *************** *** 296,299 **** --- 296,323 ---- /** + * Returns a list of all users and returns them in an array + * + * @return array + */ + function stack_user_listall() { + $userlist = NULL; + + $query = 'SELECT id, username, firstname, lastname FROM stackUser'; + + $stack_users = stack_db_query($query); + + if(0 != mysql_num_rows($stack_users)) { + + for ($i = 0; $i < mysql_num_rows($stack_users); $i++) { + $row = mysql_fetch_row($stack_users); + $userlist[] = array('id'=>$row[0],'name'=>"{$row[1]} ({$row[2]} {$row[3]})"); + } + } + + return $userlist; + } + + + /** * Build the form fragment to produce a dropdown list of current users. * Note, this builds a whole table row. *************** *** 305,313 **** function stack_user_select_formfrag($userID,$anyUser=TRUE){ ! $query = 'SELECT id, username, firstname, lastname FROM stackUser'; ! ! $stack_users = stack_db_query($query); ! if(0 != mysql_num_rows($stack_users)) { echo "<tr><td>User ID</td>\n"; --- 329,335 ---- function stack_user_select_formfrag($userID,$anyUser=TRUE){ ! $stack_users = stack_user_listall(); ! if(is_array($stack_users)) { echo "<tr><td>User ID</td>\n"; *************** *** 329,339 **** } ! for ($i = 0; $i < mysql_num_rows($stack_users); $i++) ! { ! $row = mysql_fetch_row($stack_users); ! if ($row[0] == $userID) { ! echo " <option value=\"{$row[0]}\" selected>{$row[0]} {$row[1]} ({$row[2]} {$row[3]})</option>\n"; } else { ! echo " <option value=\"{$row[0]}\">{$row[0]} {$row[1]} ({$row[2]} {$row[3]})</option>\n"; } } --- 351,360 ---- } ! foreach ($stack_users as $theuser) { ! ! if ($theuser['id'] == $userID) { ! echo " <option value=\"{$theuser['id']}\" selected>{$theuser['name']}</option>\n"; } else { ! echo " <option value=\"{$theuser['id']}\">{$theuser['name']}</option>\n"; } } Index: stackCAS.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/Attic/stackCAS.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 *** stackCAS.php 19 Aug 2005 16:16:45 -0000 1.1.2.1 --- stackCAS.php 19 Aug 2005 19:49:31 -0000 1.1.2.2 *************** *** 306,310 **** $varCommand = CASAnsTestCmd($exp1, $exp2, $t, $disp, $test); - echo "<pre>".$varCommand."</pre>"; if ($varCommand != '') { --- 306,309 ---- Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30.2.14 retrieving revision 1.30.2.15 diff -C2 -d -r1.30.2.14 -r1.30.2.15 *** stackQuestion.php 19 Aug 2005 16:16:45 -0000 1.30.2.14 --- stackQuestion.php 19 Aug 2005 19:49:31 -0000 1.30.2.15 *************** *** 796,799 **** --- 796,800 ---- $errors['question']=get_string('QValidquestionnotar','stack',''); } + } |
From: Chris S. <san...@us...> - 2005-08-19 19:49:41
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20263 Modified Files: Tag: development_xmlrqp analysis.php editquiz.php question_bank.php Log Message: Index: analysis.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/analysis.php,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -d -r1.15 -r1.15.2.1 *** analysis.php 14 Jul 2005 07:27:03 -0000 1.15 --- analysis.php 19 Aug 2005 19:49:31 -0000 1.15.2.1 *************** *** 84,88 **** // Carry out the analysis requested in $_POST //////////////////////////////////////////////// ! echo '<h1>Student answers</h1>'; if (''!= $questionID and '(none)' != $questionID) { --- 84,88 ---- // Carry out the analysis requested in $_POST //////////////////////////////////////////////// ! echo '<h1>Analysis of answers to a single question</h1>'; if (''!= $questionID and '(none)' != $questionID) { *************** *** 171,174 **** --- 171,177 ---- $query .= " AND RawMark='1.0' "; break; + case 'partial': + $query .= " AND RawMark<'1.0' "; + break; case 'nonzero': $query .= " AND RawMark>'0.0' "; *************** *** 373,376 **** --- 376,380 ---- <option value='any' ".nsf($s,'any').">Any</option>\n <option value='full' ".nsf($s,'full').">Full marks</option>\n + <option value='partial' ".nsf($s,'partial').">Not full marks</option>\n <option value='nonzero' ".nsf($s,'nonzero').">Non zero</option> <option value='zero' ".nsf($s,'zero').">Zero</option> Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.13.2.4 retrieving revision 1.13.2.5 diff -C2 -d -r1.13.2.4 -r1.13.2.5 *** editquiz.php 17 Aug 2005 16:48:46 -0000 1.13.2.4 --- editquiz.php 19 Aug 2005 19:49:31 -0000 1.13.2.5 *************** *** 1,394 **** <?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... - * @author Juliette White jv...@jv... - * - * - * This file contains the front end logic for the quiz editting - * TO DO: Some of the code in this file needs to be factored out into separate - * algorithms- ideally we should have a function for each action on entry and - * for display. - * @package frontend - * @subpackage Stack - */ - - /** - * - */ - session_start(); - - require_once("other/ListMenu.php"); - require_once("stackstd.php"); - - require_once("{$stack_root}/html/trypopupform.html"); - require_once("{$stack_root}/frontend_general/editquiz_display.php"); - require_once("{$stack_root}/html/helpform.php"); - require_once("{$stack_root}/html/quizjava.html"); - require_once("{$stack_root}/scripts/stackAuthor.php"); - - - /////////////////////////////////////////////////////////////// - // (1) Process Input - this sets $action, $user and $username - /////////////////////////////////////////////////////////////// - $default_action = 'quiz_choose'; - include('frontend_general/process_input.php'); - - include_once('frontend_general/edit_quiz_util.php'); - $PostTo = 'editquiz.php'; - $filter = ''; - $quizid = NULL; - - include('html/pagehead.php'); - - if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { - stack_display_editquiz_error_not_admin($user); - include('html/pagefoot.php'); - die(); - } - - // Work out the correct value for any filter to be applied to the question - // bank. This is not needed by all actions, but it is harmless to set it. - $question_bank_filter = stack_get_questionbank_filter(); - - //////////////////////////////////////////////// - // (2) Take any actions required on entry to the page - //////////////////////////////////////////////// - - // Possible values of $action are - // quiz_edit Edit a quiz - // quiz_choose Choose a quiz - // quiz_new Create a new quiz - // quiz_delete Delete a quiz - // quiz_edit_addqs Add questions to the quiz. - // filter Re-display the list of questions, filtered. - // quiz_xml Export the current quiz as an XML file - - // quiz_xml_db Export single quiz as XML from database - - - - - - // Get the quiz and quiz id $quiz = ''; - $quizid_source = ''; - if ('quiz_delete' == $action or 'filter' == $action) { - $quizid_source = 'post'; - } else if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { - $quizid_source = 'quiz'; - } else if ('quiz_new' == $action) { - $quizid_source = 'database'; - } - - else if ('quiz_xml' == $action) { - $quizid_source = 'post'; - } - else if ('quiz_xml_db' == $action) { - $quizid_source = 'database'; - } - - if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! ! show_array($_POST); ! //How do we preserve hidden metadata in the quiz?? $quiz_source = 'post'; - $quiz = stack_get_quiz('post', $quizid); - if ('' == $quiz) { - $quizid_source = 'post'; - } - } - - $quizid = stack_get_quizid($quizid_source, $quiz); - - if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { - $quiz = stack_get_quiz('database', $quizid); - } - - // Get the question bank filter - if ('filter' == $action) { - $filter_source = 'post'; - } else { - $filter_source = 'session'; - } - - - if ('quiz_delete' == $action and $quizid != '') { - stack_db_quiz_delete($quizid); - $action = 'quiz_choose'; - } - - if ('quiz_edit' == $action) { - // Do we need to add questions to the quiz? - if (array_key_exists('questionsToAdd',$_POST)) { - $quiz['questionsToAdd'] = array_keys($_POST['questionsToAdd']); - } - } - - if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! stack_quiz_edit($quiz,$errors); - } - - if ('filter' == $action and '' != $quizid ) { - $action = 'quiz_edit_addqs'; - } - - if ('quiz_new' == $action) { - $quiz['quizid'] = $quizid; - //<TODO> Automatically generated quiz metadata - $quiz['quizGUID'] = stack_generate_guid($stack_web_url); - $quiz['quizFormat'] = 'text/xml; charset="utf-8"'; - $quiz['quizPublisher'] = $stack_web_url; - $quiz['type'] = 'quiz'; - $quiz['quizUserLastEdited'] = $user['firstname']." ".$user['lastname']; - - if ($user['email']!='') - { ! ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; ! } - - $action = 'quiz_edit'; - } - - if ('quiz_xml' == $action) { ! ! ! include_once("{$stack_root}/scripts/stackXML.php"); - - $quiz = stack_get_quiz('database', $quizid); ! stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); ! ! } ! ! //////////////////////////////////////////////// - // (3) Generate web page - //////////////////////////////////////////////// - - stack_display_editquiz_error($errors); - - switch ($action) { - case 'quiz_xml': - { ! ! echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; ! } - case 'quiz_choose': - $quiz_store = stack_db_quiz_get(); - stack_display_editquiz_select($quiz_store, $PostTo); - break; - case 'import': - { - } ! ! case 'quiz_edit': ! stack_display_editquiz_edit($quiz,$errors,$PostTo); - break; - case 'quiz_edit_addqs': - stack_db_listquestions_quiz($question_bank_filter,$quizid); - break; - } - - include('html/pagefoot.php'); - - ?> - - --- 1,204 ---- <?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... * @author Juliette White jv...@jv... * * * This file contains the front end logic for the quiz editting * TO DO: Some of the code in this file needs to be factored out into separate * algorithms- ideally we should have a function for each action on entry and * for display. * @package frontend * @subpackage Stack */ /** * */ session_start(); require_once("other/ListMenu.php"); require_once("stackstd.php"); require_once("{$stack_root}/html/trypopupform.html"); require_once("{$stack_root}/frontend_general/editquiz_display.php"); require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/quizjava.html"); require_once("{$stack_root}/scripts/stackAuthor.php"); /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, $user and $username /////////////////////////////////////////////////////////////// $default_action = 'quiz_choose'; include('frontend_general/process_input.php'); include_once('frontend_general/edit_quiz_util.php'); $PostTo = 'editquiz.php'; $filter = ''; $quizid = NULL; include('html/pagehead.php'); if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { stack_display_editquiz_error_not_admin($user); include('html/pagefoot.php'); die(); } // Work out the correct value for any filter to be applied to the question // bank. This is not needed by all actions, but it is harmless to set it. $question_bank_filter = stack_get_questionbank_filter(); //////////////////////////////////////////////// // (2) Take any actions required on entry to the page //////////////////////////////////////////////// // Possible values of $action are // quiz_edit Edit a quiz // quiz_choose Choose a quiz // quiz_new Create a new quiz // quiz_delete Delete a quiz // quiz_edit_addqs Add questions to the quiz. // filter Re-display the list of questions, filtered. + // quiz_xml Export the current quiz as an XML file + // quiz_xml_db Export single quiz as XML from database + // quiz_report Gain a report of student's progress with this quiz. $quiz = ''; $quizid_source = ''; if ('quiz_delete' == $action or 'filter' == $action) { $quizid_source = 'post'; } else if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { $quizid_source = 'quiz'; } else if ('quiz_new' == $action) { $quizid_source = 'database'; } else if ('quiz_xml' == $action) { $quizid_source = 'post'; } else if ('quiz_xml_db' == $action) { $quizid_source = 'database'; } if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! //show_array($_POST); ! //How do we preserve hidden metadata in the quiz?? $quiz_source = 'post'; $quiz = stack_get_quiz('post', $quizid); if ('' == $quiz) { $quizid_source = 'post'; } } $quizid = stack_get_quizid($quizid_source, $quiz); if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { $quiz = stack_get_quiz('database', $quizid); } // Get the question bank filter if ('filter' == $action) { $filter_source = 'post'; } else { $filter_source = 'session'; } if ('quiz_delete' == $action and $quizid != '') { stack_db_quiz_delete($quizid); $action = 'quiz_choose'; } if ('quiz_edit' == $action) { // Do we need to add questions to the quiz? if (array_key_exists('questionsToAdd',$_POST)) { $quiz['questionsToAdd'] = array_keys($_POST['questionsToAdd']); } } if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! stack_quiz_validate($quiz,$errors); stack_quiz_edit($quiz,$errors); } if ('filter' == $action and '' != $quizid ) { $action = 'quiz_edit_addqs'; } if ('quiz_new' == $action) { $quiz['quizid'] = $quizid; //<TODO> Automatically generated quiz metadata $quiz['quizGUID'] = stack_generate_guid($stack_web_url); $quiz['quizFormat'] = 'text/xml; charset="utf-8"'; $quiz['quizPublisher'] = $stack_web_url; $quiz['type'] = 'quiz'; $quiz['quizUserLastEdited'] = $user['firstname']." ".$user['lastname']; if ($user['email']!='') { ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; } $action = 'quiz_edit'; } if ('quiz_xml' == $action) { ! include_once("{$stack_root}/scripts/stackXML.php"); $quiz = stack_get_quiz('database', $quizid); ! stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); ! } //////////////////////////////////////////////// // (3) Generate web page //////////////////////////////////////////////// stack_display_editquiz_error($errors); switch ($action) { case 'quiz_xml': { ! echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; } case 'quiz_choose': $quiz_store = stack_db_quiz_get(); stack_display_editquiz_select($quiz_store, $PostTo); break; case 'import': { } ! case 'quiz_report': ! $quizid = stack_get_quizid('post', $quiz); ! stack_quiz_report($quizid); ! break; ! case 'quiz_edit': stack_display_editquiz_edit($quiz,$errors,$PostTo); break; case 'quiz_edit_addqs': stack_db_listquestions_quiz($question_bank_filter,$quizid); break; } include('html/pagefoot.php'); ?> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8.2.8 retrieving revision 1.8.2.9 diff -C2 -d -r1.8.2.8 -r1.8.2.9 *** question_bank.php 17 Aug 2005 16:48:46 -0000 1.8.2.8 --- question_bank.php 19 Aug 2005 19:49:31 -0000 1.8.2.9 *************** *** 1,674 **** <?php - /** - * - * Welcome to STACK. A system for teaching and assessment using a - * computer algebra kernel. - [...980 lines suppressed...] case 'edit': if (!$admin) { print_string('qp_notadmin','stack'); } stack_display_qb_edit($question, $errors); break; } include('html/pagefoot.php'); ////////////////////////////////////////////////////////////// // (3) Deal with any actions on leaving the page ////////////////////////////////////////////////////////////// if ('questionbank_screen'==$action or 'edit_metadata' == $action){ session_unregister('question'); session_unregister('questionInst'); } ?> |
From: Chris S. <san...@us...> - 2005-08-19 19:49:39
|
Update of /cvsroot/stack/stack-1-0/frontend_general In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20263/frontend_general Modified Files: Tag: development_xmlrqp editquiz_display.php question_bank_util.php Log Message: Index: editquiz_display.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/editquiz_display.php,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -C2 -d -r1.8.2.1 -r1.8.2.2 *** editquiz_display.php 16 Aug 2005 15:51:35 -0000 1.8.2.1 --- editquiz_display.php 19 Aug 2005 19:49:31 -0000 1.8.2.2 *************** *** 53,56 **** --- 53,57 ---- echo "<td><a href=\"javascript:takeaction('quiz_edit','$qID');\">edit</a></td>\n"; echo "<td><a href=\"javascript:quiztry('continue_quiz','$qID');\">try</a></td>\n"; + echo "<td><a href=\"javascript:takeaction('quiz_report','$qID');\">results</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_xml','$qID');\">xml</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_delete','$qID');\"><font color='red'>del</font></a></td></tr>\n"; Index: question_bank_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/question_bank_util.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 *** question_bank_util.php 17 Aug 2005 11:24:06 -0000 1.3.2.1 --- question_bank_util.php 19 Aug 2005 19:49:31 -0000 1.3.2.2 *************** *** 112,117 **** if ('new' == $source or NULL == $question) { ! ! show_array($user); $question['questionID'] = '0'; $question['questionAnsKey'] = 'ans1'; --- 112,117 ---- if ('new' == $source or NULL == $question) { ! ! //show_array($user); $question['questionID'] = '0'; $question['questionAnsKey'] = 'ans1'; *************** *** 124,128 **** if ($user['email']!='') { ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; } } --- 124,128 ---- if ($user['email']!='') { ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; } } |
From: Chris S. <san...@us...> - 2005-08-19 16:17:00
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32232/scripts Modified Files: Tag: development_xmlrqp stackQuestion.php stackUnix.php stackUtility.php stackWin.php Added Files: Tag: development_xmlrqp stackCAS.php Log Message: Important changes to the way STACK connects to the CAS. --- NEW FILE: stackCAS.php --- <?php /** * These classes handle the generation of CAS specific code. * * Each specific CAS derives from the general base class StackCAS. * */ /** * Maxima-specific function used to produce the code * to process a list of local variables. * * @param array $locvars List of local variables to be instantiated * @param int $t Timestamp identifier used to match CAS input and output * @param string $display The desired output format (a Stack Option) * @return string The command to send to the CAS */ function CASCodeInstantiate($locvars, $t, $seed, $displayopt) { // Generates Maxima specific code // We will use a maxima block. // BLOCK([v1,...,vk], state1,...statej) // Now we will get the student's display options $OPT_OUTPUT = $displayopt; $loclistA = ''; $loclistB = ''; $cs ='cab:BLOCK([ C_op, OPT_OUTPUT'; // We know $locvars is non-empty, as we have put $answer into it! foreach ($locvars as $lk => $locv) { $key = $locv["key"]; $val = str_replace('?','qmchar',$locv["value"]); $loclistA.= ','.$key; $loclistB.= ", print(\"$lk=[ error= [\"), cte(\"$key\",ERRCATCH($key:$val)) "; } $cs .= $loclistA.'], OPT_OUTPUT:"'.$OPT_OUTPUT.'", RANDOM_SEED:'.$seed; $cs .= ", print(\"[TimeStamp= [ $t ], Locals= [ \") "; $cs .= $loclistB; $cs .= ', print("] ]") '; $cs .= ", RETURN(true) ); \n"; return($cs); } /** * Maxima-specific function used to parse CAS output into an array. * * @param array $strin Raw CAS output * @return array */ function CASParsePreparse($strin) { // Take the raw string from the CAS, and unpack this into an array. $offset = 0; $strin_len = strlen($strin); $unparsed = ''; $errors = ''; if ($eqpos = strpos($strin,'=',$offset)) { // Check there are ='s do { $gb = stack_util_grabbetween($strin,'[',']',$eqpos); $val = substr($gb[0], 1, strlen($gb[0])-2); $val = str_replace('"', '', $val); $val = trim($val); if (ereg('[A-Za-z0-9].*',substr($strin,$offset,$eqpos-$offset),$regs)) { $var = trim($regs[0]); } else { $var = 'errors'; $errors['LOCVARNAME'] = "Couldn't get the name of the local variable"; } $unparsed[$var] = $val; $offset = $gb[2]; } while (($eqpos = strpos($strin,'=',$offset)) && ($offset < $strin_len)); } else { $errors['PREPARSE'] = "There are no ='s in the raw output from the CAS!"; } if ('' != $errors) { $unparsed['errors'] = $errors; } return($unparsed); } /** * Maxima-specific function used to parse CAS output * of instantiated local variables into an array. * * @param string $instr The raw CAS output * @return array Has field ['questionVarsInst'] containing the array of instantiated local variables */ function CASParseCASOutput($instr) { // Generate a Stack data structure from some MAXIMA output. $errors = ''; $instr = trim(str_replace('#','',$instr)); $instr = trim(str_replace("\n",'',$instr)); $unp = CASParsePreparse($instr); // Unparse the main body. $uplocs = $unp['Locals']; // Grab the local variables unset($unp['Locals']); $locals_raw = CASParsePreparse($uplocs); // Now we need to turn the (error,key,value,display) tuple into an array foreach ($locals_raw as $var => $valdval) { if (ereg('.*\[.*\].*',$valdval)) { // There are some []'s in the string. $loc = CASParsePreparse($valdval); if ('' == trim($loc['error'])) { unset($loc['error']); } $locals[]=$loc; } else { $errors["LocalVarGet$var"] = "Couldn't unpack the local variable $var from the string $valdval."; } } $unp['questionVarsInst'] = $locals; if ('' != $errors) { $up['errors'] = $errors; } return($unp); } /** * Maxima-specific function used to produce the CAS command * to apply a specific answer test. * * @param string $exp1 The first expression (nominally the student's answer) * @param string $exp2 The second expression (nominally the teacher's answer) * @param int $t Timestamp identifier used to match CAS input and output * @param string $display The desired output format (a Stack Option) * @param string $test The answer test to apply * @return string The command to send to the CAS */ function CASAnsTestCmd($exp1, $exp2, $t, $OPT_OUTPUT, $test) { // Generates the CAS command to mark a question global $stackAnswerTest; $exp1 = str_replace('?','qmchar',$exp1); $exp2 = str_replace('?','qmchar',$exp2); $cas_cmd = "cab:BLOCK([ ans,str,OPT_OUTPUT], OPT_OUTPUT:\"$OPT_OUTPUT\", "; $cas_cmd .= " print(\" [TimeStamp= [ $t ], Ans= [ error = [\")"; $cas_cmd .= ", cte(\"ans\",ERRCATCH(ans:$exp1)), "; $fname = $stackAnswerTest[$test]['function']; $cas_cmd .= " str:$fname(ans,$exp2), print(str), RETURN(true)); \n"; return $cas_cmd; } /** * Maxima-specific function used to parse the CAS output from * an answer test into an array. * * @param string $instr the raw CAS output * @return array containing fields ['AnsValue'] and ['AnsDisplay'] */ function CASAnsTestParse($instr) { $unp = CASParsePreparse($instr); $unp['Ans'] = CASParsePreparse($unp['Ans']); if (''==$unp['Ans']['error']) { unset($unp['Ans']['error']); } // Sort out translations of the feedback. if (array_key_exists('FeedBack',$unp)) { $strin = str_replace("\n","",$unp['FeedBack'] ); $strin = str_replace('\\','\\\\',$strin); $strin = str_replace('$','\$',$strin); $strin = str_replace("<QUOT>",'"',$strin); //echo "STRIN: <pre>$strin</pre><br>"; ob_start(); eval($strin); $strin = ob_get_contents(); ob_end_clean(); $unp['FeedBack'] = $strin; } return $unp; } /** * Instantiate a list of local variables through the CAS. * * This function performs the following tasks: * 1. Checks each local for a PHP error * 2. If no errors, sends them to the CAS * 3. Checks for CAS errors * * @param array $locals List of local variables to instantiate. * @param int $seed The random number seed to use * @param array $options STACK options * @param array &$err Repository for errors. * @return array List of instantiated local variables. */ function stack_process_vars($locals,$seed,$options,&$err) { // Make sure ?'s are replaced by qmchar's if (is_array($locals)) { foreach ($locals as $key=> $val) { $locals[$key] = str_replace('?','qmchar',$val); } } else { $err = array('No local variables were received to be processes!'); return NULL; } $t = time(); $display = $options['Display']; $varCommand = CASCodeInstantiate($locals, $t, $seed, $display); if ($varCommand != '') { // send to CAS $varResponse = stack_maxima_rawsend($varCommand); // echo "<pre>".$varResponse."</pre>"; // Chop off the part up till the first input group. $varResponse = strstr($varResponse,"[TimeStamp"); $parsed = CASParseCASOutput($varResponse); //show_array($parsed); // Get the CAS's values of the locals into an array. // Get the CAS's values of the locals into an array. foreach ($locals as $lk => $locvar) { if (array_key_exists($lk,$parsed['questionVarsInst'])) { $locals_inst[$lk] = $locals[$lk]; $locals_inst[$lk]['display'] = ''; foreach ($parsed['questionVarsInst'][$lk] as $lkk => $lvv) { $locals_inst[$lk][$lkk] = $lvv; } } else { $locals_inst[$lk] = $locals[$lk]; $locals_inst[$lk]['error'] = 'CAS-error (no output)'; $locals_inst[$lk]['display'] = ''; } // Maxima typesets strings with a & at the front. This breaks TeX, so we // need to get rid of it..... if (array_key_exists('display',$locals_inst[$lk])) { if ( '&' == substr($locals_inst[$lk]['display'],0,1)) { $locals_inst[$lk]['display'] = substr($locals_inst[$lk]['display'],1); } } if (isset($locals_inst[$lk]['error'])) { // There is a CAS error! // Get the command that went in. $val = $locvar['value']; if ('' == $locals_inst[$lk]['display']) { // This must be a genuine error, since nothing is displayed. $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value $locals_inst[$lk]['display'] = $val; // Restore the un-CASed value } else if (strstr($locals_inst[$lk]['error'],'Plot error')) { // This must be a genuine error, since we created it! $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value } else if (FALSE != strstr($val,'plot')) { // We asked for a plot, these always generate an error! (HACK) unset($locals_inst[$lk]['error']); $locals_inst[$lk]['display'] = $locals_inst[$lk]['value']; } else { // This must also be a genuine error, but keep the display, since we have it. $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value } } } } //show_array($locals_inst); return $locals_inst; } /** * Directly perform an answer test * * @param string $exp1 A CAS expression, nominally the student's * @param string $exp2 A CAS expression, nominally the teachers's * @param string $test Which AnswerTest to apply. * @param array $options The only option needed is the Display, but other answer tests may in the future require their own options. * @return array $this_attempt An array structure, which is used to build the student's attempt. */ function CPProcessAnsTest($exp1,$exp2,$test,$disp,&$err) { // create a StackResponse object $t = time(); $varCommand = CASAnsTestCmd($exp1, $exp2, $t, $disp, $test); echo "<pre>".$varCommand."</pre>"; if ($varCommand != '') { // send to CAS $varResponse = stack_maxima_rawsend($varCommand); //echo "<pre>".$varResponse."</pre>"; // Chop off the part up till the first input group. $varResponse = strstr($varResponse,"[TimeStamp"); $parsed = CASAnsTestParse($varResponse); // If we have errors, we need to add blank fields. if (!array_key_exists('AnswerNote',$parsed)) { $parsed['AnswerNote'] = ''; } if (!array_key_exists('FeedBack',$parsed)) { $parsed['FeedBack'] = ''; } else { // We translate the language. } if (!array_key_exists('Ans',$parsed)) { $parsed['Ans']['value'] = $exp1; $parsed['Ans']['display'] = $exp1; $parsed['Ans']['error'] = get_string('CASError_ans','stack',''); } else { if (!array_key_exists('value',$parsed['Ans'])) { $parsed['Ans']['value'] = $exp1; } if (!array_key_exists('display',$parsed['Ans'])) { $parsed['Ans']['display'] = $exp1; } } } return $parsed; } ?> Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.30.2.5 retrieving revision 1.30.2.6 diff -C2 -d -r1.30.2.5 -r1.30.2.6 *** stackUtility.php 16 Aug 2005 15:51:35 -0000 1.30.2.5 --- stackUtility.php 19 Aug 2005 16:16:45 -0000 1.30.2.6 *************** *** 14,20 **** // // Also in the new release. ! // (1) remove stackData.php - and its reference in stackstd.php ! // (2) remove stackSocketSend.php - and its reference in stackstd.php ! // (3) Remove versioning from stackStd and put somewhere else. if ($stack_stand_alone) { require_once("{$stack_root}/scripts/moodlelib.php"); --- 14,22 ---- // // Also in the new release. ! // (1) remove stackData.php - and its reference in stackstd.php ! // (2) CASpool/stackProcess.php - and its reference in stackstd.php ! // (3) remove stackSocketSend.php - and its reference in stackstd.php ! // (4) remove the directory CASPool ! // (5) Remove versioning from stackStd and put somewhere else. if ($stack_stand_alone) { require_once("{$stack_root}/scripts/moodlelib.php"); *************** *** 23,26 **** --- 25,29 ---- require_once("{$stack_root}/scripts/stackUser.php"); require_once("{$stack_root}/frontend_general/frontend_util.php"); + require_once("{$stack_root}/scripts/stackCAS.php"); /** Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30.2.13 retrieving revision 1.30.2.14 diff -C2 -d -r1.30.2.13 -r1.30.2.14 *** stackQuestion.php 17 Aug 2005 11:24:06 -0000 1.30.2.13 --- stackQuestion.php 19 Aug 2005 16:16:45 -0000 1.30.2.14 *************** *** 508,545 **** // // imp = Determines where it is implemented, possible values ! // php - native to PHP. Things don't get evaluated by the CAS ! // cas - CAS systems. Here the AnswerTest options are treated as ! // a CASstring, and instantiated. ! // When a question is instantiated, this is the field questionAnsTestOptInst. ! // doc = The string which is displayed on screen ! // // // Developer information: adding a new Answer Test // To add a new answer test, // (1) complete the information below, giving your test a name and details. ! // (2) Add details of the test to the function stack_apply_answertest(), in scripts/stackQuestion.php ! // (3) If this is to be processed by the CAS, ! // (3.1) you will need to add details to ! // the function CASAnsTestCmd() in scripts/CASPool/stackCAS.php ! // (3.2) add details to the CAS scripts themselves to implement this test. // (4) Add documentation // //////////////////////////////////// ! $stackAnswerTest['AlgEquiv']['imp'] = 'cas'; ! $stackAnswerTest['CASEqual']['imp'] = 'cas'; ! $stackAnswerTest['Num_tol_relative']['imp'] = 'cas'; ! $stackAnswerTest['Num_tol_absolute']['imp'] = 'cas'; ! $stackAnswerTest['String']['imp'] = 'php'; ! $stackAnswerTest['StringSloppy']['imp'] = 'php'; ! $stackAnswerTest['RegExp']['imp'] = 'php'; ! $stackAnswerTest['FacForm']['imp'] = 'cas'; ! $stackAnswerTest['SA_factored']['imp'] = 'cas'; ! $stackAnswerTest['SA_expanded']['imp'] = 'cas'; ! $stackAnswerTest['PartFrac']['imp'] = 'cas'; ! $stackAnswerTest['Diff']['imp'] = 'cas'; ! $stackAnswerTest['Int']['imp'] = 'cas'; ! $stackAnswerTest['SA_True']['imp'] = 'cas'; ! $stackAnswerTest['True']['imp'] = 'php'; // Build a list of AnswerTests. --- 508,564 ---- // // imp = Determines where it is implemented, possible values ! // php native to PHP. Things don't get evaluated by the CAS ! // cas Goes to the CAS ! // cas-var Goes to the CAS, and the AnswerTest options require a variable. ! // cas-loc Goes to the CAS, but via the mechanism of local variables not AnswerTests. ! // ! // function = the name of the function in Maxima that will be called. // // Developer information: adding a new Answer Test // To add a new answer test, // (1) complete the information below, giving your test a name and details. ! // (2) If needed, add details of the test to the function stack_apply_answertest(), in scripts/stackQuestion.php ! // (3) If this is to be processed by the CAS, add details to the CAS scripts themselves to implement this test. // (4) Add documentation // //////////////////////////////////// ! $stackAnswerTest['AlgEquiv']['imp'] = 'cas'; ! $stackAnswerTest['AlgEquiv']['function'] = 'ATAlgEquiv'; ! ! $stackAnswerTest['CASEqual']['imp'] = 'cas'; ! $stackAnswerTest['CASEqual']['function'] = 'ATCASEqual'; ! ! $stackAnswerTest['FacForm']['imp'] = 'cas-var'; ! $stackAnswerTest['FacForm']['function'] = 'ATFacForm'; ! ! $stackAnswerTest['SA_factored']['imp'] = 'cas-var'; ! $stackAnswerTest['SA_factored']['function'] = 'ATFacForm'; ! ! $stackAnswerTest['SA_expanded']['imp'] = 'cas-var'; ! $stackAnswerTest['SA_expanded']['function'] = 'ATExpanded'; ! ! $stackAnswerTest['PartFrac']['imp'] = 'cas-var'; ! $stackAnswerTest['PartFrac']['function'] = 'AtPartFrac'; ! ! $stackAnswerTest['Diff']['imp'] = 'cas-var'; ! $stackAnswerTest['Diff']['function'] = 'ATDiff'; ! ! $stackAnswerTest['Int']['imp'] = 'cas-var'; ! $stackAnswerTest['Int']['function'] = 'ATInt'; ! ! $stackAnswerTest['SA_True']['imp'] = 'cas-loc'; ! $stackAnswerTest['SA_True']['function'] = 'cas'; ! ! $stackAnswerTest['Num_tol_relative']['imp'] = 'cas-loc'; ! $stackAnswerTest['Num_tol_relative']['function'] = 'cas'; ! ! $stackAnswerTest['Num_tol_relative']['imp'] = 'cas-loc'; ! $stackAnswerTest['Num_tol_absolute']['function'] = 'cas'; ! ! $stackAnswerTest['String']['imp'] = 'php'; ! $stackAnswerTest['StringSloppy']['imp'] = 'php'; ! $stackAnswerTest['RegExp']['imp'] = 'php'; ! $stackAnswerTest['True']['imp'] = 'php'; // Build a list of AnswerTests. *************** *** 1209,1218 **** */ function stack_apply_answertest($sa,$ta,$atest,$atest_ops,$disp,&$errors) { ! global $stack_os,$stack_web_root,$stack_web_services; ! ! // We need to build and return a $this_attempt ! $this_attempt['AnswerNote'] = ''; ! $this_attempt['FeedBack'] = ''; ! $this_attempt['RawAns'] = $sa; // This is a general response for the Ans, in case of an error. --- 1228,1232 ---- */ function stack_apply_answertest($sa,$ta,$atest,$atest_ops,$disp,&$errors) { ! global $stack_os,$stack_web_root,$stack_web_services,$stackAnswerTest; // This is a general response for the Ans, in case of an error. *************** *** 1226,1393 **** if ('LaTeX Source' == $disp) {$disp = 'LaTeX';} ! // For tests which are performed by the CAS: hand it over. ! if ('AlgEquiv' == $atest ! OR 'CASEqual' == $atest ! OR 'SA_expanded' == $atest ! OR 'FacForm' == $atest ! OR 'SA_factored' == $atest ! OR 'PartFrac' == $atest ! OR 'Diff' == $atest ! OR 'Int' == $atest) { ! $webRequest = new StackRequest('TEST'); ! ! if ('AlgEquiv' == $atest ! OR 'CASEqual' == $atest ! OR 'SA_expanded' == $atest) { ! $webRequest->crData = array('exp1' => $sa, 'exp2' => $ta, 'test' => $atest, 'display' => $disp); ! } ! ! // These tests need a list of two items, the $ta and $atest_ops ! if ( 'FacForm' == $atest ! OR 'SA_factored' == $atest ! OR 'PartFrac' == $atest ! OR 'Diff' == $atest ! OR 'Int' == $atest) { ! $errs = validate_casstring($atest_ops); ! if ('' == $errs && '' != $atest_ops ) { ! if ( 'SA_factored' == $atest ) { ! // Ignore $exp2 ! $webRequest->crData = array('exp1' => $sa, 'exp2' => "[$sa,$atest_ops,TRUE]", 'test' => $atest, 'display' => $disp); ! } else { ! $webRequest->crData = array('exp1' => $sa, 'exp2' => "[$ta,$atest_ops,FALSE]", 'test' => $atest, 'display' => $disp); ! } ! } else { ! // We have an error in the question. ! $this_attempt['FeedBack'] = "Error in question! Please contact your system administrator, since an error has occured with the AnswerTest in this question. A variable should be supplied as an AnswerTest Option, but was not."; ! $this_attempt['AnswerNote'] = "Required AnswerTest option missing, or the following error occured with AnswerTest options: $errs."; ! $this_attempt['Ans'] = $eans; ! $this_attempt['Valid'] = 'false'; ! return($this_attempt); ! } ! } ! $sa = $webRequest->crData['exp1']; ! $ta = $webRequest->crData['exp2']; $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$disp,$errors); ! // Clean up the CAS dependent scripts here ! unset($this_attempt['TimeStamp']); - $this_attempt['Result'] = FALSE; - if (array_key_exists('RawMark',$this_attempt)) { - if (1 == $this_attempt['RawMark']) { - $this_attempt['Result'] = TRUE; - } - } ! } else if ('Num_tol_relative' == $atest) { ! // First make dummy variable which converts the result to a float. ! if ('' == trim($atest_ops)) { ! $atest_ops = 0.05; ! } ! $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"abs(STACK_float({$sa}-{$ta}))"); ! $locals[2] = array('key'=>'flta' , 'value'=>"abs(STACK_float({$ta}*{$atest_ops}))"); ! $seed = 0; ! $options['Display']=$disp; ! $locInst = stack_process_vars($locals,$seed,$options,$errors); ! $this_attempt['Ans'] = $locInst[0]; ! $flsa = $locInst[1]['value']; ! $flta = $locInst[2]['value']; ! $this_attempt['AnswerNote'] = " |sa-ta|={$flsa}<={$flta}=tol*ta"; ! if ($flsa <= $flta) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! ! } else if ('Num_tol_absolute' == $atest) { ! // First make dummy variable which converts the result to a float. ! if ('' == trim($atest_ops)) { ! $atest_ops = 0.05; ! } ! $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"abs(STACK_float({$sa}-{$ta}))"); ! $locals[2] = array('key'=>'flta' , 'value'=>"abs(STACK_float({$atest_ops}))"); ! $seed = 0; ! $options['Display']=$disp; ! $locInst = stack_process_vars($locals,$seed,$options,$errors); ! $this_attempt['Ans'] = $locInst[0]; ! $flsa = $locInst[1]['value']; ! $flta = $locInst[2]['value']; ! $this_attempt['AnswerNote'] = " |sa-ta|={$flsa}<={$flta}=tol"; ! if ($flsa <= $flta) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('SA_True' == $atest) { ! $locals[0] = array('key'=>'flsa' , 'value'=>$sa); ! $seed = 0; ! $options['Display']=$disp; ! $locInst = stack_process_vars($locals,$seed,$options,$errors); ! $this_attempt['Ans'] = $locInst[0]; ! $satr = $locInst[0]['value']; ! if ('true' == strtolower($satr)) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('String' == $atest) { ! $this_attempt['Ans'] = $eans; ! // Apply a strict string check ! if (trim($sa) == trim($ta)) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('True' == $atest) { ! $this_attempt['Ans'] = $eans; ! $this_attempt['Result'] = TRUE; ! ! } else if ('StringSloppy' == $atest) { ! $sa = str_replace(' ','',strtolower(trim($sa))); ! $sa = str_replace("\n",'',$sa); ! $sa = str_replace("\t",'',$sa); ! $this_attempt['Ans'] = array('value'=> $sa, 'display'=> $sa); ! $ta = str_replace(' ','',strtolower(trim($ta))); ! $ta = str_replace("\n",'',$ta); ! $ta = str_replace("\t",'',$ta); ! // Apply a string check ! if ($sa == $ta) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('RegExp' == $atest) {// ereg(pattern,string) ! $this_attempt['Ans'] = $eans; ! // Apply a regular expression check ! if (ereg($atest_ops,$sa,$pat)) { ! $this_attempt['Result'] = TRUE; ! $this_attempt['AnswerNote'] = ' Pattern matched: '.$pat[0]; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } // If no mark has been assigned then --- 1240,1394 ---- if ('LaTeX Source' == $disp) {$disp = 'LaTeX';} ! // We need to build and return a $this_attempt ! $this_attempt['AnswerNote'] = ''; ! $this_attempt['FeedBack'] = ''; ! $this_attempt['RawAns'] = $sa; ! if ('cas' == $stackAnswerTest[$atest]['imp']) { $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$disp,$errors); + } ! if ('cas-var' == $stackAnswerTest[$atest]['imp']) { ! ! $errs = validate_casstring($atest_ops); ! $ta = "[$ta,$atest_ops,FALSE]"; ! ! if ( 'SA_factored' == $atest ) { ! $ta = "[$ta,$atest_ops,TRUE]"; ! } ! ! if ('' == $errs && '' != $atest_ops ) { ! $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$disp,$errors); ! } else { ! // We have an error in the question. ! $this_attempt['FeedBack'] = "Error in question! Please contact your system administrator, since an error has occured with the AnswerTest in this question. A variable should be supplied as an AnswerTest Option, but was not."; ! $this_attempt['AnswerNote'] = "Required AnswerTest option missing, or the following error occured with AnswerTest options: $errs."; ! $this_attempt['Ans'] = $eans; ! $this_attempt['Valid'] = 'false'; ! return($this_attempt); ! } ! } ! ! // Clean up the CAS dependent scripts here ! unset($this_attempt['TimeStamp']); ! //show_array($this_attempt); ! ! $this_attempt['Result'] = FALSE; ! if (array_key_exists('RawMark',$this_attempt)) { ! if (1 == $this_attempt['RawMark']) { ! $this_attempt['Result'] = TRUE; ! } ! } ! if ('Num_tol_relative' == $atest) { ! // First make dummy variable which converts the result to a float. ! if ('' == trim($atest_ops)) { ! $atest_ops = 0.05; ! } ! $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"abs(STACK_float({$sa}-{$ta}))"); ! $locals[2] = array('key'=>'flta' , 'value'=>"abs(STACK_float({$ta}*{$atest_ops}))"); ! $seed = 0; ! $options['Display']=$disp; ! $locInst = stack_process_vars($locals,$seed,$options,$errors); ! $this_attempt['Ans'] = $locInst[0]; ! $flsa = $locInst[1]['value']; ! $flta = $locInst[2]['value']; ! $this_attempt['AnswerNote'] = " |sa-ta|={$flsa}<={$flta}=tol*ta"; ! if ($flsa <= $flta) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! ! } else if ('Num_tol_absolute' == $atest) { ! // First make dummy variable which converts the result to a float. ! if ('' == trim($atest_ops)) { ! $atest_ops = 0.05; ! } ! $locals[0] = array('key'=>'flsa' , 'value'=>"STACK_float({$sa})"); ! $locals[1] = array('key'=>'flsa' , 'value'=>"abs(STACK_float({$sa}-{$ta}))"); ! $locals[2] = array('key'=>'flta' , 'value'=>"abs(STACK_float({$atest_ops}))"); ! $seed = 0; ! $options['Display']=$disp; ! $locInst = stack_process_vars($locals,$seed,$options,$errors); ! $this_attempt['Ans'] = $locInst[0]; ! $flsa = $locInst[1]['value']; ! $flta = $locInst[2]['value']; ! $this_attempt['AnswerNote'] = " |sa-ta|={$flsa}<={$flta}=tol"; ! if ($flsa <= $flta) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('SA_True' == $atest) { ! $locals[0] = array('key'=>'flsa' , 'value'=>$sa); ! $seed = 0; ! $options['Display']=$disp; ! $locInst = stack_process_vars($locals,$seed,$options,$errors); ! $this_attempt['Ans'] = $locInst[0]; ! $satr = $locInst[0]['value']; ! if ('true' == strtolower($satr)) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('String' == $atest) { ! $this_attempt['Ans'] = $eans; ! // Apply a strict string check ! if (trim($sa) == trim($ta)) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('True' == $atest) { ! $this_attempt['Ans'] = $eans; ! $this_attempt['Result'] = TRUE; ! ! } else if ('StringSloppy' == $atest) { ! $sa = str_replace(' ','',strtolower(trim($sa))); ! $sa = str_replace("\n",'',$sa); ! $sa = str_replace("\t",'',$sa); ! $this_attempt['Ans'] = array('value'=> $sa, 'display'=> $sa); ! $ta = str_replace(' ','',strtolower(trim($ta))); ! $ta = str_replace("\n",'',$ta); ! $ta = str_replace("\t",'',$ta); ! // Apply a string check ! if ($sa == $ta) { ! $this_attempt['Result'] = TRUE; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } else if ('RegExp' == $atest) {// ereg(pattern,string) ! $this_attempt['Ans'] = $eans; ! // Apply a regular expression check ! if (ereg($atest_ops,$sa,$pat)) { ! $this_attempt['Result'] = TRUE; ! $this_attempt['AnswerNote'] = ' Pattern matched: '.$pat[0]; ! } else { ! $this_attempt['Result'] = FALSE; ! } ! } // If no mark has been assigned then Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** stackWin.php 18 Jul 2005 11:58:22 -0000 1.7 --- stackWin.php 19 Aug 2005 16:16:45 -0000 1.7.2.1 *************** *** 88,94 **** 2 => array('file', $stack_logfiles."cas_errors.txt", 'a')); ! $TeXProcess = proc_open($stack_cas['command'],$descriptors, $pipes); ! if(is_resource($TeXProcess)) { if (!fwrite($pipes[0], $stack_cas['initCommand'])) { --- 88,94 ---- 2 => array('file', $stack_logfiles."cas_errors.txt", 'a')); ! $CASProcess = proc_open($stack_cas['command'],$descriptors, $pipes); ! if(is_resource($CASProcess)) { if (!fwrite($pipes[0], $stack_cas['initCommand'])) { *************** *** 137,335 **** } - - /** - * Instantiate a list of local variables through the CAS. - * - * This function performs the following tasks: - * 1. Checks each local for a PHP error - * 2. If no errors, sends them to the CAS - * 3. Checks for CAS errors - * - * @param array $locals List of local variables to instantiate. - * @param int $seed The random number seed to use - * @param array $options STACK options - * @param array &$err Repository for errors. - * @return array List of instantiated local variables. - */ function stack_process_vars($locals,$seed,$options,&$err) { - - // Make sure ?'s are replaced by qmchar's - if (is_array($locals)) { - foreach ($locals as $key=> $val) { - $locals[$key] = str_replace('?','qmchar',$val); - } - } - - if (isset($errors['ProcessVars'])) { - unset($errors['ProcessVars']); - } - - // generate a StackRequest and send it - $winRequest = new StackRequest('PROCESSVARS'); - $winRequest->crData = array('locals' => $locals, 'display' => $options['Display'], 'randseed' => $seed ); - - $locals_inst = CPProcessVars($winRequest); - - - return($locals_inst); - } - - - /** - * Instantiate a list of local variables. - * - * Possible errors: - * - VARS-UNPACK : request array was empty - * - VARS-CODEINST : error instantiating CAS-specific code - * - VARS-TIMESTAMP : output from CAS did not match with input - * - VARS-PARSE : output from CAS could not be parsed, any variables that could not be instantiated are restored to un-CASed value in $crReturn - * - * @param StackRequest $varRequest $crData contains the list of local variables - * @return StackResponse $varResponse $crReturn contains the instantiated values - */ - function CPProcessVars($varRequest) { - // create a StackResponse object - $varResponse = new StackResponse(); - $cpCAS = new Maxima(); - - // local variables to be processed will be stored in - // $varRequest->crData - // generate CAS command - - $locals = $varRequest->crData['locals']; - $display = $varRequest->crData['display']; - // CJS - $seed = $varRequest->crData['randseed']; - - if (!is_array($locals)) { - // no data in $varRequest! - $varResponse->crError['VARS-UNPACK'] = TRUE; - return $varResponse; - } - - $t = time(); - $varCommand = $cpCAS->CASCodeInstantiate($locals, $t, $seed, $display); - - if ($varCommand != '') { - // send to CAS - $varResponse = stack_maxima_rawsend($varCommand); - - // echo "<pre>".$varResponse."</pre>"; - - // Chop off the part up till the first input group. - $varResponse = strstr($varResponse,"[TimeStamp"); - - $parsed = $cpCAS->CASParseCASOutput($varResponse); - - //show_array($parsed); - - // Get the CAS's values of the locals into an array. - // Get the CAS's values of the locals into an array. - foreach ($locals as $lk => $locvar) { - if (array_key_exists($lk,$parsed['questionVarsInst'])) { - $locals_inst[$lk] = $locals[$lk]; - $locals_inst[$lk]['display'] = ''; - foreach ($parsed['questionVarsInst'][$lk] as $lkk => $lvv) { - $locals_inst[$lk][$lkk] = $lvv; - } - } else { - $locals_inst[$lk] = $locals[$lk]; - $locals_inst[$lk]['error'] = 'CAS-error (no output)'; - $locals_inst[$lk]['display'] = ''; - } - - // Maxima typesets strings with a & at the front. This breaks TeX, so we - // need to get rid of it..... - if (array_key_exists('display',$locals_inst[$lk])) { - if ( '&' == substr($locals_inst[$lk]['display'],0,1)) { - $locals_inst[$lk]['display'] = substr($locals_inst[$lk]['display'],1); - } - } - - if (isset($locals_inst[$lk]['error'])) { // There is a CAS error! - // Get the command that went in. - $val = $locvar['value']; - if ('' == $locals_inst[$lk]['display']) { - // This must be a genuine error, since nothing is displayed. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - $locals_inst[$lk]['display'] = $val; // Restore the un-CASed value - } else if (strstr($locals_inst[$lk]['error'],'Plot error')) { - // This must be a genuine error, since we created it! - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - } else if (FALSE != strstr($val,'plot')) { - // We asked for a plot, these always generate an error! (HACK) - unset($locals_inst[$lk]['error']); - $locals_inst[$lk]['display'] = $locals_inst[$lk]['value']; - } else { - // This must also be a genuine error, but keep the display, since we have it. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - } - } - } - } - - //show_array($locals_inst); - return $locals_inst; - - } - - - /** - * Directly perform an answer test - * - * @param string $exp1 A CAS expression, nominally the student's - * @param string $exp2 A CAS expression, nominally the teachers's - * @param string $test Which AnswerTest to apply. - * @param array $options The only option needed is the Display, but other answer tests may in the future require their own options. - * @return array $this_attempt An array structure, which is used to build the student's attempt. - */ - function CPProcessAnsTest($exp1,$exp2,$test,$disp,&$err) { - // create a StackResponse object - $varResponse = new StackResponse(); - $cpCAS = new Maxima(); - - $t = time(); - - $varCommand = $cpCAS->CASAnsTestCmd($exp1, $exp2, $t, $disp, $test); - - if ($varCommand != '') { - // send to CAS - $varResponse = stack_maxima_rawsend($varCommand); - - //echo "<pre>".$varResponse."</pre>"; - - // Chop off the part up till the first input group. - $varResponse = strstr($varResponse,"[TimeStamp"); - - $parsed = $cpCAS->CASAnsTestParse($varResponse); - - - // If we have errors, we need to add blank fields. - if (!array_key_exists('AnswerNote',$parsed)) { - $parsed['AnswerNote'] = ''; - } - - if (!array_key_exists('FeedBack',$parsed)) { - $parsed['FeedBack'] = ''; - } else { - // We translate the language. - - } - - if (!array_key_exists('Ans',$parsed)) { - $parsed['Ans']['value'] = $exp1; - $parsed['Ans']['display'] = $exp1; - $parsed['Ans']['error'] = get_string('CASError_ans','stack',''); - } else { - if (!array_key_exists('value',$parsed['Ans'])) { - $parsed['Ans']['value'] = $exp1; - } - if (!array_key_exists('display',$parsed['Ans'])) { - $parsed['Ans']['display'] = $exp1; - } - } - } - - return $parsed; - } - ?> --- 137,139 ---- Index: stackUnix.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUnix.php,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -d -r1.15 -r1.15.2.1 *** stackUnix.php 14 Jul 2005 11:37:08 -0000 1.15 --- stackUnix.php 19 Aug 2005 16:16:45 -0000 1.15.2.1 *************** *** 155,306 **** } - - /** - * Instantiate a list of local variables through the CAS. - * - * This function performs the following tasks: - * 1. Checks each local for a PHP error - * 2. If no errors, sends them to the CAS - * 3. Checks for CAS errors - * - * @param array $locals List of local variables to instantiate. - * @param int $seed The random number seed to use - * @param array $options STACK options - * @param array &$err Repository for errors. - * @return array List of instantiated local variables. - */ function stack_process_vars($locals,$seed,$options,&$err) { - - $errors = ''; - $cpCAS = new Maxima(); - - // Make sure ?'s are replaced by qmchar's - if (is_array($locals)) { - foreach ($locals as $key=> $val) { - $locals[$key] = str_replace('?','qmchar',$val); - } - } - - if (!is_array($locals)) { - // no data in $varRequest! - $errors = 'VARS-UNPACK'; - return array(); - } - - $t = time(); - $varCommand = $cpCAS->CASCodeInstantiate($locals, $t, $seed, $options['Display']); - - if ($varCommand != '') { - // send to CAS - - $varResponse = stack_maxima_rawsend($varCommand,$errors); - - // Chop off the part up till the first input group. - $varResponse = strstr($varResponse,"[TimeStamp"); - - $parsed = $cpCAS->CASParseCASOutput($varResponse); - - // Get the CAS's values of the locals into an array. - foreach ($locals as $lk => $locvar) { - if (array_key_exists($lk,$parsed['questionVarsInst'])) { - $locals_inst[$lk] = $locals[$lk]; - $locals_inst[$lk]['display'] = ''; - foreach ($parsed['questionVarsInst'][$lk] as $lkk => $lvv) { - $locals_inst[$lk][$lkk] = $lvv; - } - } else { - $locals_inst[$lk] = $locals[$lk]; - $locals_inst[$lk]['error'] = 'CAS-error (no output)'; - $locals_inst[$lk]['display'] = ''; - } - - - // Maxima typesets strings with a & at the front. This breaks TeX, so we - // need to get rid of it..... - if (array_key_exists('display',$locals_inst[$lk])) { - if ( '&' == substr($locals_inst[$lk]['display'],0,1)) { - $locals_inst[$lk]['display'] = substr($locals_inst[$lk]['display'],1); - } - } - - if (isset($locals_inst[$lk]['error'])) { // There is a CAS error! - // Get the command that went in. - $val = $locvar['value']; - if ('' == $locals_inst[$lk]['display']) { - // This must be a genuine error, since nothing is displayed. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - $locals_inst[$lk]['display'] = $val; // Restore the un-CASed value - } else if (strstr($locals_inst[$lk]['error'],'Plot error')) { - // This must be a genuine error, since we created it! - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - } else if (FALSE != strstr($val,'plot')) { - // We asked for a plot, these always generate an error! (HACK) - unset($locals_inst[$lk]['error']); - $locals_inst[$lk]['display'] = $locals_inst[$lk]['value']; - } else { - // This must also be a genuine error, but keep the display, since we have it. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - } - } - } - } - return $locals_inst; - } - - - /** - * Directly perform an answer test - * - * @param string $exp1 A CAS expression, nominally the student's - * @param string $exp2 A CAS expression, nominally the teachers's - * @param string $test Which AnswerTest to apply. - * @param array $options The only option needed is the Display, but other answer tests may in the future require their own options. - * @return array $parsed An array structure, which is used to build the student's attempt. - */ - function CPProcessAnsTest($exp1,$exp2,$test,$disp,&$err) { - // create a StackResponse object - $varResponse = new StackResponse(); - $cpCAS = new Maxima(); - - $t = time(); - - $varCommand = $cpCAS->CASAnsTestCmd($exp1, $exp2, $t, $disp, $test); - - if ($varCommand != '') { - // send to CAS - $varResponse = stack_maxima_rawsend($varCommand,$errors); - - //echo "<pre>".$varResponse."</pre>"; - - // Chop off the part up till the first input group. - $varResponse = strstr($varResponse,"[TimeStamp"); - - $parsed = $cpCAS->CASAnsTestParse($varResponse); - - // If we have errors, we need to add blank fields. - if (!array_key_exists('AnswerNote',$parsed)) { - $parsed['AnswerNote'] = ''; - } - - if (!array_key_exists('FeedBack',$parsed)) { - $parsed['FeedBack'] = ''; - } - - if (!array_key_exists('Ans',$parsed)) { - $parsed['Ans']['value'] = $exp1; - $parsed['Ans']['display'] = $exp1; - $parsed['Ans']['error'] = get_string('CASError_ans','stack',''); - } else { - if (!array_key_exists('value',$parsed['Ans'])) { - $parsed['Ans']['value'] = $exp1; - } - if (!array_key_exists('display',$parsed['Ans'])) { - $parsed['Ans']['display'] = $exp1; - } - } - } - - return $parsed; - - } - ?> --- 155,157 ---- |
From: Chris S. <san...@us...> - 2005-08-19 16:17:00
|
Update of /cvsroot/stack/stack-1-0/scripts/CASpool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32232/scripts/CASpool Modified Files: Tag: development_xmlrqp stackProcess.php Removed Files: Tag: development_xmlrqp stackCAS.php stackRequest.php stackSocket.php startsocket.php stopsocket.php Log Message: Important changes to the way STACK connects to the CAS. Index: stackProcess.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/CASpool/stackProcess.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** stackProcess.php 13 Mar 2005 15:44:27 -0000 1.2 --- stackProcess.php 19 Aug 2005 16:16:44 -0000 1.2.2.1 *************** *** 1,571 **** <?php - /** - * These classes send and receive data from an external process (e.g. CAS, TTH). - * - * @package lib - * @subpackage Stack - */ - - /** - * - */ - include_once("{$stack_root}/scripts/CASpool/stackCAS.php"); - - /** - * - */ - include_once("{$stack_root}/scripts/CASpool/stackRequest.php"); - - /** - * The base class to support communication with an external process. - * - * @see CASProcess - * @see TexProcess - * @package lib - * @subpackage Stack - */ - class StackProcess { - /** - * @var string $cpCmd Command to start the process - */ - var $cpCmd; - /** - * @var array $cpDescriptors Describes the communication pipes - */ - var $cpDescriptors; - /** - * @var array $cpPipes Pipes for stdin/stdout - */ - var $cpPipes; - /** - * @var resource $cpProcess The established communication process - */ - var $cpProcess; - - /** - * Constructor - * - * Initialises $cpCmd and $cpDescriptors. - * - * @param string $cmd Command to start the process - * @param array $descriptors Describes the communication pipes - * @return void - */ - function StackProcess($cmd, $descriptors) { - $this->cpCmd = $cmd; - $this->cpDescriptors = $descriptors; - } - - /** - * Opens communication with external process. - * - * @return boolean true if connected successfully, false otherwise - */ - function CPInitialise() { - $this->cpProcess = proc_open($this->cpCmd,$this->cpDescriptors, $this->cpPipes); - - if(is_resource($this->cpProcess)) { - return TRUE; - } else { - return FALSE; - } - } - - /** - * Send an interrupt signal to the external process. - * - * @return void - */ - function CPInterrupt() { - // retrieve status information into an array - $proc_array = proc_get_status($this->cpProcess); - // if the process is still running, send an interrupt - if ($proc_array['running']) { - // send interrupt signal (equivalent to keyboard Ctrl-C) - posix_kill($proc_array['pid'], SIGINT); - } - } - - /** - * Send and receive data from external process. - * - * Each child class must implement this function. - * - * @param StackRequest $request - * @return StackResponse - */ - function CPSend($request) { - } - - /** - * Closes communication with external process. - * - * @return void - */ - function CPClose() { - // only attempt to close if there is a connection - if (is_resource($this->cpProcess)) { - proc_close($this->cpProcess); - } - } - } - - /** - * Class to support communication with a TeX-HTML converter. - * - * @package lib - * @subpackage Stack - */ - class TexProcess extends StackProcess { - - /** - * Constructor - * - * Initialises $cpCmd and $cpDescriptors according to values set in stacksettings.inc - * - * @see StackProcess::StackProcess() - * @return void - */ - function TexProcess() { - // read values from stacksettings.inc - global $stack_logfiles; - global $stack_latex; - - $descriptors = array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('file', $stack_logfiles."tex_errors.txt", 'a')); - - parent::StackProcess($stack_latex['command'], $descriptors); - } - - /** - * Opens communication with external process. - * - * @see StackProcess::CPInitialise() - * @return boolean true if connected successfully, false otherwise - */ - function CPInitialise() { - $ret = parent::CPInitialise(); - return $ret; - } - - /** - * Send and receive data from stdin and stdout. - * - * Possible error: - * -'TEX-INVALID' if received from unknown source - * - * @param StackRequest $request Expecting $crType 'TEXCOMMAND', $crData contains TeX string to convert - * @return StackResponse $response $crReturn contains converted HTML string - */ - function CPSend($request) { - - $ret=''; - // write the data from the StackRequest object to stdin - if (strcmp($request->crType, 'TEXCOMMAND') == 0) { - fwrite($this->cpPipes[0], $request->crData); - fclose($this->cpPipes[0]); - - // read output from stdout - while (!feof($this->cpPipes[1])) { - $ret .= fgets($this->cpPipes[1], 1024); - } - fclose($this->cpPipes[1]); - - // create StackResponse object with returned results - $response = new StackResponse(); - $response->crData = trim($ret); - } else { - // invalid request - $response->crError['TEX-INVALID'] = TRUE; - } - - return $response; - } - } - - /** - * Class to support communication with an external CAS process. - * - * @package lib - * @subpackage Stack - */ - class CASProcess extends StackProcess { - - /** - * @var StackCAS $cpCAS Holds/produces CAS-specific information - */ - var $cpCAS; - /** - * @var char $cpOutputStartChar Marks the beginning of expected CAS output - */ - var $cpOutputStartChar; - /** - * @var char $cpOutputEndChar Marks the end of expected CAS output - */ - var $cpOutputEndChar; - - /** - * Constructor - * - * Uses information from stacksettings.inc to initialise $cpCmd and $cpDescriptors. The initial - * release of STACK supports the Axiom CAS, which is available from {@link http://www.nongnu.org/axiom Axiom}. - * - * @return void - */ - function CASProcess() { - // read values from stacksettings.inc - global $stack_cas; - global $stack_logfiles; - - // determine which type of StackCAS to use - if (strcmp($stack_cas['cas'], 'axiom') == 0) { - $this->cpCAS = new Axiom(); - } else if (strcmp($stack_cas['cas'], 'maxima') == 0) { - $this->cpCAS = new Maxima(); - } else { - // CAS is not supported, so exit the application (can't do much without a CAS!) - exit('The CAS specified in stacksettings.inc is not supported'); - } - - $this->cpOutputStartChar = '['; - $this->cpOutputEndChar = ']'; - - $descriptors = array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('file', $stack_logfiles.'cas_errors.txt', 'a')); - - parent::StackProcess($this->cpCAS->casCommand, $descriptors); - } - - /** - * Opens communication with external process. - * - * @return boolean true if connected successfully, false otherwise - */ - function CPInitialise() { - - $ret = parent::CPInitialise(); - - if ($ret) { - // CAS process has opened successfully - // send any initialisation commands to the CAS - $initRequest = new StackRequest('INITIALISE'); - $initRequest->crData = $this->cpCAS->casInitCommand; - $this->CPSend($initRequest); - return TRUE; - } else { - // CAS could not be initialised. - return FALSE; - } - } - - /** - * Send and receive data from stdin and stdout. - * - * Possible errors: - * - CAS-INVALID : indicates syntax error with CAS Command (didn't produce expected output) - * - CAS-TIMEOUT : took more than $stack_timeout seconds to finish processing - * - * @param StackRequest $request $crData contains the command to be sent to the CAS - * @return StackResponse $response $crReturn contains the CAS' returned value - */ - function CPSend($request) { - $response = new StackResponse(); - - if ($request->crTimed) { - global $stack_timeout; - $timeout = $stack_timeout; - } else { - $timeout = 0; - } - - // write to stdin - fwrite($this->cpPipes[0], $request->crData."\n"); - fflush($this->cpPipes[0]); - - // give the CAS a chance to process uninterrupted - sleep(1); - - fflush($this->cpPipes[1]); - stream_set_blocking($this->cpPipes[1], FALSE); - - // counters to keep track of the number of start and end characters - $left_char = 0; - $right_char = 0; - - $now = time(); - // read one character at a time until the output starting character is reached - // or until timeout - do { - $current = time(); - - if (($timeout > 0) && (($current - $now) > $timeout)) { - // character marking the start of expected output never received - // must have been a syntax error - $response->crError['CAS-INVALID'] = TRUE; - break; - } - - $ret = fread($this->cpPipes[1], 1); - //To see *exactly* what the CAS spits out: - //echo $ret; - - } while ($ret != $this->cpOutputStartChar); - - if ($response->crError['CAS-INVALID']) { - // nothing more to do, return $response with error - return $response; - } else { - // mark the beginning of the record - $response->crReturn = $this->cpOutputStartChar; - $left_char++; - $now = time(); - - // capture the output until the matching output ending character is reached - do { - $current = time(); - if (($timeout > 0) && (($current - $now) > $timeout)) { - // CAS has been evaluating for more than the prescribed value - // timeout - $response->crError['CAS-TIMEOUT'] = TRUE; - break; - } - - $ret = fread($this->cpPipes[1], 1); - //To see *exactly* what the CAS spits out: - //echo $ret; - $response->crReturn .= $ret; - - if (strcmp($ret, $this->cpOutputStartChar) == 0) { - $left_char++; - } else if (strcmp($ret, $this->cpOutputEndChar) == 0) { - $right_char++; - } - - } while ($left_char != $right_char); - - // return the response object - return $response; - } - } - - /** - * Evaluate an answer test. - * - * Possible errors: - * - TEST-UNPACK : couldn't read the data sent in the request, $crReturn contains keys of empty variables - * - TEST-UNKNOWN : an unsupported answer test was requested, $crReturn contains name of unsupported answer test - * - TEST-TIMESTAMP : output from CAS did not match with input - * - TEST-PARSE : output from CAS could not be parsed, $crReturn contains errors - * - * @param StackRequest $testRequest $crData contains answer test parameters - * @return StackResponse $testResponse $crReturn contains CAS output - */ - function CPAnswerTest($testRequest) { - // create a stackresponse object - $testResponse = new StackResponse(); - $unpackerrors = NULL; - - // $testRequest->crData contains variables - // unpack the data variables - // first check to make sure it is an array! - if (is_array($testRequest->crData)) { - foreach($testRequest->crData as $key => $val) { - if (strcmp($key, 'exp1') == 0 && isset($val)) { - $exp1 = $val; - } else if (strcmp($key, 'exp2') == 0 && isset($val)) { - $exp2 = $val; - } else if (strcmp($key, 'test') == 0 && isset($val)) { - $test = $val; - } else if (strcmp($key, 'display') == 0 && isset($val)) { - $display = $val; - } else { - $unpackerrors[] = $key; - } - } - - } else { - $testResponse->crReturn = "Expecting an array"; - $testResponse->crError['TEST-UNPACK'] = TRUE; - return $testResponse; - } - - if (is_array($unpackerrors)) { - // contains the variables that were empty - $testResponse->crReturn = $unpackerrors; - $testResponse->crError['TEST-UNPACK'] = TRUE; - return $testResponse; - } - - // get the command to send to the cas - $t = time(); - - // Hack: this should probably be a list from stackData? - $ATests = array('CASEqual','AlgEquiv','FacForm','Int','Diff'); - - if (array_search($test,$ATests,TRUE)) { - $testCommand = $this->cpCAS->CASAnsTestCmd($exp1, $exp2, $t, $display, $test); - } else { - $testResponse->crReturn = $test; - $testResponse->crError['TEST-UNKNOWN'] = TRUE; - return $testResponse; - } - - // send to CASProcess - $testRequest->crData = $testCommand; - $testRequest->crTimed = TRUE; - - // send it to the CAS - $testResponse = $this->CPSend($testRequest); - - // unparse the result - // no errors - if ($testResponse->crError === FALSE) { - - // check for the timestamp - // We need to coerce the numeric time stamp into a string. - $pos = strpos($testResponse->crReturn,"$t"); - - if (FALSE === $pos) { - $testResponse->crError['TEST-TIMESTAMP'] = TRUE; - } else { - $unp = $this->cpCAS->CASAnsTestParse($testResponse->crReturn); - - if (isset($unp['errors'])) { - - $testResponse->crReturn = $unp['errors']; - $testResponse->crError['TEST-PARSE'] = TRUE; - } else { - $testResponse->crReturn = $unp; - } - } - } - - return $testResponse; - } - - /** - * Instantiate a list of local variables. - * - * Possible errors: - * - VARS-UNPACK : request array was empty - * - VARS-CODEINST : error instantiating CAS-specific code - * - VARS-TIMESTAMP : output from CAS did not match with input - * - VARS-PARSE : output from CAS could not be parsed, any variables that could not be instantiated are restored to un-CASed value in $crReturn - * - * @param StackRequest $varRequest $crData contains the list of local variables - * @return StackResponse $varResponse $crReturn contains the instantiated values - */ - function CPProcessVars($varRequest) { - // create a StackResponse object - $varResponse = new StackResponse(); - - // local variables to be processed will be stored in - // $varRequest->crData - // generate CAS command - - $locals = $varRequest->crData['locals']; - $display = $varRequest->crData['display']; - // CJS - $seed = $varRequest->crData['randseed']; - - if (!is_array($locals)) { - // no data in $varRequest! - $varResponse->crError['VARS-UNPACK'] = TRUE; - return $varResponse; - } - - $t = time(); - $varCommand = $this->cpCAS->CASCodeInstantiate($locals, $t, $seed, $display); - - if ($varCommand != '') { - // send to CAS - $varRequest->crData = $varCommand; - $varResponse = $this->CPSend($varRequest); - - // check for errors - if ($varResponse->crError === FALSE) { - - // check timestamp - $pos = strpos($varResponse->crReturn,"$t"); // We need to coerce the numeric time stamp into a string. - if (FALSE === $pos) { - $varResponse->crError['VARS-TIMESTAMP'] = TRUE; - } else { - - $parsed = $this->cpCAS->CASParseCASOutput($varResponse->crReturn); - - // Get the CAS's values of the locals into an array. - // CJS: The whole of this foeach block has been re-written. - foreach ($locals as $lk => $locvar) { - $locals_inst[$lk] = $parsed['questionVarsInst'][$lk]; - if (isset($locals_inst[$lk]['error'])) { // There is a CAS error! - - // Get the command that went in. - $val = $locvar['value']; - if ('' == $locals_inst[$lk]['display']) { - // This must be a genuine error, since nothing is displayed. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - $locals_inst[$lk]['display'] = $val; // Restore the un-CASed value - } else if (FALSE != strstr($val,'plot')) { - // We asked for a plot, these always generate an error! (HACK) - unset($locals_inst[$lk]['error']); - $locals_inst[$lk]['display'] = $locals_inst[$lk]['value']; - } else { - // This must also be a genuine error, but keep the display, since we have it. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - $varResponse->crError['VARS-PARSE'] = TRUE; - } - - } - } - - $varResponse->crReturn = $locals_inst; - } - } - - } else { - $varResponse->crError['VARS-CODEINST'] = TRUE; - } - - return $varResponse; - } - - /** - * Closes communication with external process. - * - * Attempts to close CAS process nicely and terminates it if this doesn't work. - * - * @return void - */ - function CPClose() { - - if (is_resource($this->cpProcess)) { - - // write close command to stdin - fwrite($this->cpPipes[0], $this->cpCAS->casCloseCommand."\n"); - fflush($this->cpPipes[0]); - - // check to make sure it was closed - if (is_resource($this->cpProcess)) { - $proc_array = proc_get_status($this->cpProcess); - - if ($proc_array['running']) { - // kill off process - proc_terminate($this->cpProcess); - } - - fclose($this->cpPipes[0]); - fclose($this->cpPipes[1]); - - } - - parent::CPClose(); - } - } - } ?> --- 1,4 ---- --- stopsocket.php DELETED --- --- stackRequest.php DELETED --- --- stackSocket.php DELETED --- --- startsocket.php DELETED --- --- stackCAS.php DELETED --- |
From: Chris S. <san...@us...> - 2005-08-19 16:17:00
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32232/lang/en/doc Modified Files: Tag: development_xmlrqp author_testsuite.php Log Message: Important changes to the way STACK connects to the CAS. Index: author_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_testsuite.php,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** author_testsuite.php 25 Jul 2005 10:09:32 -0000 1.6 --- author_testsuite.php 19 Aug 2005 16:16:44 -0000 1.6.2.1 *************** *** 186,189 **** --- 186,205 ---- $testsuite[] = stack_testsuite_construct('RegExp','cxcxcz','3.1415927',0,'[0-9]*\.[0-9]*',''); + $testsuite[] = stack_testsuite_construct('SA_True','TRUE','TRUE',1,'',''); + $testsuite[] = stack_testsuite_construct('SA_True','FALSE','TRUE',0,'',''); + $testsuite[] = stack_testsuite_construct('SA_True','integerp(3)','TRUE',1,'',''); + $testsuite[] = stack_testsuite_construct('SA_True','integerp(3.1)','TRUE',0,'',''); + + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.1','1',0,'','No option, so 5%'); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.05','1',1,'',''); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.05','1',1,'0.1','Options passed'); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.05','3',0,'0.1',''); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','3.14','pi',1,'0.001',''); + + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.1','1',0,'','No option, so 5%'); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.05','1',1,'',''); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.05','1',1,'0.1','Options passed'); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.05','3',0,'0.1',''); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','3.14','pi',0,'0.001',''); /* ********************************************************** */ *************** *** 225,231 **** // (4) Sort out and display the output echo "<tr> <th> pass? </th> - <th> TAns </th> <th> SAns </th> <th> Ans </th> <th> Errors </th> <th> RawMark </th> --- 241,248 ---- // (4) Sort out and display the output echo "<tr> <th> pass? </th> <th> SAns </th> <th> Ans </th> + <th> TAns </th> + <th> Opt </th> <th> Errors </th> <th> RawMark </th> *************** *** 301,307 **** // (4) Construct the row. echo " <td> $outcome </td>\n"; - echo " <td nowrap=\"nowrap\">".stack_s($ts['TAns'])." </td>\n "; echo " <td nowrap=\"nowrap\">".stack_s($ts['SAns'])." </td>\n "; echo " <td> $dispans </td>\n "; echo " <td> $errans </td>\n "; echo " <td> $rawmark </td>\n "; --- 318,325 ---- // (4) Construct the row. echo " <td> $outcome </td>\n"; echo " <td nowrap=\"nowrap\">".stack_s($ts['SAns'])." </td>\n "; echo " <td> $dispans </td>\n "; + echo " <td nowrap=\"nowrap\">".stack_s($ts['TAns'])." </td>\n "; + echo " <td> {$ts['AnsTestOpt']} </td>\n "; echo " <td> $errans </td>\n "; echo " <td> $rawmark </td>\n "; |
From: Chris S. <san...@us...> - 2005-08-19 16:17:00
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32232/scripts/maxima Modified Files: Tag: development_xmlrqp stackmaxima.mac Added Files: Tag: development_xmlrqp complexj.lisp Log Message: Important changes to the way STACK connects to the CAS. Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** stackmaxima.mac 25 Jul 2005 10:09:32 -0000 1.22 --- stackmaxima.mac 19 Aug 2005 16:16:45 -0000 1.22.2.1 *************** *** 78,81 **** --- 78,84 ---- load("stacktex.lisp"); /* Loads LaTeX adaptions and preferences */ + complexj:TRUE; + if complexj then (j:%i,load("complexj.lisp")) else i:%i; /* Makes a complex j if needed */ + /* ARRGH! */ /* texput("<<",[" {\\color{red} ", " } ", " " ],matchfix); */ *************** *** 558,562 **** /* An answer test based expandp(sa). */ ! ATExpanded(SA) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str], RawMark:0, FeedBack:"", AnswerNote:"", --- 561,566 ---- /* An answer test based expandp(sa). */ ! /* Note, the TA is a dummy to allow one mechanism for calling functions */ ! ATExpanded(SA,TA) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str], RawMark:0, FeedBack:"", AnswerNote:"", --- NEW FILE: complexj.lisp --- ;; Customize Maxima's TEX() function. ;; Make %i print at a "j" ;; Chris Sangwin 19 August Jan 2005. ;; Useful files: ;; \Maxima-5.9.0\share\maxima\5.9.0\share\utils\mactex-utilities.lisp ;; \Maxima-5.9.0\share\maxima\5.9.0\src\mactex.lisp (defprop $%i "j" texword) |
From: Chris S. <san...@us...> - 2005-08-19 16:16:55
|
Update of /cvsroot/stack/stack-1-0/scripts/axiom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32232/scripts/axiom Removed Files: Tag: development_xmlrqp axiom_initialisation.input Log Message: Important changes to the way STACK connects to the CAS. --- axiom_initialisation.input DELETED --- |
From: pkiddie <pk...@us...> - 2005-08-19 15:33:04
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20664/scripts/rqp Modified Files: Tag: development_xmlrqp RQPv1p0Server.php nb_easyxml_lite.php nb_soapfuncs.php Removed Files: Tag: development_xmlrqp RQPv1p0Server_old.php Log Message: Integration of RQP v1 revision10 Index: nb_easyxml_lite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/nb_easyxml_lite.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 *** nb_easyxml_lite.php 28 Jul 2005 15:03:48 -0000 1.1.2.2 --- nb_easyxml_lite.php 19 Aug 2005 15:32:49 -0000 1.1.2.3 *************** *** 1,524 **** ! <?PHP ! ! /*!< This set of classes and function is to provide a simple method of ! * dealing with XML that does not depend on optional libraries ! */ ! ! define("START_TAG",1); ! define("END_TAG",2); ! define("CLOSED_TAG",3); ! define("CONTENT",4); [...1021 lines suppressed...] ! ! function getAttribute($index, $attribname) ! { ! if((is_array($this->entities[$index]->attribs))&&(array_key_exists($attribname,$this->entities[$index]->attribs))) ! return $this->entities[$index]->attribs[$attribname]; ! else ! return ""; ! } ! ! }; ! ! function nb_easyxmldoc($inp) ! { ! $dom = new nb_easyxml; ! $dom->parsein($inp); ! return $dom; ! } ! ?> \ No newline at end of file Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/RQPv1p0Server.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 *** RQPv1p0Server.php 19 Aug 2005 09:04:57 -0000 1.1.2.5 --- RQPv1p0Server.php 19 Aug 2005 15:32:49 -0000 1.1.2.6 *************** *** 1,156 **** <?php - include("nb_easyxml_lite.php"); - include("nb_soapfuncs.php"); - - include("rqp_util.php"); //Stack/RQP utility functions - [...2289 lines suppressed...] $ret .= $this->soapify_anyURI($input, "anyURI") . "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_anyURIArray($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $ret[] = $this->desoap_anyURI($xml, $cidx, "anyURI"); $cidx = $xml->FindNextPeer($cidx); } ! return $ret; } } ?> \ No newline at end of file Index: nb_soapfuncs.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/nb_soapfuncs.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 *** nb_soapfuncs.php 28 Jul 2005 15:03:48 -0000 1.1.2.2 --- nb_soapfuncs.php 19 Aug 2005 15:32:49 -0000 1.1.2.3 *************** *** 1,156 **** ! <?php ! /***************************************************************************** ! The purpose of this library is to provide a very simple, interoperable ! SOAP implentation for PHP that is not dependent on any optional libraries and ! can function with both PHP version 4.3 and PHP version 5. ! This library is expected to be used with generated code from ws_gen and ! requires nb_easyxml.php. ! *****************************************************************************/ ! ! class nbSOAPFault ! { ! var $faultcode; ! var $faultstring; ! var $faultdetail; ! ! function nbSOAPFault($faultcode, $faultstring, $faultdetail) ! { ! $this->faultcode = $faultcode; ! $this->faultstring = $faultstring; ! $this->faultdetail = $faultdetail; ! $this->faultactor = $_SERVER['PHP_SELF']; ! } ! ! function soapify() ! { ! $out = "<soap:Fault>\n"; ! $out .= "<faultcode>".$this->faultcode."</faultcode>\n"; ! $out .= "<faultstring>".$this->faultstring."</faultstring>\n"; ! $out .= "<faultactor>".$this->faultactor."</faultactor>\n"; ! $out .= "<faultdetail>".$this->faultdetail."</faultdetail>\n"; ! $out .= "</soap:Fault>"; ! return $out; ! } ! } ! ! function desoap_nbSOAPFault($xmp, $cp) ! { ! return new nbSOAPFault("","",""); ! } ! ! ! class nbSOAP ! { ! //# this is just a placeholder for now, eventually it will ! // hold serialization methods for inbuilt types and ! // the SOAP request functions. ! } ! ! // HTTP 1.1 version; under development, not ready for use ! function nbSOAP_request11($URI, $SOAPAction, $data) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! $request = "POST " . $urldata['path'] . " HTTP/1.1\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); ! stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; //## ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! //# this part needs to properly check the length of response, and ! //# time out neatly if there's too long a delay. ! $cl = strlen($contents); ! $contents .= fread($sock, 8192); ! while ((!feof($sock))&&($cl < strlen($contents))) ! { ! $cl = strlen($contents); ! $contents .= fread($sock, 8192); ! } ! fclose($sock); ! } ! echo "<pre>" . htmlentities($contents) . "</pre>"; ! return $contents; ! ! } ! ! function nbSOAP_request10($URI, $SOAPAction, $data) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! $request = "POST " . $urldata['path'] . " HTTP/1.0\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); ! stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! while (!feof($sock)) ! { ! $contents .= fread($sock, 8192); ! } ! fclose($sock); ! } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging ! return $contents; ! ! } ! ! function nbSOAP_Envelope($body) ! { ! $body = trim($body); ! if(substr($body,0,10) != "<soap:Body") ! return false; ! $soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ! $soapXML .= "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; ! $soapXML .= "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"; ! $soapXML .= $body; ! $soapXML .= "\n</soap:Envelope>\n"; ! return $soapXML; ! } ! ! function encodeXMLSafeString($in) ! { ! // this is virtually the same as htmlspecialchars, however I've made my own version to ! // ensure it always matches the decodeXMLSafeString function. ! $plain = array("&", "<", ">", "\""); ! $code = array("&", "<", ">", """); ! return str_replace($plain, $code, strval($in)); ! } ! ! function decodeXMLSafeString($in) ! { ! $code = array("<", ">", """, "&"); ! $plain = array("<", ">", "\"", "&"); ! return str_replace($code, $plain, $in); ! } ! ?> \ No newline at end of file --- 1,180 ---- ! <?php ! /***************************************************************************** ! The purpose of this library is to provide a very simple, interoperable ! SOAP implentation for PHP that is not dependent on any optional libraries and ! can function with both PHP version 4.3 and PHP version 5. ! This library is expected to be used with generated code from ws_gen and ! requires nb_easyxml.php. ! *****************************************************************************/ ! ! class nbSOAPFault ! { ! var $faultcode; ! var $faultstring; ! var $faultdetail; ! ! function nbSOAPFault($faultcode, $faultstring, $faultdetail) ! { ! $this->faultcode = $faultcode; ! $this->faultstring = $faultstring; ! $this->faultdetail = $faultdetail; ! $this->faultactor = $_SERVER['PHP_SELF']; ! } ! ! function soapify() ! { ! $out = "<soap:Fault>\n"; ! $out .= "<faultcode>".$this->faultcode."</faultcode>\n"; ! $out .= "<faultstring>".$this->faultstring."</faultstring>\n"; ! $out .= "<faultactor>".$this->faultactor."</faultactor>\n"; ! $out .= "<faultdetail>".$this->faultdetail."</faultdetail>\n"; ! $out .= "</soap:Fault>"; ! return $out; ! } ! } ! ! function desoap_nbSOAPFault($xmp, $cp) ! { ! return new nbSOAPFault("","",""); ! } ! ! ! class nbSOAP ! { ! //# this is just a placeholder for now, eventually it will ! // hold serialization methods for inbuilt types and ! // the SOAP request functions. ! } ! ! // HTTP 1.1 version; under development, still to get proxy support and error reporting. ! function nbSOAP_request11($URI, $SOAPAction, $data, $timeLimit = 20) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! // $request = "GET " . $urldata['path'] . " HTTP/1.1\r\n"; ! $request = "POST " . $urldata['path'] . " HTTP/1.1\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $startTime = time(); ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); ! stream_set_timeout($sock, 2); ! stream_set_blocking($sock, false); ! echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! //# this part needs to properly check the length of response, and ! //# time out neatly if there's too long a delay. ! $headersComplete = false; ! $pageComplete = false; ! $cl = -1; ! while ((!feof($sock))&&(!$pageComplete)) ! { ! $cl = strlen($contents); ! $contents .= fread($sock, 8192); ! /* if(!$headersComplete) ! { ! $headerEnd = strpos($contents,"\r\n\r\n"); ! if($headerEnd != false) ! { ! $headersComplete = true; ! $clp = strpos($contents,"Content-Length:"); ! $cle = strpos($contents,"\r\n",$clp); ! $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); ! $headerLength = $cle+4; ! } ! } ! if($headersComplete) // not an else because I want it done if headersComplete just set ! { ! if(strlen($contents)>=$contentLength+$headerLength) ! $pageComplete = true; ! } */ ! $callTime = time()-$startTime; ! if($callTime >= $timeLimit) ! $pageComplete = true; ! echo "<p><i><pre>[" . htmlentities($contents) . "]</pre></i></p>"; ! } ! fclose($sock); ! } ! echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging ! return $contents; ! } ! ! function nbSOAP_request10($URI, $SOAPAction, $data) ! { ! $contents = ""; ! $urldata = parse_url($URI); ! if(!array_key_exists('port', $urldata)) ! $urldata['port']=80; ! $request = "POST " . $urldata['path'] . " HTTP/1.0\r\n"; ! $request .= "Host: ". $urldata['host'] ."\r\n"; ! $request .= "Accept: */*\r\n"; ! $request .= "User-Agent: PHP-script\r\n"; ! $request .= "Content-Type: text/xml; charset=utf-8\r\n"; ! $request .= "Content-length: " . strlen($data) . "\r\n"; ! $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; ! $request .= $data; ! $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); ! stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging ! ! if($sock == false) ! { ! return false; ! } ! else ! { ! fputs($sock, $request); ! while (!feof($sock)) ! { ! $contents .= fread($sock, 8192); ! } ! fclose($sock); ! } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging ! return $contents; ! ! } ! ! function nbSOAP_Envelope($body) ! { ! $body = trim($body); ! if(substr($body,0,10) != "<soap:Body") ! return false; ! $soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; ! $soapXML .= "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; ! $soapXML .= "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"; ! $soapXML .= $body; ! $soapXML .= "\n</soap:Envelope>\n"; ! return $soapXML; ! } ! ! function encodeXMLSafeString($in) ! { ! // this is virtually the same as htmlspecialchars, however I've made my own version to ! // ensure it always matches the decodeXMLSafeString function. ! $plain = array("&", "<", ">", "\""); ! $code = array("&", "<", ">", """); ! return str_replace($plain, $code, strval($in)); ! } ! ! function decodeXMLSafeString($in) ! { ! $code = array("<", ">", """, "&"); ! $plain = array("<", ">", "\"", "&"); ! return str_replace($code, $plain, $in); ! } ! ?> \ No newline at end of file --- RQPv1p0Server_old.php DELETED --- |
From: pkiddie <pk...@us...> - 2005-08-19 14:05:24
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1372/html Modified Files: Tag: development_xmlrqp admin-menu.txt Log Message: STACK now uses new import script, and deals with questions, quizzes and question lists All echo'ing to screen removed Only accepts valid XML files, reporting to user any errors found Index: admin-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/admin-menu.txt,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -C2 -d -r1.13.2.1 -r1.13.2.2 *** admin-menu.txt 15 Aug 2005 16:09:23 -0000 1.13.2.1 --- admin-menu.txt 19 Aug 2005 14:05:13 -0000 1.13.2.2 *************** *** 4,13 **** .menu_QB|question_bank.php?action=questionbank_screen ..menu_New|question_bank.php?action=edit_new ! ..menu_Import|question_bank.php?action=import ! ..menu_Import_PDK|import.php?action=import .menu_Quizzes|editquiz.php?action=quiz_choose ..menu_New|editquiz.php?action=quiz_new ! ..menu_Import|editquiz.php?action=import ! ..menu_Import_PDK|import.php?action=import .menu_Reporting|analysis.php .menu_User|user.php --- 4,11 ---- .menu_QB|question_bank.php?action=questionbank_screen ..menu_New|question_bank.php?action=edit_new ! ..menu_Import|import.php?action=import .menu_Quizzes|editquiz.php?action=quiz_choose ..menu_New|editquiz.php?action=quiz_new ! ..menu_Import|import.php?action=import .menu_Reporting|analysis.php .menu_User|user.php |
From: pkiddie <pk...@us...> - 2005-08-19 14:05:23
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1372 Modified Files: Tag: development_xmlrqp import.php Log Message: STACK now uses new import script, and deals with questions, quizzes and question lists All echo'ing to screen removed Only accepts valid XML files, reporting to user any errors found Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/import.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 *** import.php 17 Aug 2005 16:48:46 -0000 1.1.2.5 --- import.php 19 Aug 2005 14:05:14 -0000 1.1.2.6 *************** *** 69,126 **** } ! ! ! $upload_successful = FALSE; ! if ($action == 'uploaded_xml') { - if (array_key_exists('xmlfile',$_FILES)) { - if (is_uploaded_file($_FILES['xmlfile']['tmp_name'])) { ! ! ! ! include_once("{$stack_root}/scripts/stackXML.php"); ! ! $imported = stack_xml_parse_file($_FILES['xmlfile']['tmp_name']); ! ! // If a single question has been uploaded, edit it, if multiple ! ! // questions store them in the database ! ! $upload_successful = TRUE; ! } ! } - } - - switch ($action) { - - case 'import': - - stack_display_import($errors); - - break; - - - case 'uploaded_xml': ! if ($upload_successful) { ! ! stack_display_parse_imported($imported); ! ! } ! ! break; ! } - /** --- 69,134 ---- } ! $upload_successful = FALSE; ! $errors = ''; if ($action == 'uploaded_xml') { if (array_key_exists('xmlfile',$_FILES)) { if (is_uploaded_file($_FILES['xmlfile']['tmp_name'])) { ! if (findtype($_FILES['xmlfile']['name'])=='xml') { //Only allow the uploading of XML files ! include_once("{$stack_root}/scripts/stackXML.php"); ! $imported = stack_xml_parse_file($_FILES['xmlfile']['tmp_name'],$errors); //Returns an array version of imported XML ! ! //Incorrect XML file input, no [mathQuiz] or [assessmentItem] head element ! if (!$imported) { ! $upload_successful = FALSE; ! echo("<font color=\"red\">The XML file uploaded is not a question, question list or quiz</font><br />"); ! echo("<b>Further information: $errors</b><br /><br />"); ! } ! else { ! $upload_successful = TRUE; ! } ! } ! ! else ! { ! echo("<font color=\"red\">The selected file is not an XML file</font><br /><br />"); ! } } ! ! else { ! echo("<font color=\"red\">You have not selected an XML file to upload</font><br /><br />"); ! } } } switch ($action) { case 'uploaded_xml': + if ($upload_successful) { + stack_display_parse_imported($imported); + break; + } + + else { + $action='import'; + } + + case 'import': + stack_display_import($errors); + break; + } ! /** ! * This function returns the file extension of the file uploaded. ! * ! * @param string $file The filename of the file uploaded ! * @return string $type The uploaded file's extension ! */ ! function findtype($file) { ! $revfile = strrev($file); ! $type = strtolower( strrev(substr($revfile,0,strpos($revfile,"."))) ); ! return $type; ! } /** *************** *** 135,139 **** echo nsf($errors,'import'); ! echo "Select a file to upload and edit: <br /> --- 143,147 ---- echo nsf($errors,'import'); ! echo "Select an XML file to upload and edit: <br /> *************** *** 148,152 **** </form>\n\n"; - } --- 156,159 ---- *************** *** 178,186 **** foreach($stackQuiz as $arrayKey=>$quizField) { ! show_array($arrayKey); ! show_array($imported); if (array_key_exists($arrayKey,$quiz)) { ! print_r("true"); $isQuiz = true; break; --- 185,193 ---- foreach($stackQuiz as $arrayKey=>$quizField) { ! //show_array($arrayKey); ! //show_array($imported); if (array_key_exists($arrayKey,$quiz)) { ! //print_r("true"); $isQuiz = true; break; *************** *** 218,291 **** function stack_display_show_imported_quiz($quiz) { echo "<h2>Details of quiz 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>'; //Validate quiz ! //Add quiz to database ! //Show quiz stuff to screen ! echo "<tr>\n <td>".sf($quiz,'quizID')."</td> <td>".sf($quiz,'quizName')." </td> <td>".sf($quiz,'quizDescription')." </td> <td>".sf($quiz,'quizKeywords')." </td>"; ! $errs = NULL; ! show_array($quiz); ! ! //Work on each question ! foreach ($quiz as $key => $qu) { ! ! /*if $key==('assessmentItem') ! stack_question_validate($quiz[$key],$errs[$key]); ! $qu['questionID'] = stack_db_question_add($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>"; - echo "</tr></tbody></table>\n\n"; ! ! echo stack_question_errstr($errs[$key]); ! echo "\n\n<table><thead><tr>"; - echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; - echo '</tr></thead><tbody>'; - } else { - echo "<td><font color=\"greed\">Valid question</font></td>"; ! } - echo "</tr>\n"; - - }*/ } - - echo "</tbody></table>\n"; ! } --- 225,318 ---- function stack_display_show_imported_quiz($quiz) { + global $stack_web_url; + echo "<h2>Details of quiz 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>'; //Validate quiz + $errs = NULL; + $errc = FALSE; ! stack_quiz_validate($quiz,$errs); ! stack_xml_reinstate_quiz_meta_defaults($quiz); //Reinstate any default (empty) metadata fields ! /*if (nsf($errs,$key)) { ! if (is_array($errs[$key])) { ! $errc = TRUE; ! } ! }*/ ! //Add quiz to database, retrieve its new quizID, to add each question to the quiz ! //Each quiz should have a unique ID, so will generate a new one here ! if (array_key_exists('quizGUID',$quiz)) { ! $quiz['quizGUID']=stack_generate_guid($stack_web_url) ; ! } ! ! $quiz['quizid'] = stack_db_quiz_update($quiz); //retrieve the quiz id to add questions to that quiz ! //Show quiz details on screen screen ! echo "<tr>\n <td>".sf($quiz,'quizid')."</td> <td>".sf($quiz,'quizName')." </td> <td>".sf($quiz,'quizDescription')." </td> <td>".sf($quiz,'quizKeywords')." </td>"; ! ! if ($errc) ! { ! echo "<td><font color=\"red\">Invalid quiz</font></td>"; ! echo "</tr></tbody></table>\n\n"; ! echo stack_question_errstr($errs[$key]); ! echo "\n\n<table><thead><tr>"; ! echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; ! echo '</tr></thead><tbody>'; ! } else { ! echo "<td><font color=\"greed\">Valid quiz</font></td>"; ! } ! ! echo "</tr>\n"; ! echo "</tbody></table>\n"; //end of quiz table ! 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; + $quizQuestions = $quiz['assessmentItem']; //now point to assessment items only + + foreach ($quizQuestions as $key => $qu) { + stack_question_validate($quizQuestions[$key],$errs[$key]); + stack_xml_reinstate_question_meta_defaults($qu); //Reinstate any missing metadata in order to all fields to database + $qu['questionID'] = stack_db_question_add($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>"; echo "</tr></tbody></table>\n\n"; ! echo stack_question_errstr($errs[$key]); echo "\n\n<table><thead><tr>"; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; } else { echo "<td><font color=\"greed\">Valid question</font></td>"; ! ! //For each valid question we must also add the question to the database ! stack_db_quiz_add_question($quiz['quizid'],$qu['questionID']); } echo "</tr>\n"; } echo "</tbody></table>\n"; ! ! //<TODO: Chris to implement these links> ! echo "<p><a href=\"javascript:void(0);\">Edit imported quiz</a> "; ! echo "<p><a href=\"javascript:void(0);\">View list of quizzes</a> "; } *************** *** 293,419 **** { 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) { ! ! show_array($qu); ! stack_question_validate($quiz[$key],$errs[$key]); stack_xml_reinstate_question_meta_defaults($qu); //Reinstate any missing metadata in order to all fields to database - - show_array($qu); - $qu['questionID'] = stack_db_question_add($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>"; - echo "</tr></tbody></table>\n\n"; ! ! echo stack_question_errstr($errs[$key]); ! echo "\n\n<table><thead><tr>"; - echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; - echo '</tr></thead><tbody>'; - } else { - echo "<td><font color=\"greed\">Valid question</font></td>"; - } - echo "</tr>\n"; - } - - echo "</tbody></table>\n"; } function stack_display_show_imported_question($question) { ! include("{$stack_root}/html/qselectform.php"); ! ! echo "<h2>Details of the 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>'; ! show_array($question); ! ! stack_question_validate($question,$errs); ! ! stack_xml_reinstate_question_meta_defaults($question); //Reinstate any missing metadata in order to all fields to database ! ! $question['questionID'] = stack_db_question_add($question); ! ! echo "<tr>\n <td>".sf($question,'questionID')."</td> <td>".sf($question,'questionName')." </td> <td>".sf($question,'questionDescription')." </td> <td>".sf($question,'questionKeywords')." </td>"; ! ! $errc = FALSE; ! ! if (!empty($errs)) { ! ! $errc = TRUE; ! ! } ! ! if ($errc) { ! ! echo "<td><font color=\"red\">Invalid question</font></td>"; ! ! echo "</tr></tbody></table>\n\n"; ! ! echo stack_question_errstr($errs); ! ! echo "\n\n<table><thead><tr>"; ! ! echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; ! ! echo '</tr></thead><tbody>'; ! ! } else { ! ! echo "<td><font color=\"greed\">Valid question</font></td>"; ! ! } ! ! echo "</tr>\n"; ! echo "</tbody></table>\n"; ! echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Edit imported question</a> "; ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">View list of questions</a> "; } --- 320,399 ---- { 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]); stack_xml_reinstate_question_meta_defaults($qu); //Reinstate any missing metadata in order to all fields to database $qu['questionID'] = stack_db_question_add($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>"; echo "</tr></tbody></table>\n\n"; ! echo stack_question_errstr($errs[$key]); echo "\n\n<table><thead><tr>"; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; } else { echo "<td><font color=\"greed\">Valid question</font></td>"; } echo "</tr>\n"; } echo "</tbody></table>\n"; + + //<TODO: Chris to implement these links> + echo "<p><a href=\"javascript:void(0);\">View list of questions</a> "; } function stack_display_show_imported_question($question) { + //include("{$stack_root}/html/qselectform.php"); ! echo "<h2>Details of the uploaded question</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>'; ! //show_array($question); ! stack_question_validate($question,$errs); ! stack_xml_reinstate_question_meta_defaults($question); //Reinstate any missing metadata in order to all fields to database ! $question['questionID'] = stack_db_question_add($question); ! echo "<tr>\n <td>".sf($question,'questionID')."</td> <td>".sf($question,'questionName')." </td> <td>".sf($question,'questionDescription')." </td> <td>".sf($question,'questionKeywords')." </td>"; ! $errc = FALSE; + if (!empty($errs)) { + $errc = TRUE; + } + if ($errc) { + echo "<td><font color=\"red\">Invalid question</font></td>"; + echo "</tr></tbody></table>\n\n"; + echo stack_question_errstr($errs); + echo "\n\n<table><thead><tr>"; + echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; + echo '</tr></thead><tbody>'; + } else { + echo "<td><font color=\"greed\">Valid question</font></td>"; + } ! echo "</tr>\n"; ! echo "</tbody></table>\n"; ! //<TODO: Chris to implement these links> ! echo "<p><a href=\"javascript:void(0);\">Edit imported question</a> "; ! echo "<p><a href=\"javascript:void(0);\">View list of questions</a> "; } |
From: pkiddie <pk...@us...> - 2005-08-19 14:05:23
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1372/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackDatabase.php stackQuiz.php stackXML.php Log Message: STACK now uses new import script, and deals with questions, quizzes and question lists All echo'ing to screen removed Only accepts valid XML files, reporting to user any errors found Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5.2.6 retrieving revision 1.5.2.7 diff -C2 -d -r1.5.2.6 -r1.5.2.7 *** stackQuiz.php 17 Aug 2005 16:48:46 -0000 1.5.2.6 --- stackQuiz.php 19 Aug 2005 14:05:14 -0000 1.5.2.7 *************** *** 447,451 **** --- 447,470 ---- } + //<TODO: to be implemented> + /** + * Validate a STACK quiz + * + * 1. Check required fields at the quiz level are there (name of quiz?) + * 2. Check all fields at the quiz level are valid (valid format?) + * + * @param array &$quiz The STACK quiz to validate + * @param array &$errors Repository for errors + * @return void + */ + function stack_quiz_validate(&$quiz,&$errors) { + global $stackQuiz, $debug; + if (is_array($quiz)) { + //Perform quiz field level validation here + } else { // $quiz is not an array + $errors['quiz']=get_string('QValidquestionnotar','stack',''); + } + } Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.17 retrieving revision 1.13.2.18 diff -C2 -d -r1.13.2.17 -r1.13.2.18 *** stackXML.php 17 Aug 2005 16:48:46 -0000 1.13.2.17 --- stackXML.php 19 Aug 2005 14:05:14 -0000 1.13.2.18 *************** *** 199,203 **** { $potRespFieldElem = &$xmlDoc->createElementNS('',$potRespKey); //Create a potential response field element ! print_r($potRespField); if (is_array($potRespField)) //Test for true/false branches { --- 199,203 ---- { $potRespFieldElem = &$xmlDoc->createElementNS('',$potRespKey); //Create a potential response field element ! //print_r($potRespField); if (is_array($potRespField)) //Test for true/false branches { *************** *** 348,352 **** { //Retrieve each question individually ! foreach ($quiz['questions'] as $question) { --- 348,352 ---- { //Retrieve each question individually ! foreach ($quiz['questions'] as $order=>$question) { *************** *** 358,361 **** --- 358,367 ---- $questionFrag = &stack_xml_create_question_frag_new($question); //Write <assessmentItem> corresponding to this question + + //Include an order to each question on a question list + $questionOrder = &$xmlDoc->createAttributeNS('','order'); + $questionOrder->setText($order); + $questionFrag->setAttributeNode($questionOrder); + $quizFrag->appendChild($questionFrag); //Append onto <mathQuiz> element } *************** *** 551,555 **** { //Retrieve each question individually ! foreach ($questionList as $questionID) { $question = stack_db_getquestion($questionID); //Get the questionId from the question --- 557,561 ---- { //Retrieve each question individually ! foreach ($questionList as $order=>$questionID) { $question = stack_db_getquestion($questionID); //Get the questionId from the question *************** *** 561,564 **** --- 567,576 ---- $questionFrag = &stack_xml_create_question_frag_new($question); + + //Include an order to each question on a question list + $questionOrder = &$xmlDoc->createAttributeNS('','order'); + $questionOrder->setText($order); + $questionFrag->setAttributeNode($questionOrder); + $quizFrag->appendChild($questionFrag); } *************** *** 684,689 **** foreach($question as $tag => $data) { if (is_array($data)) { - - print_r($data); // Deal with arrays of numbered attributes. if (array_key_exists('0',$data)) { --- 696,699 ---- *************** *** 795,799 **** //2. An XML file with an array of questions. //Either return a question, or quiz data structure, then detect the head element? ! function stack_xml_parse_file($fileName) { global $stack_root; --- 805,809 ---- //2. An XML file with an array of questions. //Either return a question, or quiz data structure, then detect the head element? ! function stack_xml_parse_file($fileName,&$errors) { global $stack_root; *************** *** 803,885 **** $success = $xmlDoc->loadXML($fileName); ! //In the first instance, check what type of file we are dealing with ! //Retrieve the document element ! $headElement = $xmlDoc->documentElement; ! ! //Now retrieve the version number attached to the XML file being imported, and check for equality ! $importXmlVersion = $headElement->getAttribute('version'); ! $schemaVersion = stack_xml_check_schema_version("{$stack_root}/schemas/"); ! ! if ($importXmlVersion==null) { //Retain for compatibility - use old parsing code ! $question = stack_xml_parse_question_string($xmlDoc->toString); ! } ! ! else if ($importXmlVersion==$schemaVersion) { //Where versions match up ! switch ($headElement->nodeName) ! { ! case('assessmentItem'): ! { ! //A single question ! $question = stack_xml_parse_question($xmlDoc); ! return $question; ! break; ! } ! case('mathQuiz'): ! { ! //A list of questions or a quiz? ! $quiz = stack_xml_parse_quiz($xmlDoc); ! return $quiz; ! break; } ! default: ! { ! //Any other head element return false; ! break; } - } } ! else { //Where version number of XML data is not the same as the schema ! //Throw error return false; } } - /*//This function is called when Quiz->Import is selected. - //The user is simply trying to import a quiz file - //1. Uploading a XML file containing a quiz - function stack_xml_parse_quiz_file($fileName) - { - $xmlDoc = &new DOMIT_Document(); - $xmlDoc->setNamespaceAwareness(true); - $success = $xmlDoc->loadXML($fileName); - - - //In the first instance, check what type of file we are dealing with - //Retrieve the document element - $headElementName = $xmlDoc->documentElement->nodeName; - - switch ($headElementName) - { - //A quiz - case('mathQuiz'): - { - $quiz = stack_xml_parse_quiz($xmlDoc); - break; - } - - //Any other type - default: - { - break; - - } - } - - }*/ - //This function simply maps from an element in a particular namespace onto the correct stackQuestion/stackQuiz data structure field, //and returns that field --- 813,876 ---- $success = $xmlDoc->loadXML($fileName); ! if ($success) //If the XML file could be parsed ! { ! //In the first instance, check what type of file we are dealing with ! //Retrieve the document element ! $headElement = $xmlDoc->documentElement; ! //Now retrieve the version number attached to the XML file being imported, and check for equality ! $importXmlVersion = $headElement->getAttribute('version'); ! ! if ($importXmlVersion==null) { //Retain for compatibility - use old parsing code ! $question = stack_xml_parse_question_string($xmlDoc->toString()); ! return $question; } ! else { //XML file has a version attached to it, ! $schemaVersion = stack_xml_check_schema_version("{$stack_root}/schemas/"); //Check that XML matches version with schema ! ! if ($importXmlVersion==$schemaVersion) ! { ! switch ($headElement->nodeName) ! { ! case('assessmentItem'): ! { ! //A single question ! $question = stack_xml_parse_question($xmlDoc); ! return $question; ! break; ! } ! ! case('mathQuiz'): ! { ! //A list of questions or a quiz? ! $quiz = stack_xml_parse_quiz($xmlDoc); ! return $quiz; ! break; ! } ! ! default: //Any other head node. Do not accept this ! { ! $errors='The XML file does not seem to correspond to a question or quiz'; ! return false; ! break; ! } ! } ! } ! ! else { //Where version number of XML data is not the same as the schema ! //Throw error ! $errors='The version of the quiz or question you are trying to upload is the wrong version number'; return false; ! } } } ! else if (!$success) { //The XML file is not formatted correctly ! $errors=$xmlDoc->getErrorString(); return false; } } //This function simply maps from an element in a particular namespace onto the correct stackQuestion/stackQuiz data structure field, //and returns that field *************** *** 930,935 **** function stack_xml_parse_element_into_array(&$element,&$array,$arrayType) { - show_array($array); - $children = &$element->childNodes; //Retrieve all child nodes $noChildren = count($children); //Count the number of children --- 921,924 ---- *************** *** 979,983 **** { $order = $node->getAttributeNS('','order'); ! stack_xml_parse_element_into_array($children[$i],$array[$nodeName][],$arrayType); } --- 968,987 ---- { $order = $node->getAttributeNS('','order'); ! ! switch ($nodeName) ! { ! case('assessmentItem'): { ! stack_xml_parse_element_into_array($children[$i],$array[$nodeName][],'stackQuestion'); ! break; ! } ! ! case('mathQuiz'): { ! stack_xml_parse_element_into_array($children[$i],$array[$nodeName][],'stackQuiz'); ! } ! ! default: { ! stack_xml_parse_element_into_array($children[$i],$array[$nodeName][],$arrayType); ! } ! } } *************** *** 1276,1287 **** if ($headElement) { ! //5.1. We must append a version element onto the schema, within the head element ! $schemaVersionElement = stack_xml_create_schema_version(); ! $schemaComplexType->appendChild($schemaVersionElement); } else //Add to collection of xml elements for inclusion into head element { $xmlElements[] = $name; } --- 1280,1296 ---- if ($headElement) { ! //5.1. We must append a version element onto the schema, within the head element ! $schemaVersionElement = stack_xml_create_schema_version(); ! $schemaComplexType->appendChild($schemaVersionElement); } else //Add to collection of xml elements for inclusion into head element { + //5.2 Since this is a child element we must include an order field - used in the case of an 'assessmentItem' within a 'mathQuiz' + //Add this child field to global list of child 'enclosing' elements $xmlElements[] = $name; + + $childOrderElem = &stack_xml_create_field_order(); + $schemaComplexType->appendChild($childOrderElem); } *************** *** 2449,2453 **** else if (!empty($stackQuestion[$arrayKey]['default']) && empty($quField)) { - print_r($arrayKey); unset($question[$arrayKey]); } --- 2458,2461 ---- *************** *** 2507,2511 **** else if (!empty($stackQuiz[$arrayKey]['default']) && empty($quizField)) { - print_r($arrayKey); unset($quiz[$arrayKey]); } --- 2515,2518 ---- *************** *** 2523,2527 **** foreach ($stackQuiz as $arrayKey=>$quizField) //Iterate through the master stackQuestion fields { ! if (!array_key_exists($arrayKey,$quiz)) //Where the field ocurrs in stackQuestion, but not the imported question { //and is metadata if(!empty($quizField['type']) && ($quizField['type']=='meta')) --- 2530,2534 ---- foreach ($stackQuiz as $arrayKey=>$quizField) //Iterate through the master stackQuestion fields { ! if (!array_key_exists($arrayKey,$quiz)) //Where the field ocurrs in stackQuiz, but not the imported quiz { //and is metadata if(!empty($quizField['type']) && ($quizField['type']=='meta')) *************** *** 2531,2535 **** { //Set the field in $question to the default metadata ! $quiz[$arrayKey]==$quizField['default']; } --- 2538,2542 ---- { //Set the field in $question to the default metadata ! $quiz[$arrayKey]=$quizField['default']; } Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.34.2.6 retrieving revision 1.34.2.7 diff -C2 -d -r1.34.2.6 -r1.34.2.7 *** stackDatabase.php 17 Aug 2005 16:48:46 -0000 1.34.2.6 --- stackDatabase.php 19 Aug 2005 14:05:14 -0000 1.34.2.7 *************** *** 594,598 **** // Build the query $query .= ' ('.$qu_fields.') VALUES ('.$qu_data.')'; ! print_r($query); } else {// update question --- 594,598 ---- // Build the query $query .= ' ('.$qu_fields.') VALUES ('.$qu_data.')'; ! //print_r($query); } else {// update question *************** *** 1454,1459 **** $quiz_fields = array_keys($stackQuiz); ! show_array("In db function:"); ! show_array($quiz); $quizid = ''; --- 1454,1458 ---- $quiz_fields = array_keys($stackQuiz); ! //show_array($quiz); $quizid = ''; *************** *** 1475,1478 **** --- 1474,1478 ---- if ($new_quiz) { + $qu = ''; $quv = ''; *************** *** 1495,1499 **** $result = stack_db_query($query); ! show_array($query); // GET the last quizid --- 1495,1499 ---- $result = stack_db_query($query); ! //show_array($query); // GET the last quizid *************** *** 1521,1525 **** $result = stack_db_query($query); ! show_array($query); } --- 1521,1525 ---- $result = stack_db_query($query); ! //show_array($query); } Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.10 retrieving revision 1.29.2.11 diff -C2 -d -r1.29.2.10 -r1.29.2.11 *** stackAuthor.php 17 Aug 2005 16:48:46 -0000 1.29.2.10 --- stackAuthor.php 19 Aug 2005 14:05:14 -0000 1.29.2.11 *************** *** 341,345 **** ! show_array($question); //<PDK> Now datetime --- 341,345 ---- ! //show_array($question); //<PDK> Now datetime *************** *** 1355,1359 **** ! show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; --- 1355,1359 ---- ! //show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; *************** *** 1630,1636 **** function stack_quiz_edit(&$quiz,&$errors) { - - show_array($quiz); - print_r("got here"); // (0) Establish the quizid --- 1630,1633 ---- |
From: pkiddie <pk...@us...> - 2005-08-19 09:05:08
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2496/lang/en/doc Modified Files: Tag: development_xmlrqp author_gettingstarted.php student_input.php Log Message: Implementation of initial ServerInformation RQP call Index: student_input.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/student_input.php,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** student_input.php 14 Jul 2005 17:46:58 -0000 1.2 --- student_input.php 19 Aug 2005 09:04:57 -0000 1.2.2.1 *************** *** 1,240 **** ! <?php ! /** ! * ! * 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... ! * ! * @package documentation ! * @subpackage Stack ! */ ! ! ! ?> ! ! <a name="entry"><h2>How do I enter my answers?</h2></a> ! ! You should type in your answers using the same syntax used in the ! symbolic mathematics package, known as a computer algebra system ! (cas), underpinning your implementation. This could be ! either <i>Axiom</i> or <i>Maxima</i>. The syntax is broadly similar ! to the syntax used for mathematical formulae in general programming ! languages such as Java, C and Basic and in spreadsheet programs such ! as Excel, so you will find it useful to master it. If you are ! taking the Applied Mathematics Core course AMA101 then you will ! learn to use such a system there. If you are not, the advice below should ! be sufficient. Stack tries quite hard to give helpful information ! about syntax errors. You can also learn about the right syntax by ! doing tests in practice mode and asking for ! the solutions; as well as displaying the right answers in ordinary ! mathematical notation, Stack will tell you how they could be ! entered. (However, there are often several possible ways, and Stack ! will not always suggest the easiest one.) ! <br /><br /> ! When you have entered your answer, you can always click on the ! <b>Validate</b> button at the bottom of the page to see how the CAS will ! interpret it. If there are any syntax errors or the cas has ! misunderstood what you meant then you can fix the problem before ! asking Stack to mark your work. ! ! <ul> ! <li> Numbers like <font color="BLUE">1/4</font> should be entered as ! <tt><font color="GREEN">1/4</font></tt>, not as ! <tt><font color="GREEN">0.25</font></tt>, which can cause some ! subtle problems. ! </li> ! <li> Use a star for multiplication: for example, ! <font color="BLUE">3x</font> should be ! entered as <tt><font color="GREEN">3*x</font></tt>. Forgetting this ! is by far the most ! common source of syntax errors. Note that you do <b>not</b> need ! a semicolon at the end, unlike when you are using a CAS directly. ! <br /><br /></li> ! <li> Use a caret (^) for raising something to a power: for example, ! <font color="BLUE">x<sup>2</sup></font> should be entered as ! <tt><font color="GREEN">x^2</font></tt>. You can get ! a caret by holding down the SHIFT key and pressing the 6 key ! on most keyboards. Negative or fractional powers need brackets: ! enter <font color="BLUE">x<sup>-2</sup></font> as ! <tt><font color="GREEN">x^(-2)</font></tt> ! and <font color="BLUE">x<sup>1/3</sup></font> as ! <tt><font color="GREEN">x^(1/3)</font></tt>. ! <br /><br /></li> ! <li> More generally, when in doubt, use brackets. For example, ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! </td><td nowrap="nowrap" align="center"> ! a + b<hr noshade="noshade"> ! c + d <br /></td><td nowrap="nowrap" align="center"> ! </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! should be entered as ! <tt><font color="GREEN">(a+b)/(c+d)</font></tt>. ! Note that in this context you should always use ordinary round ! bracket (like <tt><font color="GREEN">(a+b)</font></tt>), not ! square or curly ones (like <tt><font color="GREEN">[a+b]</font></tt> ! or <tt><font color="GREEN">{a+b}</font></tt>). ! <br /> ! If you type ! <tt><font color="GREEN">a+b/(c+d)</font></tt>, then Stack ! will think that you mean ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! a +</td><td nowrap="nowrap" align="center"> ! b<hr noshade="noshade"> ! c + d<br /></td><td nowrap="nowrap" align="center"> ! </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! If you type <tt><font color="GREEN">(a+b)/c+d</font></tt>, then Stack ! will think that you mean ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! </td><td nowrap="nowrap" align="center"> ! a + b<hr noshade="noshade"> ! c<br /></td><td nowrap="nowrap" align="center"> ! + d </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! If you type <tt><font color="GREEN">a+b/c+d</font></tt>, then Stack ! will think that you mean ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! a +</td><td nowrap="nowrap" align="center"> ! b<hr noshade="noshade"> ! c<br /></td><td nowrap="nowrap" align="center"> ! + d </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! <br /> ! Some other examples: ! <ul> ! <li> ! <font color="BLUE">2<sup>a+b</sup></font> should be entered as ! <tt><font color="GREEN">2^(a+b)</font></tt> ! </li> ! <li> ! <font color="BLUE">2 cos 3x</font> should be entered as ! <tt><font color="GREEN">2*cos(3*x)</font></tt> ! </li> ! <li> ! <font color="BLUE">e<sup>ax</sup>sin(bx)</font> should be entered as ! <tt><font color="GREEN">exp(a*x)*sin(b*x)</font></tt> ! </li> ! <li> ! <font color="BLUE">(a x<sup>2</sup> + b x + c)<sup>-1</sup></font> ! should be entered as ! <tt><font color="GREEN">(a*x^2 + b*x + c)^(-1)</font></tt>. ! </li> ! </ul> ! <br /><br /></li> ! <li>the CAS system is case-sensitive. Do not enter ! <tt><font color="GREEN">X</font></tt> instead of ! <tt><font color="GREEN">x</font></tt>, or ! <tt><font color="GREEN">a</font></tt> instead of ! <tt><font color="GREEN">A</font></tt>, or ! <tt><font color="GREEN">Log(Z)</font></tt> instead of ! <tt><font color="GREEN">log(z)</font></tt>. ! </li> ! <li>The absolute value of <font color="BLUE">x</font>, which is ! written as <font color="BLUE">|x|</font> in traditional notation, ! must be entered as <tt><font color="GREEN">abs(x)</font></tt>. ! </li> ! <li> ! Standard functions such as sin, cos, tan, exp, log and so on can ! be entered using their usual names. However, the argument must ! <font color="RED">always</font> be enclosed in brackets: ! <font color="BLUE">sin x</font> should be entered as ! <tt><font color="GREEN">sin(x)</font></tt>, ! <font color="BLUE">ln 3</font> should be entered as ! <tt><font color="GREEN">ln(3)</font></tt> and so on. You can use ! either <tt><font color="GREEN">log(x)</font></tt> or ! <tt><font color="GREEN">ln(x)</font></tt> for ! the natural logarithm of x (note that both of these start with a ! lower case l, not a capital I). The function ! <font color="BLUE">1/sin(x)</font> must be ! referred to as <tt><font color="GREEN">csc(x)</font></tt> rather ! than <tt><font color="GREEN">cosec(x)</font></tt> (or you can just call ! it <tt><font color="GREEN">1/sin(x)</font></tt> if you prefer). You ! should always write ! <tt><font color="GREEN">exp(x)</font></tt> for ! <font color="BLUE">e<sup>x</sup></font>. ! <br /><br /></li> ! <li> ! <font color="BLUE">sin<sup>2</sup>x</font> should be entered as ! <tt><font color="GREEN">sin(x)^2</font></tt> (which is ! what it really means, after all). Similarly for ! <font color="BLUE">tan<sup>2</sup>(x)</font>, ! <font color="BLUE">sinh<sup>2</sup>(x)</font> and so on. ! <br /><br /></li> ! <li> ! Recall that <font color="BLUE">sin<sup>-1</sup>(x)</font> ! traditionally means the number <font color="BLUE">t</font> such that ! <font color="BLUE">sin(t) = x</font>, which is of ! course completely different from the number ! <font color="BLUE">sin(x)<sup>-1</sup> = 1/sin(x)</font>. This ! traditional notation is really rather unfortunate and is not used ! by the CAS; instead, <font color="BLUE">sin<sup>-1</sup>(x)</font> ! should be entered as <tt><font color="GREEN">arcsin(x)</font></tt>. ! Similarly, <font color="BLUE">tan<sup>-1</sup>(x)</font> should be ! entered as <tt><font color="GREEN">arctan(x)</font></tt> and so on. ! <br /><br /></li> ! <li> ! Greek letters can be entered using their English names: for ! example, enter ! <font face="SYMBOL" color="BLUE">a+b</font> ! as <tt><font color="GREEN">alpha+beta</font></tt>, and ! <font face="SYMBOL" color="BLUE">2p</font> ! as <tt><font color="GREEN">2*pi</font></tt>. ! <br /><br /></li> ! <li> ! When you work directly with a CAS, the vector <font color="BLUE">(1,2,3)</font> must be entered as ! <tt><font color="GREEN">vector([1,2,3])</font></tt>. Many Stack ! questions are set up so that you can just enter <tt><font color="green">[1,2,3]</font></tt> instead. ! </li> ! <li> ! When you work directly with a CAS, the matrix ! <font color="BLUE"> ! </font><center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! </td><td align="left"><font face="symbol"> ! é<br />ê<br /> ! ë ! </font></td><td align="center"> ! </td><td nowrap="nowrap"><table border="0" align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 1 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 2 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 3 </td></tr></tbody></table></td></tr><tr><td nowrap="nowrap" align="center" colspan="1"><table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 4 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 5 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table><tbody><tr><td nowrap="nowrap" align="center" colspan="1">6</td></tr></tbody></table></td></tr></tbody></table> ! </td><td nowrap="nowrap"></td><td align="left"><font face="symbol"> ! ù<br />ú<br /> ! û ! </font></td><td align="center"> ! </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! ! must be entered as ! <tt><font color="GREEN">matrix([1,2,3],[4,5,6])</font></tt>. ! </li> ! </ul> --- 1,480 ---- ! <?php ! ! /** ! ! * ! ! * 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... ! ! * ! ! * @package documentation ! ! * @subpackage Stack ! ! */ ! ! ! ! ! ! ?> ! ! ! ! <a name="entry"><h2>How do I enter my answers?</h2></a> ! ! ! ! You should type in your answers using the same syntax used in the ! ! symbolic mathematics package, known as a computer algebra system ! ! (cas), underpinning your implementation. This could be ! ! either <i>Axiom</i> or <i>Maxima</i>. The syntax is broadly similar ! ! to the syntax used for mathematical formulae in general programming ! ! languages such as Java, C and Basic and in spreadsheet programs such ! ! as Excel, so you will find it useful to master it. If you are ! ! taking the Applied Mathematics Core course AMA101 then you will ! ! learn to use such a system there. If you are not, the advice below should ! ! be sufficient. Stack tries quite hard to give helpful information ! ! about syntax errors. You can also learn about the right syntax by ! ! doing tests in practice mode and asking for ! ! the solutions; as well as displaying the right answers in ordinary ! ! mathematical notation, Stack will tell you how they could be ! ! entered. (However, there are often several possible ways, and Stack ! ! will not always suggest the easiest one.) ! ! <br /><br /> ! ! When you have entered your answer, you can always click on the ! ! <b>Validate</b> button at the bottom of the page to see how the CAS will ! ! interpret it. If there are any syntax errors or the cas has ! ! misunderstood what you meant then you can fix the problem before ! ! asking Stack to mark your work. ! ! ! ! <ul> ! ! <li> Numbers like <font color="BLUE">1/4</font> should be entered as ! ! <tt><font color="GREEN">1/4</font></tt>, not as ! ! <tt><font color="GREEN">0.25</font></tt>, which can cause some ! ! subtle problems. ! ! </li> ! ! <li> Use a star for multiplication: for example, ! ! <font color="BLUE">3x</font> should be ! ! entered as <tt><font color="GREEN">3*x</font></tt>. Forgetting this ! ! is by far the most ! ! common source of syntax errors. Note that you do <b>not</b> need ! ! a semicolon at the end, unlike when you are using a CAS directly. ! ! <br /><br /></li> ! ! <li> Use a caret (^) for raising something to a power: for example, ! ! <font color="BLUE">x<sup>2</sup></font> should be entered as ! ! <tt><font color="GREEN">x^2</font></tt>. You can get ! ! a caret by holding down the SHIFT key and pressing the 6 key ! ! on most keyboards. Negative or fractional powers need brackets: ! ! enter <font color="BLUE">x<sup>-2</sup></font> as ! ! <tt><font color="GREEN">x^(-2)</font></tt> ! ! and <font color="BLUE">x<sup>1/3</sup></font> as ! ! <tt><font color="GREEN">x^(1/3)</font></tt>. ! ! <br /><br /></li> ! ! <li> More generally, when in doubt, use brackets. For example, ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! </td><td nowrap="nowrap" align="center"> ! ! a + b<hr noshade="noshade"> ! ! c + d <br /></td><td nowrap="nowrap" align="center"> ! ! </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! should be entered as ! ! <tt><font color="GREEN">(a+b)/(c+d)</font></tt>. ! ! Note that in this context you should always use ordinary round ! ! bracket (like <tt><font color="GREEN">(a+b)</font></tt>), not ! ! square or curly ones (like <tt><font color="GREEN">[a+b]</font></tt> ! ! or <tt><font color="GREEN">{a+b}</font></tt>). ! ! <br /> ! ! If you type ! ! <tt><font color="GREEN">a+b/(c+d)</font></tt>, then Stack ! ! will think that you mean ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! a +</td><td nowrap="nowrap" align="center"> ! ! b<hr noshade="noshade"> ! ! c + d<br /></td><td nowrap="nowrap" align="center"> ! ! </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! If you type <tt><font color="GREEN">(a+b)/c+d</font></tt>, then Stack ! ! will think that you mean ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! </td><td nowrap="nowrap" align="center"> ! ! a + b<hr noshade="noshade"> ! ! c<br /></td><td nowrap="nowrap" align="center"> ! ! + d </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! If you type <tt><font color="GREEN">a+b/c+d</font></tt>, then Stack ! ! will think that you mean ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! a +</td><td nowrap="nowrap" align="center"> ! ! b<hr noshade="noshade"> ! ! c<br /></td><td nowrap="nowrap" align="center"> ! ! + d </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! <br /> ! ! Some other examples: ! ! <ul> ! ! <li> ! ! <font color="BLUE">2<sup>a+b</sup></font> should be entered as ! ! <tt><font color="GREEN">2^(a+b)</font></tt> ! ! </li> ! ! <li> ! ! <font color="BLUE">2 cos 3x</font> should be entered as ! ! <tt><font color="GREEN">2*cos(3*x)</font></tt> ! ! </li> ! ! <li> ! ! <font color="BLUE">e<sup>ax</sup>sin(bx)</font> should be entered as ! ! <tt><font color="GREEN">exp(a*x)*sin(b*x)</font></tt> ! ! </li> ! ! <li> ! ! <font color="BLUE">(a x<sup>2</sup> + b x + c)<sup>-1</sup></font> ! ! should be entered as ! ! <tt><font color="GREEN">(a*x^2 + b*x + c)^(-1)</font></tt>. ! ! </li> ! ! </ul> ! ! <br /><br /></li> ! ! <li>the CAS system is case-sensitive. Do not enter ! ! <tt><font color="GREEN">X</font></tt> instead of ! ! <tt><font color="GREEN">x</font></tt>, or ! ! <tt><font color="GREEN">a</font></tt> instead of ! ! <tt><font color="GREEN">A</font></tt>, or ! ! <tt><font color="GREEN">Log(Z)</font></tt> instead of ! ! <tt><font color="GREEN">log(z)</font></tt>. ! ! </li> ! ! <li>The absolute value of <font color="BLUE">x</font>, which is ! ! written as <font color="BLUE">|x|</font> in traditional notation, ! ! must be entered as <tt><font color="GREEN">abs(x)</font></tt>. ! ! </li> ! ! <li> ! ! Standard functions such as sin, cos, tan, exp, log and so on can ! ! be entered using their usual names. However, the argument must ! ! <font color="RED">always</font> be enclosed in brackets: ! ! <font color="BLUE">sin x</font> should be entered as ! ! <tt><font color="GREEN">sin(x)</font></tt>, ! ! <font color="BLUE">ln 3</font> should be entered as ! ! <tt><font color="GREEN">ln(3)</font></tt> and so on. You can use ! ! either <tt><font color="GREEN">log(x)</font></tt> or ! ! <tt><font color="GREEN">ln(x)</font></tt> for ! ! the natural logarithm of x (note that both of these start with a ! ! lower case l, not a capital I). The function ! ! <font color="BLUE">1/sin(x)</font> must be ! ! referred to as <tt><font color="GREEN">csc(x)</font></tt> rather ! ! than <tt><font color="GREEN">cosec(x)</font></tt> (or you can just call ! ! it <tt><font color="GREEN">1/sin(x)</font></tt> if you prefer). You ! ! should always write ! ! <tt><font color="GREEN">exp(x)</font></tt> for ! ! <font color="BLUE">e<sup>x</sup></font>. ! ! <br /><br /></li> ! ! <li> ! ! <font color="BLUE">sin<sup>2</sup>x</font> should be entered as ! ! <tt><font color="GREEN">sin(x)^2</font></tt> (which is ! ! what it really means, after all). Similarly for ! ! <font color="BLUE">tan<sup>2</sup>(x)</font>, ! ! <font color="BLUE">sinh<sup>2</sup>(x)</font> and so on. ! ! <br /><br /></li> ! ! <li> ! ! Recall that <font color="BLUE">sin<sup>-1</sup>(x)</font> ! ! traditionally means the number <font color="BLUE">t</font> such that ! ! <font color="BLUE">sin(t) = x</font>, which is of ! ! course completely different from the number ! ! <font color="BLUE">sin(x)<sup>-1</sup> = 1/sin(x)</font>. This ! ! traditional notation is really rather unfortunate and is not used ! ! by the CAS; instead, <font color="BLUE">sin<sup>-1</sup>(x)</font> ! ! should be entered as <tt><font color="GREEN">arcsin(x)</font></tt>. ! ! Similarly, <font color="BLUE">tan<sup>-1</sup>(x)</font> should be ! ! entered as <tt><font color="GREEN">arctan(x)</font></tt> and so on. ! ! <br /><br /></li> ! ! <li> ! ! Greek letters can be entered using their English names: for ! ! example, enter ! ! <font face="SYMBOL" color="BLUE">a+b</font> ! ! as <tt><font color="GREEN">alpha+beta</font></tt>, and ! ! <font face="SYMBOL" color="BLUE">2p</font> ! ! as <tt><font color="GREEN">2*pi</font></tt>. ! ! <br /><br /></li> ! ! <li> ! ! When you work directly with a CAS, the vector <font color="BLUE">(1,2,3)</font> must be entered as ! ! <tt><font color="GREEN">vector([1,2,3])</font></tt>. Many Stack ! ! questions are set up so that you can just enter <tt><font color="green">[1,2,3]</font></tt> instead. ! ! </li> ! ! <li> ! ! When you work directly with a CAS, the matrix ! ! <font color="BLUE"> ! ! </font><center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! </td><td align="left"><font face="symbol"> ! ! é<br />ê<br /> ! ! ë ! ! </font></td><td align="center"> ! ! </td><td nowrap="nowrap"><table border="0" align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 1 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 2 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 3 </td></tr></tbody></table></td></tr><tr><td nowrap="nowrap" align="center" colspan="1"><table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 4 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 5 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table><tbody><tr><td nowrap="nowrap" align="center" colspan="1">6</td></tr></tbody></table></td></tr></tbody></table> ! ! </td><td nowrap="nowrap"></td><td align="left"><font face="symbol"> ! ! ù<br />ú<br /> ! ! û ! ! </font></td><td align="center"> ! ! </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! ! ! must be entered as ! ! <tt><font color="GREEN">matrix([1,2,3],[4,5,6])</font></tt>. ! ! </li> ! ! </ul> ! Index: author_gettingstarted.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_gettingstarted.php,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** author_gettingstarted.php 14 Jul 2005 18:19:57 -0000 1.4 --- author_gettingstarted.php 19 Aug 2005 09:04:57 -0000 1.4.2.1 *************** *** 1,510 **** ! <?php ! /** ! * An authoring guide for STACK questions. ! * ! * @package documentation ! * @subpackage Stack ! */ ! ! /** ! * [...1501 lines suppressed...] ! <p>It is also possible to define functions within the Question ! ! Variables for use within a question. This is not recommended, ! ! and has not been widely tested. For example ! ! <pre>dum1 = f(x) := x^2 ! ! n = f(4)</pre> Again, the syntax requires this to be of the form ! ! <tt>key = value</tt>, so that another dummy assignment has taken ! ! place. Please look at Maxima's documentation for <?php ! ! $url = $stack_web_url."maximadocs/maxdoc/maxima_39.html#SEC120"; ! ! echo " <a href='$url'>functions</a>.</p> "; ! ! ?> ! |
From: pkiddie <pk...@us...> - 2005-08-19 09:05:07
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2496/scripts/rqp Modified Files: Tag: development_xmlrqp RQPv1p0Server.php rqp_util.php Added Files: Tag: development_xmlrqp stackDetails.php stackDocs.php Removed Files: Tag: development_xmlrqp RQPv1p0Client.php Log Message: Implementation of initial ServerInformation RQP call --- RQPv1p0Client.php DELETED --- --- NEW FILE: stackDetails.php --- <?php /** * This simple script returns some specific server information */ require('../../stackstd.php'); echo 'Properties of the current STACK server<br><br>'; echo 'Current STACK version: '.$stack_ver['release'].'<br>'; echo 'Administrator:'.'Admin User<br>'; echo 'Administrators e-mail: <a href="mailto:'.$stack_mail['admin_email'].'">'.$stack_mail['admin_email'].'</a><br>'; ?> Index: rqp_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/rqp_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 *** rqp_util.php 28 Jul 2005 13:38:01 -0000 1.1.2.1 --- rqp_util.php 19 Aug 2005 09:04:57 -0000 1.1.2.2 *************** *** 91,98 **** $item = NULL; ! if ('' == trim($source)) { ! // No source supplied ! return MakeRQPFault(MakeRQPError('emptySource', 'No item source supplied.'), 'No item source supplied.'); } --- 91,100 ---- $item = NULL; ! ! // No source supplied if ('' == trim($source)) { ! ! //return MakeRQPFault(MakeRQPError('emptySource', 'No item source supplied.'), 'No item source supplied.'); ! return 'No item source supplied' } *************** *** 192,195 **** --- 194,198 ---- } + class /** * Creates an RQP style SOAP fault object. Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/RQPv1p0Server.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 *** RQPv1p0Server.php 17 Aug 2005 11:24:06 -0000 1.1.2.4 --- RQPv1p0Server.php 19 Aug 2005 09:04:57 -0000 1.1.2.5 *************** *** 1,782 **** ! <?php ! include("nb_easyxml_lite.php"); ! include("nb_soapfuncs.php"); ! ! include("rqp_util.php"); //Stack/RQP utility functions ! include("../../stackstd.php"); //Reqd for version info for STACK ! ! /********* Data structures used by this web service ********* ! * ! * type ServerInformationDType{ [...3217 lines suppressed...] ! $cidx = $xml->FindChildElement($idx); ! ! while($cidx != false) ! ! { ! ! $ret[] = $this->desoap_anyURI($xml, $cidx, "anyURI"); ! ! $cidx = $xml->FindNextPeer($cidx); ! ! } ! ! } ! ! ! ! } ! ?> \ No newline at end of file --- NEW FILE: stackDocs.php --- <?php /** Script responsible for reproducing documentation for the student in how to answer questions * Depends on the stack server's language - check from stackstd.php */ require('../../stackstd.php'); //Retrieve language from stackstd: $lang = $stack_defaultlang; $lang = 'en'; $action = $_GET['action']; switch ($action) { case('student'): //Retrieve the relevent docs include("{$stack_root}/lang/$lang/doc/student_input.php"); break; case('admin'): include("{$stack_root}/lang/$lang/doc/author_gettingstarted.php"); break; case('teacher'): echo("Teacher docs here"); break; default: echo("What to do when no action supplied?"); break; } //Generate HTML for a back button echo '<FORM> <INPUT type="button" value="Back to Moodle" onClick="javascript:history.back()"> </FORM>' ?> |
From: pkiddie <pk...@us...> - 2005-08-17 16:48:56
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31977/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackDatabase.php stackQuiz.php stackXML.php Log Message: Moved question validation for an exported file into stackXML Ensure all metadata is being written out into database for questions and quizzes Ensure all 'default' metadata is removed from XML when exported, but reinstated whe imported Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5.2.5 retrieving revision 1.5.2.6 diff -C2 -d -r1.5.2.5 -r1.5.2.6 *** stackQuiz.php 17 Aug 2005 11:24:06 -0000 1.5.2.5 --- stackQuiz.php 17 Aug 2005 16:48:46 -0000 1.5.2.6 *************** *** 1,226 **** ! <?php ! ! /** ! * This file contains most functions which deal with quizzes. ! * ! * @package scripts ! * @subpackage Stack ! */ ! ! /** ! * ! */ ! // 'Unique quiz ID - local mySQL value' ! $stackQuiz['quizid']['descript'] = 'Quiz ID number'; ! $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; ! $stackQuiz['quizid']['type'] = 'meta'; ! ! // 'Quiz name' ! $stackQuiz['quizName']['descript'] = 'Quiz name'; ! $stackQuiz['quizName']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizName']['type'] = 'meta'; ! $stackQuiz['quizName']['metatag'] = 'title'; //dc:title ! $stackQuiz['quizName']['metatype'] = 'dublincore'; ! ! // 'Quiz description' ! $stackQuiz['quizDescription']['descript'] = 'Description'; ! $stackQuiz['quizDescription']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizDescription']['type'] = 'meta'; ! $stackQuiz['quizDescription']['metatag'] = 'description'; //dc:description ! $stackQuiz['quizDescription']['metatype'] = 'dublincore'; ! ! // 'Quiz options' ! $stackQuiz['quizOptions']['descript'] = 'Quiz options'; ! $stackQuiz['quizOptions']['mysql'] = 'TEXT'; ! $stackQuiz['quizOptions']['type'] = 'other'; ! ! // 'Quiz due date' ! $stackQuiz['quizDueDate']['descript'] = 'Due date'; ! $stackQuiz['quizDueDate']['mysql'] = 'int(10)'; ! $stackQuiz['quizDueDate']['type'] = 'date'; ! ! // 'Quiz mode' ! $stackQuiz['quizMode']['descript'] = 'Mode'; ! $stackQuiz['quizMode']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizMode']['type'] = 'string'; ! ! //<PDK> Quiz Metadata added - database updated ! // 'Globally unique quiz ID'; ! $stackQuiz['quizGUID']['required'] = 'system'; ! $stackQuiz['quizGUID']['mysql'] = 'CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters ! $stackQuiz['quizGUID']['type'] = 'meta'; ! $stackQuiz['quizGUID']['metatag'] = 'identifier'; ! $stackQuiz['quizGUID']['metatype'] = 'dublincore'; ! ! // 'Keywords'; ! $stackQuiz['quizKeywords']['required'] = 'optional'; ! $stackQuiz['quizKeywords']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizKeywords']['type'] = 'meta'; ! $stackQuiz['quizKeywords']['metatag'] = 'keyword'; //lom:keyword ! $stackQuiz['quizKeywords']['metatype'] = 'lom'; ! ! // 'Last edited by'; ! $stackQuiz['quizUserLastEdited']['required']='system'; ! $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; ! $stackQuiz['quizUserLastEdited']['type']='meta'; ! $stackQuiz['quizUserLastEdited']['metatag']='creator'; //dc:creator ! $stackQuiz['quizUserLastEdited']['metatype']='dublincore'; ! ! // 'Last edited on'; ! $stackQuiz['quizDateLastEdited']['required']='system'; ! $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; ! $stackQuiz['quizDateLastEdited']['type']='meta'; ! $stackQuiz['quizDateLastEdited']['metatag']='date'; //dc:date ! $stackQuiz['quizDateLastEdited']['metatype']='dublincore'; ! ! //Publisher ! $stackQuiz['quizPublisher']['required']='system'; ! $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; ! $stackQuiz['quizPublisher']['type']='meta'; ! $stackQuiz['quizPublisher']['metatag']='publisher'; //dc:publisher ! $stackQuiz['quizPublisher']['metatype']='dublincore'; ! ! //Type: Hidden from user ! $stackQuiz['type']['values']=array('quiz','quiz'); //Default to 'type' enumeration in XSD file ! $stackQuiz['type']['required']='optional'; ! $stackQuiz['type']['mysql']='TINYTEXT'; ! $stackQuiz['type']['type']='meta'; ! $stackQuiz['type']['metatag']='type'; //dc:type ! $stackQuiz['type']['metatype']='dublincore'; ! ! //Format: Hidden from user, selected by script ! $stackQuiz['quizFormat']['values']=array('application','audio','image', ! 'message','model','text','video', ! 'multipart'); ! $stackQuiz['quizFormat']['required']='optional'; ! $stackQuiz['quizFormat']['mysql']='TINYTEXT'; ! $stackQuiz['quizFormat']['type']='meta'; //dc:format ! $stackQuiz['quizFormat']['metatag']='format'; ! $stackQuiz['quizFormat']['metatype']='dublincore'; ! ! //Language: Defaulted to current system language, but user definable ! $stackQuiz['quizLanguage']['values']=array('en','fr','nl','es','unspecified'); ! $stackQuiz['quizLanguage']['required']='optional'; ! $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; ! $stackQuiz['quizLanguage']['type']='meta'; ! $stackQuiz['quizLanguage']['metatag']='language'; //dc:language ! $stackQuiz['quizLanguage']['metatype']='dublincore'; ! $stackQuiz['quizLanguage']['default']=$stack_defaultlang; //take the default language; ! ! //Rights ! $stackQuiz['quizRights']['required']='optional'; ! $stackQuiz['quizRights']['mysql']='TEXT'; ! $stackQuiz['quizRights']['type']='meta'; ! $stackQuiz['quizRights']['metatag']='rights'; //dc:rights ! $stackQuiz['quizRights']['metatype']='dublincore'; ! $stackQuiz['quizRights']['default']='http://www.gnu.org/copyleft/gpl.html'; ! ! //Learning context: Defaulted to system context, but user definable ! $stackQuiz['quizLearningContext']['values']=array('Primary Education','Secondary Education','Higher Education', ! 'University First Cycle','University Second Cycle','University Post Grade', ! 'Technical School First Cycle','Technical School Second Cycle','Professional Formation', ! 'Continuous Formation','Vocational Training','unspecified'); ! $stackQuiz['quizLearningContext']['required']='optional'; ! $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; ! $stackQuiz['quizLearningContext']['type']='meta'; ! $stackQuiz['quizLearningContext']['metatag']='context'; //lom:context ! $stackQuiz['quizLearningContext']['metatype']='lom'; ! $stackQuiz['quizLearningContext']['default']='unspecified'; ! ! //Difficulty: Default to null - up to user to specify this ! $stackQuiz['quizDifficulty']['values']=array('Very Easy','Easy','Medium', ! 'Difficult','Very Difficult','unspecified'); ! $stackQuiz['quizDifficulty']['required']='optional'; ! $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; ! $stackQuiz['quizDifficulty']['type']='meta'; ! $stackQuiz['quizDifficulty']['metatag']='difficulty'; //lom:difficulty ! $stackQuiz['quizDifficulty']['metatype']='lom'; ! $stackQuiz['quizDifficulty']['default']='unspecified'; ! ! //Competency: Default to solve - then up to user ! $stackQuiz['quizCompetency']['values']=array('think','argue','solve', ! 'represent','language','communicate', ! 'tools','unspecified'); ! $stackQuiz['quizCompetency']['required']='optional'; ! $stackQuiz['quizCompetency']['mysql']='TINYTEXT'; ! $stackQuiz['quizCompetency']['type']='meta'; ! $stackQuiz['quizCompetency']['metatag']='competency'; ! $stackQuiz['quizCompetency']['metatype']='stack'; //competency ! $stackQuiz['quizCompetency']['default']='unspecified'; ! ! //CompetencyLevel: Default to null - then up to user ! $stackQuiz['quizCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', ! 'complex','unspecified'); ! $stackQuiz['quizCompetencyLevel']['required']='optional'; ! $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; ! $stackQuiz['quizCompetencyLevel']['type']='meta'; ! $stackQuiz['quizCompetencyLevel']['metatag']='competencylevel'; //competencylevel ! $stackQuiz['quizCompetencyLevel']['metatype']='stack'; ! $stackQuiz['quizCompetencyLevel']['default']='unspecified'; ! ! //Time to allocate: Default to null - then up to user ! $stackQuiz['quizTimeAllocated']['required']='optional'; ! $stackQuiz['quizTimeAllocated']['mysql']='TIME'; ! $stackQuiz['quizTimeAllocated']['type']='meta'; ! $stackQuiz['quizTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime ! $stackQuiz['quizTimeAllocated']['metatype']='lom'; ! $stackQuiz['quizTimeAllocated']['default']="00:00:00"; ! ! //Type of quiz: Default to algebraicExpression as that is only type of quiz atm, but provides extensibility ! $stackQuiz['quizExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', ! 'fillInBlank','unspecified'); ! $stackQuiz['quizExcerciseType']['required']='optional'; ! $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; ! $stackQuiz['quizExcerciseType']['type']='meta'; ! $stackQuiz['quizExcerciseType']['metatag']='excercisetype'; //excercisetype ! $stackQuiz['quizExcerciseType']['metatype']='stack'; ! $stackQuiz['quizExcerciseType']['default']='unspecified'; ! ! /** ! * Displays the student quiz selection screen ! * @param array $quize_store The list of quizzes ! * @param $user ! * @return void ! */ ! function stack_quiz_student_select($quiz_store, $user) { ! global $stack_root; ! ! require_once("{$stack_root}/html/quizjava.html"); ! echo "<h1>Please choose a quiz to try</h1>"; ! global $stackQuiz; ! if (is_array($quiz_store)) { ! echo "<p>\n<form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='quizid' value='-1'> ! <input type='hidden' name='action' value='continue_quiz'>"; ! echo "\n<table cellpadding='2'>\n"; ! echo "\n<tr><th>{$stackQuiz['quizName']['descript']}</th><th>{$stackQuiz['quizDescription']['descript']}</th><th>Last mark (%)</th><th>{$stackQuiz['quizDueDate']['descript']}</th></tr>"; ! foreach ($quiz_store as $qs => $quiz) { ! $qname = $quiz['quizName']; ! $qID = $quiz['quizid']; ! $mark = '-'; ! if (is_array($user)) { ! if (array_key_exists('id',$user)) { ! $userinfo = stack_db_quiz_quizattempt_getlast($qID,$user['id']); ! if (is_array($userinfo)) { ! if (NULL != $userinfo['mark']) { ! $mark = round(100*$userinfo['mark']/$userinfo['maxmark'],2); ! } ! } ! } ! } ! ! echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; ! echo "<td>".$quiz['quizDescription']."</td><td align='center'>$mark</td>\n"; ! if ('' != $quiz['quizDueDate']) { ! echo "<td>".stack_time_display($quiz['quizDueDate'])."</td>"; ! } ! echo "</tr>\n"; ! } ! echo "\n</table>\n</form>\n</p>"; ! } else { ! echo "<p>You have no quizzes available to try.</p>"; ! } ! } ! ! ! ?> --- 1,454 ---- ! <?php ! ! ! ! /** ! ! * This file contains most functions which deal with quizzes. ! ! * ! ! * @package scripts ! ! * @subpackage Stack ! ! */ ! ! ! ! /** ! ! * ! ! */ ! ! // 'Unique quiz ID - local mySQL value' ! ! $stackQuiz['quizid']['descript'] = 'Quiz ID number'; ! ! $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; ! ! $stackQuiz['quizid']['type'] = 'meta'; ! ! ! ! // 'Quiz name' ! ! $stackQuiz['quizName']['descript'] = 'Quiz name'; ! ! $stackQuiz['quizName']['mysql'] = 'TINYTEXT'; ! ! $stackQuiz['quizName']['type'] = 'meta'; ! ! $stackQuiz['quizName']['metatag'] = 'title'; //dc:title ! ! $stackQuiz['quizName']['metatype'] = 'dublincore'; ! ! ! ! // 'Quiz description' ! ! $stackQuiz['quizDescription']['descript'] = 'Description'; ! ! $stackQuiz['quizDescription']['mysql'] = 'TINYTEXT'; ! ! $stackQuiz['quizDescription']['type'] = 'meta'; ! ! $stackQuiz['quizDescription']['metatag'] = 'description'; //dc:description ! ! $stackQuiz['quizDescription']['metatype'] = 'dublincore'; ! ! ! ! // 'Quiz options' ! ! $stackQuiz['quizOptions']['descript'] = 'Quiz options'; ! ! $stackQuiz['quizOptions']['mysql'] = 'TEXT'; ! ! $stackQuiz['quizOptions']['type'] = 'other'; ! ! ! ! // 'Quiz due date' ! ! $stackQuiz['quizDueDate']['descript'] = 'Due date'; ! ! $stackQuiz['quizDueDate']['mysql'] = 'int(10)'; ! ! $stackQuiz['quizDueDate']['type'] = 'date'; ! ! ! ! // 'Quiz mode' ! ! $stackQuiz['quizMode']['descript'] = 'Mode'; ! ! $stackQuiz['quizMode']['mysql'] = 'TINYTEXT'; ! ! $stackQuiz['quizMode']['type'] = 'string'; ! ! ! ! //<PDK> Quiz Metadata added - database updated ! ! // 'Globally unique quiz ID'; ! ! $stackQuiz['quizGUID']['required'] = 'system'; ! ! $stackQuiz['quizGUID']['mysql'] = 'CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters ! ! $stackQuiz['quizGUID']['type'] = 'meta'; ! ! $stackQuiz['quizGUID']['metatag'] = 'identifier'; ! ! $stackQuiz['quizGUID']['metatype'] = 'dublincore'; ! ! ! ! // 'Keywords'; ! ! $stackQuiz['quizKeywords']['required'] = 'optional'; ! ! $stackQuiz['quizKeywords']['mysql'] = 'TINYTEXT'; ! ! $stackQuiz['quizKeywords']['type'] = 'meta'; ! ! $stackQuiz['quizKeywords']['metatag'] = 'keyword'; //lom:keyword ! ! $stackQuiz['quizKeywords']['metatype'] = 'lom'; ! ! $stackQuiz['quizKeywords']['descript'] = 'Keywords'; //<PDK>Need for display purposes ! ! ! ! // 'Last edited by'; ! ! $stackQuiz['quizUserLastEdited']['required']='system'; ! ! $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; ! ! $stackQuiz['quizUserLastEdited']['type']='meta'; ! ! $stackQuiz['quizUserLastEdited']['metatag']='creator'; //dc:creator ! ! $stackQuiz['quizUserLastEdited']['metatype']='dublincore'; ! ! ! ! // 'Last edited on'; ! ! $stackQuiz['quizDateLastEdited']['required']='system'; ! ! $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; ! ! $stackQuiz['quizDateLastEdited']['type']='meta'; ! ! $stackQuiz['quizDateLastEdited']['metatag']='date'; //dc:date ! ! $stackQuiz['quizDateLastEdited']['metatype']='dublincore'; ! ! ! ! //Publisher ! ! $stackQuiz['quizPublisher']['required']='system'; ! ! $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizPublisher']['type']='meta'; ! ! $stackQuiz['quizPublisher']['metatag']='publisher'; //dc:publisher ! ! $stackQuiz['quizPublisher']['metatype']='dublincore'; ! ! ! ! //Type: Hidden from user ! ! $stackQuiz['type']['values']=array('quiz','quiz'); //Default to 'type' enumeration in XSD file ! ! $stackQuiz['type']['required']='optional'; ! ! $stackQuiz['type']['mysql']='TINYTEXT'; ! ! $stackQuiz['type']['type']='meta'; ! ! $stackQuiz['type']['metatag']='type'; //dc:type ! ! $stackQuiz['type']['metatype']='dublincore'; ! ! ! ! //Format: Hidden from user, selected by script ! ! $stackQuiz['quizFormat']['values']=array('application','audio','image', ! ! 'message','model','text','video', ! ! 'multipart'); ! ! $stackQuiz['quizFormat']['required']='optional'; ! ! $stackQuiz['quizFormat']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizFormat']['type']='meta'; //dc:format ! ! $stackQuiz['quizFormat']['metatag']='format'; ! ! $stackQuiz['quizFormat']['metatype']='dublincore'; ! ! ! ! //Language: Defaulted to current system language, but user definable ! ! $stackQuiz['quizLanguage']['values']=array('en','fr','nl','es','unspecified'); ! ! $stackQuiz['quizLanguage']['required']='optional'; ! ! $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizLanguage']['type']='meta'; ! ! $stackQuiz['quizLanguage']['metatag']='language'; //dc:language ! ! $stackQuiz['quizLanguage']['metatype']='dublincore'; ! ! $stackQuiz['quizLanguage']['default']=$stack_defaultlang; //take the default language; ! ! ! ! //Rights ! ! $stackQuiz['quizRights']['required']='optional'; ! ! $stackQuiz['quizRights']['mysql']='TEXT'; ! ! $stackQuiz['quizRights']['type']='meta'; ! ! $stackQuiz['quizRights']['metatag']='rights'; //dc:rights ! ! $stackQuiz['quizRights']['metatype']='dublincore'; ! ! $stackQuiz['quizRights']['default']='http://www.gnu.org/copyleft/gpl.html'; ! ! ! ! //Learning context: Defaulted to system context, but user definable ! ! $stackQuiz['quizLearningContext']['values']=array('Primary Education','Secondary Education','Higher Education', ! ! 'University First Cycle','University Second Cycle','University Post Grade', ! ! 'Technical School First Cycle','Technical School Second Cycle','Professional Formation', ! ! 'Continuous Formation','Vocational Training','unspecified'); ! ! $stackQuiz['quizLearningContext']['required']='optional'; ! ! $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizLearningContext']['type']='meta'; ! ! $stackQuiz['quizLearningContext']['metatag']='context'; //lom:context ! ! $stackQuiz['quizLearningContext']['metatype']='lom'; ! ! $stackQuiz['quizLearningContext']['default']='unspecified'; ! ! ! ! //Difficulty: Default to null - up to user to specify this ! ! $stackQuiz['quizDifficulty']['values']=array('Very Easy','Easy','Medium', ! ! 'Difficult','Very Difficult','unspecified'); ! ! $stackQuiz['quizDifficulty']['required']='optional'; ! ! $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizDifficulty']['type']='meta'; ! ! $stackQuiz['quizDifficulty']['metatag']='difficulty'; //lom:difficulty ! ! $stackQuiz['quizDifficulty']['metatype']='lom'; ! ! $stackQuiz['quizDifficulty']['default']='unspecified'; ! ! ! ! //Competency: Default to solve - then up to user ! ! $stackQuiz['quizCompetency']['values']=array('think','argue','solve', ! ! 'represent','language','communicate', ! ! 'tools','unspecified'); ! ! $stackQuiz['quizCompetency']['required']='optional'; ! ! $stackQuiz['quizCompetency']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizCompetency']['type']='meta'; ! ! $stackQuiz['quizCompetency']['metatag']='competency'; ! ! $stackQuiz['quizCompetency']['metatype']='stack'; //competency ! ! $stackQuiz['quizCompetency']['default']='unspecified'; ! ! ! ! //CompetencyLevel: Default to null - then up to user ! ! $stackQuiz['quizCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', ! ! 'complex','unspecified'); ! ! $stackQuiz['quizCompetencyLevel']['required']='optional'; ! ! $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizCompetencyLevel']['type']='meta'; ! ! $stackQuiz['quizCompetencyLevel']['metatag']='competencylevel'; //competencylevel ! ! $stackQuiz['quizCompetencyLevel']['metatype']='stack'; ! ! $stackQuiz['quizCompetencyLevel']['default']='unspecified'; ! ! ! ! //Time to allocate: Default to null - then up to user ! ! $stackQuiz['quizTimeAllocated']['required']='optional'; ! ! $stackQuiz['quizTimeAllocated']['mysql']='TIME'; ! ! $stackQuiz['quizTimeAllocated']['type']='meta'; ! ! $stackQuiz['quizTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime ! ! $stackQuiz['quizTimeAllocated']['metatype']='lom'; ! ! $stackQuiz['quizTimeAllocated']['default']="00:00:00"; ! ! ! ! //Type of quiz: Default to algebraicExpression as that is only type of quiz atm, but provides extensibility ! ! $stackQuiz['quizExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', ! ! 'fillInBlank','unspecified'); ! ! $stackQuiz['quizExcerciseType']['required']='optional'; ! ! $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; ! ! $stackQuiz['quizExcerciseType']['type']='meta'; ! ! $stackQuiz['quizExcerciseType']['metatag']='excercisetype'; //excercisetype ! ! $stackQuiz['quizExcerciseType']['metatype']='stack'; ! ! $stackQuiz['quizExcerciseType']['default']='unspecified'; ! ! ! ! /** ! ! * Displays the student quiz selection screen ! ! * @param array $quize_store The list of quizzes ! ! * @param $user ! ! * @return void ! ! */ ! ! function stack_quiz_student_select($quiz_store, $user) { ! ! global $stack_root; ! ! ! ! require_once("{$stack_root}/html/quizjava.html"); ! ! echo "<h1>Please choose a quiz to try</h1>"; ! ! global $stackQuiz; ! ! if (is_array($quiz_store)) { ! ! echo "<p>\n<form name='quizform' action='quiz.php' method='POST'> ! ! <input type='hidden' name='quizid' value='-1'> ! ! <input type='hidden' name='action' value='continue_quiz'>"; ! ! echo "\n<table cellpadding='2'>\n"; ! ! echo "\n<tr><th>{$stackQuiz['quizName']['descript']}</th><th>{$stackQuiz['quizDescription']['descript']}</th><th>Last mark (%)</th><th>{$stackQuiz['quizDueDate']['descript']}</th></tr>"; ! ! foreach ($quiz_store as $qs => $quiz) { ! ! $qname = $quiz['quizName']; ! ! $qID = $quiz['quizid']; ! ! $mark = '-'; ! ! if (is_array($user)) { ! ! if (array_key_exists('id',$user)) { ! ! $userinfo = stack_db_quiz_quizattempt_getlast($qID,$user['id']); ! ! if (is_array($userinfo)) { ! ! if (NULL != $userinfo['mark']) { ! ! $mark = round(100*$userinfo['mark']/$userinfo['maxmark'],2); ! ! } ! ! } ! ! } ! ! } ! ! ! ! echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; ! ! echo "<td>".$quiz['quizDescription']."</td><td align='center'>$mark</td>\n"; ! ! if ('' != $quiz['quizDueDate']) { ! ! echo "<td>".stack_time_display($quiz['quizDueDate'])."</td>"; ! ! } ! ! echo "</tr>\n"; ! ! } ! ! echo "\n</table>\n</form>\n</p>"; ! ! } else { ! ! echo "<p>You have no quizzes available to try.</p>"; ! ! } ! ! } ! ! ! ! ! ! ?> ! Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.16 retrieving revision 1.13.2.17 diff -C2 -d -r1.13.2.16 -r1.13.2.17 *** stackXML.php 16 Aug 2005 22:43:29 -0000 1.13.2.16 --- stackXML.php 17 Aug 2005 16:48:46 -0000 1.13.2.17 *************** *** 99,108 **** function stack_xml_create_question_new($question) { // Don't export questionID if (array_key_exists('questionID',$question)) { unset($question['questionID']); } - // Make sure the question is validated. - stack_question_validate($question,$errors); $xmlDoc = &new DOMIT_Document(); --- 99,110 ---- function stack_xml_create_question_new($question) { + //Validate the question + stack_question_validate($question,$errors); + stack_xml_remove_question_meta_defaults($question); //Remove any disused fields before writing out + // Don't export questionID if (array_key_exists('questionID',$question)) { unset($question['questionID']); } $xmlDoc = &new DOMIT_Document(); *************** *** 351,355 **** $question = stack_db_getquestion($question['questionID']); //Get the questionId from the question data structure stack_question_validate($question,$errors); //Validate it ! unset($question['questionID']); --- 353,358 ---- $question = stack_db_getquestion($question['questionID']); //Get the questionId from the question data structure stack_question_validate($question,$errors); //Validate it ! stack_xml_remove_question_meta_defaults($question); //Remove any disused fields before writing out ! unset($question['questionID']); *************** *** 551,555 **** { $question = stack_db_getquestion($questionID); //Get the questionId from the question ! stack_question_validate($question,$errors); //Validate it unset($question['questionID']); --- 554,560 ---- { $question = stack_db_getquestion($questionID); //Get the questionId from the question ! stack_question_validate($question,$errors); //Validate it ! ! stack_xml_remove_question_meta_defaults($question); //Remove any unused metadata fields from each $question unset($question['questionID']); *************** *** 917,920 **** --- 922,928 ---- } } + + //If unsuccessful at resolving + return $element->nodeName; } *************** *** 933,941 **** $nodeName = $node->nodeName; ! //Is this node the member of a metadata namespace? If so, map it onto the equivalent question field ! if (!empty($node->namespaceURI)) ! { ! $nodeName = stack_xml_map_element_ns($node,$arrayType); ! } //We will have a nodeName at this point, whether the actual element or resolved from namespace //If node has children --- 941,948 ---- $nodeName = $node->nodeName; ! //Check whether node is metadata and if so resolve to equivalent question field ! $nodeName = stack_xml_map_element_ns($node,$arrayType); ! ! //} //We will have a nodeName at this point, whether the actual element or resolved from namespace //If node has children *************** *** 960,972 **** //Get the item $item = $nodeList->item($j); ! //print_r("List item: ".$item->parentNode->nodeName); ! //print_r("<br>"); ! //print_r("Parent node: ".$node->parentNode->nodeName); ! //print_r("<br>"); ! if ($item->parentNode->nodeName!=$node->parentNode->nodeName) { $length=1; ! } ! } --- 967,975 ---- //Get the item $item = $nodeList->item($j); ! ! if ($item->parentNode->nodeName!=$node->parentNode->nodeName) //where they are not { $length=1; ! } } *************** *** 980,986 **** - //print_r($length); - //show_array($nodeList); - //If there are multiple elements of the same name //Deal with arrays of values: for example potential responses and questionVar/answerVar --- 983,986 ---- *************** *** 2423,2426 **** --- 2423,2542 ---- } + /** + * This function iterates through the specified array and removes metadata whose value is the system default + * + * @see stack_xml_create_question_schema() + * @param array $&array The array to search, by reference + * @param string $value The value to search for in that array + * @return bool True if the value being searched for exists, False otherwise + */ + function stack_xml_remove_question_meta_defaults(&$question) + { + global $stackQuestion; + + foreach ($question as $arrayKey=>$quField) //Iterate through the question fields + { + if (array_key_exists($arrayKey,$stackQuestion)) //Where that field exists in the stackQuestion data structure + { + if(!empty($stackQuestion[$arrayKey]['type']) && ($stackQuestion[$arrayKey]['type']=='meta')) + { + //Check stackQuestion data structure has a default for it, and if so, that the value is equal to that default + if(!empty($stackQuestion[$arrayKey]['default']) && $quField==$stackQuestion[$arrayKey]['default']) { + unset($question[$arrayKey]); + } + + //If the field has a default value but the field is blank - dont write out + else if (!empty($stackQuestion[$arrayKey]['default']) && empty($quField)) + { + print_r($arrayKey); + unset($question[$arrayKey]); + } + } + + //Else we just ignore it and write out + } + } + } + + function stack_xml_reinstate_question_meta_defaults(&$question) + { + global $stackQuestion; + + foreach ($stackQuestion as $arrayKey=>$quField) //Iterate through the master stackQuestion fields + { + if (!array_key_exists($arrayKey,$question)) //Where the field ocurrs in stackQuestion, but not the imported question + { //and is metadata + if(!empty($quField['type']) && ($quField['type']=='meta')) + { + //If metadata field has defaults + if(!empty($quField['default'])) + { + //Set the field in $question to the default metadata + $question[$arrayKey]=$quField['default']; + } + + } + } + } + } + + /** + * This function iterates through the specified array and removes metadata whose value is the system default + * + * @see stack_xml_create_question_schema() + * @param array $&array The array to search, by reference + * @param string $value The value to search for in that array + * @return bool True if the value being searched for exists, False otherwise + */ + function stack_xml_remove_quiz_meta_defaults(&$quiz) + { + global $stackQuiz; + + foreach ($quiz as $arrayKey=>$quizField) //Iterate through the question fields + { + if (array_key_exists($arrayKey,$stackQuiz)) //Where that field exists in the stackQuiz data structure + { + if(!empty($stackQuiz[$arrayKey]['type']) && ($stackQuiz[$arrayKey]['type']=='meta')) + { + //Check stackQuestion data structure has a default for it, and if so, that the value is equal to that default + if(!empty($stackQuiz[$arrayKey]['default']) && $quizField==$stackQuiz[$arrayKey]['default']) { + unset($quiz[$arrayKey]); + } + + //If the field has a default value but the field is blank - dont write out + else if (!empty($stackQuiz[$arrayKey]['default']) && empty($quizField)) + { + print_r($arrayKey); + unset($quiz[$arrayKey]); + } + } + + //Else we just ignore it and write out + } + } + } + + function stack_xml_reinstate_quiz_meta_defaults(&$quiz) + { + global $stackQuiz; + + foreach ($stackQuiz as $arrayKey=>$quizField) //Iterate through the master stackQuestion fields + { + if (!array_key_exists($arrayKey,$quiz)) //Where the field ocurrs in stackQuestion, but not the imported question + { //and is metadata + if(!empty($quizField['type']) && ($quizField['type']=='meta')) + { + //If metadata field has defaults + if(!empty($quizField['default'])) + { + //Set the field in $question to the default metadata + $quiz[$arrayKey]==$quizField['default']; + } + + } + } + } + } + if (!stack_xml_check_schema_version("{$stack_root}/schemas/")) { Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.34.2.5 retrieving revision 1.34.2.6 diff -C2 -d -r1.34.2.5 -r1.34.2.6 *** stackDatabase.php 17 Aug 2005 11:24:06 -0000 1.34.2.5 --- stackDatabase.php 17 Aug 2005 16:48:46 -0000 1.34.2.6 *************** *** 1453,1456 **** --- 1453,1459 ---- $quiz_fields = array_keys($stackQuiz); + + show_array("In db function:"); + show_array($quiz); $quizid = ''; *************** *** 1466,1469 **** --- 1469,1477 ---- } + // Let SQL add the "last edit", like the question + if (array_key_exists('quizDateLastEdited',$quiz)) { + unset($quiz['quizDateLastEdited']); + } + if ($new_quiz) { $qu = ''; *************** *** 1486,1489 **** --- 1494,1499 ---- $query = "INSERT INTO stackQuiz ($qu) VALUES ($quv)"; $result = stack_db_query($query); + + show_array($query); // GET the last quizid *************** *** 1510,1513 **** --- 1520,1525 ---- $query = "UPDATE stackQuiz SET $qu WHERE quizid = '$quizid'"; $result = stack_db_query($query); + + show_array($query); } Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.9 retrieving revision 1.29.2.10 diff -C2 -d -r1.29.2.9 -r1.29.2.10 *** stackAuthor.php 17 Aug 2005 11:24:06 -0000 1.29.2.9 --- stackAuthor.php 17 Aug 2005 16:48:46 -0000 1.29.2.10 *************** *** 1,1094 **** ! <?php ! /** ! * Functions which deal with authoring questions and quizzes. These only need to be ! * loaded when an edit page needs to be generated. ! * ! * @package scripts ! * @subpackage Stack ! */ ! ! //****************************************************** [...3256 lines suppressed...] ! global $stackQuiz; ! ! ! ! $fd='stackQuiz_'.$field; ! ! ! ! $fd=get_string($fd,'stack',''); ! ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuiz');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! ! return($strout); ! ! } ! ! ! ! ?> ! |
From: pkiddie <pk...@us...> - 2005-08-17 16:48:55
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31977 Modified Files: Tag: development_xmlrqp changelog.txt editquiz.php import.php question_bank.php Log Message: Moved question validation for an exported file into stackXML Ensure all metadata is being written out into database for questions and quizzes Ensure all 'default' metadata is removed from XML when exported, but reinstated whe imported Index: changelog.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/changelog.txt,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** changelog.txt 17 Aug 2005 11:24:05 -0000 1.1.2.8 --- changelog.txt 17 Aug 2005 16:48:46 -0000 1.1.2.9 *************** *** 75,78 **** - Declarenamespace using DOMIT v1 - RQP faults encapsulated within SOAP specific faults. ! - Remove minOcurrs and maxOcurrs on root 'type' nodes --- 75,79 ---- - Declarenamespace using DOMIT v1 - RQP faults encapsulated within SOAP specific faults. ! - Remove minOcurrs and maxOcurrs on root 'type' nodes ! - <How do we preserve hidden metadata in the quiz??> Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/import.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 *** import.php 17 Aug 2005 11:24:05 -0000 1.1.2.4 --- import.php 17 Aug 2005 16:48:46 -0000 1.1.2.5 *************** *** 308,311 **** --- 308,315 ---- stack_question_validate($quiz[$key],$errs[$key]); + stack_xml_reinstate_question_meta_defaults($qu); //Reinstate any missing metadata in order to all fields to database + + show_array($qu); + $qu['questionID'] = stack_db_question_add($qu); *************** *** 370,373 **** --- 374,379 ---- stack_question_validate($question,$errs); + stack_xml_reinstate_question_meta_defaults($question); //Reinstate any missing metadata in order to all fields to database + $question['questionID'] = stack_db_question_add($question); Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.13.2.3 retrieving revision 1.13.2.4 diff -C2 -d -r1.13.2.3 -r1.13.2.4 *** editquiz.php 17 Aug 2005 11:24:05 -0000 1.13.2.3 --- editquiz.php 17 Aug 2005 16:48:46 -0000 1.13.2.4 *************** *** 1,196 **** ! <?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... ! * @author Juliette White jv...@jv... ! * ! * ! * This file contains the front end logic for the quiz editting ! * TO DO: Some of the code in this file needs to be factored out into separate ! * algorithms- ideally we should have a function for each action on entry and ! * for display. ! * @package frontend ! * @subpackage Stack ! */ ! ! /** ! * ! */ ! session_start(); ! ! require_once("other/ListMenu.php"); ! require_once("stackstd.php"); ! ! require_once("{$stack_root}/html/trypopupform.html"); ! require_once("{$stack_root}/frontend_general/editquiz_display.php"); ! require_once("{$stack_root}/html/helpform.php"); ! require_once("{$stack_root}/html/quizjava.html"); ! require_once("{$stack_root}/scripts/stackAuthor.php"); ! ! ! /////////////////////////////////////////////////////////////// ! // (1) Process Input - this sets $action, $user and $username ! /////////////////////////////////////////////////////////////// ! $default_action = 'quiz_choose'; ! include('frontend_general/process_input.php'); ! ! include_once('frontend_general/edit_quiz_util.php'); ! $PostTo = 'editquiz.php'; ! $filter = ''; ! $quizid = NULL; ! ! include('html/pagehead.php'); ! ! if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { ! stack_display_editquiz_error_not_admin($user); ! include('html/pagefoot.php'); ! die(); ! } ! ! // Work out the correct value for any filter to be applied to the question ! // bank. This is not needed by all actions, but it is harmless to set it. ! $question_bank_filter = stack_get_questionbank_filter(); ! ! //////////////////////////////////////////////// ! // (2) Take any actions required on entry to the page ! //////////////////////////////////////////////// ! ! // Possible values of $action are ! // quiz_edit Edit a quiz ! // quiz_choose Choose a quiz ! // quiz_new Create a new quiz ! // quiz_delete Delete a quiz ! // quiz_edit_addqs Add questions to the quiz. ! // filter Re-display the list of questions, filtered. ! // quiz_xml Export the current quiz as an XML file ! // quiz_xml_db Export single quiz as XML from database ! ! ! // Get the quiz and quiz id ! $quiz = ''; ! $quizid_source = ''; ! if ('quiz_delete' == $action or 'filter' == $action) { ! $quizid_source = 'post'; ! } else if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! $quizid_source = 'quiz'; ! } else if ('quiz_new' == $action) { ! $quizid_source = 'database'; ! } ! ! else if ('quiz_xml' == $action) { ! $quizid_source = 'post'; ! } ! else if ('quiz_xml_db' == $action) { ! $quizid_source = 'database'; ! } ! ! if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! $quiz_source = 'post'; ! $quiz = stack_get_quiz('post', $quizid); ! if ('' == $quiz) { ! $quizid_source = 'post'; ! } ! } ! ! $quizid = stack_get_quizid($quizid_source, $quiz); ! ! if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { ! $quiz = stack_get_quiz('database', $quizid); ! } ! ! // Get the question bank filter ! if ('filter' == $action) { ! $filter_source = 'post'; ! } else { ! $filter_source = 'session'; ! } ! ! ! if ('quiz_delete' == $action and $quizid != '') { ! stack_db_quiz_delete($quizid); ! $action = 'quiz_choose'; ! } ! ! if ('quiz_edit' == $action) { ! // Do we need to add questions to the quiz? ! if (array_key_exists('questionsToAdd',$_POST)) { ! $quiz['questionsToAdd'] = array_keys($_POST['questionsToAdd']); ! } ! } ! ! if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! stack_quiz_edit($quiz,$errors); ! } ! ! if ('filter' == $action and '' != $quizid ) { ! $action = 'quiz_edit_addqs'; ! } ! ! if ('quiz_new' == $action) { ! $quiz['quizid'] = $quizid; ! //<TODO> Automatically generated quiz metadata ! $quiz['quizGUID'] = stack_generate_guid($stack_web_url); ! $quiz['quizFormat'] = 'text/xml; charset="utf-8"'; ! $quiz['quizPublisher'] = $stack_web_url; ! $quiz['type'] = 'quiz'; ! $quiz['quizUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! ! if ($user['email']!='') ! { ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; ! } ! ! $action = 'quiz_edit'; ! } ! ! if ('quiz_xml' == $action) { ! ! include_once("{$stack_root}/scripts/stackXML.php"); ! ! $quiz = stack_get_quiz('database', $quizid); ! $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); ! } ! ! //////////////////////////////////////////////// ! // (3) Generate web page ! //////////////////////////////////////////////// ! ! stack_display_editquiz_error($errors); ! ! switch ($action) { ! case 'quiz_xml': ! { ! echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; ! } ! case 'quiz_choose': ! $quiz_store = stack_db_quiz_get(); ! stack_display_editquiz_select($quiz_store, $PostTo); ! break; ! case 'import': ! { ! } ! case 'quiz_edit': ! stack_display_editquiz_edit($quiz,$errors,$PostTo); ! break; ! case 'quiz_edit_addqs': ! stack_db_listquestions_quiz($question_bank_filter,$quizid); ! break; ! } ! ! include('html/pagefoot.php'); ! ! ?> ! --- 1,394 ---- ! <?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... ! ! * @author Juliette White jv...@jv... ! ! * ! ! * ! ! * This file contains the front end logic for the quiz editting ! ! * TO DO: Some of the code in this file needs to be factored out into separate ! ! * algorithms- ideally we should have a function for each action on entry and ! ! * for display. ! ! * @package frontend ! ! * @subpackage Stack ! ! */ ! ! ! ! /** ! ! * ! ! */ ! ! session_start(); ! ! ! ! require_once("other/ListMenu.php"); ! ! require_once("stackstd.php"); ! ! ! ! require_once("{$stack_root}/html/trypopupform.html"); ! ! require_once("{$stack_root}/frontend_general/editquiz_display.php"); ! ! require_once("{$stack_root}/html/helpform.php"); ! ! require_once("{$stack_root}/html/quizjava.html"); ! ! require_once("{$stack_root}/scripts/stackAuthor.php"); ! ! ! ! ! ! /////////////////////////////////////////////////////////////// ! ! // (1) Process Input - this sets $action, $user and $username ! ! /////////////////////////////////////////////////////////////// ! ! $default_action = 'quiz_choose'; ! ! include('frontend_general/process_input.php'); ! ! ! ! include_once('frontend_general/edit_quiz_util.php'); ! ! $PostTo = 'editquiz.php'; ! ! $filter = ''; ! ! $quizid = NULL; ! ! ! ! include('html/pagehead.php'); ! ! ! ! if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { ! ! stack_display_editquiz_error_not_admin($user); ! ! include('html/pagefoot.php'); ! ! die(); ! ! } ! ! ! ! // Work out the correct value for any filter to be applied to the question ! ! // bank. This is not needed by all actions, but it is harmless to set it. ! ! $question_bank_filter = stack_get_questionbank_filter(); ! ! ! ! //////////////////////////////////////////////// ! ! // (2) Take any actions required on entry to the page ! ! //////////////////////////////////////////////// ! ! ! ! // Possible values of $action are ! ! // quiz_edit Edit a quiz ! ! // quiz_choose Choose a quiz ! ! // quiz_new Create a new quiz ! ! // quiz_delete Delete a quiz ! ! // quiz_edit_addqs Add questions to the quiz. ! ! // filter Re-display the list of questions, filtered. ! ! // quiz_xml Export the current quiz as an XML file ! ! // quiz_xml_db Export single quiz as XML from database ! ! ! ! ! ! // Get the quiz and quiz id ! ! $quiz = ''; ! ! $quizid_source = ''; ! ! if ('quiz_delete' == $action or 'filter' == $action) { ! ! $quizid_source = 'post'; ! ! } else if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! ! $quizid_source = 'quiz'; ! ! } else if ('quiz_new' == $action) { ! ! $quizid_source = 'database'; ! ! } ! ! ! ! else if ('quiz_xml' == $action) { ! ! $quizid_source = 'post'; ! ! } ! ! else if ('quiz_xml_db' == $action) { ! ! $quizid_source = 'database'; ! ! } ! ! ! ! if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! ! show_array($_POST); ! //How do we preserve hidden metadata in the quiz?? ! $quiz_source = 'post'; ! ! $quiz = stack_get_quiz('post', $quizid); ! ! if ('' == $quiz) { ! ! $quizid_source = 'post'; ! ! } ! ! } ! ! ! ! $quizid = stack_get_quizid($quizid_source, $quiz); ! ! ! ! if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { ! ! $quiz = stack_get_quiz('database', $quizid); ! ! } ! ! ! ! // Get the question bank filter ! ! if ('filter' == $action) { ! ! $filter_source = 'post'; ! ! } else { ! ! $filter_source = 'session'; ! ! } ! ! ! ! ! ! if ('quiz_delete' == $action and $quizid != '') { ! ! stack_db_quiz_delete($quizid); ! ! $action = 'quiz_choose'; ! ! } ! ! ! ! if ('quiz_edit' == $action) { ! ! // Do we need to add questions to the quiz? ! ! if (array_key_exists('questionsToAdd',$_POST)) { ! ! $quiz['questionsToAdd'] = array_keys($_POST['questionsToAdd']); ! ! } ! ! } ! ! ! ! if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! ! stack_quiz_edit($quiz,$errors); ! ! } ! ! ! ! if ('filter' == $action and '' != $quizid ) { ! ! $action = 'quiz_edit_addqs'; ! ! } ! ! ! ! if ('quiz_new' == $action) { ! ! $quiz['quizid'] = $quizid; ! ! //<TODO> Automatically generated quiz metadata ! ! $quiz['quizGUID'] = stack_generate_guid($stack_web_url); ! ! $quiz['quizFormat'] = 'text/xml; charset="utf-8"'; ! ! $quiz['quizPublisher'] = $stack_web_url; ! ! $quiz['type'] = 'quiz'; ! ! $quiz['quizUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! ! ! ! if ($user['email']!='') ! ! { ! ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; ! ! } ! ! ! ! $action = 'quiz_edit'; ! ! } ! ! ! ! if ('quiz_xml' == $action) { ! ! ! ! include_once("{$stack_root}/scripts/stackXML.php"); ! ! ! ! $quiz = stack_get_quiz('database', $quizid); ! stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata ! $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); ! ! } ! ! ! ! //////////////////////////////////////////////// ! ! // (3) Generate web page ! ! //////////////////////////////////////////////// ! ! ! ! stack_display_editquiz_error($errors); ! ! ! ! switch ($action) { ! ! case 'quiz_xml': ! ! { ! ! echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; ! ! } ! ! case 'quiz_choose': ! ! $quiz_store = stack_db_quiz_get(); ! ! stack_display_editquiz_select($quiz_store, $PostTo); ! ! break; ! ! case 'import': ! ! { ! ! } ! ! case 'quiz_edit': ! ! stack_display_editquiz_edit($quiz,$errors,$PostTo); ! ! break; ! ! case 'quiz_edit_addqs': ! ! stack_db_listquestions_quiz($question_bank_filter,$quizid); ! ! break; ! ! } ! ! ! ! include('html/pagefoot.php'); ! ! ! ! ?> ! ! ! Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8.2.7 retrieving revision 1.8.2.8 diff -C2 -d -r1.8.2.7 -r1.8.2.8 *** question_bank.php 17 Aug 2005 11:24:06 -0000 1.8.2.7 --- question_bank.php 17 Aug 2005 16:48:46 -0000 1.8.2.8 *************** *** 1,339 **** ! <?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 [...984 lines suppressed...] ! ////////////////////////////////////////////////////////////// ! ! // (3) Deal with any actions on leaving the page ! ! ////////////////////////////////////////////////////////////// ! ! ! ! if ('questionbank_screen'==$action or 'edit_metadata' == $action){ ! ! session_unregister('question'); ! ! session_unregister('questionInst'); ! ! } ! ! ! ! ?> ! |
From: pkiddie <pk...@us...> - 2005-08-17 16:48:54
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31977/scripts/install Modified Files: Tag: development_xmlrqp stackUpdateDatabase.php Log Message: Moved question validation for an exported file into stackXML Ensure all metadata is being written out into database for questions and quizzes Ensure all 'default' metadata is removed from XML when exported, but reinstated whe imported Index: stackUpdateDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackUpdateDatabase.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 *** stackUpdateDatabase.php 17 Aug 2005 11:24:06 -0000 1.3.2.2 --- stackUpdateDatabase.php 17 Aug 2005 16:48:46 -0000 1.3.2.3 *************** *** 12,16 **** /** This PHP script simply adds new fields to mySQL for metadata. This affects both questions and quizzes */ ! // v1.1 - Changed questionUserLastEdited field to text type // v1.0 - initial - added metadata fields $addQuestionColumnQuery = ' --- 12,16 ---- /** This PHP script simply adds new fields to mySQL for metadata. This affects both questions and quizzes */ ! // v1.1 - Changed questionUserLastEdited, quizUserLastEdited field to text type // v1.0 - initial - added metadata fields $addQuestionColumnQuery = ' |
From: Chris S. <san...@us...> - 2005-08-17 11:35:45
|
Update of /cvsroot/stack/stack-1-0/scripts/CASpool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24703/scripts/CASpool Modified Files: stackCAS.php Log Message: Index: stackCAS.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/CASpool/stackCAS.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stackCAS.php 14 Jul 2005 12:53:40 -0000 1.6 --- stackCAS.php 17 Aug 2005 11:35:36 -0000 1.7 *************** *** 464,467 **** --- 464,470 ---- $cas_cmd .= " str:ATPartFrac(ans,$exp2), print(str), RETURN(true)); \n"; break; + case 'SingleFrac'; + $cas_cmd .= " str:ATSingleFrac(ans,$exp2), print(str), RETURN(true)); \n"; + break; case 'Int'; $cas_cmd .= " str:ATInt(ans,$exp2), print(str), RETURN(true)); \n"; |
From: Chris S. <san...@us...> - 2005-08-17 11:35:45
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24703/scripts/maxima Modified Files: stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** stackmaxima.mac 16 Aug 2005 12:34:14 -0000 1.25 --- stackmaxima.mac 17 Aug 2005 11:35:36 -0000 1.26 *************** *** 597,603 **** if factor( expand( sExpr ) ) = factor( expand( tExpr ) ) then BLOCK( ! [topOp, list], topOp: op( sExpr ), ! list: args( sExpr ), if topOp = "//" then BLOCK( val: "false", --- 597,603 ---- if factor( expand( sExpr ) ) = factor( expand( tExpr ) ) then BLOCK( ! [topOp, list], topOp: op( sExpr ), ! list: args( sExpr ), if topOp = "//" then BLOCK( val: "false", *************** *** 621,625 **** ansnote : "ATPartFrac_diff_variables", fb:StackAddFeedback("","ATPartFrac_diff_variables"), ! ret: StackReturnOb(val, rawmk, ansnote,fb) ) else --- 621,625 ---- ansnote : "ATPartFrac_diff_variables", fb:StackAddFeedback("","ATPartFrac_diff_variables"), ! ret: StackReturnOb(val, rawmk, ansnote,fb) ) else *************** *** 640,644 **** ) else ! BLOCK( if sDeg = 2 then ret: quadTest(sExpr,tExpr,wrt) --- 640,644 ---- ) else ! BLOCK( if sDeg = 2 then ret: quadTest(sExpr,tExpr,wrt) *************** *** 667,671 **** /* True(0) otherwise */ /* ******************************************************************** */ ! ATSingFrac(sExpr, TList):= BLOCK( [NEGDISTRIB, val, rawmk, fb, ansnote, tExpr, quiet, facdum], NEGDISTRIB: FALSE, val:"", rawmk:"1", --- 667,671 ---- /* True(0) otherwise */ /* ******************************************************************** */ ! ATSingleFrac(sExpr, TList):= BLOCK( [NEGDISTRIB, val, rawmk, fb, ansnote, tExpr, quiet, facdum], NEGDISTRIB: FALSE, val:"", rawmk:"1", *************** *** 684,699 **** if factor( expand ( sExpr ) ) = factor( expand( tExpr ) ) then BLOCK ! ( topOp: op(sExpr), if topOp = "//" then ! BLOCK ! ( val:"true", rawmk:"1", ! ansnote: "ATSingFrac_true", ! fb: StackAddFeedback("",ansnote) ! ) ! else ! BLOCK ( val:"false", --- 684,699 ---- if factor( expand ( sExpr ) ) = factor( expand( tExpr ) ) then BLOCK ! ( topOp: op(sExpr), if topOp = "//" then ! BLOCK ! ( val:"true", rawmk:"1", ! ansnote: "ATSingFrac_true", ! fb: StackAddFeedback("",ansnote) ! ) ! else ! BLOCK ( val:"false", *************** *** 702,710 **** fb: StackAddFeedback("",ansnote) ), ! ret: StackReturnOb(val,rawmk,ansnote,fb) ) else if (sameVars(sExpr, tExpr) # true) then BLOCK ! ( val:"false", rawmk:"0", --- 702,710 ---- fb: StackAddFeedback("",ansnote) ), ! ret: StackReturnOb(val,rawmk,ansnote,fb) ) else if (sameVars(sExpr, tExpr) # true) then BLOCK ! ( val:"false", rawmk:"0", *************** *** 722,726 **** else BLOCK ! ( val:"true", rawmk:"0", --- 722,726 ---- else BLOCK ! ( val:"true", rawmk:"0", *************** *** 729,734 **** ), ret: StackReturnOb(val,rawmk,ansnote,fb), ! if quiet # TRUE then fb:"", ! RETURN(ret) ) )$ --- 729,734 ---- ), ret: StackReturnOb(val,rawmk,ansnote,fb), ! if quiet # TRUE then fb:"", ! RETURN(ret) ) )$ |
From: Chris S. <san...@us...> - 2005-08-17 11:35:44
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24703/scripts Modified Files: stackQuestion.php Log Message: Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** stackQuestion.php 22 Jul 2005 12:47:40 -0000 1.30 --- stackQuestion.php 17 Aug 2005 11:35:36 -0000 1.31 *************** *** 515,518 **** --- 515,519 ---- $stackAnswerTest['SA_expanded']['imp'] = 'cas'; $stackAnswerTest['PartFrac']['imp'] = 'cas'; + $stackAnswerTest['SingleFrac']['imp'] = 'cas'; $stackAnswerTest['Diff']['imp'] = 'cas'; $stackAnswerTest['Int']['imp'] = 'cas'; *************** *** 1208,1211 **** --- 1209,1213 ---- OR 'SA_factored' == $atest OR 'PartFrac' == $atest + OR 'SingleFrac' == $atest OR 'Diff' == $atest OR 'Int' == $atest) { *************** *** 1222,1225 **** --- 1224,1228 ---- OR 'SA_factored' == $atest OR 'PartFrac' == $atest + OR 'SingleFrac' == $atest OR 'Diff' == $atest OR 'Int' == $atest) { |
From: Chris S. <san...@us...> - 2005-08-17 11:35:44
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24703/lang/en/doc Modified Files: en_doc.php Log Message: Index: en_doc.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/en_doc.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** en_doc.php 25 Jul 2005 10:09:32 -0000 1.6 --- en_doc.php 17 Aug 2005 11:35:35 -0000 1.7 *************** *** 360,374 **** $stackAnswerTest['PartFrac']['doc']="This test checks to see if the expression in <tt>SA</tt> is ! the partial fraction of <tt>tExpr</tt> which is the first part of the list SBL. It uses functions found in ! stackMaxima.mac in order to give feedback.<p> ! The function takes in the Students Answer (<tt>SA</tt>), and a List (<tt>SBL</tt>), SBL consist of ! 3 parts, the Teachers Expression (<tt>tExpr</tt>), the variable to which the partial fraction has respect to, and whether ! formative feedback is required. <p> ! Feedback comes in several forms, <tt>TRUE</tt> if and only if the answer is the partial fraction of ! the Teacher's Expression, whether it be a factored form or not. Feedback is also given based on ! incorrect answers in order to guide the student to the right answer. For exmaple the common denominator is returned ! in order for the student to check the denominators of their partial fraction. See the AnswerTest <tt>AT_PartFrac</tt> ! for more details."; $stackAnswerTest['Diff']['doc']="This test is a general differentiation test. --- 360,369 ---- $stackAnswerTest['PartFrac']['doc']="This test checks to see if the expression in <tt>SA</tt> is ! the partial fraction of <tt>TA</tt><p> ! Feedback comes in several forms, and you should refer to the test suite for details."; + $stackAnswerTest['SingleFrac']['doc']="This test checks if an algebraic fraction has been + written as a single fraction. This is essentially the reverse process of writing + an expression in partial fraction form."; $stackAnswerTest['Diff']['doc']="This test is a general differentiation test. |