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-09-12 09:30:17
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle/quiz In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12475/quiz Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle/quiz added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:29:55
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12379/moodle Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle added to the repository |
From: pkiddie <pk...@us...> - 2005-09-12 09:24:33
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11501/scripts/rqp Modified Files: RQPv1p0Server.php stackRQP.php Log Message: Slight alterations to functioning of RQP server. Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RQPv1p0Server.php 9 Sep 2005 10:59:21 -0000 1.9 --- RQPv1p0Server.php 12 Sep 2005 09:24:24 -0000 1.10 *************** *** 117,121 **** 'timeDependent' => FALSE , 'canComputerScore' => TRUE , ! 'maxScore' => 0, 'valid' => FALSE ); --- 117,121 ---- 'timeDependent' => FALSE , 'canComputerScore' => TRUE , ! 'maxScore' => 1, //assumed default of 1 'valid' => FALSE ); *************** *** 135,139 **** $itemProperties['maxScore']=$quOptions['QuVal']; //This isnt being returned?? is it in latest spec?? ! $itemInfo['title'] = $question['questionName']; } --- 135,139 ---- $itemProperties['maxScore']=$quOptions['QuVal']; //This isnt being returned?? is it in latest spec?? ! $itemInfo['name'] = $question['questionName']; } *************** *** 204,215 **** if (empty($source)) { ! //Is this a new NEW question, or are we in an existing authoring session if (empty($inputData)) { // if empty input array - we are starting afresh ! $question = stack_question_new('Paul Kiddie'); //Create question with mim fields. Todo, how do we get admin name from Moodle } else { $question = stack_rqp_question_get($inputData); // parse input fields stack_question_validate($question,$errors); // validate question and add potential reponse fields //Where there are no errors in the users input and the user has requested to save the question --- 204,221 ---- if (empty($source)) { ! //First time through authoring session if (empty($inputData)) { // if empty input array - we are starting afresh ! $question = stack_question_new('Remote User'); //Create question with mim fields. Todo, how do we get admin name from Moodle ! ! $output['body'] = stack_question_edit_form_substance($question,$errors,$namePrefix, $remoteCaller = TRUE); } + //Successive edits in new authoring session else { $question = stack_rqp_question_get($inputData); // parse input fields stack_question_validate($question,$errors); // validate question and add potential reponse fields + + $output['title'] = $question['questionName']; + $output['body'] = stack_question_edit_form_substance($question,$errors,$namePrefix, $remoteCaller = TRUE); //Where there are no errors in the users input and the user has requested to save the question *************** *** 218,221 **** --- 224,230 ---- $outcomeVars['completion'] = 'complete'; $outcomeVars['source'] = stack_rqp_source_write($question); + + //Disable all input fields + $output['body'] = stack_rqp_input_fields_disable($output['body']); } *************** *** 225,231 **** } } - - $output['title'] = $question['questionName']; - $output['body'] = stack_question_edit_form_substance($question,$errors,$namePrefix, $remoteCaller = TRUE); } --- 234,237 ---- *************** *** 237,248 **** switch($source) { case('adminOptions'): { $options_headings = array(get_string('stackOptions_edit_out','stack'),''); $options_list = array('Display','Language'); ! ! $fieldname = 'quiz'.'[quizOptions]'; $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), 'stem' => '', 'feedback' => '', --- 243,263 ---- switch($source) { case('adminOptions'): { + if (!$options = stack_rqp_keyval_field_get($inputData,'questionOptions')) { // options set in input fields + $question_options = array(); + } + + else { + $question_options = unserialize(html_entity_decode($options)); + } + + $optval = stack_options_formvals_set($question_options); + $options_headings = array(get_string('stackOptions_edit_out','stack'),''); $options_list = array('Display','Language'); ! $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$namePrefix, TRUE), 'stem' => '', 'feedback' => '', *************** *** 250,253 **** --- 265,271 ---- 'answer' => '', 'solution' => ''); + + $outcomeVars['completion'] = 'complete'; + $outcomeVars['options'] = stack_rqp_keyval_field_get($inputData,'questionOptions'); //Return options as serialised string contained by [questionOptions] break; } *************** *** 256,265 **** $options_headings = array(get_string('stackOptions_edit_out','stack'),''); $options_list = array('Display','Language'); - - $fieldname = 'quiz'.'[quizOptions]'; $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), 'stem' => '', 'feedback' => '', --- 274,281 ---- $options_headings = array(get_string('stackOptions_edit_out','stack'),''); $options_list = array('Display','Language'); $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$namePrefix, TRUE), 'stem' => '', 'feedback' => '', *************** *** 273,282 **** $options_headings = array(get_string('stackOptions_edit_out','stack'),''); $options_list = array('Display','Language'); - - $fieldname = 'quiz'.'[quizOptions]'; $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), 'stem' => '', 'feedback' => '', --- 289,296 ---- $options_headings = array(get_string('stackOptions_edit_out','stack'),''); $options_list = array('Display','Language'); $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$namePrefix, TRUE), 'stem' => '', 'feedback' => '', *************** *** 290,294 **** //This could only be STACK question source XML default: { ! if (empty($inputData)) { //On initial entry of editing an existing qu. $question = stack_rqp_parse_xml_string($source, &$errors); // Retrieve the question from source --- 304,309 ---- //This could only be STACK question source XML default: { ! //On initial entry of editing an existing qu. ! if (empty($inputData)) { $question = stack_rqp_parse_xml_string($source, &$errors); // Retrieve the question from source *************** *** 309,312 **** --- 324,330 ---- $outcomeVars['completion'] = 'complete'; $outcomeVars['source'] = stack_rqp_source_write($question); + + //Disable all input fields + $output['body'] = stack_rqp_input_fields_disable($output['body']); } *************** *** 474,541 **** $stem .= trim($questionInst['questionStemInst']); ! //9.2 Construct last answer ! $answer = ''; if ('' !==trim($last_attempt['RawAns'])) { //if there is an attempt made ! $answer .= 'Your last submitted answer was: <code>'; ! $answer .= htmlspecialchars(trim($last_attempt['RawAns'])); ! $answer .= '<code><br />'; ! $answer .= 'This was interpreted as:'; ! $answer .= trim($last_attempt['AnsDisp']); } ! //9.3 Construct 'validation'. is this response? ! $response = ''; ! if (array_key_exists('Valid',$this_attempt) && 'true' === $this_attempt['Valid']) { ! $response .= '<code>'; ! $response .= htmlspecialchars(trim($this_attempt['RawAns'])); ! $response .= '</code> was interpreted as:<br />'; ! $response .= trim($this_attempt['AnsDisp']); } - else { - $validation = trim($this_attempt['Feedback']); - } ! //9.4 Construct interactions - ??? $AnsFieldName; $body =''; - $feedback=''; $body .= stack_question_inst_try_formfrag($RawAns, $AnsFieldName); ! //9.5 Construct feedback if (array_key_exists('Valid',$this_attempt) && 'true' === $this_attempt['Valid']) { $feedback = trim($this_attempt['FeedBack']); } ! ! $correct = ''; if (array_key_exists('questionSolInst',$questionInst)) { if (array_key_exists('display', $questionInst['questionSolInst'])) { ! $correct= trim($questionInst['questionSolInst']['display']); } } ! //What if there is no worked solution - display correct response ! if ('' === $correct) { if (array_key_exists('questionAnsInst',$questionInst)) { if (array_key_exists('display', $questionInst['questionAnsInst'])) { ! $correct .= 'A correct answer is:<br />'; ! $correct .= trim($questionInst['questionAnsInst']['display']); } if (array_key_exists('value', $questionInst['questionAnsInst'])) { if (array_key_exists('display', $questionInst['questionAnsInst'])) { ! $correct .= '<br />which can be entered as:'; } else { ! $correct .= 'A correct answer can be entered as:'; } ! $correct .= trim($questionInst['questionAnsInst']['value']); } } } - $solution =''; - $solution .= $correct; //10. Construct Render params --- 492,567 ---- $stem .= trim($questionInst['questionStemInst']); ! //9.2 Construct last response made by student ! $response = ''; if ('' !==trim($last_attempt['RawAns'])) { //if there is an attempt made ! $response .= 'Your last submitted answer was: <code>'; ! $response .= htmlspecialchars(trim($last_attempt['RawAns'])); ! $response .= '</code><br />'; ! $response .= 'This was interpreted as:'; ! $response .= trim($last_attempt['AnsDisp']); } ! //9.3 Construct answer where required ! $answer = ''; ! if (array_key_exists('questionAnsInst',$questionInst)) { ! if (array_key_exists('display', $questionInst['questionAnsInst'])) { ! $answer .= 'A correct answer is:<br />'; ! $answer .= trim($questionInst['questionAnsInst']['display']); ! } ! ! if (array_key_exists('value', $questionInst['questionAnsInst'])) { ! if (array_key_exists('display', $questionInst['questionAnsInst'])) { ! $answer .= '<br />which can be entered as:'; ! } ! ! else { ! $answer .= 'A correct answer can be entered as:'; ! } ! ! $answer .= trim($questionInst['questionAnsInst']['value']); ! } } ! //9.4 Construct student attempt interactions $body =''; $body .= stack_question_inst_try_formfrag($RawAns, $AnsFieldName); ! //9.5 Construct feedback, e.g. at potential response level ! $feedback=''; if (array_key_exists('Valid',$this_attempt) && 'true' === $this_attempt['Valid']) { $feedback = trim($this_attempt['FeedBack']); } ! ! //9.6 Construct solution to question ! $solution = ''; if (array_key_exists('questionSolInst',$questionInst)) { if (array_key_exists('display', $questionInst['questionSolInst'])) { ! $solution= trim($questionInst['questionSolInst']['display']); } } ! //What if there is no worked solution available, just display correct response ! if ('' === $solution) { if (array_key_exists('questionAnsInst',$questionInst)) { if (array_key_exists('display', $questionInst['questionAnsInst'])) { ! $solution .= 'A correct answer is:<br />'; ! $solution .= trim($questionInst['questionAnsInst']['display']); } if (array_key_exists('value', $questionInst['questionAnsInst'])) { if (array_key_exists('display', $questionInst['questionAnsInst'])) { ! $solution .= '<br />which can be entered as:'; } else { ! $solution .= 'A correct answer can be entered as:'; } ! $solution .= trim($questionInst['questionAnsInst']['value']); } } } //10. Construct Render params *************** *** 568,572 **** //Construct RenderType ! $render = array('persistentData' => serialize($persistence), 'outcomeVars' => $outcomeVars, 'onSubmit' => $onSubmit, --- 594,598 ---- //Construct RenderType ! $render = array('persistentData' => serialize($persistence), //else '', 'outcomeVars' => $outcomeVars, 'onSubmit' => $onSubmit, Index: stackRQP.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/stackRQP.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** stackRQP.php 8 Sep 2005 22:07:25 -0000 1.4 --- stackRQP.php 12 Sep 2005 09:24:24 -0000 1.5 *************** *** 149,152 **** --- 149,175 ---- return false; } + + function stack_rqp_serialize_options() + { + } + + /** + * + * This takes the HTML output from the creation of the authoring form fragment, and simply disables + * each input field + * + */ + function stack_rqp_input_fields_disable($formFields) + { + $disabledForm = ''; + + $disabledForm = str_replace('<input', '<input disabled', $formFields); + $disabledForm = str_replace('<button', '<button disabled', $disabledForm); + $disabledForm = str_replace('<textarea', '<textarea disabled', $disabledForm); + $disabledForm = str_replace('<option', '<option disabled', $disabledForm); + $disabledForm = str_replace('<select', '<select disabled', $disabledForm); + + return $disabledForm; + } /** |
From: Chris S. <san...@us...> - 2005-09-12 08:24:13
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29788/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.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** stackmaxima.mac 12 Sep 2005 08:07:47 -0000 1.32 --- stackmaxima.mac 12 Sep 2005 08:24:02 -0000 1.33 *************** *** 19,23 **** FPPREC:16; /* Work with 16 digits */ ! ASSUME_POS:TRUE; %E_TO_NUMLOG:TRUE; --- 19,23 ---- FPPREC:16; /* Work with 16 digits */ ! /* ASSUME_POS:TRUE; */ %E_TO_NUMLOG:TRUE; |
From: Chris S. <san...@us...> - 2005-09-12 08:18:24
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28447/scripts/install Modified Files: stacktest.php Log Message: Index: stacktest.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stacktest.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** stacktest.php 12 Sep 2005 08:07:47 -0000 1.10 --- stacktest.php 12 Sep 2005 08:18:03 -0000 1.11 *************** *** 114,117 **** --- 114,118 ---- $err =''; $locals = NULL; + $options = stack_options_set(NULL); $options['Display']='LaTeX'; |
From: Chris S. <san...@us...> - 2005-09-12 08:07:56
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368/scripts Modified Files: stackAuthor.php stackCAS.php stackQuestion.php stackQuiz.php Added Files: stackDoc.php stackZone.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** stackAuthor.php 5 Sep 2005 13:40:56 -0000 1.43 --- stackAuthor.php 12 Sep 2005 08:07:47 -0000 1.44 *************** *** 391,396 **** } ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$prefix,$remoteCaller); --- 391,396 ---- } ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$prefix,$remoteCaller); *************** *** 879,884 **** ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),''); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','Language'); $fieldname = 'quiz'.'[quizOptions]'; --- 879,884 ---- ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','Complex no','Language'); $fieldname = 'quiz'.'[quizOptions]'; *************** *** 1299,1304 **** ! $options_headings = array('',get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),''); ! $options_list = array('QuizMode','InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','Language'); $fieldname = 'subject'.'[subjectOptions]'; --- 1299,1304 ---- ! $options_headings = array('',get_string('stackOptions_edit_inmeth','stack'),'','','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('QuizMode','InsertStars','InformalSyntax','AllowInputTool','Floats','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','Complex no','Language'); $fieldname = 'subject'.'[subjectOptions]'; --- NEW FILE: stackZone.php --- <?php /** * This file contains most functions which deal with the zone. * * @package scripts * @subpackage Stack */ /* the stackZone data structure */ /** * Orders subjects according to the way they are listed on the screen. * @param array $subject_store * @return array $subject_store */ function stack_zone_subjects_order($subject_store) { $reveal_subject = array(); $hidden_subject = array(); foreach ($subject_store as $sub) { if ('' === $sub['subjectOrder']) { $hidden_subject[] = $sub; } else { $subo = $sub; $subo['order'] = $subo['subjectOrder']; $reveal_subject[] = $subo; } } $subject_store = array_merge($reveal_subject,$hidden_subject); return $subject_store; } Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** stackQuestion.php 4 Sep 2005 19:24:57 -0000 1.34 --- stackQuestion.php 12 Sep 2005 08:07:47 -0000 1.35 *************** *** 24,27 **** --- 24,34 ---- // values = possible values, for a list this is an array. // default = default value. There must be one! + // CAS_KEY = The name of the variable to which this option will + // be assigned when it is in the CAS. + // The CAS is always called with these set up. + // CAS_TYPE = Tells us what to do with this. + // string, send as a string + // ex, send as an expression + // fun, apply a function to this value. //****************************************************** *************** *** 51,54 **** --- 58,79 ---- $stackOptions['Display']['values'] = array('String','LaTeX','MathML','LaTeX Source'); $stackOptions['Display']['default'] = 'LaTeX'; + $stackOptions['Display']['CAS_KEY'] = 'OPT_OUTPUT'; + $stackOptions['Display']['CAS_TYPE'] = 'string'; + + + // 'Complex j'; + $stackOptions['Complex no']['type'] = 'list'; + $stackOptions['Complex no']['values'] = array('i','j'); + $stackOptions['Complex no']['default'] = 'i'; + $stackOptions['Complex no']['CAS_KEY'] = 'make_complexJ'; + $stackOptions['Complex no']['CAS_TYPE'] = 'fun'; + + // 'Floats'; + $stackOptions['Floats']['type'] = 'list'; + $stackOptions['Floats']['values'] = array('TRUE','FALSE'); + $stackOptions['Floats']['default'] = 'TRUE'; + $stackOptions['Floats']['CAS_KEY'] = 'OPT_NoFloats'; + $stackOptions['Floats']['CAS_TYPE'] = 'ex'; + // 'Language'; *************** *** 122,125 **** --- 147,157 ---- $stackOptions['SubjectMode']['default'] = 'the class list only'; + // We need for efficiency reasons to sort out which options go to the CAS. + $stackOptionsCAS = ''; + foreach ($stackOptions as $optname => $opt) { + if (array_key_exists('CAS_KEY',$opt)) { // This is an option which goes to the CAS + $stackOptionsCAS[$optname] = array('CAS_KEY' => $opt['CAS_KEY'], 'CAS_TYPE' => $opt['CAS_TYPE']); + } + } //<PDK> sqlToSchemaMapping array maps basic SQL data types used in STAKCK to their respective XML schema data types *************** *** 1228,1236 **** * @param string $atest The name of the answer test * @param array $atest_ops The answer test options ! * @param string $disp The display option * @param array &$errors Repository for errors * @return array $stackQuestionAttempt data structure containing the information for this attempt. */ ! function stack_apply_answertest($sa,$ta,$atest,$atest_ops,$disp,&$errors) { global $stack_os,$stack_web_root,$stack_web_services,$stackAnswerTest; --- 1260,1268 ---- * @param string $atest The name of the answer test * @param array $atest_ops The answer test options ! * @param string $options The display option * @param array &$errors Repository for errors * @return array $stackQuestionAttempt data structure containing the information for this attempt. */ ! function stack_apply_answertest($sa,$ta,$atest,$atest_ops,$options,&$errors) { global $stack_os,$stack_web_root,$stack_web_services,$stackAnswerTest; *************** *** 1251,1255 **** if ('cas' == $stackAnswerTest[$atest]['imp']) { ! $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$disp,$errors); } --- 1283,1287 ---- if ('cas' == $stackAnswerTest[$atest]['imp']) { ! $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$options,$errors); } *************** *** 1264,1268 **** if ('' == $errs && '' != $atest_ops ) { ! $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$disp,$errors); } else { // We have an error in the question. --- 1296,1300 ---- if ('' == $errs && '' != $atest_ops ) { ! $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$options,$errors); } else { // We have an error in the question. *************** *** 1609,1613 **** $ta = $all_locs_Inst[$tan]['value']; ! $this_PRattempt = stack_apply_answertest($sa,$ta,$answertest[$prn],$answertestopt[$prn],$disp,$errors); if (array_key_exists('error', $this_PRattempt['Ans'] )) { --- 1641,1645 ---- $ta = $all_locs_Inst[$tan]['value']; ! $this_PRattempt = stack_apply_answertest($sa,$ta,$answertest[$prn],$answertestopt[$prn],$options,$errors); if (array_key_exists('error', $this_PRattempt['Ans'] )) { *************** *** 1700,1704 **** } ! $this_attempt = array_merge($this_attempt,stack_apply_answertest($RawAns,$CorrectAns,$at,$ato,$disp,$errors)); $this_attempt['RawAns']= $RawAns; --- 1732,1736 ---- } ! $this_attempt = array_merge($this_attempt,stack_apply_answertest($RawAns,$CorrectAns,$at,$ato,$options,$errors)); $this_attempt['RawAns']= $RawAns; Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** stackQuiz.php 7 Sep 2005 14:19:35 -0000 1.14 --- stackQuiz.php 12 Sep 2005 08:07:47 -0000 1.15 *************** *** 186,190 **** function stack_quiz_student_select($subjectID, $quiz_store, $user, $review=FALSE, $returnurl='') { global $stack_root; ! require_once("{$stack_root}/html/quizjava.html"); echo '<h2>'.get_string('quiz_choose','stack').'</h2>'; --- 186,194 ---- function stack_quiz_student_select($subjectID, $quiz_store, $user, $review=FALSE, $returnurl='') { global $stack_root; ! ! if (!$review) { ! include($stack_root.'/html/quizchoose.html'); ! require_once("{$stack_root}/html/quizjava.html"); ! } echo '<h2>'.get_string('quiz_choose','stack').'</h2>'; *************** *** 192,211 **** global $stackQuiz; if (is_array($quiz_store)) { ! echo "<script language=\"javascript\"> ! function quizreview(u,n,m) { ! document.forms.quizform.userid.value = u; ! document.forms.quizform.quizid.value = n; ! document.forms.quizform.subjectID.value = m; ! document.forms.quizform.submit(); ! } ! </script> ! <p>\n<form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='returnurl' value ='$returnurl' /> ! <input type='hidden' name='userid' value='-1' /> ! <input type='hidden' name='quizid' value='-1' /> ! <input type='hidden' name='subjectID' value='-1' /> ! <input type='hidden' name='action' value='review' />"; 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) { --- 196,203 ---- global $stackQuiz; if (is_array($quiz_store)) { ! ! 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>\n</tr>\n"; foreach ($quiz_store as $qs => $quiz) { *************** *** 237,241 **** echo "</tr>\n"; } ! echo "\n</table>\n</form>\n</p>"; } else { echo '<p>'.get_string('quiz_nonetochoose','stack').'</p>'; --- 229,233 ---- echo "</tr>\n"; } ! echo "\n</table>\n</p>"; } else { echo '<p>'.get_string('quiz_nonetochoose','stack').'</p>'; --- NEW FILE: stackDoc.php --- <?php /** * This file contains most functions which deal with documentation. * * @package scripts * @subpackage Stack */ /** */ /** * Display an example of the stack question * * * @param $question The question to be displayed. * */ function stack_doc_dispexample($question) { global $stackQuestion; //show_array($question); echo "<table border='1'>\n"; foreach ($question as $key => $val) { $fieldname = 'stackQuestion_'.$key; $descript = get_string($fieldname,'stack'); echo "<tr>\n <td>"; echo "<a href=\"javascript:HelpPopup('$key','stackQuestion');\">{$descript}</a></td>\n"; echo " <td><tt>$val</tt> </td>\n</tr>\n"; } echo "</table>\n"; } /** * Display, with hyperlinking, the STACK question field name and a link to the help pop-up. * * * @param string $command The command to be displayed * @param string $stackhelp Optional: the help file which contains the field. */ function stack_doc_dispstackqfield($command,$stackhelp='stackQuestion') { global $stackQuestion,$stackQuestionPotResp,$stackOptions; if ('stackQuestion' == $stackhelp) { $fieldname = 'stackQuestion_'.$command; $descript = get_string($fieldname,'stack'); } else if ('stackQuestionPotResp' == $stackhelp) { $fieldname = 'stackQuestion_PR_'.$command; $descript = get_string($fieldname,'stack'); } else if ('stackOptions' == $stackhelp) { $fieldname = 'stackOptions_'.$command; $descript = get_string($fieldname,'stack'); } echo "<a href=\"javascript:HelpPopup('$command','$stackhelp');\">$descript</a> "; } /** * Display, with hyper-linking, the STACK command * * * @param string $command The command to be displayed */ function stack_doc_dispstackcommand($command) { echo "<a href=\"#STACK_command_{$command}\"><font color=\"orange\"><tt>$command</tt></font></a> "; } ?> Index: stackCAS.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackCAS.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackCAS.php 25 Aug 2005 16:06:17 -0000 1.2 --- stackCAS.php 12 Sep 2005 08:07:47 -0000 1.3 *************** *** 11,33 **** * 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; --- 11,51 ---- * 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 int $seed The random number generation seed ! * @param array $options * @return string The command to send to the CAS */ ! function CASCodeInstantiate($locvars, $t, $seed, $options) { ! global $stackOptionsCAS; // Generates Maxima specific code // We will use a maxima block. // BLOCK([v1,...,vk], state1,...statej) ! $loclistA = ''; $loclistB = ''; + $cs ='cab:BLOCK([ RANDOM_SEED'; + + // Now we will add options + foreach ($stackOptionsCAS as $optname => $opt) { + $optkey = $opt['CAS_KEY']; + switch ($opt['CAS_TYPE']) { + case 'string': + $loclistA.= ', '.$optkey; + $loclistC.= ', '.$optkey.':"'.$options[$optname].'"'; + break; + case 'ex': + $loclistA.= ', '.$optkey; + $loclistC.= ', '.$optkey.':'.$options[$optname]; + break; + case 'fun': + $loclistC.= ', '.$optkey.'('.$options[$optname].')'; + break; + } + } // 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; *************** *** 35,39 **** } ! $cs .= $loclistA.'], OPT_OUTPUT:"'.$OPT_OUTPUT.'", RANDOM_SEED:'.$seed; $cs .= ", print(\"[TimeStamp= [ $t ], Locals= [ \") "; --- 53,57 ---- } ! $cs .= $loclistA.'], RANDOM_SEED:'.$seed.$loclistC; $cs .= ", print(\"[TimeStamp= [ $t ], Locals= [ \") "; *************** *** 43,46 **** --- 61,65 ---- $cs .= ", RETURN(true) ); \n"; + //echo "<pre>".$cs."</pre>"; return($cs); } *************** *** 142,156 **** * @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"; --- 161,198 ---- * @return string The command to send to the CAS */ ! function CASAnsTestCmd($exp1, $exp2, $t, $options, $test) { // Generates the CAS command to mark a question ! global $stackAnswerTest,$stackOptionsCAS; $exp1 = str_replace('?','qmchar',$exp1); $exp2 = str_replace('?','qmchar',$exp2); ! $loclistA = ''; ! $loclistB = ''; ! $cs ='cab:BLOCK([ RANDOM_SEED'; ! ! // Now we will add options ! foreach ($stackOptionsCAS as $optname => $opt) { ! $optkey = $opt['CAS_KEY']; ! switch ($opt['CAS_TYPE']) { ! case 'string': ! $loclistA.= ', '.$optkey; ! $loclistC.= ', '.$optkey.':"'.$options[$optname].'"'; ! break; ! case 'ex': ! $loclistA.= ', '.$optkey; ! $loclistC.= ', '.$optkey.':'.$options[$optname]; ! break; ! case 'fun': ! $loclistC.= ', '.$optkey.'('.$options[$optname].')'; ! break; ! } ! } ! ! $cas_cmd = "cab:BLOCK([ ans,str{$loclistA}] {$loclistC}, "; $cas_cmd .= " print(\" [TimeStamp= [ $t ], Ans= [ error = [\")"; $cas_cmd .= ", cte(\"ans\",ERRCATCH(ans:$exp1)), "; + $cas_cmd .= "str:stack_validate(ans), print(str),"; $fname = $stackAnswerTest[$test]['function']; $cas_cmd .= " str:$fname(ans,$exp2), print(str), RETURN(true)); \n"; *************** *** 169,197 **** 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; } --- 211,249 ---- function CASAnsTestParse($instr) { ! $unp = CASParsePreparse($instr); ! $unp['Ans'] = CASParsePreparse($unp['Ans']); ! if (''==$unp['Ans']['error']) { ! unset($unp['Ans']['error']); ! } ! if ('false' == $unp['ValidationValid']) { ! $unp['Valid'] = 'false'; ! $unp['AnswerNote'] = $unp['ValidationNote']; ! $unp['FeedBack'] = $unp['ValidationFeedBack']; ! } ! unset($unp['ValidationValid']); ! unset($unp['ValidationNote']); ! unset($unp['ValidationFeedBack']); ! // 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; } *************** *** 225,231 **** $t = time(); ! $display = $options['Display']; ! ! $varCommand = CASCodeInstantiate($locals, $t, $seed, $display); if ($varCommand != '') { --- 277,281 ---- $t = time(); ! $varCommand = CASCodeInstantiate($locals, $t, $seed, $options); if ($varCommand != '') { *************** *** 298,309 **** * @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); if ($varCommand != '') { --- 348,359 ---- * @param string $exp2 A CAS expression, nominally the teachers's * @param string $test Which AnswerTest to apply. ! * @param array $options * @return array $this_attempt An array structure, which is used to build the student's attempt. */ ! function CPProcessAnsTest($exp1,$exp2,$test,$options,&$err) { // create a StackResponse object $t = time(); ! $varCommand = CASAnsTestCmd($exp1, $exp2, $t, $options, $test); if ($varCommand != '') { |
From: Chris S. <san...@us...> - 2005-09-12 08:07:55
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368/scripts/maxima Modified Files: complexj.lisp stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** stackmaxima.mac 1 Sep 2005 09:14:50 -0000 1.31 --- stackmaxima.mac 12 Sep 2005 08:07:47 -0000 1.32 *************** *** 80,85 **** 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! */ --- 80,85 ---- load("stacktex.lisp"); /* Loads LaTeX adaptions and preferences */ ! /* Makes a complex j if needed */ ! make_complexJ(OPT_COMPLEXJ) := if OPT_COMPLEXJ=j then (j:%i,load("complexj.lisp")) else i:%i; /* ARRGH! */ *************** *** 201,204 **** --- 201,220 ---- RETURN(str) ); + + StackValidOb(val,note,fb):=BLOCK([str], + str:concat(" ValidationValid = [ ",val," ], ValidationNote = [ ",note," ], ValidationFeedBack= [ ",fb," ]"), + RETURN(str) + ); + + + /* ******************************************* */ + /* Validate an expression */ + /* ******************************************* */ + + stack_validate(ex) := BLOCK( + IF OPT_NoFloats AND anyfloatex(ex) THEN + RETURN(StackValidOb("false","Illegal_floats",StackAddFeedback("","Illegal_floats"))), + RETURN(StackValidOb("true","","")) + )$ /* ************************************/ *************** *** 221,226 **** if OPT_OUTPUT#"MathML" then ufn:CONCAT(" <html>",ufn,"</html> "), - - /* Removed on Windows: cd '",IMAGE_DIR,"' */ preamble:CONCAT("set key off set zeroaxis --- 237,240 ---- *************** *** 229,235 **** set output ",afn), set_plot_option([GNUPLOT_OUT_FILE,tfn]), ! set_plot_option([GNUPLOT_PREAMBLE, preamble]), if length(ra) = 1 then plot2d(ex,ra[1]), ! if length(ra) = 2 then plot2d(ex,ra[1],ra[2]), sysp:CONCAT(GNUPLOT_CMD," ",tfn), sysr:CONCAT(DEL_CMD," ",tfn), --- 243,249 ---- set output ",afn), set_plot_option([GNUPLOT_OUT_FILE,tfn]), ! set_plot_option([GNUPLOT_PREAMBLE, preamble]), if length(ra) = 1 then plot2d(ex,ra[1]), ! if length(ra) = 2 then plot2d(ex,ra[1],ra[2]), sysp:CONCAT(GNUPLOT_CMD," ",tfn), sysr:CONCAT(DEL_CMD," ",tfn), *************** *** 239,242 **** --- 253,295 ---- /* ********************************** */ + /* Analysis tests */ + /* ********************************** */ + + /* This determines if an expression is continuous + ex the expression, + v the variable, + xp the point at which to evaluate. */ + continuousp(ex,v,xp) := BLOCK([lp,lm], + lp: limit(ex,v,xp,MINUS), + lm: limit(ex,v,xp,PLUS), + /* print(lp), print(lm), */ + IF lp # UND + AND lm # UND + AND lp # IND + AND lm # IND + AND lp # INF + AND lm # INF + AND lp # MINF + AND lm # MINF + AND lp = lm + THEN TRUE ELSE FALSE + )$ + + + /* This determines if an expression is differentiable + ex the expression, + v the variable, + xp the point at which to evaluate, + n the number of times it is differentiated (optional). + */ + diffp(ex,[args]) := BLOCK([v,xp,n], + v:args[1], + xp:args[2], + n:1, + IF length(args)=3 THEN n:args[3], + RETURN(continuousp(diff(ex,v,n),v,xp)) + )$ + + /* ********************************** */ /* Algebraic tests */ /* ********************************** */ *************** *** 311,314 **** --- 364,381 ---- RETURN(ret) )$ + /* Decides is any floats are in the expression. */ + anyfloatex(ex) := BLOCK([PARTSWITCH,ret,kloop], + ret:FALSE, + IF floatnump(ex) THEN RETURN(TRUE), + IF atom(ex) THEN RETURN(FALSE), + PARTSWITCH:TRUE, + FOR kloop:1 WHILE PART(ex,kloop)#END DO + ret:ret OR anyfloatex(PART(ex,kloop)), + RETURN(ret) + )$ + + /* compare with*/ + /* coefl:map('first,rest(coeffs(SA,x))) */ + /* allinteger(l) returns true if all of the list are integers */ *************** *** 586,593 **** if errcatch(deg:degree(SA,v))=[] then RETURN(StackReturnOb("false","0","ATFacForm_error_degreeSA",StackAddFeedback("","ATFacForm_error_degreeSA"))), - /* Check all the coefficients are not floats */ - coefl:map('first,rest(coeffs(SA,x))), - if anyfloat(coefl) then - RETURN(StackReturnOb("false","0","ATFacForm_error_float",StackAddFeedback("","ATFacForm_error_float"))), aequiv:Stack_Test(SA,SB), /* An integer answe is always correct. */ --- 653,656 ---- *************** *** 647,650 **** --- 710,714 ---- ATPartFrac(SA,SBL) := BLOCK([NEGDISTRIB,val,rawmk,fb,ansnote,SB,v,quiet,facdum], NEGDISTRIB:FALSE, + /* Check for floats */ val:"", rawmk:1, fb:StackAddFeedback("","AT_NOTIMPLEMENTED"), ansnote:"", /* SBL is a list: the teacher's answer, the variable, and whether formative feedback is to be provided. */ Index: complexj.lisp =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/complexj.lisp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** complexj.lisp 25 Aug 2005 16:06:17 -0000 1.2 --- complexj.lisp 12 Sep 2005 08:07:47 -0000 1.3 *************** *** 7,8 **** --- 7,10 ---- (defprop $%i "j" texword) + + (defprop $%i "<mi>j</mi> " mathmlword) |
From: Chris S. <san...@us...> - 2005-09-12 08:07:55
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368/html Added Files: quizchoose.html Log Message: --- NEW FILE: quizchoose.html --- <!-- This form is used by stackQuiz -> stack_quiz_student_select an also by the file user.php for a similar purpose --> <script language="javascript"> function quizreview(u,n,m) { document.forms.quizform.userid.value = u; document.forms.quizform.quizid.value = n; document.forms.quizform.subjectID.value = m; document.forms.quizform.submit(); } </script> <form name='quizform' action='quiz.php' method='POST'> <input type='hidden' name='returnurl' value ='<?php $returnurl ?>' /> <input type='hidden' name='userid' value='-1' /> <input type='hidden' name='quizid' value='-1' /> <input type='hidden' name='subjectID' value='-1' /> <input type='hidden' name='action' value='review' /> </form> |
From: Chris S. <san...@us...> - 2005-09-12 08:07:55
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368/lang/en Modified Files: stack.php Log Message: Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/stack.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** stack.php 4 Sep 2005 19:24:57 -0000 1.26 --- stack.php 12 Sep 2005 08:07:47 -0000 1.27 *************** *** 54,58 **** // Stack page footer. $string['ThisSTACKVer'] = 'This is STACK version'; ! $string['ThisPageTook'] = 'This page took approximatly'; $string['seconds'] = 'seconds'; $string['STACKlogo'] = 'STACK logo'; --- 54,58 ---- // Stack page footer. $string['ThisSTACKVer'] = 'This is STACK version'; ! $string['ThisPageTook'] = 'This page took approximately'; $string['seconds'] = 'seconds'; $string['STACKlogo'] = 'STACK logo'; *************** *** 143,147 **** $string['USR_Address'] = 'Address'; $string['USR_Department'] = 'Department'; ! $string['USR_Institution'] = 'Instituion'; //////////////////////////////////////// --- 143,147 ---- $string['USR_Address'] = 'Address'; $string['USR_Department'] = 'Department'; ! $string['USR_Institution'] = 'Institution'; //////////////////////////////////////// *************** *** 177,181 **** $string['stackQuestion_questionFormat'] = 'Digital manifestation'; $string['stackQuestion_questionLanguage'] = 'Language of content'; ! $string['stackQuestion_questionLearningContext'] = 'Targetted to'; $string['stackQuestion_questionDifficulty'] = 'Difficulty'; $string['stackQuestion_questionCompetency'] = 'Competencies trained'; --- 177,181 ---- $string['stackQuestion_questionFormat'] = 'Digital manifestation'; $string['stackQuestion_questionLanguage'] = 'Language of content'; ! $string['stackQuestion_questionLearningContext'] = 'Targeted to'; $string['stackQuestion_questionDifficulty'] = 'Difficulty'; $string['stackQuestion_questionCompetency'] = 'Competencies trained'; *************** *** 222,226 **** $string['stackQuiz_quizFormat'] = 'Digital manifestation'; $string['stackQuiz_quizLanguage'] = 'Language of content'; ! $string['stackQuiz_quizLearningContext']= 'Targetted to'; $string['stackQuiz_quizDifficulty'] = 'Difficulty'; $string['stackQuiz_quizCompetency'] = 'Competencies trained'; --- 222,226 ---- $string['stackQuiz_quizFormat'] = 'Digital manifestation'; $string['stackQuiz_quizLanguage'] = 'Language of content'; ! $string['stackQuiz_quizLearningContext']= 'Targeted to'; $string['stackQuiz_quizDifficulty'] = 'Difficulty'; $string['stackQuiz_quizCompetency'] = 'Competencies trained'; *************** *** 240,244 **** $string['stackSubject_subjectFormat'] = 'Digital manifestation'; $string['stackSubject_subjectLanguage'] = 'Language of content'; ! $string['stackSubject_subjectLearningContext']= 'Targetted to'; $string['stackSubject_subjectDifficulty'] = 'Difficulty'; $string['stackSubject_subjectCompetency'] = 'Competencies trained'; --- 240,244 ---- $string['stackSubject_subjectFormat'] = 'Digital manifestation'; $string['stackSubject_subjectLanguage'] = 'Language of content'; ! $string['stackSubject_subjectLearningContext']= 'Targeted to'; $string['stackSubject_subjectDifficulty'] = 'Difficulty'; $string['stackSubject_subjectCompetency'] = 'Competencies trained'; *************** *** 266,269 **** --- 266,271 ---- $string['stackOptions_SyntaxHint'] = 'Syntax Hint'; $string['stackOptions_Display'] = 'Display'; + $string['stackOptions_Complex no'] = 'Complex no'; + $string['stackOptions_Floats'] = 'Forbid floats'; $string['stackOptions_Language'] = 'Language'; $string['stackOptions_QuVal'] = 'Question value'; *************** *** 350,353 **** --- 352,356 ---- $string['AT_NOTIMPLEMENTED'] = 'This answer test has not been implemented.'; + $string['Illegal_floats'] = 'Your answer contains floating point numbers, which are not allowed in this question. You need to type in numbers as fractions. For example, you should type 1/3 not 0.3333, which is after all only an approximation to one third.'; $string['ATAlgEquiv_SA_not_matrix'] = 'Your answer should be a matrix, but is not.'; *************** *** 375,382 **** $string['ATFacForm_error_list'] = 'The answer test failed. Please contact your systems administrator'; $string['ATFacForm_error_degreeSA'] = 'The CAS could not establish the algebraic degree of your answer.'; - $string['ATFacForm_error_float'] = 'You should not use any floating point (decimal) numbers. Please use only integers, fractions etc.'; $string['ATFacForm_isfactored'] = 'Your answer is factored, well done. '; // needs a space at the end. $string['ATFacForm_notfactored'] = 'Your answer is not factored. '; // needs a space at the end. ! $string['ATFacForm_notalgequiv'] = 'Note that your answer is not algebarically equivalent to the correct answer. You must have done something wrong. '; // needs a space at the end. $string['ATPartFrac_error_list'] = $string['ATFacForm_error_list']; --- 378,384 ---- $string['ATFacForm_error_list'] = 'The answer test failed. Please contact your systems administrator'; $string['ATFacForm_error_degreeSA'] = 'The CAS could not establish the algebraic degree of your answer.'; $string['ATFacForm_isfactored'] = 'Your answer is factored, well done. '; // needs a space at the end. $string['ATFacForm_notfactored'] = 'Your answer is not factored. '; // needs a space at the end. ! $string['ATFacForm_notalgequiv'] = 'Note that your answer is not algebraically equivalent to the correct answer. You must have done something wrong. '; // needs a space at the end. $string['ATPartFrac_error_list'] = $string['ATFacForm_error_list']; *************** *** 410,414 **** $string['FE_notadmin'] = 'Not permitted!'; ! $string['FE_needadmin'] = 'You need to be logged in as the admin to edit quizzes, but seem to be user {$a}.'; $string['FE_errors_exist'] = 'Errors exist!'; $string['FE_errors_field'] = 'The field $a, gave the following error.'; --- 412,416 ---- $string['FE_notadmin'] = 'Not permitted!'; ! $string['FE_needadmin'] = 'You need to be logged in as the administrator, but seem to be user {$a}.'; $string['FE_errors_exist'] = 'Errors exist!'; $string['FE_errors_field'] = 'The field $a, gave the following error.'; |
From: Chris S. <san...@us...> - 2005-09-12 08:07:55
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368/lang/en/doc Modified Files: author_commonsyntax.php author_gettingstarted.php en_doc.php Log Message: Index: author_commonsyntax.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_commonsyntax.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** author_commonsyntax.php 14 Jul 2005 18:05:04 -0000 1.3 --- author_commonsyntax.php 12 Sep 2005 08:07:47 -0000 1.4 *************** *** 9,12 **** --- 9,14 ---- */ + include_once("$stack_root/scripts/stackDoc.php"); + ?> *************** *** 36,39 **** --- 38,43 ---- */ include($stack_root.'/scripts/maxima/stackfun.php'); + include($stack_root.'/scripts/stackAuthor.php'); + /** *************** *** 129,134 **** <pre>@plot(x^2,[x,-1,1])@</pre> ! To get many plots in one window, we need to define a list of functions, perhaps with Maxima's ! <a href='maximadocs/maxdoc/maxima_38.html#IDX948'>MAKELIST</a> command. <pre>@(p(k):=x^k,pl:makelist(p(k),k,1,5),plot(pl,[x,-1,1]))@</pre> --- 133,147 ---- <pre>@plot(x^2,[x,-1,1])@</pre> ! You can add a second variable to control the axes. ! ! <pre>@plot(x^2,[x,-1,1],[y,0,2])@</pre> + However, Maxima will not always allow you to get the axes you want. This is on the to-do list for STACK. + + To get many plots in one window, we need to define a list of functions. + + <pre>@plot([x^2,sin(x)],[x,-1,1])@</pre> + + This can be done with Maxima's + <a href='maximadocs/maxdoc/maxima_38.html#IDX948'>MAKELIST</a> command <pre>@(p(k):=x^k,pl:makelist(p(k),k,1,5),plot(pl,[x,-1,1]))@</pre> Index: author_gettingstarted.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_gettingstarted.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** author_gettingstarted.php 25 Aug 2005 16:06:17 -0000 1.5 --- author_gettingstarted.php 12 Sep 2005 08:07:47 -0000 1.6 *************** *** 1,1020 **** <?php - /** - * An authoring guide for STACK questions. - * - * @package documentation - [...1443 lines suppressed...] <pre> m = rand([y,x,t]) p = rand(7)+1 q = 0 dum1 = block(for i:1 while i<=p do (q:q+rand(9)*m^p,p:p-1),return(q)) r = int(q,m) </pre> <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> "; ?> Index: en_doc.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/en_doc.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** en_doc.php 25 Aug 2005 16:25:41 -0000 1.8 --- en_doc.php 12 Sep 2005 08:07:47 -0000 1.9 *************** *** 1,842 **** <?php - /** - * Describes the data structure stackQuestion - * - * - Preliminary stackQuestion metadata documentation - [...1242 lines suppressed...] //Learning context $stackQuiz['quizLearningContext']['doc']="Describes the educational context of the intended target audience of the resource. User defined list type"; //Difficulty $stackQuiz['quizDifficulty']['doc']="How difficult it is to work through the resource for the given target audience. Percieved difficulty, user defined list type"; //Competency $stackQuiz['quizCompetency']['doc']="Mathematical competancies a resource trains. User defined, list type"; //CompetencyLevel $stackQuiz['quizCompetencyLevel']['doc']="Mathematical skills a resource requires/trains. User defined, list type"; //Time to allocate $stackQuiz['quizTimeAllocated']['doc']="An approximate time it takes to work with the resource. User defined, list type"; //Type of question $stackQuiz['quizExcerciseType']['doc']="Type of interactive elements used in the context of the excercise. User defined, list type"; ?> |
From: Chris S. <san...@us...> - 2005-09-12 08:07:54
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368/scripts/install Modified Files: stacktest.php Log Message: Index: stacktest.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stacktest.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** stacktest.php 29 Aug 2005 18:41:03 -0000 1.9 --- stacktest.php 12 Sep 2005 08:07:47 -0000 1.10 *************** *** 42,49 **** include($stack_logfiles.'CASkeywords.php'); } else { ! die("<font color='red'>Cannot read the file {$stack_logfiles}CASkeywords.php.</font>"); } ! echo "<p>Check here for errors.</p>"; /************************************************/ --- 42,49 ---- include($stack_logfiles.'CASkeywords.php'); } else { ! die("<font color='red'>Cannot read the file {$stack_logfiles}CASkeywords.php.</font>"); } ! echo "<p><font color='green'>Test write a success!</font></p>"; /************************************************/ *************** *** 66,70 **** fwrite($fh,"Test write a success!"); fclose($fh); ! echo "<br /><font color='green'>Test write a success!</font>"; // /************************************************/ --- 66,72 ---- fwrite($fh,"Test write a success!"); fclose($fh); ! ! echo "<p><font color='green'>Test write a success!</font></p>"; ! // /************************************************/ |
From: Chris S. <san...@us...> - 2005-09-12 08:07:54
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26368 Modified Files: editzone.php quiz.php user.php Log Message: Index: editzone.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editzone.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editzone.php 4 Sep 2005 21:26:18 -0000 1.2 --- editzone.php 12 Sep 2005 08:07:47 -0000 1.3 *************** *** 37,40 **** --- 37,41 ---- require_once("{$stack_root}/scripts/stackAuthor.php"); require_once("{$stack_root}/scripts/stackFrontend.php"); + require_once("{$stack_root}/scripts/stackZone.php"); require_once("{$stack_root}/html/trypopupform.html"); *************** *** 97,115 **** $subject_store = stack_db_subject_get(); ! ! $reveal_subject = array(); ! $hidden_subject = array(); ! foreach ($subject_store as $sub) { ! ! if ('' === $sub['subjectOrder']) { ! $hidden_subject[] = $sub; ! } else { ! $subo = $sub; ! $subo['order'] = $subo['subjectOrder']; ! $reveal_subject[] = $subo; ! } ! ! } ! $subject_store = array_merge($reveal_subject,$hidden_subject); echo "<form name='stackzoneeditform' action='$PostTo' method='POST'>\n"; --- 98,102 ---- $subject_store = stack_db_subject_get(); ! $subject_store = stack_zone_subjects_order($subject_store); echo "<form name='stackzoneeditform' action='$PostTo' method='POST'>\n"; Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** quiz.php 9 Sep 2005 11:48:12 -0000 1.38 --- quiz.php 12 Sep 2005 08:07:47 -0000 1.39 *************** *** 31,35 **** } - ////////////////////////////////////////////////////////// // (2) Assign default values to quiz specific variables. --- 31,34 ---- Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** user.php 5 Sep 2005 09:19:26 -0000 1.8 --- user.php 12 Sep 2005 08:07:47 -0000 1.9 *************** *** 28,31 **** --- 28,32 ---- require_once("{$stack_root}/scripts/stackFrontend.php"); + require_once("{$stack_root}/scripts/stackZone.php"); *************** *** 82,86 **** break; case 'review': ! echo "Not yet implemented."; //$quiz_store = stack_db_quiz_get(); //stack_quiz_student_select($quiz_store, $user_stu,TRUE); --- 83,109 ---- break; case 'review': ! ! $subject_store = stack_db_subject_get(); ! $subject_store = stack_zone_subjects_order($subject_store); ! ! include($stack_root.'/html/quizchoose.html'); ! ! $name = "{$user_stu[username]} ({$user_stu[firstname]} {$user_stu[lastname]})"; ! echo "<h1>Review the work of $name</h1>\n\n"; ! ! echo "<p>\n<b>Subjects</b>\n\n"; ! foreach ($subject_store as $subject) { ! $subjectID = $subject['subjectID']; ! echo "<br /><a href=#subject{$subjectID}>(".$subjectID.') '.$subject['subjectName']."</a>\n"; ! } ! echo "</p>\n"; ! ! foreach ($subject_store as $subject) { ! $subjectID = $subject['subjectID']; ! echo "<h1><a name=\"subject{$subjectID}\">({$subjectID}) ".$subject['subjectName']."</h1>\n\n"; ! $quiz_store = stack_db_subject_quiz_list_student($subjectID); ! stack_quiz_student_select($subjectID,$quiz_store, $user_stu, TRUE); ! } ! //$quiz_store = stack_db_quiz_get(); //stack_quiz_student_select($quiz_store, $user_stu,TRUE); |
From: Chris S. <san...@us...> - 2005-09-09 11:48:20
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27041 Modified Files: quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** quiz.php 9 Sep 2005 11:45:48 -0000 1.37 --- quiz.php 9 Sep 2005 11:48:12 -0000 1.38 *************** *** 137,145 **** // Check the $quizid is in the $subject if (!stack_db_subject_quiz_contained($subjectID,$quizid)) { ! echo "The quizID number is not linked to the subjectID numbers supplied"; die(); } // Get the particular quiz, without hidden questions. $quiz = stack_db_quiz_get($quizid,FALSE); // Get a list of questionIDs in this quiz $quiz_questions = NULL; --- 137,149 ---- // Check the $quizid is in the $subject if (!stack_db_subject_quiz_contained($subjectID,$quizid)) { ! echo "The quizID number is not linked to the subjectID numbers supplied."; die(); } // Get the particular quiz, without hidden questions. $quiz = stack_db_quiz_get($quizid,FALSE); + + // HACK: should we give this $quiz to this $user? + // Not yet done. (This page might be called directly with a form). + // Get a list of questionIDs in this quiz $quiz_questions = NULL; |
From: Chris S. <san...@us...> - 2005-09-09 11:45:57
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26598 Modified Files: quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** quiz.php 9 Sep 2005 11:14:59 -0000 1.36 --- quiz.php 9 Sep 2005 11:45:48 -0000 1.37 *************** *** 137,141 **** // Check the $quizid is in the $subject if (!stack_db_subject_quiz_contained($subjectID,$quizid)) { ! echo "The quizID number is not linked to the subjectID numbers supplied". die(); } --- 137,141 ---- // Check the $quizid is in the $subject if (!stack_db_subject_quiz_contained($subjectID,$quizid)) { ! echo "The quizID number is not linked to the subjectID numbers supplied"; die(); } |
From: Chris S. <san...@us...> - 2005-09-09 11:15:07
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19275/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** stackDatabase.php 7 Sep 2005 14:19:35 -0000 1.48 --- stackDatabase.php 9 Sep 2005 11:14:59 -0000 1.49 *************** *** 2016,2019 **** --- 2016,2042 ---- /** + * Checks a quiz is really in the subject. + * + * @param int $subjectID The subjectID number of the subject needed. + * @param int $quizid The quizid of the quiz + * @return void + */ + function stack_db_subject_quiz_contained($subjectID,$quizid) { + + $exists = FALSE; + + $query = "SELECT quizid FROM subject_quiz WHERE subjectID = '$subjectID' AND quizid = '$quizid'"; + + $result = stack_db_query($query); + if(0 != mysql_num_rows($result)) { + $exists = TRUE; + } + + return $exists; + + } + + + /** * Drop a quizid from a subject * |
From: Chris S. <san...@us...> - 2005-09-09 11:15:07
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19275 Modified Files: quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** quiz.php 7 Sep 2005 14:19:35 -0000 1.35 --- quiz.php 9 Sep 2005 11:14:59 -0000 1.36 *************** *** 134,137 **** --- 134,143 ---- if (array_key_exists('quizid',$_POST)) { $quizid = $_POST['quizid']; + + // Check the $quizid is in the $subject + if (!stack_db_subject_quiz_contained($subjectID,$quizid)) { + echo "The quizID number is not linked to the subjectID numbers supplied". + die(); + } // Get the particular quiz, without hidden questions. $quiz = stack_db_quiz_get($quizid,FALSE); |
From: pkiddie <pk...@us...> - 2005-09-09 11:00:39
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13797/scripts/rqp Added Files: nb_easyxml_lite.php Log Message: --- NEW FILE: nb_easyxml_lite.php --- <?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); define("XML_ERROR",0); define("XML_DECLARATION",5); // <?xml define("XML_DOCTYPE",6); // <!DOCTYPE ... > define("XML_INSTRUCTION",7); // <? define("XML_CDATA",8); // <[CDATA[ ... ]]> define("XML_COMMENT",9); // <!-- ... --> /*! Base class from which tag and content classes are derived. Never used directly. */ class nb_xml_part{ var $type; //!< Indicates the type of entity - tag, content etc. var $depth; //!< Indicates how deep in the xml tree this entity is. //! A 'pure virtual' function. Derived classes impliment their own version. function dump() { return "<font color='red'>This should never be called!</font><br>"; } }; //! Class for tags in the list of the XML. class nb_xml_tag extends nb_xml_part{ var $tagname; //!< The name of the tag, no namespace prefix var $attribs; //!< An associative array containing attributes keyed by name var $cleansource; //!< the tidy source for the tag. // Next four lines added 28Jun05 NSFB var $nsURI; //!< The namespace URI of the tag if it exists var $nsPrefix; //!< The namespace prefix of the tag if it was used // this is only really meaningful in start elements, potentially used in closed though var $nsDetail; //!< an array of namespaces declared here ['!'] used as prefix for default; /*! Constructor takes a XML tag (without < >) sets $tagname, * $type (START_TAG|END_TAG|CLOSED_TAG), and $attribs, * an associative array of attributes. */ function nb_xml_tag($tagsource) { // initialise to default values $this->nsDetail = array(); $this->nsPrefix = ""; $this->nsURI = false; // "" would be empty, false is undefined // tidy up the ends and make sure the < and > are gone. $tagsource=trim($tagsource); if($tagsource[0]=="<") { $tagsource = substr($tagsource,1); } if($tagsource[strlen($tagsource)-1]==">") { $tagsource = substr($tagsource,0,strlen($tagsource)-1); } $tagsource=trim($tagsource); $this->cleansource=$tagsource; // now check what sort of tag it is... // echo $tagsource[0]; // debug switch($tagsource[0]) { case '?': if(substr($tagsource,0,4)=="?xml"){ $this->type = XML_DECLARATION;} else{ $this->type = XML_INSTRUCTION;} break; case '!': if(substr($tagsource,0,8)=="!DOCTYPE"){ $this->type = XML_DOCTYPE;} elseif(substr($tagsource,0,3)=="!--"){ $this->type = XML_COMMENT;} else{ $this->type = XML_ERROR;} break; case '[': if(substr($tagsource,0,7)=="[CDATA["){ $this->type = XML_CDATA;} else{ $this->type = XML_ERROR;} break; case '/': $this->type = END_TAG; $this->tagname = substr($tagsource,1); // split off namespace part if it exists, added 28Jun05 NSFB if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; break; default: //it's a normal tag! if($tagsource[strlen($tagsource)-1]=='/'){ $this->type = CLOSED_TAG; $tagsource = substr($tagsource,0,strlen($tagsource)-1); } else{ $this->type = START_TAG;} // need to extract name and attributes here. if(strpos($tagsource," ")==false) { $nm=$tagsource; $attrs=""; } else list($nm,$attrs)=explode(" ",$tagsource,2); $attrs = preg_replace("/\s+/"," ",$attrs); $attrs = str_replace("= \"","=\"",$attrs); $attrs = str_replace(" =\"","=\"",$attrs); $attrs=trim($attrs); while(strlen($attrs)>2) { if((strpos($attrs," ")!==false)&&((strpos($attrs," ")<strpos($attrs,"=")))) //== would indicate end of attribs, no val { list($attrname,$attrs)=explode(" ",$attrs,2); $attrval=true; } else { list($attrname,$attrs)=explode("=",$attrs,2); $echar=$attrs[0]; $attrs=trim($attrs); if(($echar=="\"")||($echar=="'")) { $attrs = substr($attrs,1); list($attrval,$attrs)=explode($echar,$attrs,2); } else list($attrval,$attrs)=explode(" ",$attrs,2); if($attrval=="") $attrval=true; } $this->attribs[trim($attrname)]=$attrval; $attrs=trim($attrs); // do the namespace collecting stuff, added 28Jun05, NSFB if(strpos($attrname,":")!==false) list($attrname, $prefix) = explode(":",$attrname,2); else $prefix = ""; // so there's a key use this instead of ""; if($attrname=="xmlns") { $this->nsDetail[$prefix] = trim($attrval); } // end of namespace collecting stuff } $this->tagname = $nm; if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; // alocate namespace URI if possible , added 28Jun05, NSFB if(array_key_exists($this->nsPrefix,$this->nsDetail)) $this->nsURI = $this->nsDetail[$this->nsPrefix]; break; } } /*! Creates a tidy version of the tag for output. Start, end and closed tags are all correctly formated. Attributes will not nessesaraly be in the original order. \return A string containing the well formated tag. */ function dump() { switch($this->type) { case START_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } return $rstr.">"; break; case CLOSED_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } else { if(strlen($this->attribs)>0){$rstr .= " ".$this->attribs;} } return $rstr."/>"; break; case END_TAG: return "</".$this->tagname.">"; break; default: return "<".$this->cleansource.">"; break; } } }; /*! Class for content in the XML list - content is everything between tags, but does not include child tags, they become the next item in the list. */ class nb_xml_content extends nb_xml_part{ var $content; /*! constructor takes the content and sets the block type. \param $source is the content. */ function nb_xml_content($source) { $this->content = $source; $this->type = CONTENT; } //! returns the content. function dump() { return $this->content; } } /*! The main class of the XML library reads in XML and provides methods for manipulating it. The XML is held as a list of tags and content, each with a type and depth. */ class nb_easyxml { var $entities; var $source; // C++ private: equiv /*! Get a 'block' of xml from $this->source, either a tag or DATA/CDATA starting * from $point, update point to first char after the 'block' */ function getblock(&$point) { if($this->source[$point]=='<') { //print("<br>tag at $point<br>");//debug switch($this->source[$point+1]) { case '?': $estr = '?'.'>'; // split to be nice to PHP parser; break; case '!': if(substr($this->source,$point+1,3)=="!--"){ $estr = "-->";} elseif($this->source[$point+2]=="["){ $estr = "]]>";} else{ $estr = ">";} break; default: $estr = ">"; break; } $epoint = strpos($this->source,$estr,$point); if($epoint === false) { $point = strlen($this->source); return ""; } $epoint += strlen($estr); $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } else { $epoint = strpos($this->source,'<',$point); if($epoint === false) { $epoint = strlen($this->source); } $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } } // C++ protected: equiv /*! Parses XML into the list and does a limited amount of checking. Not really intended to be used from outside the library. \param $source is the xml to be parsed. */ function parsein($source) { $this->entities=""; // this clears out old data. $this->source = $source; $prspt=0; // counter for where in the xml the parser has got to (PaRSe PoinT). $level=0; // how far down the xml tree I am! $nsInfo = array(); // namespace allocation array while($prspt < strlen($this->source)) { $block = $this->getblock($prspt); $printblk = htmlentities($block); // echo "<p><b>".$prspt."</b> ".strlen($block)."<br>".$printblk."</p>";//debug if($block[0] == '<') { $tagcls = new nb_xml_tag($block); $tagcls->depth = $level; if($tagcls->type== START_TAG) { $tagatlev[$level]=$tagcls->tagname; //printf("At level $level got tag '$tagcls->tagname'<br>"); // debug // store namespace info $nsInfo[$level] = $tagcls->nsDetail; $level++; $testlev = $level - 1; // no need to test this level as tag parser does it. while(($tagcls->nsURI === false)&&($testlev >= 0)) { if(array_key_exists($tagcls->nsPrefix, $nsInfo[$testlev])) $tagcls->nsURI = $nsInfo[$testlev][$tagcls->nsPrefix]; $testlev--; } //printf("At level $level got tag '$tagcls->tagname' in namespace {$tagcls->nsURI}<br>"); // debug } $this->entities[] = $tagcls; //$sz = sizeof($this->entities); //debug //echo $this->entities[$sz-1]->depth.": tag - ".$tagcls->tagname."<br>"; // debug if($tagcls->type== END_TAG) { $level--; if($tagatlev[$level]!=$tagcls->tagname) { die("XML error - unmatching start and end tags (/".$tagatlev[$level]." expected, found /".$tagcls->tagname.")"); } } } else { $tblock = trim($block); if($tblock != "") // eliminate all whitespace blocks. { $contcls = new nb_xml_content($block); $contcls->depth = $level; $this->entities[] = $contcls; //echo $contcls->depth.": some content<br>"; // debug } } } } /*! Finds the root tag of the xml. \return the index of the root tag. */ function root() { $index=0; while(($index<=sizeof($this->entities))&&($this->entities[$index]->type!=START_TAG)) { $index++; } if($index<=sizeof($this->entities)){ return $index;} else{ return false;} } /*! Finds the index of the first occurence of a tag after an index point. \param $tagnm is the tag name to search for \param $startpt is the point to start the search from (defaults to 0) \return the index of the first occurence of the tag or false */ function findElement($tagnm, $startpt=0, $namespace = false) { $n = $startpt; $found = false; while(($n < sizeof($this->entities))&&($found===false)) { if(($this->entities[$n]->type==START_TAG)&&($this->entities[$n]->tagname==$tagnm)) { if(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) $found=true; } if($found==false) $n++; } if($found===true){ return $n; } else{ return false;} } function getContent($idx) { if($this->entities[$idx]->type==CLOSED_TAG) return ""; elseif($this->entities[$idx]->type==START_TAG) { $n = $idx+1; $rstr = ""; while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$idx]->depth)) { if($this->entities[$n]->type==CONTENT) //# need to deal with CDATA too { $rstr .= $this->entities[$n]->dump(); } $n++; } return $rstr; } else return false; } /*! Finds either an immediate child or a peer (same depth) tag. If $tagnm is "" (default) the first child or peer tag is returned, otherwise only one with a matching name. This is the basic function for FindChildTag, FindNextPeerTag etc. This should be considered private, nicer functions exist that call this. \return index of the found tag or false. */ function findclosetag($parent, $tagnm="", $child=false, $namespace=false) { if($parent===false) die("false passed as parent in findclosetag"); $n = $parent+1; $seekdepth=$this->entities[$parent]->depth; //echo "$n parent [$parent], depth $seekdepth;<br>"; if($child) $seekdepth++; $found = false; while(($n < sizeof($this->entities))&&($found===false)&&($this->entities[$n]->depth>=$seekdepth)) { if((($this->entities[$n]->type==START_TAG)|| ($this->entities[$n]->type==CLOSED_TAG)) &&($this->entities[$n]->depth==$seekdepth) &&(($tagnm=="")||($this->entities[$n]->tagname==$tagnm)) &&(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) ){ $found=true;} else{ $n++;} } if($found===true){ return $n; } else{ return false;} } /*! Finds imediate child tags of a particular tag (indicated by index). The tag index returned will either be the first child tag, or the first with a particular name. \param $parent is the index of the tag to find children of. \param $tagnm if provided is the tagname of child to search for. \return the index of the child tag or false */ function findChildElement($parent, $tagnm="", $namespace=false) { return $this->findclosetag($parent, $tagnm, true, $namespace); } /*! Finds the next peer tag of a particular tag (indicated by index) The tag index returned will either be the first peer tag, or the first with a particular name. \param $searchfrom is the index of the tag to search from. \param $tagnm is the tagname of peer to search for - if not given returns the first child index \return the index of the child tag or false */ function findNextPeer($searchfrom, $tagnm="", $namespace=false) { return $this->findclosetag($searchfrom, $tagnm, false, $namespace); } /*! Converts a block into a string of XML. The block goes from the start tag index provided to the matching end tag. \param $tagnum is the index of the start tag of the block to be dumped \return a string containing the block of XML */ function dumpblock($tagnum) { if($tagnum===false) return ""; $n = $tagnum+1; $rstr = $this->entities[$tagnum]->dump(); while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$tagnum]->depth)) { $rstr .= $this->entities[$n]->dump(); $n++; } return $rstr; } function getName($index) { return $this->entities[$index]->tagname; } function getNamespace($index) { return $this->entities[$index]->nsURI; } 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; } ?> |
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13239/scripts/rqp Modified Files: RQPv1p0Server.php Removed Files: index.php nb_easyxml_lite.php nusoap.php rqp.wsdl rqp_calls.php rqp_util.php uni_soap.php uni_soap.php5 Log Message: Modifications to RQP directory structure --- uni_soap.php5 DELETED --- --- index.php DELETED --- --- rqp_util.php DELETED --- --- uni_soap.php DELETED --- --- nusoap.php DELETED --- Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RQPv1p0Server.php 8 Sep 2005 22:07:25 -0000 1.8 --- RQPv1p0Server.php 9 Sep 2005 10:59:21 -0000 1.9 *************** *** 2,6 **** include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); - //include("rqp_util.php"); //Stack/RQP utility function. include("../../stackConfig.php"); include("../../stackLib.php"); --- 2,5 ---- *************** *** 51,191 **** */ - // "Insert *s where needed"; - $stackOptions['InsertStars']['type'] = 'list'; - $stackOptions['InsertStars']['values'] = array('TRUE','FALSE'); - $stackOptions['InsertStars']['default'] = 'FALSE'; - - // 'Allow informal syntax'; - $stackOptions['InformalSyntax']['type'] = 'list'; - $stackOptions['InformalSyntax']['values'] = array('TRUE','FALSE'); - $stackOptions['InformalSyntax']['default'] = 'TRUE'; - - // 'Input tools'; - $stackOptions['AllowInputTool']['type'] = 'list'; - $stackOptions['AllowInputTool']['values'] = array('Form box','Form box + JOME'); - $stackOptions['AllowInputTool']['default'] = 'Form box + JOME'; - - // 'Syntax Hint'; - $stackOptions['SyntaxHint']['type'] = 'string'; - $stackOptions['SyntaxHint']['values'] = ''; - $stackOptions['SyntaxHint']['default'] = ''; - - // 'Display'; - $stackOptions['Display']['type'] = 'list'; - $stackOptions['Display']['values'] = array('String','LaTeX','MathML','LaTeX Source'); - $stackOptions['Display']['default'] = 'LaTeX'; - - // 'Language'; - $stackOptions['Language']['type'] = 'list'; - $stackOptions['Language']['values'] = array('en','es','nl'); - $stackOptions['Language']['default'] = 'en'; - - // 'Question value'; - $stackOptions['QuVal']['type'] = 'number'; - $stackOptions['QuVal']['values'] = ''; - $stackOptions['QuVal']['default'] = '1'; - - // 'Mark modification method'; - $stackOptions['MarkModMethod']['type'] = 'list'; - $stackOptions['MarkModMethod']['values'] = array('Penalty','Last Answer'); - $stackOptions['MarkModMethod']['default'] = 'Penalty'; - - // 'Question penalty'; - $stackOptions['Penalty']['type'] = 'number'; - $stackOptions['Penalty']['values'] = ''; - $stackOptions['Penalty']['default'] = '0.1'; - - // 'Forbidden words'; - $stackOptions['Forbid']['type'] = 'string'; - $stackOptions['Forbid']['values'] = ''; - $stackOptions['Forbid']['default'] = ''; - - // 'Allowed words'; - $stackOptions['Allow']['type'] = 'string'; - $stackOptions['Allow']['values'] = ''; - $stackOptions['Allow']['default'] = ''; - - // 'Answer test'; - $stackOptions['AnsTest']['type'] = 'list'; - $stackOptions['AnsTest']['values'] = ''; // This is automatically defined below, after the answer tests. - $stackOptions['AnsTest']['default'] = 'AlgEquiv'; - - // 'Answer test options'; - $stackOptions['AnsTestOpt']['type'] = 'string'; - $stackOptions['AnsTestOpt']['values'] = ''; - $stackOptions['AnsTestOpt']['default'] = ''; - - // "Teacher's email"; - $stackOptions['TeacherEmail']['type'] = 'string'; - $stackOptions['TeacherEmail']['values'] = ''; - $stackOptions['TeacherEmail']['default'] = ''; - - // 'Feedback: correct'; - $stackOptions['FeedBackGenericCorrect']['type'] = 'html'; - $stackOptions['FeedBackGenericCorrect']['values'] = ''; - $stackOptions['FeedBackGenericCorrect']['default'] = get_string('stackOptions_FeedBackGenericCorrect_def','stack',''); - - // 'Feedback: incorrect'; - $stackOptions['FeedBackGenericIncorrect']['type'] = 'html'; - $stackOptions['FeedBackGenericIncorrect']['values'] = ''; - $stackOptions['FeedBackGenericIncorrect']['default'] = get_string('stackOptions_FeedBackGenericIncorrect_def','stack',''); - - // 'Feedback: partially correct'; - $stackOptions['FeedBackGenericPCorrect']['type'] = 'html'; - $stackOptions['FeedBackGenericPCorrect']['values'] = ''; - $stackOptions['FeedBackGenericPCorrect']['default'] = get_string('stackOptions_FeedBackGenericPCorrect_def','stack',''); - - - // 'Show solution'; - $stackOptions['QuizMode']['type'] = 'list'; - $stackOptions['QuizMode']['values'] = array('Practice','Assessment','Strict'); - $stackOptions['QuizMode']['default'] = 'Practice'; - - $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. - // and add these to the options. - $ats = ''; - foreach( $stackAnswerTest as $field => $q_field) - { $ats[] = $field; } - - $stackOptions['AnsTest']['values'] = $ats; - class RQPv1p0 extends RQPv1p0_nbSOAP { --- 50,53 ---- --- nb_easyxml_lite.php DELETED --- --- rqp_calls.php DELETED --- --- rqp.wsdl DELETED --- |
From: pkiddie <pk...@us...> - 2005-09-09 10:59:29
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/old In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13239/scripts/rqp/old Added Files: nb_easyxml_lite.php nusoap.php rqp.wsdl rqp_calls.php rqp_util.php uni_soap.php uni_soap.php5 Log Message: Modifications to RQP directory structure --- NEW FILE: uni_soap.php5 --- <?php /* $trace indicates if the soap messages should be saved (i.e. if get_soap_messages is used) and should be used only for debugging */ function soap_connect($wsdl, $trace=false) { try { $connection = new SoapClient($wsdl, array('soap_version'=>SOAP_1_1, 'exceptions'=>true, 'trace'=>$trace)); } catch (SoapFault $f) { $connection = $f; } catch (Exception $e) { $connection = new SoapFault('client', 'Could not connect to the service'); } return $connection; } function soap_call($connection, $call, $params) { try { $return = $connection->__call($call, $params); } catch (SoapFault $f) { $return = $f; } catch (Exception $e) { $return = new SoapFault('client', 'Could call the method'); } // return multiple parameters using an object rather than an array if (is_array($return)) { $keys = array_keys($return); $assoc = true; foreach ($keys as $key) { if (!is_string($key)) { $assoc = false; break; } } if ($assoc) $return = (object) $return; } return $return; } function soap_serve($wsdl, $functions) { // create server object $s = new SoapServer($wsdl); // export functions foreach ($functions as $func) $s->addFunction($func); // handle the request $s->handle(); } function make_soap_fault($faultcode, $faultstring, $faultactor='', $detail='', $faultname='', $headerfault='') { return new SoapFault($faultcode, $faultstring, $faultactor, $detail, $faultname, $headerfault); } function get_last_soap_messages($connection) { return array('request'=>$connection->__getLastRequest(), 'response'=>$connection->__getLastResponse()); } // Fix simple type encoding - work around a bug in PHP function soap_encode($value, $name, $type, $namespace, $encode=XSD_STRING) { $value = new SoapVar($value, $encode, $type, $namespace); if ('' === $name) return $value; return new SoapParam($value, $name); } // Fix complex type encoding - work around a bug in PHP function soap_encode_object($value, $name, $type, $namespace) { if (!is_object($value)) return $value; $value = new SoapVar($value, SOAP_ENC_OBJECT, $type, $namespace); if ('' === $name) return $value; return new SoapParam($value, $name); } // Fix array encoding - work around a bug in PHP function soap_encode_array($value, $name, $type, $namespace) { if (!is_array($value)) return $value; $value = new SoapVar($value, SOAP_ENC_ARRAY, 'ArrayOf' . $type, $namespace); if ('' === $name) return $value; return new SoapParam($value, $name); } ?> --- NEW FILE: rqp_util.php --- <?php /** * Stack RQP utility functions * Not part of the RQP Server/Client combo but necessary to interact with RQP * * @package stackRQP * @subpackage Stack */ // Utility functions // /** * Converts an associative array of variables into an array of key-value * objects suitable for RQP * * Creates an array of {@link RQPVar} objects from an associative array * of variables. * @param array $vars Associative array of variables. * @return array Returns an array of objects with the key property set to * the key of the corresponding entry in the vars parameter and the values * property set to the corresponding value. */ function MakeRQPVars($vars) { if (!count($vars)) return array(); array_walk($vars, create_function('&$val, $key', '$obj->identifier = $key; $obj->values = (is_array($val) ? array_values($val) : array($val)); $val = $obj;')); return array_values($vars); } /** * Converts an array of name-value objects as used by RQP into an * associative array of variables. * * Creates an associative array of responses from an array of * {@link RQPInput} objects. * @param array $vars Array of {@link RQPInput} objects. * @return array Returns an associative array with the key of each element * set to the name property of the corresponding object and the value set to * the value property of the corresponding object. */ function FlattenRQPInputs($vars) { if (!is_array($vars)) return array(); $return = array(); foreach ($vars as $var) { $var = (object) $var; // sort out nuSOAP encoding weirdness if (!empty($var->name)) { $return[$var->name] = $var->value; } } return $return; } /** * Converts an array of key-value objects as used by RQP into an * associative array of variables. * * Creates an associative array of variables from an array of {@link RQPVar} * objects. * @param array $vars Array of {@link RQPVar} objects. * @return array Returns an associative array with the key of each element * set to the key property of the corresponding object and the value set to * the values property of the corresponding object. */ function FlattenRQPVars($vars) { if (!is_array($vars)) return array(); $return = array(); foreach ($vars as $var) { $var = (object) $var; // sort out nuSOAP encoding weirdness if (!empty($var->identifier)) { if (1 === count($var->values)) $return[$var->identifier] = $var->values[0]; else $return[$var->identifier] = array_values($var->values); } } return $return; } /** * Interprets source for the all operations which need it. * * @param string $source The item source. * @return array $item The item is returned. */ function source_handler($source, &$format, &$errors, $item_information=FALSE) { global $stack_web_url; $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' } // We need to use the source supplied, and had beter interpret the format. if ('' === $format) { // format not specified; we are asked to make our best guess if (stristr($source,'<assessmentItem>')) { $format = STACK_URI_FORMAT_XML; } else { $format = STACK_URI_FORMAT_FLAT; } } switch ($format) { case STACK_URI_FORMAT_XML: $itemTemp = stack_xml_parse_question_string($source); $item = $itemTemp['assessmentItem']; $questionBody = addslashes(base64_serialize($itemTemp)); break; case STACK_URI_FORMAT_FLAT: $questionBody = $source; $item = stack_db_decodebody($questionBody); break; default: // Invalid format return MakeRQPFault(MakeRQPError('unknownFormat', '`' . $format . '\' is not a format which STACK can use.'), 'Unknown source format.'); } // By this stage we should have an $item. // Validate item $errors = array(); stack_question_validate($item,$errors); // HACK: throwing a SOAP error here will break the itemInformation operation..... if (count($errors) > 0) { // $errstr should be generated on the client side // $errstr = stack_question_errstr($errors); if (!$item_information) return MakeRQPFault(MakeRQPError('invalidSource', 'The item is invalid.', $errors)); } // HACK: Items no longer need GUIDS so just generate one if it is not set if (empty($item['questionGUID'])) { $item['questionGUID'] = stack_generate_guid($stack_web_url); } $item['questionID'] = 0; // For test and RQP questions only return $item; } /** * Creates an RQP error object. * * An {@link RQPError} object is created to represent the error condition. * @param string $id The identifier for the error (this will be prefixed * with the error URI). * @param string $description Human readable description of the error * reprensented by the id. * @param mixed $detail Machine readable information about the error. * @return RQPError The error object created. */ function MakeRQPError($id, $description='', $detail='') { $error = new RQPError; $error->identifier = RQP_URI_ERROR . $id; $error->message = $description; $error->detail = $detail; return $error; } /** * Checks if a value is an RQP error object. * * The value is tested for being an object and if it is an object for being * of class {@link RQPError}. * @param mixed $value The value to be tested. * @return boolean Returns true if the value is an object of class * {@link RQPError}, false otherwise. */ if (floor(phpversion()) > 4) { function IsRQPError($value) { if (is_object($value)) { if ('RQPError' === get_class($value)) { return true; } } return false; } } else { // get_class returns the class name in lowercase under PHP 4 function IsRQPError($value) { if (is_object($value)) { if ('rqperror' === get_class($value)) { return true; } } return false; } } class /** * Creates an RQP style SOAP fault object. * * Creates a SOAP fault object with an RQP error object describing the * error using the SOAP detail field. * @param object $error The {@link RQPError} object describing the error. * @param string $description Human readable description of the error * reprensented by the id field of the error object. * @return SoapFault The SOAP fault object. */ function MakeRQPFault($error, $description='') { $errorID = substr($error->id, strlen(RQP_URI_ERROR)); switch ($errorID) { case 'emptySource': case 'unknownFormat': case 'invalidSource': case 'invalidTemplateVariables': $who = 'Client'; break; default: $who = 'Server'; break; } if (empty($description)) $description = $errorID; return make_soap_fault($who, 'RQP error: '.$description, '', $error); } ?> --- NEW FILE: uni_soap.php --- <?php /** * Web Services Toolkit for PHP * * This script sorts out whether or not to use the native PHP support for * SOAP. * * @package stackRQP * @subpackage Stack */ // Web services wrapper library script if (class_exists('SoapClient')) { // Use the native PHP5 support require_once('uni_soap.php5'); } else{ // Use nuSOAP instead require_once('nusoap.php'); function make_soap_fault($faultcode, $faultstring, $faultactor='', $detail='', $faultname='', $headerfault='') { return new soap_fault($faultcode, $faultactor, $faultstring, $detail); } function is_soap_fault($obj) { if (!is_object($obj)) return false; return (strcasecmp(get_class($obj), 'soap_fault') === 0); } if (class_exists('soap_client')) { function soap_connect($wsdl, $trace=false) { return new soap_client($wsdl, 'wsdl'); } } else { function soap_connect($wsdl, $trace=false) { return new soapclient($wsdl, 'wsdl'); } } function soap_call($connection, $call, $params) { $result = $connection->call($call, $params); if ($connection->fault) { return @make_soap_fault($result['faultcode'], $result['faultstring'], '', $result['detail']); } if ($connection->error_str) { return @make_soap_fault('server', $connection->error_str, '', $connection->response); } /* Fix objects being returned as associative arrays (to fit with PHP5 SOAP support */ return fix_object($result); } function soap_serve($wsdl, $functions) { global $HTTP_RAW_POST_DATA; $s = new soap_server($wsdl); $s->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''); } function get_last_soap_messages($connection) { return array('request'=>$connection->request, 'response'=>$connection->response); } /* Fix objects being returned as associative arrays (to fit with PHP5 SOAP support */ function fix_object($value) { if (is_array($value)) { $value = array_map('fix_object', $value); $keys = array_keys($value); /* check for arrays of length 1 (they get given the key "item" rather than 0 by nusoap) */ if (1 === count($value) && 'item' === $keys[0]) { $value = array_values($value); } else { /* cast to object if it is an associative array with at least one string key */ foreach ($keys as $key) { if (is_string($key)) { $value = (object) $value; break; } } } } return $value; } // Fix simple type encoding - not needed for nuSOAP function soap_encode($value, $name, $type, $namespace, $encode=0) { return $value; } // Fix complex type encoding - not needed for nuSOAP function soap_encode_object($value, $name, $type, $namespace) { return $value; } // Fix array encoding - not needed for nuSOAP function soap_encode_array($value, $name, $type, $namespace) { return $value; } } // In both cases... function handle_soap_wsdl_request($wsdlfile, $address=false) { header('Content-type: application/wsdl+xml'); $wsdl = file_get_contents($wsdlfile); if (false !== $address) { if (true === $address) { $address = (($_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; } $wsdl = str_replace('###SERVER_ADDRESS###', $address, $wsdl); } echo $wsdl; exit; } ?> --- NEW FILE: nusoap.php --- <?php /** * NuSOAP - Web Services Toolkit for PHP * <br> * Copyright (c) 2002 NuSphere Corporation * Stack RQP item engine implementation * * @package stackRQP * @subpackage Stack */ /* $Id: nusoap.php,v 1.1 2005/09/09 10:59:22 pkiddie Exp $ NuSOAP - Web Services Toolkit for PHP Copyright (c) 2002 NuSphere Corporation This library is free software; you can redistribute it and/or [...6479 lines suppressed...] $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); break; } if (! $found) { $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); $this->cookies[] = $newCookie; } } return true; } } // Backwards compatibility definition // This won't work where native PHP SOAP support is present // so the new name should be used whenever possible if (!class_exists('SoapClient')) { class soapclient extends soap_client { } } ?> --- NEW FILE: nb_easyxml_lite.php --- <?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); define("XML_ERROR",0); define("XML_DECLARATION",5); // <?xml define("XML_DOCTYPE",6); // <!DOCTYPE ... > define("XML_INSTRUCTION",7); // <? define("XML_CDATA",8); // <[CDATA[ ... ]]> define("XML_COMMENT",9); // <!-- ... --> /*! Base class from which tag and content classes are derived. Never used directly. */ class nb_xml_part{ var $type; //!< Indicates the type of entity - tag, content etc. var $depth; //!< Indicates how deep in the xml tree this entity is. //! A 'pure virtual' function. Derived classes impliment their own version. function dump() { return "<font color='red'>This should never be called!</font><br>"; } }; //! Class for tags in the list of the XML. class nb_xml_tag extends nb_xml_part{ var $tagname; //!< The name of the tag, no namespace prefix var $attribs; //!< An associative array containing attributes keyed by name var $cleansource; //!< the tidy source for the tag. // Next four lines added 28Jun05 NSFB var $nsURI; //!< The namespace URI of the tag if it exists var $nsPrefix; //!< The namespace prefix of the tag if it was used // this is only really meaningful in start elements, potentially used in closed though var $nsDetail; //!< an array of namespaces declared here ['!'] used as prefix for default; /*! Constructor takes a XML tag (without < >) sets $tagname, * $type (START_TAG|END_TAG|CLOSED_TAG), and $attribs, * an associative array of attributes. */ function nb_xml_tag($tagsource) { // initialise to default values $this->nsDetail = array(); $this->nsPrefix = ""; $this->nsURI = false; // "" would be empty, false is undefined // tidy up the ends and make sure the < and > are gone. $tagsource=trim($tagsource); if($tagsource[0]=="<") { $tagsource = substr($tagsource,1); } if($tagsource[strlen($tagsource)-1]==">") { $tagsource = substr($tagsource,0,strlen($tagsource)-1); } $tagsource=trim($tagsource); $this->cleansource=$tagsource; // now check what sort of tag it is... // echo $tagsource[0]; // debug switch($tagsource[0]) { case '?': if(substr($tagsource,0,4)=="?xml"){ $this->type = XML_DECLARATION;} else{ $this->type = XML_INSTRUCTION;} break; case '!': if(substr($tagsource,0,8)=="!DOCTYPE"){ $this->type = XML_DOCTYPE;} elseif(substr($tagsource,0,3)=="!--"){ $this->type = XML_COMMENT;} else{ $this->type = XML_ERROR;} break; case '[': if(substr($tagsource,0,7)=="[CDATA["){ $this->type = XML_CDATA;} else{ $this->type = XML_ERROR;} break; case '/': $this->type = END_TAG; $this->tagname = substr($tagsource,1); // split off namespace part if it exists, added 28Jun05 NSFB if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; break; default: //it's a normal tag! if($tagsource[strlen($tagsource)-1]=='/'){ $this->type = CLOSED_TAG; $tagsource = substr($tagsource,0,strlen($tagsource)-1); } else{ $this->type = START_TAG;} // need to extract name and attributes here. if(strpos($tagsource," ")==false) { $nm=$tagsource; $attrs=""; } else list($nm,$attrs)=explode(" ",$tagsource,2); $attrs = preg_replace("/\s+/"," ",$attrs); $attrs = str_replace("= \"","=\"",$attrs); $attrs = str_replace(" =\"","=\"",$attrs); $attrs=trim($attrs); while(strlen($attrs)>2) { if((strpos($attrs," ")!==false)&&((strpos($attrs," ")<strpos($attrs,"=")))) //== would indicate end of attribs, no val { list($attrname,$attrs)=explode(" ",$attrs,2); $attrval=true; } else { list($attrname,$attrs)=explode("=",$attrs,2); $echar=$attrs[0]; $attrs=trim($attrs); if(($echar=="\"")||($echar=="'")) { $attrs = substr($attrs,1); list($attrval,$attrs)=explode($echar,$attrs,2); } else list($attrval,$attrs)=explode(" ",$attrs,2); if($attrval=="") $attrval=true; } $this->attribs[trim($attrname)]=$attrval; $attrs=trim($attrs); // do the namespace collecting stuff, added 28Jun05, NSFB if(strpos($attrname,":")!==false) list($attrname, $prefix) = explode(":",$attrname,2); else $prefix = ""; // so there's a key use this instead of ""; if($attrname=="xmlns") { $this->nsDetail[$prefix] = trim($attrval); } // end of namespace collecting stuff } $this->tagname = $nm; if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; // alocate namespace URI if possible , added 28Jun05, NSFB if(array_key_exists($this->nsPrefix,$this->nsDetail)) $this->nsURI = $this->nsDetail[$this->nsPrefix]; break; } } /*! Creates a tidy version of the tag for output. Start, end and closed tags are all correctly formated. Attributes will not nessesaraly be in the original order. \return A string containing the well formated tag. */ function dump() { switch($this->type) { case START_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } return $rstr.">"; break; case CLOSED_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } else { if(strlen($this->attribs)>0){$rstr .= " ".$this->attribs;} } return $rstr."/>"; break; case END_TAG: return "</".$this->tagname.">"; break; default: return "<".$this->cleansource.">"; break; } } }; /*! Class for content in the XML list - content is everything between tags, but does not include child tags, they become the next item in the list. */ class nb_xml_content extends nb_xml_part{ var $content; /*! constructor takes the content and sets the block type. \param $source is the content. */ function nb_xml_content($source) { $this->content = $source; $this->type = CONTENT; } //! returns the content. function dump() { return $this->content; } } /*! The main class of the XML library reads in XML and provides methods for manipulating it. The XML is held as a list of tags and content, each with a type and depth. */ class nb_easyxml { var $entities; var $source; // C++ private: equiv /*! Get a 'block' of xml from $this->source, either a tag or DATA/CDATA starting * from $point, update point to first char after the 'block' */ function getblock(&$point) { if($this->source[$point]=='<') { //print("<br>tag at $point<br>");//debug switch($this->source[$point+1]) { case '?': $estr = '?'.'>'; // split to be nice to PHP parser; break; case '!': if(substr($this->source,$point+1,3)=="!--"){ $estr = "-->";} elseif($this->source[$point+2]=="["){ $estr = "]]>";} else{ $estr = ">";} break; default: $estr = ">"; break; } $epoint = strpos($this->source,$estr,$point); if($epoint === false) { $point = strlen($this->source); return ""; } $epoint += strlen($estr); $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } else { $epoint = strpos($this->source,'<',$point); if($epoint === false) { $epoint = strlen($this->source); } $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } } // C++ protected: equiv /*! Parses XML into the list and does a limited amount of checking. Not really intended to be used from outside the library. \param $source is the xml to be parsed. */ function parsein($source) { $this->entities=""; // this clears out old data. $this->source = $source; $prspt=0; // counter for where in the xml the parser has got to (PaRSe PoinT). $level=0; // how far down the xml tree I am! $nsInfo = array(); // namespace allocation array while($prspt < strlen($this->source)) { $block = $this->getblock($prspt); $printblk = htmlentities($block); // echo "<p><b>".$prspt."</b> ".strlen($block)."<br>".$printblk."</p>";//debug if($block[0] == '<') { $tagcls = new nb_xml_tag($block); $tagcls->depth = $level; if($tagcls->type== START_TAG) { $tagatlev[$level]=$tagcls->tagname; //printf("At level $level got tag '$tagcls->tagname'<br>"); // debug // store namespace info $nsInfo[$level] = $tagcls->nsDetail; $level++; $testlev = $level - 1; // no need to test this level as tag parser does it. while(($tagcls->nsURI === false)&&($testlev >= 0)) { if(array_key_exists($tagcls->nsPrefix, $nsInfo[$testlev])) $tagcls->nsURI = $nsInfo[$testlev][$tagcls->nsPrefix]; $testlev--; } //printf("At level $level got tag '$tagcls->tagname' in namespace {$tagcls->nsURI}<br>"); // debug } $this->entities[] = $tagcls; //$sz = sizeof($this->entities); //debug //echo $this->entities[$sz-1]->depth.": tag - ".$tagcls->tagname."<br>"; // debug if($tagcls->type== END_TAG) { $level--; if($tagatlev[$level]!=$tagcls->tagname) { die("XML error - unmatching start and end tags (/".$tagatlev[$level]." expected, found /".$tagcls->tagname.")"); } } } else { $tblock = trim($block); if($tblock != "") // eliminate all whitespace blocks. { $contcls = new nb_xml_content($block); $contcls->depth = $level; $this->entities[] = $contcls; //echo $contcls->depth.": some content<br>"; // debug } } } } /*! Finds the root tag of the xml. \return the index of the root tag. */ function root() { $index=0; while(($index<=sizeof($this->entities))&&($this->entities[$index]->type!=START_TAG)) { $index++; } if($index<=sizeof($this->entities)){ return $index;} else{ return false;} } /*! Finds the index of the first occurence of a tag after an index point. \param $tagnm is the tag name to search for \param $startpt is the point to start the search from (defaults to 0) \return the index of the first occurence of the tag or false */ function findElement($tagnm, $startpt=0, $namespace = false) { $n = $startpt; $found = false; while(($n < sizeof($this->entities))&&($found===false)) { if(($this->entities[$n]->type==START_TAG)&&($this->entities[$n]->tagname==$tagnm)) { if(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) $found=true; } if($found==false) $n++; } if($found===true){ return $n; } else{ return false;} } function getContent($idx) { if($this->entities[$idx]->type==CLOSED_TAG) return ""; elseif($this->entities[$idx]->type==START_TAG) { $n = $idx+1; $rstr = ""; while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$idx]->depth)) { if($this->entities[$n]->type==CONTENT) //# need to deal with CDATA too { $rstr .= $this->entities[$n]->dump(); } $n++; } return $rstr; } else return false; } /*! Finds either an immediate child or a peer (same depth) tag. If $tagnm is "" (default) the first child or peer tag is returned, otherwise only one with a matching name. This is the basic function for FindChildTag, FindNextPeerTag etc. This should be considered private, nicer functions exist that call this. \return index of the found tag or false. */ function findclosetag($parent, $tagnm="", $child=false, $namespace=false) { if($parent===false) die("false passed as parent in findclosetag"); $n = $parent+1; $seekdepth=$this->entities[$parent]->depth; //echo "$n parent [$parent], depth $seekdepth;<br>"; if($child) $seekdepth++; $found = false; while(($n < sizeof($this->entities))&&($found===false)&&($this->entities[$n]->depth>=$seekdepth)) { if((($this->entities[$n]->type==START_TAG)|| ($this->entities[$n]->type==CLOSED_TAG)) &&($this->entities[$n]->depth==$seekdepth) &&(($tagnm=="")||($this->entities[$n]->tagname==$tagnm)) &&(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) ){ $found=true;} else{ $n++;} } if($found===true){ return $n; } else{ return false;} } /*! Finds imediate child tags of a particular tag (indicated by index). The tag index returned will either be the first child tag, or the first with a particular name. \param $parent is the index of the tag to find children of. \param $tagnm if provided is the tagname of child to search for. \return the index of the child tag or false */ function findChildElement($parent, $tagnm="", $namespace=false) { return $this->findclosetag($parent, $tagnm, true, $namespace); } /*! Finds the next peer tag of a particular tag (indicated by index) The tag index returned will either be the first peer tag, or the first with a particular name. \param $searchfrom is the index of the tag to search from. \param $tagnm is the tagname of peer to search for - if not given returns the first child index \return the index of the child tag or false */ function findNextPeer($searchfrom, $tagnm="", $namespace=false) { return $this->findclosetag($searchfrom, $tagnm, false, $namespace); } /*! Converts a block into a string of XML. The block goes from the start tag index provided to the matching end tag. \param $tagnum is the index of the start tag of the block to be dumped \return a string containing the block of XML */ function dumpblock($tagnum) { if($tagnum===false) return ""; $n = $tagnum+1; $rstr = $this->entities[$tagnum]->dump(); while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$tagnum]->depth)) { $rstr .= $this->entities[$n]->dump(); $n++; } return $rstr; } function getName($index) { return $this->entities[$index]->tagname; } function getNamespace($index) { return $this->entities[$index]->nsURI; } 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; } ?> --- NEW FILE: rqp_calls.php --- <?php /** * Stack RQP item engine core functions. These act as * the implementation of the RQP. * * @package stackRQP * @subpackage Stack */ /** * RQP Error object * * An object containing the error code (a 16 bit unsigned integer), * a human readable string message and additional details. */ class RQPError { public $identifier; public $message; public $detail; } /** * RQP Variable object * * An object containing a key (name for the variable) and an array of * strings giving the encoded value(s). */ class RQPVar { public $identifier; public $values; } /** * RQP Input object * * An object containing a name-value pair, holding a response to an * interaction */ class RQPInput { public $name; public $value; } /** * RQP Output object * * An object containing a fragment of code in the given format (identified * by MIME type) to be inserted in the document the client is building * representing a particular component of the item (identified by URI). */ class RQPOutput { public $identifier; public $encoding; public $output; } /** * RQP namespace URI * * This constant defines the namespace URI used by RQP */ define('RQP_URI_NAMESPACE', 'http://schemas.rqp.org/rqp'); /** * Base RQP URI for RQP-defined identifiers * * RQP defines standard URIs for common values of the parameters. Currently * there is no RQP domain so we define a base URI here so that it can be * changed later. */ define('RQP_URI_BASE', 'http://rqp.org/'); /** * RQP parameter URIs * * RQP defines standard URIs for common values of the parameters. These are * defined in several categories under different directories under the base * URI. */ define('RQP_URI_ERROR', RQP_URI_BASE . 'errors/'); define('RQP_URI_FORMAT', RQP_URI_BASE . 'formats/'); define('RQP_URI_OUTCOME', RQP_URI_BASE . 'outcomes/'); define('RQP_URI_COMPONENT', RQP_URI_BASE . 'components/'); /** * Stack version (date: YYYYMMDDHH) */ define('STACK_VERSION_DATE', '2005033117'); /** * Stack item parameter URIs * * The Stack item type defines a number of custom values for various * RQP parameters. */ define('STACK_URI_BASE', 'http://eee595.bham.ac.uk/~stack/rqp/'); define('STACK_URI_FORMAT_XML', STACK_URI_BASE . 'formats/xml'); define('STACK_URI_FORMAT_FLAT', STACK_URI_BASE . 'formats/flat'); /** * Returns an array of information about the server * * Interface independent information about the server is returned. This * includes the input formats accepted, output formats available and * output format templates supported. * @return array Returns an associative array with the following fields: * - identifier A URI identifying the server system and version. * - name A short name for the server system. * - description A string containing a description of the server * which may include software version numbers and * other information. * - cloning A boolean flag indicating if the server supports * cloning (the RQP_ProcessTemplate and RQP_Clone * operations). * - implicitCloning A boolean flag indicating if the server supports * the use of item templates together with instance * data (template variables or a seed) in the * rendering calls as if they were regular items. * - rendering A boolean flag indicating if the server supports * rendering (all operations other than * RQP_ServerInformation, RQP_ItemInformation and the * cloning operations. * - itemFormat A comma separated list of input formats supported. * - renderFormats An array of URIs giving the supported render formats. * The first entry is the default. */ function stack_rqp_ServerInformationCall() { $itemFormats = array(STACK_URI_FORMAT_XML, STACK_URI_FORMAT_FLAT); $renderFormats = array(RQP_URI_FORMAT . 'xhtml-1.0-web', RQP_URI_FORMAT . 'xhtml-1.0-print', RQP_URI_FORMAT . 'latex-2e', RQP_URI_FORMAT . 'plain'); // Fix return types where required // (works around a bug in early versions of PHP 5) $itemFormats = soap_encode_array($itemFormats, 'itemFormats', 'anyURI', RQP_URI_NAMESPACE); $renderFormats = soap_encode_array($renderFormats, 'renderFormats', 'anyURI', RQP_URI_NAMESPACE); return array('identifier' => STACK_URI_BASE . 'stack.html#' . STACK_VERSION_DATE, 'name' => 'STACK', 'description' => 'STACK server. See http://sourceforge.net/projects/stack', 'cloning' => FALSE, 'implicitCloning' => TRUE, 'rendering' => TRUE, 'itemFormats' => $itemFormats, 'renderFormats' => $renderFormats); } /** * Returns information about the given item source * * This function examines the item source passed to it and returns * information about it. This information includes the type of item * passed, any syntax or similar errors in the source and attributes * such as if the source describes a template, if the item is adaptive, etc. * @param string $itemSource The source for the item or just the RQP tag * with a period in place of the last space character indicating that the * item source should be loaded from the cache. * @return array Returns an associative array with the following fields: * - format A string giving the type of item source passed. * - sourceErrors A string with a human readable description of any * syntax (or similar) errors. * - template A boolean flag indicating if the source is for an * item template. * - adaptive A boolean flag indicating if the item is adaptive. * - timeDependent A boolean flag indicating if the item is time * dependent. * - canComputerScore A boolean flag indicating if the item can be computer * scored. * - solutionAvailable A boolean flag indicating if worked solutions are * available for the item. * - hintAvailable A boolean flag indicating if hints are available for * the item. * - validationPossible A boolean flag indicating if validation makes sense for * the item. * - maxScore An integer giving the maximum obtainable score for the * item. * - length An integer giving the number of items in the package, one * for regular items. */ function stack_rqp_ItemInformationCall($item,$format,$errors) { $options = stack_options_set($item,$errors); // Ensure $errors is an array if (empty($errors)) { $errors = array(); } // Fix return types where required // (works around a bug in early versions of PHP 5) $sourceErrors = soap_encode_array($errors, 'sourceErrors', 'error', RQP_URI_NAMESPACE); return array('format' => $format, 'sourceErrors' => $sourceErrors, 'template' => ( array_key_exists('questionVars', $item ) ? TRUE : FALSE), 'adaptive' => TRUE, 'timeDependent' => FALSE, 'canComputerScore' => TRUE, 'solutionAvailable' => ( array_key_exists('questionSol', $item ) ? TRUE : FALSE), 'hintAvailable' => FALSE, 'validationPossible' => TRUE, 'maxScore' => $options['QuVal'], 'length' => 1); } /** * Performs template processing to instantiate the template variables for * the item * * The supplied item source is parsed. The randomizer is then seeded using * a server generated seed if none is given. The * template variables are then instantiated by performing template * processing. * @param string $item * @return array Returns an associative array with the following fields: * - seed The integer seed used to seed the randomizer. This * will be equal to the seed parameter unless that * parameter was zero. * - templateVars An array of {@link RQPVar} objects containing the * template variables instantiated during template * processing. */ function stack_rqp_ProcessTemplateCall($item) { } // Clone call function stack_rqp_CloneCall($item, $templateVars) { } // SessionInformation call function stack_rqp_SessionInformationCall($item, $templateVars, $persistence) { // (1) $questionGUID = $item['questionGUID']; $persistence = base64_unserialize($persistentData); $templateVars = FlattenRQPVars($templateVars); $options = stack_options_set($item,$errors); // (2) Generate a $seed $useClonedItem = TRUE; list($usec, $sec) = explode(' ', microtime()); $seed = (integer) ((float) $sec + ((float) $usec * 100000)); $useClonedItem = FALSE; // (3) Decide if we should use a cached $itemClone, or generate our own. if ($useClonedItem and stack_db_rqpcache_itemInst_exists($questionGUID,$seed)) { // (3.1) Get it from the database. $itemClone = stack_db_rqpcache_itemInst_get($questionGUID,$seed); } else { // (4) Generate an $itemClone // (4.1) Should we use the questionVars in the item, or the templateVars? if (array_key_exists('questionVars',$item)) { if (is_array($templateVars) and count($templateVars)) { // We have (i) questionVars, and (ii) templateVars // HACK: should only happen if all questionVars are in templateVars! //Substitute the questionVars with templateVars unset($item['questionVars']); foreach ($templateVars as $key => $value) { $item['questionVars'][] = array('key' => $key, 'value' => $value); } } } // (4.2) Make sure we have a cloned item to work with. $itemClone = NULL; $itemClone = stack_question_inst($item,$seed,$options,$errors); // (4.3) if the cloning generated errors, we should stop here. // HACK, Not done. // (4.4) Cache this if required. stack_db_rqpcache_itemInst_add($questionGUID,$seed,$itemClone); } // END of (3) & (4) // (5) Now make sure the $templateVars are recorded. // (5.1) Only record the last value assigned to each 'questionVarsInst' name. if (array_key_exists('questionVarsInst',$itemClone)) { $templateVars = NULL; foreach ($itemClone['questionVarsInst'] as $key => $value) { $templateVars[$value['key']] = $value['value']; } } // (5.2) questionNoteInst if (array_key_exists('questionNoteInst',$itemClone)) { $persistence['questionNoteInst']= trim($itemClone['questionNoteInst']); } // (6) Work out the correct responses (teacher's answer) $correct = ''; // TODO: Is this the right way to do this? if (array_key_exists('questionAnsInst', $itemClone)) { if (array_key_exists('value', $itemClone['questionAnsInst'])) { $correct = trim($itemClone['questionAnsInst']['value']); } } $correctResponses = array((object) array('name' => '_1', 'value' => $correct)); $outcomeVars = MakeRQPVars($outcomeVars); $templateVars = MakeRQPVars($templateVars); // Fix return types where required // (works around a bug in early versions of PHP 5) $templateVars = soap_encode_array($templateVars, 'templateVars', 'variable', RQP_URI_NAMESPACE); $correctResponses = soap_encode_array($correctResponses, 'correctResponses', 'input', RQP_URI_NAMESPACE); return array('templateVars' => $templateVars, 'correctResponses' => $correctResponses); } // Render function stack_rqp_RenderCall($item, $templateVars, $persistentData, $responses, $advanceState, $namePrefix, $appletBase, $mediaBase, $renderFormat, $modalFormat) { // These are the return values $outcomeVars = array(); $stem = ''; $lastAnswer = ''; $validation = ''; $interactions = ''; $feedback = ''; $solution = ''; $errors = NULL; // (1) $questionGUID = $item['questionGUID']; $persistence = base64_unserialize($persistentData); $templateVars = FlattenRQPVars($templateVars); $responses = FlattenRQPInputs($responses); // Get the display option from the render format if (RQP_URI_FORMAT . 'xhtml-1.0-web' == $renderFormat) { $item['questionOptions']['Display'] = 'LaTeX'; $encoding = 'application/xhtml+xml'; } else if (RQP_URI_FORMAT . 'xhtml-1.0-print' == $renderFormat) { $item['questionOptions']['Display'] = 'LaTeX'; $encoding = 'application/xhtml+xml'; } else if (RQP_URI_FORMAT . 'latex-2e' == $renderFormat) { $item['questionOptions']['Display'] = 'LaTeX Source'; // TODO: What is the MIME type for latex? $encoding = 'application/x-latex'; } else if(RQP_URI_FORMAT . 'plain' == $renderFormat) { $item['questionOptions']['Display'] = 'String'; $encoding = 'text/plain'; } else { return MakeRQPFault(MakeRQPError('unknownRenderFormat', 'This server does not support the ' . $renderFormat . 'render format.'), 'Unknown render format.'); } $options = stack_options_set($item,$errors); // (2) Generate $seed $useClonedItem = TRUE; list($usec, $sec) = explode(' ', microtime()); $seed = (integer) ((float) $sec + ((float) $usec * 100000)); $useClonedItem = FALSE; // (3) Decide if we should use a cached $itemClone, or generate our own. if ($useClonedItem and stack_db_rqpcache_itemInst_exists($questionGUID,$seed)) { // (3.1) Get it from the database. $itemClone = stack_db_rqpcache_itemInst_get($questionGUID,$seed); } else { // (4) Generate an $itemClone // (4.1) Should we use the questionVars in the item, or the templateVars? if (array_key_exists('questionVars',$item)) { if (is_array($templateVars) and count($templateVars)) { // We have (i) questionVars, and (ii) templateVars // HACK: should only happen if all questionVars are in templateVars! //Substitute the questionVars with templateVars unset($item['questionVars']); foreach ($templateVars as $key => $value) { $item['questionVars'][] = array('key' => $key, 'value' => $value); } } } // (4.2) Make sure we have a cloned item to work with. $itemClone = NULL; $itemClone = stack_question_inst($item,$seed,$options,$errors); // (4.3) if the cloning generated errors, we should stop here. // HACK, Not done. // (4.4) Cache this if required. //stack_db_rqpcache_itemInst_add($questionGUID,$seed,$itemClone); } // END of (3) & (4) // (5) Now make sure the $templateVars are recorded. // (5.1) Only record the last value assigned to each 'questionVarsInst' name. if (array_key_exists('questionVarsInst',$itemClone)) { $templateVars = NULL; foreach ($itemClone['questionVarsInst'] as $key => $value) { $templateVars[$value['key']] = $value['value']; } } // (5.2) questionNoteInst if (array_key_exists('questionNoteInst',$itemClone)) { $persistence['questionNoteInst']= trim($itemClone['questionNoteInst']); } // (6) Check for and deal with responses // This could mean we process a response. $score = 0; // The score for this attempt, including penalties. $AnsFieldName = $namePrefix.'_1'; // Get the most recent attempt from the history $last_attempt = array('RawAns' => '', 'AnsVal' => '', 'AnsDisp' => '', 'RawMark' => 0, 'Penalty' => 0, 'FeedBack' => ''); if (is_array($persistence)) { if (array_key_exists('attempts', $persistence)) { if (is_array($persistence['attempts'])) { $last_attempt = end($persistence['attempts']); } } } $RawAns = ''; // Holds the student's answer, if there is one. if (array_key_exists($AnsFieldName, $responses)) { $RawAns = $responses[$AnsFieldName]; } else if (array_key_exists('RawAns', $persistence)) { $RawAns = $persisence['RawAns']; } // Has an attempt been made? if ('' != $RawAns) { // Response processing! $this_attempt = stack_question_inst_mark($itemClone,$options,$RawAns,$errors); // Was the response processed sucessfully? if (array_key_exists('Ans',$this_attempt)) { // Make $this_attempt like the persistent data attempts (but with // the full Ans array) $this_attempt['RawAns'] = $RawAns; $this_attempt['AnsVal'] = $this_attempt['Ans']['value']; $this_attempt['AnsDisp'] = $this_attempt['Ans']['display']; } else { $this_attempt = array('RawAns' => '', 'AnsVal' => '', 'AnsDisp' => '', 'RawMark' => 0, 'Penalty' => 0, 'FeedBack' => ''); } } else { // Use the previous attempt $this_attempt = $last_attempt; } // End of (6) // (7) Advance the state (if required) and calculate the overall score // We advance the state regardless here so that the score calculation // works below, then we remove the new entry if $advanceState is false // (7.1) Update the persistent data // We only count an attempt as "new" from the point of view of // marking and penalties if it is interpreted as being different. if ($this_attempt['AnsVal'] != $last_attempt['AnsVal']) { // Append this attempt to the array in the persistent data if (!is_array($persistence)) { $persistence = array(); } if (!array_key_exists('attempts',$persistence)) { $persistence['attempts'] = array(); } // Push the new info on the end. $per_att = $this_attempt; unset($per_att['Ans']); $persistence['attempts'][] = $per_att; unset($per_att); } // (7.2) Calculate the overall score ($score) // This is taken from stack_question_inst_calcmark($questionAttempts,$qval) // We can't use this because we don't record 'mark'/'validate' // I don't think keeping this info out is a good idea, the client has to // deal with the persistence data. // TODO: Remove the array with the complete history of attempts and keep // just the last attempt in the persistent data. Store the score for that // attempt and just update it rather than walking the whole history. if (is_array($persistence)) { if (array_key_exists('attempts',$persistence)) { // It should always exist! $maxmark=0; $cumpen=0; foreach ( $persistence['attempts'] as $val ) { $cumpen += $val['Penalty']; $maxmark= max( ($val['RawMark'] - $cumpen), $maxmark ); } // Now use the value of the question. $maxmark = $maxmark * $options['QuVal']; $score = $maxmark; } } // (7.3) Undo the change to the persistent data if $advanceState is false if (!$advanceState && $this_attempt['AnsVal'] != $last_attempt['AnsVal']) { // Remove the new attempt array_pop($persistence['attempts']); } // (7.4) Save the raw response in the presistent data so that the // interaction can be filled in with the correct value in future if ('' != $RawAns) { $persistence['RawAns'] = $RawAns; } else if (array_key_exists('RawAns', $persistence)) { // We want to fill in the last response (graded or otherwise) in the // interaction in (8) below $RawAns = $persistence['RawAns']; } // (7.5) Update $last_attempt to be this attempt if required if ($advanceState && $this_attempt['AnsVal'] != $last_attempt['AnsVal']) { $last_attempt = $this_attempt; unset($last_attempt['Ans']); } // (8) Construct the question stem, last answer, validation, feedback and // interactions if ( RQP_URI_FORMAT . 'latex-2e' == $renderFormat ) { // We assume LaTeX source // (8.1) Construct the stem $stem .= trim($itemClone['questionStemInst']); // (8.2) Construct the last answer if ('' !== trim($last_attempt['RawAns'])) { $lastAnswer .= "Your last submitted answer was:\n"; $lastAnswer .= '\begin{verbatim}'; $lastAnswer .= trim($last_attempt['RawAns']); $lastAnswer .= "\end{verbatim}\n\n"; $lastAnswer .= "This was interpreted as:\n"; $lastAnswer .= '\begin{center}'; $lastAnswer .= trim($last_attempt['AnsDisp']); $lastAnswer .= "\end{center}\n"; } // (8.3) Construct the validation if ('true' === $this_attempt['Valid']) { $validation .= trim($this_attempt['RawAns']); $validation .= " was interpretted as:\n"; $validation .= trim($this_attempt['AnsDisp']); $validation .= "\n"; } else { $validation .= trim($this_attempt['FeedBack']) . "\n"; } // (8.4) Construct the interactions $interactions .= trim($this_attempt['AnsDisp']); // (8.5) Construct the feedback if ('true' === $this_attempt['Valid']) { $feedback = trim($this_attempt['FeedBack']) . "\n"; } // (8.6) Construct the solution $correct = ''; if (array_key_exists('questionSolInst', $itemClone)) { if (array_key_exists('display', $itemClone['questionSolInst'])) { $correct = trim($itemClone['questionSolInst']['display']); } } // If there is no worked solution just display the correct response if ('' === $correct) { if (array_key_exists('questionAnsInst', $itemClone)) { if (array_key_exists('display', $itemClone['questionAnsInst'])) { $correct .= "A correct answer is:\n"; $correct .= trim($itemClone['questionAnsInst']['display']); } if (array_key_exists('value', $itemClone['questionAnsInst'])) { if (array_key_exists('display', $itemClone['questionAnsInst'])) { $correct .= "\nwhich can be entered as: "; } else { $correct .= 'A correct answer can be entered as: '; } $correct .= trim($itemClone['questionAnsInst']['value']); } } } $solution .= $correct . "\n"; } else if ( RQP_URI_FORMAT . 'plain' == $renderFormat ) { // (8.1) Construct the stem $stem .= trim($itemClone['questionStemInst']); // (8.2) Construct the last answer if ('' !== trim($last_attempt['RawAns'])) { $lastAnswer .= "Your last submitted answer was:\n"; $lastAnswer .= trim($last_attempt['RawAns']); $lastAnswer .= "\n\n"; $lastAnswer .= "This was interpreted as:\n"; $lastAnswer .= trim($this_attempt['AnsDisp']); $lastAnswer .= "\n"; } // (8.3) Construct the validation if ('true' === $this_attempt['Valid']) { $validation .= trim($this_attempt['RawAns']); $validation .= " was interpretted as:\n"; $validation .= trim($this_attempt['AnsDisp']); $validation .= "\n"; } else { $validation .= trim($this_attempt['FeedBack']) . "\n"; } // (8.4) Construct the interactions $interactions .= trim($this_attempt['AnsDisp']); // (8.5) Construct the feedback if ('true' === $this_attempt['Valid']) { $feedback = trim($this_attempt['FeedBack']) . "\n"; } // (8.6) Construct the solution $correct = ''; if (array_key_exists('questionSolInst', $itemClone)) { if (array_key_exists('display', $itemClone['questionSolInst'])) { $correct = trim($itemClone['questionSolInst']['display']); } } // If there is no worked solution just display the correct response if ('' === $correct) { if (array_key_exists('questionAnsInst', $itemClone)) { if (array_key_exists('display', $itemClone['questionAnsInst'])) { $correct .= "A correct answer is:\n"; $correct .= trim($itemClone['questionAnsInst']['display']); } if (array_key_exists('value', $itemClone['questionAnsInst'])) { if (array_key_exists('display', $itemClone['questionAnsInst'])) { $correct .= "\nwhich can be entered as: "; } else { $correct .= 'A correct answer can be entered as: '; } $correct .= trim($itemClone['questionAnsInst']['value']); } } } $solution .= $correct . "\n"; } else { // We assume HTML of some kind. // (8.1) Construct the stem $stem .= trim($itemClone['questionStemInst']); // (8.2) Construct the last answer if ('' !== trim($last_attempt['RawAns'])) { $lastAnswer .= 'Your last submitted answer was: <code>'; $lastAnswer .= htmlspecialchars(trim($last_attempt['RawAns'])); $lastAnswer .= '</code><br />'; $lastAnswer .= 'This was interpreted as:'; $lastAnswer .= trim($last_attempt['AnsDisp']); } // (8.3) Construct the validation if ('true' === $this_attempt['Valid']) { $validation .= '<code>'; $validation .= htmlspecialchars(trim($this_attempt['RawAns'])); $validation .= '</code> was interpreted as:<br />'; $validation .= trim($this_attempt['AnsDisp']); } else { $validation .= trim($this_attempt['FeedBack']); } // (8.4) Construct the interactions if (RQP_URI_FORMAT . 'xhtml-1.0-web' == $renderFormat) { // Use the most recent response (even if not marked) when in // interactive mode $interactions .= stack_question_inst_try_formfrag($RawAns, $AnsFieldName); } else { $interactions .= trim($this_attempt['AnsDisp']); } // (8.5) Construct the feedback if ('true' === $this_attempt['Valid']) { $feedback = trim($this_attempt['FeedBack']); } // (8.6) Construct the solution $correct = ''; if (array_key_exists('questionSolInst', $itemClone)) { if (array_key_exists('display', $itemClone['questionSolInst'])) { $correct = trim($itemClone['questionSolInst']['display']); } } // If there is no worked solution just display the correct response if ('' === $correct) { if (array_key_exists('questionAnsInst', $itemClone)) { if (array_key_exists('display', $itemClone['questionAnsInst'])) { $correct .= 'A correct answer is:<br />'; $correct .= trim($itemClone['questionAnsInst']['display']); } if (array_key_exists('value', $itemClone['questionAnsInst'])) { if (array_key_exists('display', $itemClone['questionAnsInst'])) { $correct .= '<br />which can be entered as: '; } else { $correct .= 'A correct answer can be entered as: '; } $correct .= trim($itemClone['questionAnsInst']['value']); } } } $solution .= $correct; } // (9) Construct the $outcomeVars // (note, it is tempting to just do $outcomeVars = $this_attempt.......) $outcomeVars[RQP_URI_OUTCOME . 'valid'] = ( array_key_exists('questionVars', $item ) ? 'true' : 'false'); $outcomeVars[RQP_URI_OUTCOME . 'grade'] = $score; $outcomeVars[RQP_URI_OUTCOME . 'rawScore'] = $this_attempt['RawMa... [truncated message content] |
From: pkiddie <pk...@us...> - 2005-09-09 10:46:23
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/old In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10630/old Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/old added to the repository --> Using per-directory sticky tag `development_xmlrqp' |
From: pkiddie <pk...@us...> - 2005-09-08 22:07:33
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27864/scripts/rqp Modified Files: RQPv1p0Server.php stackRQP.php Log Message: Implementation of render operation in presenting and grading questions Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RQPv1p0Server.php 5 Sep 2005 08:52:21 -0000 1.7 --- RQPv1p0Server.php 8 Sep 2005 22:07:25 -0000 1.8 *************** *** 253,257 **** $itemProperties = array('template' => TRUE , 'adaptive' => TRUE , ! 'timeDependant' => FALSE , 'canComputerScore' => TRUE , 'maxScore' => 0, --- 253,257 ---- $itemProperties = array('template' => TRUE , 'adaptive' => TRUE , ! 'timeDependent' => FALSE , 'canComputerScore' => TRUE , [...1145 lines suppressed...] - $persistentData = base64_serialize($persistence); - - - - // Fix return types where required - - // (works around a bug in early versions of PHP 5) - - $templateVars = soap_encode_array($templateVars, 'templateVars', 'variable', RQP_URI_NAMESPACE); - - $outcomeVars = soap_encode_array($outcomeVars, 'outcomeVars', 'variable', RQP_URI_NAMESPACE); - - $output = soap_encode_array($output, 'output', 'output', RQP_URI_NAMESPACE);*/ - - //return new nbSOAPFault("unimplemented", "The RQP_Renderservice has not been implemented yet", ""); - // Fill in web method fuctionality here. - // return a RenderDType } --- 714,717 ---- Index: stackRQP.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/stackRQP.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stackRQP.php 5 Sep 2005 08:52:21 -0000 1.3 --- stackRQP.php 8 Sep 2005 22:07:25 -0000 1.4 *************** *** 41,44 **** --- 41,55 ---- } + function stack_get_seed() { + if (array_key_exists('seed',$_POST)) { + $seed=$_POST['seed']; + } else { + // HACK: this should involve the concept of a user! + $seed = time(); + } + + return $seed; + } + /** * Converts a string of XML to a STACK question instance *************** *** 121,124 **** --- 132,152 ---- } } + + /** + * + * + * + */ + function stack_rqp_keyval_field_get($keyvalArray, $key) + { + foreach ($keyvalArray as $field) { + if ($field['key'] == $key) + { + return $field['val']; + } + } + + return false; + } /** |
From: Chris S. <san...@us...> - 2005-09-07 14:29:18
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21600 Modified Files: choosequiz.php Log Message: Index: choosequiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/choosequiz.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** choosequiz.php 7 Sep 2005 14:19:35 -0000 1.1 --- choosequiz.php 7 Sep 2005 14:28:58 -0000 1.2 *************** *** 17,20 **** --- 17,26 ---- require_once('stackLib.php'); + /** + * To use this script, add a variable $choosequiz_store + * to stackConfig.php which is an array of the subjectID numbers + * of subjects you wish to be available through this page. + */ + $user = stack_user_guest(); *************** *** 22,28 **** if (array_key_exists('subjectID',$_GET)) { - $subjectID = $_GET['subjectID']; // Check this is permitted. $subject = stack_db_subject_get($subjectID,FALSE); --- 28,44 ---- if (array_key_exists('subjectID',$_GET)) { // Check this is permitted. + if (isset($choosequiz_store)) { + if (FALSE !== array_search($_GET['subjectID'],$choosequiz_store)) { + $subjectID = $_GET['subjectID']; + } else { + echo "This subject is not available through this page."; + die(); + } + } else { + echo "The administrator of this STACK server has not released any subjects."; + die(); + } $subject = stack_db_subject_get($subjectID,FALSE); |
From: Chris S. <san...@us...> - 2005-09-07 14:19:47
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19268/scripts Modified Files: stackDatabase.php stackQuiz.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** stackQuiz.php 5 Sep 2005 13:40:56 -0000 1.13 --- stackQuiz.php 7 Sep 2005 14:19:35 -0000 1.14 *************** *** 184,188 **** * @return void */ ! function stack_quiz_student_select($subjectID, $quiz_store, $user, $review=FALSE) { global $stack_root; require_once("{$stack_root}/html/quizjava.html"); --- 184,188 ---- * @return void */ ! function stack_quiz_student_select($subjectID, $quiz_store, $user, $review=FALSE, $returnurl='') { global $stack_root; require_once("{$stack_root}/html/quizjava.html"); *************** *** 201,208 **** </script> <p>\n<form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='userid' value='-1'> ! <input type='hidden' name='quizid' value='-1'> ! <input type='hidden' name='subjectID' value='-1'> ! <input type='hidden' name='action' value='review'>"; 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>"; --- 201,209 ---- </script> <p>\n<form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='returnurl' value ='$returnurl' /> ! <input type='hidden' name='userid' value='-1' /> ! <input type='hidden' name='quizid' value='-1' /> ! <input type='hidden' name='subjectID' value='-1' /> ! <input type='hidden' name='action' value='review' />"; 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>"; Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** stackDatabase.php 5 Sep 2005 13:40:56 -0000 1.47 --- stackDatabase.php 7 Sep 2005 14:19:35 -0000 1.48 *************** *** 2084,2087 **** --- 2084,2089 ---- global $stackQuiz; + $quiz_list = ''; + $query = "SELECT quizid FROM subject_quiz WHERE subjectID = {$subjectID} AND qord >= 0 ORDER BY qord"; *************** *** 2097,2101 **** } } - return $quiz_list; } --- 2099,2102 ---- |
From: Chris S. <san...@us...> - 2005-09-07 14:19:47
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19268 Modified Files: index.php quiz.php Added Files: choosequiz.php Log Message: --- NEW FILE: choosequiz.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * * @package Stack */ session_start(); require_once('stackConfig.php'); require_once('stackLib.php'); $user = stack_user_guest(); if (array_key_exists('subjectID',$_GET)) { $subjectID = $_GET['subjectID']; // Check this is permitted. $subject = stack_db_subject_get($subjectID,FALSE); $_SESSION['subject'] = $subject; } else if (array_key_exists('subject',$_SESSION)) { $subject = $_SESSION['subject']; $subjectID = $subject['subjectID']; } else { echo "You need to supply details of a STACK subjectID number."; die(); } echo "<table width='100%'>\n<tr>\n <td align='left'><h1>STACK quizzes</h1></td>\n"; echo " <td align='right'><img src='pics/logo.png' alt='STACK logo' /></td>\n</tr>\n</table>"; echo $subject['subjectHTMLHead']; $quiz_store = stack_db_subject_quiz_list_student($subjectID); stack_quiz_student_select($subjectID,$quiz_store, $user, FALSE, "choosequiz.php"); echo $subject['subjectHTMLFoot']; Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** quiz.php 5 Sep 2005 13:26:22 -0000 1.34 --- quiz.php 7 Sep 2005 14:19:35 -0000 1.35 *************** *** 63,66 **** --- 63,74 ---- } + // We need to be able to exit this page in flexible ways. + $returnurl = 'index.php?action=choose_quiz'; + if (array_key_exists('returnurl',$_POST)) { + if ('' != $_POST['returnurl']) { + $returnurl = $_POST['returnurl']; + } + } + // Now datetime $tnow = time(); *************** *** 575,578 **** --- 583,588 ---- // Now display each question, each with a form fragment. echo "<form name='quizform' action='$PostTo' method='POST'>\n"; + echo "<input type='hidden' name='returnurl' value ='$returnurl' />"; + foreach ($quizInst as $key => $qInst) { *************** *** 735,739 **** } ! 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>"; --- 745,749 ---- } ! echo "<tr><td><a href='$returnurl'>".get_string('Home','stack','')."</a></td> <td>".get_string('STACKHomePage','stack','')."</td></tr>\n"; echo "</table>"; Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** index.php 4 Sep 2005 21:26:18 -0000 1.29 --- index.php 7 Sep 2005 14:19:35 -0000 1.30 *************** *** 101,104 **** --- 101,105 ---- } + $subjectID = ''; if ('choose_quiz' == $action) { if (array_key_exists('subjectID',$_POST)) { *************** *** 157,161 **** break; case 'choose_quiz': ! if ('' == $subjectID) { echo "Please choose a subject first."; } else { --- 158,162 ---- break; case 'choose_quiz': ! if ('' === $subjectID) { echo "Please choose a subject first."; } else { |
From: Chris S. <san...@us...> - 2005-09-05 14:10:14
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24420 Modified Files: stackInstall.php Log Message: Index: stackInstall.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackInstall.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** stackInstall.php 4 Sep 2005 19:24:57 -0000 1.18 --- stackInstall.php 5 Sep 2005 14:10:01 -0000 1.19 *************** *** 128,131 **** --- 128,137 ---- stack_mysqlcmd($qu,'root',$err); + // (2.5) Drop some student data + //stack_mysqlcmd("DROP TABLE questionAttempts",$stack_mysql['user'],$err); + //stack_mysqlcmd("DROP TABLE quizAttempts",$stack_mysql['user'],$err); + + + // (3) Create a question table // |