From: pkiddie <pk...@us...> - 2005-10-05 11:43:57
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4725/scripts/rqp Modified Files: RQPv1p0Server.php stackRQP.php Log Message: Latest version of RQPServer and client Implemented options Error reporting Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RQPv1p0Server.php 12 Sep 2005 09:24:24 -0000 1.10 --- RQPv1p0Server.php 5 Oct 2005 11:43:44 -0000 1.11 *************** *** 67,71 **** } - // return new nbSOAPFault("unimplemented", "The RQP_ServerInformationservice has not been implemented yet", ""); $si['type'] = "STACK"; $si['version'] = $stack_ver['release']; --- 67,70 ---- *************** *** 80,85 **** 'authoring' => TRUE, 'adminOptions' => TRUE, ! 'teacherOptions'=> FALSE, ! 'userOptions' => TRUE); $si['mimetypes']=array("text/html"); $si['resources']=array("Location of JOME and any other prerequisites for server operation"); --- 79,84 ---- 'authoring' => TRUE, 'adminOptions' => TRUE, ! 'teacherOptions'=> TRUE, ! 'userOptions' => FALSE); $si['mimetypes']=array("text/html"); $si['resources']=array("Location of JOME and any other prerequisites for server operation"); *************** *** 171,175 **** //Response parameters - $persistentData=''; $onSubmit=''; $head=''; --- 170,173 ---- *************** *** 236,252 **** } ! //Existing question with existing XML source else if (!empty($source)) { - //Use existing source to fill in fields within authoring form - //Import source XML and display question editing form 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)); } --- 234,260 ---- } ! //cases: 1. editing an existing question with existing XML source ! // 2. editing question options, where source = adminOptions, teacherOptions or userOptions else if (!empty($source)) { switch($source) { case('adminOptions'): { ! //Are we in existing session, i.e. inputData to process? ! if (!empty($inputData)) { ! $client_options = stack_rqp_keyval_field_get($inputData,'questionOptions'); // options set in input fields ! $question_options = unserialize(html_entity_decode($client_options)); } ! //inputdata is empty, so maybe were in a new session? ! else { ! //Have options been set in $options render field - from relevant db table ! if (!empty($options['admin'])) { ! $question_options = unserialize(html_entity_decode(html_entity_decode(html_entity_decode($options['admin'])))); //bad! ! } ! ! else { ! //No options set in either inputData or render field - so assume defaults ! $question_options = array(); ! } } *************** *** 256,262 **** $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' => '', --- 264,268 ---- $options_list = array('Display','Language'); ! $output = array('title' => '', 'body' => stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$namePrefix, TRUE), 'stem' => '', *************** *** 271,280 **** } ! case('teacherOptions'): { ! $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' => '', --- 277,306 ---- } ! case('teacherOptions'): { ! //Are we in existing session, i.e. inputData to process? ! if (!empty($inputData)) { ! $client_options = stack_rqp_keyval_field_get($inputData,'questionOptions'); // options set in input fields ! $question_options = unserialize(html_entity_decode($client_options)); ! } ! ! //inputData is empty, so maybe were in a new session? ! else { ! //Have options been set in $options render field ! if (!empty($options['teacher'])) { ! $question_options = unserialize(html_entity_decode(html_entity_decode(html_entity_decode($options['teacher'])))); //bad! ! } ! ! else { ! //No options set in either inputData or render field - so assume defaults ! $question_options = array(); ! } ! } ! ! $optval = stack_options_formvals_set($question_options); ! ! $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'); ! $output = array('title' => '', 'body' => stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$namePrefix, TRUE), 'stem' => '', *************** *** 283,295 **** 'answer' => '', 'solution' => ''); break; } case('userOptions'): { ! $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' => '', --- 309,346 ---- 'answer' => '', 'solution' => ''); + + $outcomeVars['completion'] = 'complete'; + $outcomeVars['options'] = stack_rqp_keyval_field_get($inputData,'questionOptions'); //Return options as serialised string contained by [questionOptions] break; + } case('userOptions'): { ! //Are we in existing session, i.e. inputData to process? ! if (!empty($inputData)) { ! $client_options = stack_rqp_keyval_field_get($inputData,'questionOptions'); // options set in input fields ! $question_options = unserialize(html_entity_decode($client_options)); ! } ! ! //inputData is empty, so maybe were in a new session? ! else { ! //Have options been set in $options render field ! if (!empty($options['user'])) { ! $question_options = unserialize(html_entity_decode(html_entity_decode(html_entity_decode($options['user'])))); //bad! ! } ! ! else { ! //No options set in either inputData or render field - so assume defaults ! $question_options = array(); ! } ! } ! ! $optval = stack_options_formvals_set($question_options); ! ! //TODO: What user options to set? ! $options_headings = array(get_string('stackOptions_edit_out','stack')); ! $options_list = array('Display'); ! $output = array('title' => '', 'body' => stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$namePrefix, TRUE), 'stem' => '', *************** *** 298,306 **** 'answer' => '', 'solution' => ''); break; } ! //run where the source contains something other than options directives. ! //This could only be STACK question source XML default: { //On initial entry of editing an existing qu. --- 349,359 ---- 'answer' => '', 'solution' => ''); + + $outcomeVars['completion'] = 'complete'; + $outcomeVars['options'] = stack_rqp_keyval_field_get($inputData,'questionOptions'); //Return options as serialised string contained by [questionOptions] break; } ! //STACK question source XML default: { //On initial entry of editing an existing qu. *************** *** 344,348 **** } ! //Currently empty directives means attempting a question else { $output = array('title' => '', //initially question will have no title --- 397,401 ---- } ! //If any other keys in directives assume attempting a question else { $output = array('title' => '', //initially question will have no title *************** *** 371,376 **** $question['questionID'] = -1; //1. Set question options, from question ! $options = stack_options_set($question); //2. Generate a seed, for randomisation --- 424,465 ---- $question['questionID'] = -1; + //Option management and setting + //adminOptions = subjectOpts - overriden by quiz (teacher) options + if (!empty($options['admin'])) { + $subjectOptions = unserialize(html_entity_decode(html_entity_decode(html_entity_decode($options['admin'])))); //bad! + } + + else $subjectOptions = NULL; + + //teacherOptions = quizOpts + if (!empty($options['teacher'])) { + $quizOptions = unserialize(html_entity_decode(html_entity_decode(html_entity_decode($options['teacher'])))); //bad! + } + + else $quizOptions = NULL; + + //Extension to this needed that userOptions take precedence over questionOptions (will simply be display related stuff) + if (!empty($options['user'])) { + $userOptions = unserialize(html_entity_decode(html_entity_decode(html_entity_decode($userOptions)))); + + if (is_array($userOptions)) { + foreach ($stackOptions as $opt => $fields) { + if (array_key_exists($opt,$userOptions)) { + $question['questionOptions'][$opt] = $opt_toset[$opt]; + } + } + } + } + + //STACK adheres to ISO language naming + if (!empty($options['language'])) { + $question['questionOptions']['Language'] = $options['language']; + } + + //$options['accept'] + //$options['user-agent'] + //1. Set question options, from question ! $options = stack_options_set($question, $quizOptions, $subjectOptions); //2. Generate a seed, for randomisation *************** *** 535,544 **** } ! //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']); } } --- 624,635 ---- } ! //9.6 Construct solution to question - ONLY where 'solution' is set in directives $solution = ''; ! if (in_array('solution',$directives)) { ! if (array_key_exists('questionSolInst',$questionInst)) { if (array_key_exists('display', $questionInst['questionSolInst'])) { $solution= trim($questionInst['questionSolInst']['display']); } + } } *************** *** 592,598 **** $files = array(); - //Construct RenderType ! $render = array('persistentData' => serialize($persistence), //else '', 'outcomeVars' => $outcomeVars, 'onSubmit' => $onSubmit, --- 683,688 ---- $files = array(); //Construct RenderType ! $render = array('persistentData' => '', 'outcomeVars' => $outcomeVars, 'onSubmit' => $onSubmit, *************** *** 601,604 **** --- 691,699 ---- 'mimetype' => $mimetype, 'files' => $files); + + if (!empty($persistence)) { + $render['persistentData'] = serialize($persistence); + } + return $render; } Index: stackRQP.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/stackRQP.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stackRQP.php 12 Sep 2005 09:24:24 -0000 1.5 --- stackRQP.php 5 Oct 2005 11:43:44 -0000 1.6 *************** *** 150,157 **** } - function stack_rqp_serialize_options() - { - } - /** * --- 150,153 ---- |