You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(486) |
Jul
(201) |
Aug
(194) |
Sep
(87) |
Oct
(72) |
Nov
(72) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(41) |
Mar
(22) |
Apr
(4) |
May
(12) |
Jun
|
Jul
|
Aug
(42) |
Sep
(21) |
Oct
(14) |
Nov
(10) |
Dec
|
2007 |
Jan
(14) |
Feb
(34) |
Mar
(61) |
Apr
(54) |
May
(140) |
Jun
(184) |
Jul
(164) |
Aug
(130) |
Sep
(241) |
Oct
(175) |
Nov
(148) |
Dec
(96) |
2008 |
Jan
(5) |
Feb
(38) |
Mar
(30) |
Apr
(46) |
May
(25) |
Jun
(22) |
Jul
(5) |
Aug
(17) |
Sep
(2) |
Oct
(100) |
Nov
(83) |
Dec
(33) |
2009 |
Jan
(127) |
Feb
(43) |
Mar
(86) |
Apr
(34) |
May
(50) |
Jun
(168) |
Jul
(48) |
Aug
(66) |
Sep
(38) |
Oct
(75) |
Nov
(113) |
Dec
(72) |
2010 |
Jan
(123) |
Feb
(68) |
Mar
(26) |
Apr
(11) |
May
(39) |
Jun
(131) |
Jul
(56) |
Aug
(79) |
Sep
(69) |
Oct
(17) |
Nov
(166) |
Dec
(32) |
2011 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(8) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Chris S. <san...@us...> - 2005-10-07 06:26:46
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27355 Modified Files: question_bank.php Log Message: Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** question_bank.php 4 Sep 2005 21:26:18 -0000 1.15 --- question_bank.php 7 Oct 2005 06:26:38 -0000 1.16 *************** *** 170,177 **** --- 170,179 ---- stack_db_question_add($question); $action = 'questionbank_screen'; + $action = 'edit'; break; case 'save_as': stack_db_question_add($question,TRUE); $action = 'questionbank_screen'; + $action = 'edit'; break; } |
From: Chris S. <san...@us...> - 2005-10-07 06:26:45
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27355/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.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** stack.php 12 Sep 2005 08:07:47 -0000 1.27 --- stack.php 7 Oct 2005 06:26:38 -0000 1.28 *************** *** 297,301 **** $string['menu_NewQ'] = 'New question'; $string['menu_Author'] = 'Author doc'; ! $string['menu_Syntax'] = 'Syntax'; $string['menu_Options'] = 'Options'; $string['menu_AnswerT'] = 'Answer tests'; --- 297,301 ---- $string['menu_NewQ'] = 'New question'; $string['menu_Author'] = 'Author doc'; ! $string['menu_Syntax'] = 'STACK commands'; $string['menu_Options'] = 'Options'; $string['menu_AnswerT'] = 'Answer tests'; |
From: Chris S. <san...@us...> - 2005-10-07 06:26:45
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27355/html Modified Files: help_popup.php Log Message: Index: help_popup.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/help_popup.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** help_popup.php 29 Aug 2005 18:41:03 -0000 1.7 --- help_popup.php 7 Oct 2005 06:26:38 -0000 1.8 *************** *** 81,85 **** // This needs to come after 'fact' ! $filename="{$stack_root}/lang/{$lang}/doc/$variable.php"; include($filename); --- 81,93 ---- // This needs to come after 'fact' ! $fn = $variable; ! switch ($variable) { ! case 'stackQuestionPotResp': ! $fn = 'author_potresp'; ! break; ! ! } ! ! $filename="{$stack_root}/lang/{$lang}/doc/$fn.php"; include($filename); |
From: Chris S. <san...@us...> - 2005-10-05 16:18:26
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8964/html Modified Files: prehead.html stack.css Log Message: Index: stack.css =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/stack.css,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stack.css 25 Jul 2005 11:26:19 -0000 1.5 --- stack.css 5 Oct 2005 16:18:17 -0000 1.6 *************** *** 1,4 **** body { ! } --- 1,4 ---- body { ! font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; } Index: prehead.html =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/prehead.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** prehead.html 3 Jul 2005 14:28:27 -0000 1.4 --- prehead.html 5 Oct 2005 16:18:17 -0000 1.5 *************** *** 15,18 **** --- 15,21 ---- <link rel="shortcut icon" href="pics/logo_sm.gif" /> </head> + <style type="text/css"> + @import url(html/stack.css); + </style> |
From: pkiddie <pk...@us...> - 2005-10-05 11:44:25
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4725/scripts/rqp/moodle_16_rqp/quiz Modified Files: version.php Added Files: edit.php index.php Log Message: Latest version of RQPServer and client Implemented options Error reporting Index: version.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/version.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** version.php 12 Sep 2005 09:46:59 -0000 1.1 --- version.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 6,10 **** //////////////////////////////////////////////////////////////////////////////// ! $module->version = 2005091200; // The (date) version of this module $module->requires = 2005021600; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? --- 6,10 ---- //////////////////////////////////////////////////////////////////////////////// ! $module->version = 2005093000; // The (date) version of this module $module->requires = 2005021600; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? --- NEW FILE: edit.php --- <?php // $Id: edit.php,v 1.1 2005/10/05 11:43:44 pkiddie Exp $ /** * Page to edit quizzes * * This page generally has two columns: * The right column lists all available questions in a chosen category and * allows them to be edited or more to be added. This column is only there if * the quiz does not already have student attempts * The left column lists all questions that have been added to the current quiz. * This column is only there if this page has been called in the context of a quiz. * The lecturer can add questions from the right hand list to the quiz or remove them * * The script also processes a number of actions: * Actions affecting a quiz: * up and down Changes the order of questions and page breaks * addquestion Adds a single question to the quiz * add Adds several selected questions to the quiz * addrandom Adds a certain number of random questions to the quiz * delete Removes a question from the quiz * setgrades Changes the maximum grades for questions in the quiz * repaginate Re-paginates the quiz * Actions affecting the question pool: * move Moves a question to a different category * deleteselected Deletes the selected questions from the category * Other actions: * cat Chooses the category * displayoptions Sets display options * * @version $Id: edit.php,v 1.1 2005/10/05 11:43:44 pkiddie Exp $ * @author Martin Dougiamas and many others. This has recently been extensively * rewritten by Gustav Delius and other members of the Serving Mathematics project * {@link http://maths.york.ac.uk/serving_maths} * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ require_once("../../config.php"); require_once("editlib.php"); require_login(); $courseid = optional_param('courseid'); $quizid = optional_param('quizid'); $page = optional_param('page', -1); $perpage = optional_param('perpage', 20); $type = optional_param('type', 0); //Used for setting options for particular RQP type $strquizzes = get_string('modulenameplural', 'quiz'); $strquiz = get_string('modulename', 'quiz'); $streditingquestions = get_string('editquestions', "quiz"); $streditingquiz = get_string("editinga", "moodle", $strquiz); if ($modform = data_submitted() and !empty($modform->course)) { // data submitted $SESSION->modform = $modform; // Save the form in the current session } else if ($quizid) { if (isset($SESSION->modform->id) and $SESSION->modform->id == $quizid) { // modform for this quiz already exists, use it $modform = $SESSION->modform; } else { // create new modform from database if (! $modform = get_record('quiz', 'id', $quizid)) { error("The required quiz doesn't exist"); } $modform->instance = $modform->id; $SESSION->modform = $modform; // Save the form in the current session $cm = get_coursemodule_from_instance('quiz', $modform->instance); $modform->cmid = $cm->id; // We don't log all visits to this page but only those that recreate modform add_to_log($cm->course, 'quiz', 'editquestions', "view.php?id=$cm->id", "$quizid", $cm->id); } } else if ($courseid) { // Page retrieve through "Edit Questions" link - no quiz selected $modform->course = $courseid; unset($modform->instance); $SESSION->modform = $modform; // Save the form in the current session add_to_log($courseid, 'quiz', 'editquestions', "index.php?id=$courseid"); } else { // we might get here after editing a question in // a popup window. So close window automatically. ?> <script type="text/javascript"> <!-- if (self.name == 'editquestion') { self.close(); } --> </script> <noscript> <?php notify(get_string('pleaseclose', 'quiz')); ?> </noscript> <?php // no quiz or course was specified so we need to use the stored modform if (isset($SESSION->modform)) { $modform = $SESSION->modform; } else { exit; } } if (! $course = get_record("course", "id", $modform->course)) { error("This course doesn't exist"); } require_login($course->id, false); if (!isteacheredit($course->id)) { error("You can't modify this course!"); } if (isset($modform->instance) && empty($modform->grades)) // Construct an array to hold all the grades. { $modform->grades = quiz_get_all_question_grades($modform); } if ($page > -1) { $modform->page = $page; } else { $page = isset($modform->page) ? $modform->page : 0; } /// Now, check for commands on this page and modify variables as necessary if (isset($_REQUEST['up']) and confirm_sesskey()) { /// Move the given question up a slot $questions = explode(",", $modform->questions); if ($up > 0 and isset($questions[$up])) { $prevkey = ($questions[$up-1] == 0) ? $up-2 : $up-1; $swap = $questions[$prevkey]; $questions[$prevkey] = $questions[$up]; $questions[$up] = $swap; $modform->questions = implode(",", $questions); // Always have a page break at the end $modform->questions = $modform->questions . ',0'; // Avoid duplicate page breaks $modform->questions = str_replace(',0,0', ',0', $modform->questions); if (!set_field('quiz', 'questions', $modform->questions, 'id', $modform->instance)) { error('Could not save question list'); } } } if (isset($_REQUEST['down']) and confirm_sesskey()) { /// Move the given question down a slot $questions = explode(",", $modform->questions); if ($down < count($questions)) { $nextkey = ($questions[$down+1] == 0) ? $down+2 : $down+1; $swap = $questions[$nextkey]; $questions[$nextkey] = $questions[$down]; $questions[$down] = $swap; $modform->questions = implode(",", $questions); // Avoid duplicate page breaks $modform->questions = str_replace(',0,0', ',0', $modform->questions); if (!set_field('quiz', 'questions', $modform->questions, 'id', $modform->instance)) { error('Could not save question list'); } } } if (isset($_REQUEST['addquestion']) and confirm_sesskey()) { /// Add a single question to the current quiz quiz_add_quiz_question($_REQUEST['addquestion'], $modform); } if (isset($_REQUEST['add']) and confirm_sesskey()) { /// Add selected questions to the current quiz foreach ($_POST as $key => $value) { // Parse input for question ids if (substr($key, 0, 1) == "q") { quiz_add_quiz_question(substr($key,1), $modform); } } } if (isset($_REQUEST['addrandom']) and confirm_sesskey()) { /// Add random questions to the quiz $recurse = optional_param('recurse', 0, PARAM_BOOL); $categoryid = required_param('categoryid', PARAM_INT); $randomcount = required_param('randomcount', PARAM_INT); // load category if (! $category = get_record('quiz_categories', 'id', $categoryid)) { error('Category ID is incorrect'); } // find existing random questions in this category $random = RANDOM; if ($existingquestions = get_records_select('quiz_questions', "qtype = '$random' AND category = '$category->id'")) { // now remove the ones that are already used in this quiz if ($questionids = explode(',', $modform->questions)) { foreach ($questionids as $questionid) { unset($existingquestions[$questionid]); } } // now take as many of these as needed $i = 0; while (($existingquestion = array_pop($existingquestions)) and ($i < $randomcount)) { if ($existingquestion->questiontext == $recurse) { // this question has the right recurse property, so use it quiz_add_quiz_question($existingquestion->id, $modform); $i++; } } $randomcreate = $randomcount - $i; // the number of additional random questions needed. } else { $randomcreate = $randomcount; } if ($randomcreate > 0) { $form->name = get_string('random', 'quiz') .' ('. $category->name .')'; $form->questiontext = $recurse; // we use the questiontext field to store the info // on whether to include questions in subcategories $form->questiontextformat = 0; $form->image = ''; $form->defaultgrade = 1; $form->hidden = 1; for ($i=0; $i<$randomcreate; $i++) { $form->stamp = make_unique_id_code(); // Set the unique code (not to be changed) $question = new stdClass; $question->category = $category->id; $question->qtype = RANDOM; $question = $QUIZ_QTYPES[RANDOM]->save_question($question, $form, $course); if(!isset($question->id)) { error('Could not insert new random question!'); } quiz_add_quiz_question($question->id, $modform); } } } if (isset($_REQUEST['repaginate']) and confirm_sesskey()) { /// Re-paginate the quiz if (isset($_REQUEST['questionsperpage'])) { $modform->questionsperpage = required_param('questionsperpage', 1, PARAM_INT); if (!set_field('quiz', 'questionsperpage', $modform->questionsperpage, 'id', $modform->id)) { error('Could not save number of questions per page'); } } $modform->questions = quiz_repaginate($modform->questions, $modform->questionsperpage); if (!set_field('quiz', 'questions', $modform->questions, 'id', $modform->id)) { error('Could not save layout'); } } if (isset($_REQUEST['move']) and confirm_sesskey()) { /// Move selected questions to new category if (!$tocategory = get_record('quiz_categories', 'id', $_REQUEST['category'])) { error('Invalid category'); } if (!isteacheredit($tocategory->course)) { error(get_string('categorynoedit', 'quiz', $tocategory->name), 'edit.php'); } foreach ($_POST as $key => $value) { // Parse input for question ids if (substr($key, 0, 1) == "q") { $key = substr($key,1); if (!set_field('quiz_questions', 'category', $tocategory->id, 'id', $key)) { error('Could not update category field'); } } } } if (isset($_REQUEST['delete']) and confirm_sesskey()) { /// Remove a question from the quiz quiz_delete_quiz_question($_REQUEST['delete'], $modform); } if (isset($_REQUEST['deleteselected'])) { // delete selected questions from the category if (isset($confirm) and confirm_sesskey()) { // teacher has already confirmed the action if ($confirm == md5($deleteselected)) { if ($questionlist = explode(',', $deleteselected)) { // for each question either hide it if it is in use or delete it foreach ($questionlist as $questionid) { if (record_exists('quiz_question_instances', 'question', $questionid) or record_exists('quiz_states', 'originalquestion', $questionid)) { if (!set_field('quiz_questions', 'hidden', 1, 'id', $questionid)) { error('Was not able to hide question'); } } else { delete_records("quiz_questions", "id", $questionid); } } } redirect("edit.php"); } else { error("Confirmation string was incorrect"); } } else { // teacher still has to confirm // make a list of all the questions that are selected $rawquestions = $_POST; $questionlist = ''; // comma separated list of ids of questions to be deleted $questionnames = ''; // string with names of questions separated by <br /> with // an asterix in front of those that are in use $inuse = false; // set to true if at least one of the questions is in use foreach ($rawquestions as $key => $value) { // Parse input for question ids if (substr($key, 0, 1) == "q") { $key = substr($key,1); $questionlist .= $key.','; if (record_exists('quiz_question_instances', 'question', $key) or record_exists('quiz_states', 'originalquestion', $key)) { $questionnames .= '* '; $inuse = true; } $questionnames .= get_field('quiz_questions', 'name', 'id', $key).'<br />'; } } if (!$questionlist) { // no questions were selected redirect('edit.php'); } $questionlist = rtrim($questionlist, ','); // Add an explanation about questions in use if ($inuse) { $questionnames .= get_string('questionsinuse', 'quiz'); } print_header_simple($streditingquestions, '', "<a href=\"index.php?id=$course->id\">$strquizzes</a>". " -> $streditingquestions"); notice_yesno(get_string("deletequestionscheck", "quiz", $questionnames), "edit.php?sesskey=$USER->sesskey&deleteselected=$questionlist&confirm=".md5($questionlist), "edit.php"); print_footer($course); exit; } } if (isset($_REQUEST['setgrades']) and confirm_sesskey()) { /// The grades have been updated, so update our internal list $rawgrades = $_POST; unset($modform->grades); foreach ($rawgrades as $key => $value) { // Parse input for question -> grades if (substr($key, 0, 1) == "q") { $key = substr($key,1); $modform->grades[$key] = $value; quiz_update_question_instance($modform->grades[$key], $key, $modform->instance); } } // If rescaling is required save the new maximum if (isset($_REQUEST['maxgrade'])) { $modform->grade = optional_param('maxgrade', 0); if (!set_field('quiz', 'grade', $modform->grade, 'id', $modform->instance)) { error('Could not set new maximal grade for quiz'); } } } if (isset($_REQUEST['cat'])) { /// coming from category selection drop-down menu $modform->category = $cat; $page = 0; $modform->page = 0; } if(isset($_REQUEST['recurse'])) { $SESSION->quiz_recurse = optional_param('recurse', 0, PARAM_BOOL); } if(isset($_REQUEST['showbreaks'])) { $SESSION->quiz_showbreaks = optional_param('showbreaks', 0, PARAM_BOOL); } if(isset($_REQUEST['showhidden'])) { $SESSION->quiz_showhidden = optional_param('showhidden', 0, PARAM_BOOL); } /// Delete any teacher preview attempts if the quiz has been modified if (isset($_REQUEST['setgrades']) or isset($_REQUEST['delete']) or isset($_REQUEST['repaginate']) or isset($_REQUEST['addrandom']) or isset($_REQUEST['addquestion']) or isset($_REQUEST['up']) or isset($_REQUEST['down']) or isset($_REQUEST['add'])) { delete_records('quiz_attempts', 'preview', '1', 'quiz', $modform->id); } /// all commands have been dealt with, now print the page if (empty($modform->category) or !record_exists('quiz_categories', 'id', $modform->category)) { $category = quiz_get_default_category($course->id); $modform->category = $category->id; } if (!isset($SESSION->quiz_recurse)) { $SESSION->quiz_recurse = 1; } if (!isset($SESSION->quiz_showhidden)) { $SESSION->quiz_showhidden = false; } if (!isset($SESSION->quiz_showbreaks)) { $SESSION->quiz_showbreaks = ($CFG->quiz_questionsperpage < 2) ? 0 : 1; } $SESSION->modform = $modform; // Print basic page layout. if (isset($modform->instance) and record_exists_sql("SELECT * FROM {$CFG->prefix}quiz_attempts WHERE quiz = '$modform->instance' AND preview = '0' LIMIT 1")){ // one column layout with table of questions used in this quiz $strupdatemodule = isteacheredit($course->id) ? update_module_button($modform->cmid, $course->id, get_string('modulename', 'quiz')) : ""; print_header_simple($streditingquiz, '', "<a href=\"index.php?id=$course->id\">$strquizzes</a>". " -> <a href=\"view.php?q=$modform->instance\">".format_string($modform->name).'</a>'. " -> $streditingquiz", "", "", true, $strupdatemodule); $currenttab = 'edit'; $quiz = &$modform; include('tabs.php'); print_simple_box_start("center"); $attemptcount = count_records('quiz_attempts', 'quiz', $modform->instance, 'preview', 0); $strviewallanswers = get_string("viewallanswers","quiz",$attemptcount); $strattemptsexist = get_string("attemptsexist","quiz"); $usercount = count_records_select('quiz_attempts', "quiz = '$modform->id' AND preview = '0'", 'COUNT(DISTINCT userid)'); $strusers = $course->students; if (! $cm = get_coursemodule_from_instance("quiz", $modform->instance, $course->id)) { error("Course Module ID was incorrect"); } echo "<center>\n"; echo "$strattemptsexist<br /><a href=\"report.php?mode=overview&id=$cm->id\">$strviewallanswers ($usercount $strusers)</a>"; echo "<form target=\"_parent\" method=\"get\" action=\"$CFG->wwwroot/mod/quiz/edit.php\">\n"; echo " <input type=\"hidden\" name=\"courseid\" value=\"$course->id\" />\n"; echo " <input type=\"submit\" value=\"".get_string("editcatquestions", "quiz")."\" />\n"; echo "</form>"; echo "</center><br/ >\n"; $sumgrades = quiz_print_question_list($modform, false, $SESSION->quiz_showbreaks); if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $modform->instance)) { error('Failed to set sumgrades'); } print_simple_box_end(); print_footer($course); exit; } if (!isset($modform->instance)) { // one column layout for non-quiz-specific editing page print_header_simple($streditingquestions, '', "<a href=\"index.php?id=$course->id\">$strquizzes</a>". " -> $streditingquestions"); echo '<table align="center" border="0" cellpadding="2" cellspacing="0">'; echo '<tr><td valign="top">'; } else { // two column layout with quiz info in left column $strupdatemodule = isteacheredit($course->id) ? update_module_button($modform->cmid, $course->id, get_string('modulename', 'quiz')) : ""; print_header_simple($streditingquiz, '', "<a href=\"index.php?id=$course->id\">$strquizzes</a>". " -> <a href=\"view.php?q=$modform->instance\">".format_string($modform->name).'</a>'. " -> $streditingquiz", "", "", true, $strupdatemodule); $currenttab = 'edit'; $quiz = &$modform; include('tabs.php'); echo '<table border="0" width="100%" cellpadding="2" cellspacing="0">'; echo '<tr><td width="50%" valign="top">'; print_simple_box_start("center", "100%"); $sumgrades = quiz_print_question_list($modform, true, $SESSION->quiz_showbreaks); if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $modform->instance)) { error('Failed to set sumgrades'); } print_simple_box_end(); echo '</td><td valign="top" width="50%">'; } // non-quiz-specific column print_simple_box_start("center", "100%"); // starts with category selection form quiz_print_category_form($course, $modform->category, $SESSION->quiz_recurse, $SESSION->quiz_showhidden); print_simple_box_end(); print_spacer(5,1); // continues with list of questions print_simple_box_start("center", "100%"); quiz_print_cat_question_list($course, $modform->category, isset($modform->instance) ? $modform->instance : 0, $SESSION->quiz_recurse, $page, $perpage, $SESSION->quiz_showhidden); print_simple_box_end(); if (!isset($modform->instance)) { print_continue("index.php?id=$modform->course"); } echo '</td></tr>'; echo '</table>'; $streditquizleveloptions = get_string('editquizrqpoptions','quiz'); //Print RQP quiz level teacher options //Only allow selection of RQP types actually used in quiz if ($QUIZ_RQP_TYPES = quiz_rqp_get_types()) { if (count($QUIZ_RQP_TYPES)!=0) { echo "<td valign=\"top\"><b>$streditquizleveloptions:</b></td>"; echo '<td valign="top" align="right">'; popup_form ("edit.php?quizid=$quizid&type=", $QUIZ_RQP_TYPES, "teacheroptions", "", "choose", "", "", false, "self"); echo '</td><td width="10" valign="top" align="right">'; helpbutton("options", $streditquizleveloptions, "quiz"); echo '</td></tr>'; } } //If the type optional parameter has been set, and is greater than 0, pop up options dialog for specified RQP type if ($type!=0) { quiz_rqp_optionsDialog('teacherOptions', $type, "", "", $quiz->id); } print_footer($course); ?> --- NEW FILE: index.php --- <?php // $Id: index.php,v 1.1 2005/10/05 11:43:44 pkiddie Exp $ /** * This page lists all the instances of quiz in a particular course * * @version $Id: index.php,v 1.1 2005/10/05 11:43:44 pkiddie Exp $ * @author Martin Dougiamas and many others. * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ require_once("../../config.php"); require_once("locallib.php"); require_variable($id); // course $options = optional_param('options', 0, PARAM_INT); //if options form is to be displayed $type = optional_param('type', 0, PARAM_INT); //where user has selected a type to display course options for if (! $course = get_record("course", "id", $id)) { error("Course ID is incorrect"); } require_login($course->id); add_to_log($course->id, "quiz", "view all", "index.php?id=$course->id", ""); // Print the header $strquizzes = get_string("modulenameplural", "quiz"); $streditquestions = isteacheredit($course->id) ? "<form target=\"_parent\" method=\"get\" " ." action=\"$CFG->wwwroot/mod/quiz/edit.php\">" ."<input type=\"hidden\" name=\"courseid\" " ." value=\"$course->id\" />" ."<input type=\"submit\" " ." value=\"".get_string("editquestions", "quiz")."\" /></form>" : ""; $strquiz = get_string("modulename", "quiz"); print_header_simple("$strquizzes", "", "$strquizzes", "", "", true, $streditquestions, navmenu($course)); // Get all the appropriate data if (! $quizzes = get_all_instances_in_course("quiz", $course)) { notice("There are no quizzes", "../../course/view.php?id=$course->id"); die; } // Print the list of instances (your module will probably extend this) $timenow = time(); $strname = get_string("name"); $strweek = get_string("week"); $strtopic = get_string("topic"); $strbestgrade = get_string("bestgrade", "quiz"); $strquizcloses = get_string("quizcloses", "quiz"); $strattempts = get_string("attempts", "quiz"); $strusers = $course->students; if (isteacher($course->id)) { $gradecol = $strattempts; } else { $gradecol = $strbestgrade; } if ($course->format == "weeks") { $table->head = array ($strweek, $strname, $strquizcloses, $gradecol); $table->align = array ("center", "left", "left", "left"); $table->size = array (10, "", "", ""); } else if ($course->format == "topics") { $table->head = array ($strtopic, $strname, $strquizcloses, $gradecol); $table->align = array ("center", "left", "left", "left"); $table->size = array (10, "", "", ""); } else { $table->head = array ($strname, $strquizcloses, $gradecol); $table->align = array ("left", "left", "left"); $table->size = array ("", "", ""); } $currentsection = ""; foreach ($quizzes as $quiz) { if (!$quiz->visible) { //Show dimmed if the mod is hidden $link = "<a class=\"dimmed\" href=\"view.php?id=$quiz->coursemodule\">".format_string($quiz->name,true)."</a>"; } else { //Show normal if the mod is visible $link = "<a href=\"view.php?id=$quiz->coursemodule\">".format_string($quiz->name,true)."</a>"; } $bestgrade = quiz_get_best_grade($quiz, $USER->id); $printsection = ""; if ($quiz->section !== $currentsection) { if ($quiz->section) { $printsection = $quiz->section; } if ($currentsection !== "") { $table->data[] = 'hr'; } $currentsection = $quiz->section; } $closequiz = $quiz->timeclose ? userdate($quiz->timeclose) : ''; if (isteacher($course->id)) { if ($usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)')) { $attemptcount = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0); $strviewallreports = get_string('viewallreports', 'quiz', $attemptcount); $gradecol = "<a href=\"report.php?mode=overview&q=$quiz->id\">$strviewallreports ($usercount $strusers)</a>"; } else { $answercount = 0; $gradecol = ""; } } else { if ($bestgrade === NULL || $quiz->grade == 0) { $gradecol = ""; } else { $gradecol = "$bestgrade / $quiz->grade"; } } if ($course->format == "weeks" or $course->format == "topics") { $table->data[] = array ($printsection, $link, $closequiz, $gradecol); } else { $table->data[] = array ($link, $closequiz, $gradecol); } } echo "<br />"; print_table($table); $streditcourseleveloptions = get_string('editcourserqpoptions','quiz'); // Now print RQP teacher options if (isteacheredit($course->id)) { if ($QUIZ_RQP_TYPES = quiz_rqp_get_types()) { if (count($QUIZ_RQP_TYPES)!=0) { echo "<td valign=\"top\"><b>$streditcourseleveloptions:</b></td>"; echo '<td valign="top" align="right">'; popup_form ("index.php?id=$id&options=1&type=", $QUIZ_RQP_TYPES, "teacheroptions", "", "choose", "", "", false, "self"); echo '</td><td width="10" valign="top" align="right">'; helpbutton("teacheroptions",$streditcourseleveloptions, "quiz"); echo '</td></tr>'; } } } if ($type!=0) { quiz_rqp_optionsDialog('teacherOptions', $type, $course->id); } // Finish the page print_footer($course); ?> |
From: pkiddie <pk...@us...> - 2005-10-05 11:44:21
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4725/scripts/rqp/moodle_16_rqp/quiz/db Modified Files: mysql.php postgres7.php Log Message: Latest version of RQPServer and client Implemented options Error reporting Index: mysql.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/db/mysql.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mysql.php 12 Sep 2005 09:46:59 -0000 1.1 --- mysql.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 912,918 **** options longblob NOT NULL default '')"); ! //Quiz options execute_sql('ALTER TABLE '.$CFG->prefix."quiz_rqp ADD `options` longblob NOT NULL default ''"); } return true; --- 912,926 ---- options longblob NOT NULL default '')"); ! //Question Options execute_sql('ALTER TABLE '.$CFG->prefix."quiz_rqp ADD `options` longblob NOT NULL default ''"); } + + if ($oldversion < 2005093000) { + //Quiz options + execute_sql('CREATE TABLE '.$CFG->prefix."quiz_rqp_quiz_options (id INT( 10 ) UNSIGNED PRIMARY KEY AUTO_INCREMENT, + quizid INT( 10 ) UNSIGNED NOT NULL, + typeid INT( 10 ) UNSIGNED NOT NULL, + options longblob NOT NULL default '')"); + } return true; Index: postgres7.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/db/postgres7.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** postgres7.php 12 Sep 2005 09:46:59 -0000 1.1 --- postgres7.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 1007,1010 **** --- 1007,1017 ---- modify_database('',"ALTER TABLE prefix_quiz_rqp ADD options TEXT NOT NULL default ''"); } + + if ($oldversion < 2005093000) { + modify_database('',"CREATE TABLE prefix_quiz_rqp_quiz_options (id SERIAL PRIMARY KEY, + quizid integer NOT NULL default '0', + typeid integer NOT NULL default '0', + options TEXT NOT NULL default '');"); + } |
From: pkiddie <pk...@us...> - 2005-10-05 11:43:57
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang/en/help/quiz In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4725/scripts/rqp/moodle_16_rqp/lang/en/help/quiz Added Files: options.html Log Message: Latest version of RQPServer and client Implemented options Error reporting --- NEW FILE: options.html --- <p align="center"><b>Setting options for RQP question types</b></p> <p>Using RQP the teacher, administrator and user all have control of particular options set at particular levels:</p> <p><b>Administrator Options</b></p> <ul> <p>These options are set at the quiz module administration level.</p> </ul> <p><b>Teacher Options</b></p> <ul> <p>The teacher may set options for the RQP question type at the quiz level and/or at the course level. If no options are set at the quiz level, then course level options are used, and if these have not been set, then the option defaults are assumed.</p> </ul> <p><b>User Options</b></p> <ul> <p>These options can be set whenever the Remote Question protocol is used to render an assessment item.</p> </ul> |
From: pkiddie <pk...@us...> - 2005-10-05 11:43:57
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4725/scripts/rqp/moodle_16_rqp/quiz/lang/en Modified Files: quiz.php Log Message: Latest version of RQPServer and client Implemented options Error reporting Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/lang/en/quiz.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** quiz.php 12 Sep 2005 09:46:59 -0000 1.1 --- quiz.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 23,26 **** --- 23,28 ---- $string['serverinuse'] = 'This server is the last remaining $a type, which will make some existing questions unavailable.'; $string['adminOptions'] = 'Administrator Options'; + $string['teacherOptions'] = 'Teacher Options'; + $string['userOptions'] = 'User Options'; $string['norqptype'] = 'No remote question type specified'; $string['invalidrqptype'] = 'Invalid remote question type'; *************** *** 28,32 **** $string['noserverforrqptype'] = 'Could not retrieve server for this RQP type'; $string['invalidoptiontype'] = 'The type of options has not been specified'; ! ! ?> --- 30,46 ---- $string['noserverforrqptype'] = 'Could not retrieve server for this RQP type'; $string['invalidoptiontype'] = 'The type of options has not been specified'; ! $string['editcourserqpoptions'] = 'Edit course-level RQP options for type'; ! $string['editquizrqpoptions'] = 'Edit quiz-level RQP options for type'; ! $string['errorloadteacheroptions'] = 'Could not load teacher options for specified type. <br/>More information: both quizid and courseid not set!'; ! $string['options'] = 'Set Options'; ! $string['adminuseronly'] = 'You need to be an admin user to use this page.'; ! $string['nowebservice'] = 'The chosen server does not offer web services. Please try another'; ! $string['errorprocrequest'] = 'This server has experienced an error whilst processing your request. More information: '; ! $string['notsavetype'] = 'Could not save type'; ! $string['notsaveserver'] = 'Could not save server'; ! $string['notsavemimetypes'] = 'Could not save mimetypes for server'; ! $string['noadminoptionstoset'] = 'No administrator options to set for selected RQP type'; ! $string['noteacheroptionstoset'] = 'No teacher options to set for selected RQP type'; ! $string['nouseroptionstoset'] = 'No user options to set for selected RQP type'; ! $string['servernotresponding'] = 'The server URL supplied does not seem to be responding. Please try again later'; ?> |
From: pkiddie <pk...@us...> - 2005-10-05 11:43:57
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4725/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp Modified Files: editquestion.php lib.php options.php questiontype.php types.php Log Message: Latest version of RQPServer and client Implemented options Error reporting Index: lib.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp/lib.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lib.php 12 Sep 2005 09:46:59 -0000 1.1 --- lib.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 22,25 **** --- 22,28 ---- define ('RQP_VER','1.0'); + //This global array holds an ordered, up to date list of all RQP types + $rqpTypes = array(); + /** * Checks the current version of PHP and uses the correct instance checking function, based *************** *** 50,65 **** } /** ! * Create an option dialog and pass $optionType and $type to options.php script by GET method */ ! function quiz_rqp_optionsDialog($optionType, $type) { $jsOpenOptions = '<script language="javascript" type="text/javascript">'; ! $jsOpenOptions .= 'javascript:'; ! $jsOpenOptions .= "window.open('options.php?typeid=$type&optionstype=$optionType','optionspopup', ! 'left=20,top=20,width=500,height=500,toolbar=0,resizable=1')"; $jsOpenOptions .= '</script>'; echo $jsOpenOptions; } --- 53,145 ---- } + //For a specified type, retrieve the administrators options + function quiz_rqp_get_admin_options($typeid) { + + if (!$adminOptions = get_record('quiz_rqp_types', 'id', $typeid)) { + return false; + } + + else return $adminOptions->options; + } + + //For a specified user and RQP server type, retrieve the user options + function quiz_rqp_get_user_options($userid, $typeid) { + if (!$userOptions = get_record('quiz_rqp_user_options', 'userid', $userid, 'typeid', $typeid)) { + return false; + } + + else return $userOptions->options; + } + + //For a specified quiz and RQP server type, retrieve the quiz options (part of the teacher options) + function quiz_rqp_get_quiz_options($quizid, $typeid) { + if (!$quizOptions = get_record('quiz_rqp_quiz_options', 'quizid', $quizid, 'typeid', $typeid)) { + return false; + } + + else return $quizOptions->options; + } + + //For a specified course and RQP server type, retrieve the course options (part of the teacher options) + function quiz_rqp_get_course_options($courseid, $typeid) { + if (!$courseOptions = get_record('quiz_rqp_course_options', 'courseid', $courseid, 'typeid', $typeid)) { + return false; + } + + else return $courseOptions->options; + } + + //For a specified course, quiz and RQP server type, retrieve the teachers options (quiz options, if they exist + //override the course options + //TODO: Some options manipulation here, as course options and quiz options under umbrella of 'teacher' options. + //These options strings are RQP server specific, in STACK's case each option represented in as a value in an array + //So this is the functionality atm + function quiz_rqp_get_teacher_options($quizid, $courseid, $typeid) { + + //1. Get quiz options and use as teacherOptions if they exist + if (!$teacherOptions = quiz_rqp_get_quiz_options($quizid,$typeid)) { + //1.1 Unsuccessful, so use course options, if they exist + $teacherOptions = quiz_rqp_get_course_options($courseid, $typeid); + } + + return $teacherOptions; //false if no quiz/course options found for RQP type + //otherwise serialsied options string + } + /** ! * Create an option dialog and pass required parameters to the options.php script by GET method ! * optionType can be one of userOptions, teacherOptions, adminOptions */ ! function quiz_rqp_optionsDialog($optionType, $type="", $course="", $user="", $quiz="") { + global $CFG; + + //Echo javascript to open an optionsDialog with specified parameters $jsOpenOptions = '<script language="javascript" type="text/javascript">'; ! $jsOpenOptions .= 'javascript:'; ! $jsOpenOptions .= "window.open('".s($CFG->wwwroot)."/mod/quiz/questiontypes/rqp/options.php?optionstype=$optionType&typeid=$type&courseid=$course&userid=$user&quizid=$quiz','optionspopup', ! 'left=20,top=20,width=500,height=500,toolbar=0,resizable=1,scrollbars=yes')"; ! $jsOpenOptions .= '</script>'; echo $jsOpenOptions; + } + + //Get a list of RQP question types from the quiz_rqp_types table and return to calling function + //Used in course/quiz level options, to set the options for a particular RQP question type + function quiz_rqp_get_types() + { + if (!$rqp_types = get_records('quiz_rqp_types')) { + return false; + } + + //else + $rqpQuestionTypes = array(); + + foreach($rqp_types as $rqp_type) { + $rqpQuestionTypes[$rqp_type->id] = $rqp_type->name; + } + + return $rqpQuestionTypes; } *************** *** 193,207 **** } ! function quiz_rqp_debug_soap($item) { ! global $CFG; ! if ($CFG->debug) { ! echo 'Here is the dump of the soap fault:<pre>'; ! var_dump($item); ! echo '<pre>'; ! } } //Returns a server url given a specified type, by randomly selecting a server ! function quiz_rqp_get_server($typeid) { if (!$servers = get_records('quiz_rqp_servers', 'typeid', $typeid)) { --- 273,448 ---- } ! //Used in types.php to ensure that the server can be communicated to, before sending web service request ! function quiz_rqp_check_server($url, $serverid=0) { ! $timeLimit = 20; ! ! if ($serverid!=0) { ! $server = get_record('quiz_rqp_servers', 'id', $serverid); ! $urldata = parse_url($server->url); ! } ! ! else $urldata = parse_url($url); ! ! if(!array_key_exists('port', $urldata)) { ! $urldata['port']=80; ! } ! ! $sock = @fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); //run silently ! ! @stream_set_timeout($sock, 2); ! @stream_set_blocking($sock, false); ! ! //If connection established ! if ($sock) { ! @fclose($sock); ! return true; ! } ! ! //No connection could be established ! else if (!$sock) { ! @fclose($sock); ! return false; ! } ! } ! function quiz_rqp_initialise() { ! global $rqpTypes; ! ! //Go through each type and each server, adding [] -> [type] -> [serverid],[url] to $rqpType array ! if ($types = get_records('quiz_rqp_types')) ! { ! foreach ($types as $type) { ! if ($servers = get_records('quiz_rqp_servers', 'typeid', $type->id)) { ! ! shuffle($servers); ! ! foreach ($servers as $server) { ! $rqpTypes[$type->id][] = $server->id; ! } ! } ! } ! } ! } ! ! //Will be called by the types.php function, if a server is added/removed ! //Check that this type exists within $rqpTypes, if not, add it and the new server ! function quiz_rqp_add_server($typeid, $serverid) { ! global $rqpTypes; ! ! $rqpTypes[$typeid][] = $serverid; } + //This function called by types.php function if a server is removed + //In this case, check if there are any other servers of a type, if not remove that type + function quiz_rqp_remove_server($typeid, $serverid) { + global $rqpTypes; + + if(array_key_exists($typeid, $rqpTypes)) { + $servers = $rqpTypes[$typeid]; + + for ($i=0;$i<count($servers);$i++) { + + if($servers[$i]==$serverid) { + //We have found our match, now remove it + $servers = array_delete($servers, $i); + + break; + } + } + + //Count the nunber of $servers left + if(count($servers)==0) { + array_delete($rqpTypes, $typeid); + } + + else { //if at least one server left of that type + //Update server list + $rqpTypes[$typeid] = $servers; + } + } + } + + //Removes an item indexed by a $item key. Then re-orders + function array_delete($array, $item) { + if (isset($array[$item])) + unset($array[$item]); + + return array_merge($array); + + } + + //Responsible for initialising server list and keeping up to date, with servers that work the best up the top! + function quiz_rqp_get_server($typeid) { + global $rqpTypes; + + $timeLimit = 20; + + if (empty($rqpTypes)) { + quiz_rqp_initialise(); + } + + //Now check for the typeid that a server exists that we can use + if(array_key_exists($typeid, $rqpTypes)) { + if(count($rqpTypes[$typeid]>0)) { + $servers = $rqpTypes[$typeid]; //help readability only + + for ($i=0;$i<count($servers);$i++) { //iterate through each server in order! + $server = get_record('quiz_rqp_servers', 'id', $servers[$i]); + + $urldata = parse_url($server->url); + if(!array_key_exists('port', $urldata)) { + $urldata['port']=80; + } + + $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); + + stream_set_timeout($sock, 2); + stream_set_blocking($sock, false); + + //If connection established + if ($sock) { + fclose($sock); + $temp = $servers[$i]; + $servers = array_delete($servers, $i); //Remove from original position + array_unshift($servers, $temp); //Push this server up to the top of the new list + + unset($temp); + break; + } + + //No connection could be established, keep iterating + else if (!$sock) { + $server=false; + fclose($sock); + } + } + + //Remember to update $rqpTypes array + $rqpTypes[$typeid] = $servers; + } + + //count = 0 + else $server = false; + } + + //no servers of particular type found + else $server = false; + + return $server; //either false or an actual server! + } + + //Returns a server url given a specified type, by randomly selecting a server ! //<TODO>Need to keep a single list of servers, possibly within session variable, check with Gustav ! //takes rqpType as a global array ! function quiz_rqp_get_server_old($typeid) { ! global $rqpTypes; ! ! $timeLimit = 20; //default time limit before timeout for particular server ! ! //Initialise list of servers within $rqpTypes, which will be managed by this function ! if (empty($rqpTypes)) { ! quiz_rqp_initialise(); ! } ! if (!$servers = get_records('quiz_rqp_servers', 'typeid', $typeid)) { *************** *** 209,242 **** } ! shuffle($servers); ! return $servers[0]; ! } ! ! function quiz_rqp_get_server_old($typeid) { ! ! if (!array_key_exists($typeid, $remote_connections)) { ! // get the available servers ! if (!$servers = get_records('quiz_rqp_servers', 'typeid', $typeid)) { ! // we don't have a server for this question type ! return false; ! } ! // put them in a random order ! shuffle($servers); ! // go through them and try to connect to each until we are successful ! foreach ($servers as $server) { ! if ($remote_connections[$typeid] = rqp_connect($server->url)) { ! break; // we have a connection ! } else { ! // We have a dead server here, should somehow flag that ! } } } ! // check that we did get a connection ! if (!$remote_connections[$typeid]) { ! unset($remote_connections[$typeid]); ! return false; ! } ! return true; } ?> --- 450,485 ---- } ! shuffle($servers); //put servers in a random order ! foreach ($servers as $server) { ! //go through each of them and try to communicate with server till successful ! $urldata = parse_url($server->url); ! if(!array_key_exists('port', $urldata)) { ! $urldata['port']=80; } + + $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); + + stream_set_timeout($sock, 2); + stream_set_blocking($sock, false); + + //If connection established + if ($sock) { + fclose($sock); + + //push this server up to the top of the new list + break; + } + + //No connection could be established + //Keep iterating + //<TODO> What do we do with this dead server + else if (!$sock) { + $server=false; + fclose($sock); + } } ! ! return $server; //either false or an actual server! } ?> Index: questiontype.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp/questiontype.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** questiontype.php 12 Sep 2005 09:46:59 -0000 1.1 --- questiontype.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 12,16 **** require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php'); - //require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/remote.php'); require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/RQPv1p0Client.php'); --- 12,15 ---- *************** *** 315,319 **** */ function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { ! global $CFG; require_once("RQPv1p0Client.php"); --- 314,324 ---- */ function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { ! global $CFG, $USER; ! ! $courseid = $cmoptions->course; ! $typeid = $question->options->type; ! $userid = $USER->id; ! $quizid = $cmoptions->id; //Is this the quizid? ! $struseroptions = get_string('userOptions','quiz'); require_once("RQPv1p0Client.php"); *************** *** 336,345 **** //Initialise render parameters $render['source'] = $question->options->source; ! $render['options'] = array ( 'admin' => '' , ! 'teacher' => 'current quiz name', ! 'user' => '', ! 'user-agent' => '', ! 'accept' => '', ! 'language' => ''); $render['persistentData']= ''; --- 341,350 ---- //Initialise render parameters $render['source'] = $question->options->source; ! $render['options'] = array ( 'admin' => quiz_rqp_get_admin_options($question->options->type) , ! 'teacher' => quiz_rqp_get_teacher_options($quizid, $courseid, $typeid), ! 'user' => quiz_rqp_get_user_options($USER->id, $question->options->type), ! 'user-agent' => $_SERVER['HTTP_USER_AGENT'], ! 'accept' => $_SERVER['HTTP_ACCEPT'], ! 'language' => current_language()); $render['persistentData']= ''; *************** *** 362,365 **** --- 367,371 ---- //Check SOAP fault has not been returned if (is_instance_of($output,'nbSOAPFault')) { + print_r($output); notify('SOAP fault returned. Please try again!'); unset($output); *************** *** 405,409 **** //5. Any STACK responses ! if ($options->validation) { if (!empty($output['output']['response'])) { echo '<div class="RQPresponse">'; --- 411,416 ---- //5. Any STACK responses ! if ($options->validation) { ! if (!empty($output['output']['response'])) { echo '<div class="RQPresponse">'; *************** *** 414,421 **** //6. Answer where required ! if (!empty($output['output']['answer'])) { echo '<div class="RQPanswer">'; echo html_entity_decode($output['output']['answer']); echo '</div>'; } --- 421,430 ---- //6. Answer where required ! if ($options->correct_responses) { ! if (!empty($output['output']['answer'])) { echo '<div class="RQPanswer">'; echo html_entity_decode($output['output']['answer']); echo '</div>'; + } } *************** *** 429,432 **** --- 438,446 ---- } + if ($server->properties & RQP_SERVER_USEROPTIONS) { + echo "<a title=\"$struseroptions\" href=\"javascript:void();\" onClick=\"openpopup('/mod/quiz/questiontypes/rqp/options.php?typeid=$server->typeid&userid=$USER->id&optionstype=userOptions','useroptions', + 'scrollbars=yes,resizable=yes,width=500,height=500', false)\">Edit user options</a>\n"; + } + // Remove the render output created during grading (if any) unset($state->options->renderoutput); *************** *** 478,482 **** */ function grade_responses(&$question, &$state, $cmoptions) { ! global $CFG; require_once("RQPv1p0Client.php"); --- 492,501 ---- */ function grade_responses(&$question, &$state, $cmoptions) { ! global $CFG, $USER; ! ! $courseid = $cmoptions->course; ! $typeid = $question->options->type; ! $userid = $USER->id; ! $quizid = $cmoptions->id; //Is this the quizid? require_once("RQPv1p0Client.php"); *************** *** 488,502 **** //Initialise render parameters $render['source'] = $options->source; ! $render['options'] = array ( 'admin' => '' , ! 'teacher' => 'current quiz name', ! 'user' => '', ! 'user-agent' => '', ! 'accept' => '', ! 'language' => ''); ! $render['persistentData']= ''; ! ! $render['directives'] = array(''); ! $render['mimetypes'] = array('text/html');; $render['namePrefix'] = $question->name_prefix; --- 507,519 ---- //Initialise render parameters $render['source'] = $options->source; ! $render['options'] = array ( 'admin' => quiz_rqp_get_admin_options($typeid) , ! 'teacher' => quiz_rqp_get_teacher_options($quizid, $courseid, $typeid), ! 'user' => quiz_rqp_get_user_options($userid, $typeid), ! 'user-agent' => $_SERVER['HTTP_USER_AGENT'], ! 'accept' => $_SERVER['HTTP_ACCEPT'], ! 'language' => current_language()); ! $render['persistentData']= $state->options->persistent_data; ! $render['directives'] = array(''); $render['mimetypes'] = array('text/html');; $render['namePrefix'] = $question->name_prefix; *************** *** 512,518 **** } if (QUIZ_EVENTGRADE == $state->event ! || QUIZ_EVENTCLOSE == $state->event) ! { $render['directives'][] = 'advanceState'; } --- 529,536 ---- } + //Advance the state where applicable if (QUIZ_EVENTGRADE == $state->event ! || QUIZ_EVENTCLOSE == $state->event ! || QUIZ_EVENTVALIDATE == $state->event) { $render['directives'][] = 'advanceState'; } *************** *** 536,539 **** --- 554,558 ---- if (is_instance_of($output,'nbSOAPFault')) { notify('SOAP fault returned. Please try again!'); + print_r($output); unset($output); return false; *************** *** 592,595 **** --- 611,615 ---- $link->name = 'managetypes'; $link->link = 'types.php'; + return array($link); } Index: editquestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp/editquestion.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editquestion.php 12 Sep 2005 09:46:59 -0000 1.1 --- editquestion.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 3,7 **** require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php'); ! $strbacktoquiz = get_string("backtoquiz", "quiz"); //Here we must decide whether to display the RQP servers authoring form, or use the generic one --- 3,8 ---- require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php'); ! $strbacktoquiz = get_string("backtoquiz", "quiz"); ! $struseroptions = get_string("userOptions", "quiz"); //Here we must decide whether to display the RQP servers authoring form, or use the generic one *************** *** 16,20 **** $question->options->type = $typeid; $question->options->source = ''; - //$question->options->format = ''; } --- 17,20 ---- *************** *** 47,52 **** 'accept' => '', 'language' => ''); ! ! $render['persistentData']= ''; //not used in authoring $render['directives'] = array('edit'); --- 47,57 ---- 'accept' => '', 'language' => ''); ! ! if (!empty($SESSION->persistent_data)) { ! $render['persistentData']= $SESSION->options->persistent_data; //not used in authoring ! } ! ! //On first render operation ! else $render['persistentData'] = ''; $render['directives'] = array('edit'); *************** *** 77,80 **** --- 82,88 ---- $render['namePrefix'],$render['itemBase'], $render['resourceBase'],$render['tempfileBase']); + + //Set any persistent data in the session variable + $SESSION->persistent_data = $response['persistentData']; //Construct RQP server form: we always post back to question.php to perform form processing *************** *** 83,87 **** echo '<input type="hidden" name="type" value="'.$type->id.'"/>'; //TODO: both type and typeid are used, echo '<input type="hidden" name="typeid" value="'.$type->id.'"/>'; //but represent same value! - //$typeid var disused echo '<input type="hidden" name="completion" value="'.$response['outcomeVars']['completion'].'"/>'; --- 91,94 ---- *************** *** 90,93 **** --- 97,106 ---- echo html_entity_decode($response['output']['body']); + //Pop-up for user options + if ($server->properties & RQP_SERVER_USEROPTIONS) { + echo "<a title=\"$struseroptions\" href=\"javascript:void();\" onClick=\"openpopup('/mod/quiz/questiontypes/rqp/options.php?typeid=$typeid&userid=$USER->id&optionstype=userOptions','useroptions', + 'scrollbars=yes,resizable=yes,width=500,height=500', false)\">Edit user options</a>\n"; + } + if ("complete"!=$response['outcomeVars']['completion']) { $QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz); *************** *** 111,114 **** --- 124,128 ---- echo '<input type="hidden" name="source" value="'.$response['outcomeVars']['source'].'"/>'; echo '<input type="hidden" name="name" value="'.$response['output']['title'].'"/>'; + } Index: options.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp/options.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** options.php 12 Sep 2005 09:46:59 -0000 1.1 --- options.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 5,18 **** require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php'); ! $type = optional_param('typeid', 0, PARAM_INT); //if of RQP type for which to set options for ! //$course = optional_param('courseid', 0, PARAM_INT); ! //$quiz = optional_param('quizid', 0, PARAM_INT); ! $optionsType = optional_param('optionstype'); //type of options that should be displayed ! // Check user admin require_login(); ! if (!isadmin()) { error('You need to be an admin user to use this page.', $CFG->wwwroot . '/login/index.php'); } if (!$site = get_site()) { --- 5,26 ---- require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php'); ! require_variable($typeid); //rqp type to set options for. Necessary in all cases for setting options ! require_variable($optionstype); //options type: one of adminOptions, teacherOptions, userOptions. ! $course = optional_param('courseid', 0, PARAM_INT); //if setting teacher options at course level ! $quiz = optional_param('quizid', 0, PARAM_INT); //if setting teacher options at quiz level ! $user = optional_param('userid', 0, PARAM_INT); //if setting user options during rendering ! ! // Check for correct user require_login(); ! ! //If called in context of adminOptions - must be the administrator ! if (!isadmin() && empty($course) && empty($quiz) && empty($user)) { error('You need to be an admin user to use this page.', $CFG->wwwroot . '/login/index.php'); } + + if (!isteacher() && !empty($course) && !empty($quiz)) { //If called in context of teacherOptions - must be teacher of course + error('You need to be a teacher user to use this page.', $CFG->wwwroot . '/login/index.php'); + } if (!$site = get_site()) { *************** *** 21,96 **** $strmodulename = get_string('modulename', 'quiz'); ! $stritemtypes = get_string('itemtypes', 'quiz'); ! $navigation = '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/index.php">' . get_string('admin') . '</a> -> ' . ! '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/configure.php">' . get_string('configuration') . '</a> -> ' . ! '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/modules.php">' . get_string('managemodules') . '</a> -> ' . ! '<a href="' . s($CFG->wwwroot) . '/' . s($CFG->admin) . '/module.php?module=quiz&sesskey=' . sesskey() . '">' . ! get_string('modulename', 'quiz') . '</a> -> ' . $stritemtypes; ! print_header($site->shortname . ': ' . $strmodulename . ': ' . $stritemtypes, $site->fullname, $navigation, '', '', true, '', ''); ! ! if ($type==0) { ! notify(get_string('invalidrqptype','quiz')); ! exit(); ! } ! if ($optionsType==NULL) { ! notify(get_string('invalidoptiontype','quiz')); ! } ! if ($form = data_submitted() and confirm_sesskey()) ! { ! //<TODO: Take the appropriate action depending on whether called in the context of student, teacher or admin options> ! //For now we shall just serialise into adminOptions field ! switch ($optionsType) { ! case('adminOptions') : ! { ! //Perform render operation with fields present in input data ! //1. Get type in order to get namePrefix for ! if (!$rqpType = get_record('quiz_rqp_types', 'id', $type)) { ! notify(get_string('invalidrqptype','quiz')); ! exit(); ! } ! //1. Select a server to render options for: ! if (!$server = quiz_rqp_get_server($type)) { ! notify(get_string('noserverforrqptype','quiz')); ! exit(); ! } ! ! require_once("RQPv1p0Client.php"); ! $rqpserver = new RQPv1p0(); ! $rqpserver->Url = $server->url; ! ! $render['source']="$optionsType"; //For options, source=adminOptions,teacherOptions,userOptions ! ! $render['persistentData']=''; ! $render['directives']=array('edit'); ! ! $render['mimetypes']=array('text/html');; ! $render['namePrefix']=$rqpType->name; ! $render['itemBase']=''; ! ! //Check presence of form fields which are to be processed ! if (empty($form)) { ! $render['inputData']=array(); ! } ! ! else { ! $render['inputData']=quiz_rqp_parse_input($form,$render['namePrefix']); ! } ! ! $response = $rqpserver->RQP_Render($render['source'],array(), ! $render['persistentData'],$render['inputData'], ! $render['directives'],$render['mimetypes'], ! $render['namePrefix'],$render['itemBase'], ! '',''); //Now check 'options' outcome variable for a serialised options string ! if ($old = get_record('quiz_rqp_types', 'id', $type)) { ! //Update adminOptions field ! $old->options = $response['outcomeVars']['options']; //Place adminOptions string into quiz_rqp_types table if (!update_record('quiz_rqp_types', $old)) { ! notice("Could not update current rqp type field: adminOptions! (type=$type)"); } --- 29,102 ---- $strmodulename = get_string('modulename', 'quiz'); ! $stroptions = get_string('options', 'quiz'); ! print_header($site->shortname . ': ' . $strmodulename . ': ' . $stroptions, $site->fullname, '', '', '', true, '', ''); ! //Successive attempts within options.php script ! if ($form = data_submitted() and confirm_sesskey()) { ! while (isset($form->add)) { // using like if but with support for break ! ! //Do not process request where optionsType is not one of the allowed strings ! if ($optionstype!= 'adminOptions' && $optionstype!='teacherOptions' && $optionstype!='userOptions') { ! notify(get_string('invalidoptiontype','quiz')); ! exit(); ! } ! ! //Perform render operation with fields present in input data ! //1. Get type in order to get namePrefix for ! if (!$rqpType = get_record('quiz_rqp_types', 'id', $typeid)) { ! notify(get_string('invalidrqptype','quiz')); ! exit(); ! } ! //1. Select a server to render options for: ! if (!$server = quiz_rqp_get_server($typeid)) { ! notify(get_string('noserverforrqptype','quiz')); ! exit(); ! } ! ! require_once("RQPv1p0Client.php"); ! ! $rqpserver = new RQPv1p0(); ! $rqpserver->Url = $server->url; ! ! $render['source']="$optionstype"; //For options, source=adminOptions,teacherOptions,userOptions ! $render['persistentData']=$form->persistentData; //Use any persistent data as request from original response ! $render['directives']=array('edit'); ! $render['mimetypes']=array('text/html');; ! $render['namePrefix']=$rqpType->name; ! $render['itemBase']=''; ! $render['resourceBase'] =''; ! $render['tempfileBase'] =''; ! ! //Check presence of form fields which are to be processed ! if (empty($form)) { ! $render['inputData']=array(); ! } ! ! else { ! $render['inputData']=quiz_rqp_parse_input($form,$render['namePrefix']); ! } ! ! $response = $rqpserver->RQP_Render($render['source'],array(), ! $render['persistentData'],$render['inputData'], ! $render['directives'],$render['mimetypes'], ! $render['namePrefix'],$render['itemBase'], ! $render['resourceBase'],$render['tempfileBase']); ! ! //Do not proceed with updating options unless RQP server has finished ! if($response['outcomeVars']['completion']!='complete') { ! break; ! } + switch ($optionstype) { + //This block performs the updating of the options + case('adminOptions') : { //Now check 'options' outcome variable for a serialised options string ! if ($old = get_record('quiz_rqp_types', 'id', $typeid)) { ! $old->options = $response['outcomeVars']['options']; //Update 'options' field //Place adminOptions string into quiz_rqp_types table if (!update_record('quiz_rqp_types', $old)) { ! notice("Could not update current rqp type field: adminOptions! (type=$typeid)"); } *************** *** 98,133 **** notice("Updated administrator options"); } ! } ! break; } ! case('teacherOptions') : ! { ! //Place teacherOptions string into either: ! //1. quiz_rqp_course_options table, if called in context of course (i.e. courseid additional param is set) ! //2. quiz_rqp, if called in context of a quiz (i.e. quizid additional param is set) break; } ! case('userOptions') : ! { ! //Place userOptions string into: ! //1. quiz_rqp_user_options table, where 'userid' additional param will be set! break; } ! } ! } ! //Render the options //1. Get type in order to get namePrefix for ! if (!$rqpType = get_record('quiz_rqp_types', 'id', $type)) { notify(get_string('invalidrqptype','quiz')); exit(); } //2. Select a server to render options for: ! if (!$server = quiz_rqp_get_server($type)) { notify(get_string('noserverforrqptype','quiz')); exit(); --- 104,233 ---- notice("Updated administrator options"); } ! } ! ! //Serious error here, RQP question type does not exist for options being set ! else { ! notice("Could not retrieve RQP type $typeid"); ! } ! break; } ! case('teacherOptions') : { ! if (!empty($course)) { ! //Set options should be saved in quiz_rqp_course_options ! //1. Check if course options exist already, and overwrite ! if ($old = get_record('quiz_rqp_course_options', 'courseid', $course, 'typeid', $typeid)) { ! $old->options = $response['outcomeVars']['options']; ! ! if (!update_record('quiz_rqp_course_options', $old)) { ! notice("Could not update course specific teacherOptions (type=$typeid), (course=$course)"); ! } ! ! else { ! notice("Updated course teacher options"); ! } ! } ! ! //2. Where course options do not exist ! else { ! //Construct a course options object ! $course_options->courseid = $courseid; ! $course_options->typeid = $typeid; ! $course_options->options = $response['outcomeVars']['options']; ! ! if (!$course_options->id = insert_record('quiz_rqp_course_options', $course_options)) { ! notice("Could not save course specific teacherOptions (type=$typeid), (course=$courseid)"); ! } ! } ! } ! else if (!empty($quiz)) { ! //Set options should be saved in quiz_rqp_quiz_options table ! //1. Check if quiz options exist already, and prepare to overwrite ! if ($old = get_record('quiz_rqp_quiz_options', 'quizid', $quiz, 'typeid', $typeid)) { ! $old->options = $response['outcomeVars']['options']; ! ! if (!update_record('quiz_rqp_quiz_options', $old)) { ! notice("Could not update quiz specific teacherOptions (type=$typeid), (quiz=$quiz)"); ! } ! ! else { ! notice("Updated quiz teacher options"); ! } ! } ! ! //2. Where quiz options do not exist ! else { ! //Construct a course options object ! $quiz_options->quizid = $quiz; ! $quiz_options->typeid = $typeid; ! $quiz_options->options = $response['outcomeVars']['options']; ! ! if (!$quiz_options->id = insert_record('quiz_rqp_quiz_options', $quiz_options)) { ! notice("Could not save course specific teacherOptions (type=$typeid), (quiz=$quiz)"); ! } ! } ! } ! ! //Where $course and $quiz are both unset ! else { ! notify(get_string('errorloadteacheroptions','quiz')); ! exit(); ! } ! break; } ! case('userOptions') : { ! if (!empty($user)) { ! //Set options saved into quiz_rqp_user_options table ! //1. Check if user options exist already, and prepare to overwrite ! if ($old = get_record('quiz_rqp_user_options', 'userid', $user, 'typeid', $typeid)) { ! $old->options = $response['outcomeVars']['options']; ! ! if (!update_record('quiz_rqp_user_options', $old)) { ! notice("Could not update user options for the current RQP question type (type=$typeid), (user=$user)"); ! } ! ! else { ! notice("Updated user options for current RQP type"); ! } ! } ! ! //2. Where quiz options do not exist ! else { ! //Construct a course options object ! $user_options->userid = $user; ! $user_options->typeid = $typeid; ! $user_options->options = $response['outcomeVars']['options']; ! ! if (!$user_options->id = insert_record('quiz_rqp_user_options', $user_options)) { ! notice("Could not save user options for the current RQP question type (type=$typeid), (user=$user)"); ! } ! } ! } ! ! //Where $user is unset - cannot set user options without this ! else { ! notify(get_string('errorloaduseroptions','quiz')); ! exit(); ! } ! break; } ! } ! } } + //End of data_submitted ! //Initally render the options //1. Get type in order to get namePrefix for ! if (!$rqpType = get_record('quiz_rqp_types', 'id', $typeid)) { notify(get_string('invalidrqptype','quiz')); exit(); } //2. Select a server to render options for: ! if (!$server = quiz_rqp_get_server($typeid)) { notify(get_string('noserverforrqptype','quiz')); exit(); *************** *** 136,141 **** else { ! //Check if response obtained by above render operation if (!isset($response)) { //Otherwise initial render operation require_once("RQPv1p0Client.php"); --- 236,242 ---- else { ! //Check and use response obtained by above render operation, if one exists if (!isset($response)) { + //Otherwise initial render operation require_once("RQPv1p0Client.php"); *************** *** 143,150 **** $rqpserver->Url = $server->url; ! $render['source']="$optionsType"; //For options, source=adminOptions,teacherOptions,userOptions ! $render['persistentData']=''; ! $render['inputData']=array(); $render['directives']=array('edit'); --- 244,251 ---- $rqpserver->Url = $server->url; ! $render['source']="$optionstype"; //For options, source=adminOptions,teacherOptions,userOptions ! $render['persistentData']=''; //Blank for initial response ! $render['inputData']=array(); //Blank for initial options render op $render['directives']=array('edit'); *************** *** 152,161 **** $render['namePrefix']=$rqpType->name; $render['itemBase']=''; ! $response = $rqpserver->RQP_Render($render['source'],array(), $render['persistentData'],$render['inputData'], $render['directives'],$render['mimetypes'], $render['namePrefix'],$render['itemBase'], ! '',''); } } --- 253,340 ---- $render['namePrefix']=$rqpType->name; $render['itemBase']=''; + $render['resourceBase'] = ''; + $render['tempfileBase'] = ''; ! //We may have some options already set by user to pass in render operation: ! $render['options'] = array('user-agent' => $_SERVER['HTTP_USER_AGENT'], ! 'accept' => $_SERVER['HTTP_ACCEPT'], ! 'language' => current_language()); //Moodle language ! ! //Load initial options - check the context in which this page was called: ! switch ($optionstype) { ! case('adminOptions') : { ! //<TODO> attempt to get a server within the type that supports admin options ! if ($server->properties & !RQP_SERVER_ADMINOPTIONS) { ! notify(get_string('noadminoptionstoset', 'quiz')); ! exit(); ! } ! ! $rqptype = get_record('quiz_rqp_types','id',$typeid); ! $render['options']['admin'] = $rqptype->options; ! ! break; ! } ! ! case('teacherOptions') : { ! //<TODO> attempt to get a server within the type that supports teacher options ! if ($server->properties & !RQP_SERVER_TEACHEROPTIONS) { ! notify(get_string('noteacheroptionstoset', 'quiz')); ! exit(); ! } ! ! //Where $course and $quiz are both unset ! if (empty($course) && empty($quiz)) { ! notify(get_string('errorloadteacheroptions','quiz')); ! exit(); ! } ! ! //teacher options called in context of course - get course options for particular RQP type ! else if (!empty($course)) { ! $rqptype = get_record('quiz_rqp_course_options', 'courseid', $course, 'typeid', $typeid); ! $render['options']['teacher'] = $rqptype->options; ! } ! ! //teacher options called in context of quiz - get quiz options for particualr RQP type ! else if (!empty($quiz)) { ! $rqptype = get_record('quiz_rqp_quiz_options', 'quizid', $quiz, 'typeid', $typeid); ! $render['options']['teacher'] = $rqptype->options; ! } ! ! break; ! } ! ! case('userOptions') : { ! //<TODO> attempt to get a server within the type that supports user options ! if ($server->properties & !RQP_SERVER_USEROPTIONS) { ! notify(get_string('nouseroptionstoset', 'quiz')); ! exit(); ! } ! ! //Where $user is unset - cannot set user options without this ! if (empty($user)) { ! notify(get_string('errorloaduseroptions','quiz')); ! exit(); ! } ! ! //user options ! $rqptype = get_record('quiz_rqp_user_options', 'userid', $user, 'typeid', $typeid); ! $render['options']['user'] = $rqptype->options; ! ! break; ! } ! ! default: { ! notify(get_string('invalidoptiontype','quiz')); ! exit(); ! ! break; ! } ! } ! ! $response = $rqpserver->RQP_Render($render['source'],$render['options'], $render['persistentData'],$render['inputData'], $render['directives'],$render['mimetypes'], $render['namePrefix'],$render['itemBase'], ! $render['resourceBase'],$render['tempfileBase']); } } *************** *** 163,171 **** $addButton = '<input type="submit" value="save options" name="add" />'; $cancelButton = '<input type="button" onclick="window.close()" value="cancel"\" />'; ! ! print_heading_with_help('Administrator options'); ! echo '<form action="options.php?typeid='.$type.'&optionstype='.$optionsType.'" method="post">'; echo '<center>'; echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; echo html_entity_decode($response['output']['body']); echo '<br/><br/>'.$addButton; --- 342,353 ---- $addButton = '<input type="submit" value="save options" name="add" />'; $cancelButton = '<input type="button" onclick="window.close()" value="cancel"\" />'; ! $stroptionstoset = get_string($optionstype, 'quiz'); ! ! //Actual form ! print_heading_with_help($stroptionstoset, 'options', 'quiz'); ! echo '<form action="'."options.php?optionstype=$optionstype&typeid=$typeid&courseid=$course&userid=$user&quizid=$quiz".'" method="post">'; echo '<center>'; echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'; + echo '<input type="hidden" name="persistentData" value="'.$response['persistentData'].'" />'; //cache any persistent data from RQP server echo html_entity_decode($response['output']['body']); echo '<br/><br/>'.$addButton; Index: types.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/quiz/questiontypes/rqp/types.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** types.php 12 Sep 2005 09:46:59 -0000 1.1 --- types.php 5 Oct 2005 11:43:44 -0000 1.2 *************** *** 15,19 **** require_login(); if (!isadmin()) { ! error('You need to be an admin user to use this page.', $CFG->wwwroot . '/login/index.php'); } --- 15,19 ---- require_login(); if (!isadmin()) { ! error(get_string('adminuseronly', 'quiz'), $CFG->wwwroot . '/login/index.php'); } *************** *** 37,53 **** while (isset($form->add)) { // using like if but with support for break ! //check url was given ! if (empty($form->url)) { notify(get_string('missingitemtypeurl', 'quiz')); break; ! } ! //Check url corresponds to valid format ! else if (!preg_match('/^(http|https):\/\//', $form->url)) ! { notify(get_string('incorrecturlused', 'quiz')); $straddtypeurl = $form->url; break; ! } require_once("RQPv1p0Client.php"); --- 37,60 ---- while (isset($form->add)) { // using like if but with support for break ! //check url was given ! if (empty($form->url)) { notify(get_string('missingitemtypeurl', 'quiz')); break; ! } ! //Check url corresponds to valid format ! else if (!preg_match('/^(http|https):\/\//', $form->url)) ! { notify(get_string('incorrecturlused', 'quiz')); $straddtypeurl = $form->url; break; ! } ! ! if (!quiz_rqp_check_server($form->url)) ! { ! notify(get_string('servernotresponding', 'quiz')); ! $straddtypeurl = $form->url; ! break; ! } require_once("RQPv1p0Client.php"); *************** *** 66,78 **** //If SOAP fault is that which the method invoked is not implemented if ($serverinfo->faultcode=='notImplemented') { ! notify('This web server does not offer web services. Please try another'); } else if ($serverinfo->faultcode=='processingFailed') { ! notify('This server has experienced an error whilst processing your request. Please try again later'); ! } ! ! else { ! notify('Could not contact the web server specified. Please ensure you have used the correct URL'); } --- 73,81 ---- //If SOAP fault is that which the method invoked is not implemented if ($serverinfo->faultcode=='notImplemented') { ! notify(get_string('nowebservice', 'quiz')); } else if ($serverinfo->faultcode=='processingFailed') { ! notify(get_string('errorprocrequest', 'quiz').$serverinfo->faultstring); } *************** *** 92,96 **** } - $newType = false; --- 95,98 ---- *************** *** 106,110 **** if (!$type->id = insert_record('quiz_rqp_types', $type)) { ! error("Could not save type $type"); } } --- 108,112 ---- if (!$type->id = insert_record('quiz_rqp_types', $type)) { ! error(get_string('notsavetype', 'quiz')." $type"); } } *************** *** 130,134 **** if (!$server->id = insert_record('quiz_rqp_servers', $server)) { //Retrieve the server id for adding mimetypes to it ! error("Could not save server ".$form->url); } --- 132,136 ---- if (!$server->id = insert_record('quiz_rqp_servers', $server)) { //Retrieve the server id for adding mimetypes to it ! error(get_string('notsaveserver', 'quiz')." $form->url"); } *************** *** 145,149 **** if (!insert_record('quiz_rqp_mimetypes', $mimetype)) { ! error("Could not save mimetypes for server $form->url"); } } --- 147,151 ---- if (!insert_record('quiz_rqp_mimetypes', $mimetype)) { ! error(get_string('notsavemimetypes', 'quiz')." $form->url"); } } *************** *** 151,157 **** } ! //Now we need to retrieve any external resources STACK uses, i.e. JOME. Iterate through each URL ! /*foreach ($serverinfo['resources'] as $server_resource) ! { $split = explode('/',$server_resource) $length = count($split); --- 153,159 ---- } ! //Now we need to retrieve any external resources STACK uses, i.e. JOME. Iterate through each URL ! /*foreach ($serverinfo['resources'] as $server_resource) ! { $split = explode('/',$server_resource) $length = count($split); *************** *** 159,184 **** //may need to fopen here and get file info, if permissions allow! ! }*/ ! // print info about new server ! print_heading(get_string('serveradded', 'quiz')); ! quiz_rqp_print_serverinfo($serverinfo); ! if ($newType && $serverinfo['serverProperties']['adminOptions']) { ! //Now we must display options for type of server, if it is a new type ! $options = $type->id; ! break; ! } ! } ! else { //server already exists in database, inform user ! print_heading(get_string('serverexists', 'quiz')); ! break; ! } } } --- 161,185 ---- //may need to fopen here and get file info, if permissions allow! ! }*/ ! // print info about new server ! print_heading(get_string('serveradded', 'quiz')); ! quiz_rqp_print_serverinfo($serverinfo); ! if ($newType && $serverinfo['serverProperties']['adminOptions']) { ! //Now we must display options for type of server, if it is a new type ! $options = $type->id; ! break; ! } } ! else { //server already exists in database, inform user ! print_heading(get_string('serverexists', 'quiz')); ! break; ! } } } *************** *** 186,193 **** //Used when user wants to change options for a particular type - randomise the server used, also used when initally changing settings if ($options and confirm_sesskey()) { //retrieve admin options - //$server = quiz_rqp_get_server($options); //returns an arbitrary server given a type id - - //$server = get_record('quiz_rqp_servers', 'id', $options); - quiz_rqp_optionsDialog('adminOptions',$options); } --- 187,190 ---- *************** *** 199,202 **** --- 196,201 ---- //Delete the mimetypes associated with the deleted server delete_records('quiz_rqp_mimetypes', 'serverid', $delete); + + if (count_records('quiz_rqp_servers') == 0) { //Inform user no more RQP servers exist *************** *** 241,253 **** //If SOAP fault is that which the method invoked is not implemented if ($serverinfo->faultcode=='notImplemented') { ! notify('This web server does not offer web services. Please try another'); } else if ($serverinfo->faultcode=='processingFailed') { ! notify('This server has experienced an error whilst processing your request. Please try again later'); ! } ! ! else { ! notify('Could not contact the web server specified. Please ensure you have used the correct URL'); } --- 240,248 ---- //If SOAP fault is that which the method invoked is not implemented if ($serverinfo->faultcode=='notImplemented') { ! notify(get_string('nowebservice', 'quiz')); } else if ($serverinfo->faultcode=='processingFailed') { ! notify(get_string('errorprocrequest', 'quiz').$serverinfo->faultstring); } *************** *** 257,264 **** else { ! // print the info ! print_heading(get_string('serverinfo', 'quiz')); ! quiz_rqp_print_serverinfo($serverinfo); ! } } } --- 252,259 ---- else { ! // print the info ! print_heading(get_string('serverinfo', 'quiz')); ! quiz_rqp_print_serverinfo($serverinfo); ! } } } *************** *** 295,304 **** if ($types) { foreach ($types as $type) { if (!$servers = get_records('quiz_rqp_servers', 'typeid', $type->id)) { delete_records('quiz_rqp_types', 'id', $type->id); } else { foreach ($servers as $server) { ! //<TODO> Should iterate through servers to check that ServerInfo hasnt changed, and update if necessary $actions = '<a title="' . $strinfo . '" href="types.php?info='.$server->id.'&sesskey='.sesskey().'"><img src="../../../../pix/i/info.gif" border="0" alt="'.$strinfo.'" align="absbottom" /></a> <a title="'.$strdelete.'" href="types.php?delete='.$server->id.'&sesskey='.sesskey().'"><img src="../../../../pix/t/delete.gif" border="0" alt="'.$strdelete.'" /></a>'; $options = '<a title="' . $stroptions. '"href="types.php?options='.$type->id.'&sesskey='.sesskey().'"><img src="../../../../pix/i/edit.gif" border="0" alt="'.$stroptions.'" align="absbottom" /></a> '; --- 290,332 ---- if ($types) { foreach ($types as $type) { + + //Cleanup operation if (!$servers = get_records('quiz_rqp_servers', 'typeid', $type->id)) { delete_records('quiz_rqp_types', 'id', $type->id); + delete_records('quiz_rqp_user_options', 'typeid' , $type->id); //Delete options for disused types + delete_records('quiz_rqp_quiz_options', 'typeid' , $type->id); + delete_records('quiz_rqp_course_options', 'typeid' , $type->id); + } else { foreach ($servers as $server) { ! //Iterate through servers silently to check that ServerInfo hasnt changed, and update if necessary ! require_once("RQPv1p0Client.php"); ! ! $rqpserver = new RQPv1p0(); ! $rqpserver->Url = $server->url; ! ! $temp_serverinfo = $rqpserver->RQP_ServerInformation(); ! ! //Server properties flag production ! $temp_properties = 0; ! $temp_properties += empty($temp_serverinfo['serverProperties']['rendering']) ? 0 : RQP_SERVER_RENDERING; //key = rendering ! $temp_properties += empty($temp_serverinfo['serverProperties']['implicitCloning']) ? 0 : RQP_SERVER_IMPLICITCLONING; //key = implicitCloning ! $temp_properties += empty($temp_serverinfo['serverProperties']['explicitCloning']) ? 0 : RQP_SERVER_EXPLICITCLONING; //key = explicitCloning ! $temp_properties += empty($temp_serverinfo['serverProperties']['authoring']) ? 0 : RQP_SERVER_AUTHORING; //key = authoring ! $temp_properties += empty($temp_serverinfo['serverProperties']['adminOptions']) ? 0 : RQP_SERVER_ADMINOPTIONS; //key = adminOptions ! $temp_properties += empty($temp_serverinfo['serverProperties']['teacherOptions']) ? 0 : RQP_SERVER_TEACHEROPTIONS; //key = teacherOptions ! $temp_properties += empty($temp_serverinfo['serverProperties']['userOptions']) ? 0 : RQP_SERVER_USEROPTIONS; //key = userOptions ! ! if(($temp_serverinfo['version']!=$server->version) || ($temp_properties!=$server['properties'])) { //where information has changed ! //Propogate new information onto database ! $server->version = $temp_serverinfo['version']; ! $server->details = $temp_serverinfo['details']; ! ! $server->properties = $temp_properties; ! ! update_record('quiz_rqp_servers', $server); ! } ! $actions = '<a title="' . $strinfo . '" href="types.php?info='.$server->id.'&sesskey='.sesskey().'"><img src="../../../../pix/i/info.gif" border="0" alt="'.$strinfo.'" align="absbottom" /></a> <a title="'.$strdelete.'" href="types.php?delete='.$server->id.'&sesskey='.sesskey().'"><img src="../../../../pix/t/delete.gif" border="0" alt="'.$strdelete.'" /></a>'; $options = '<a title="' . $stroptions. '"href="types.php?options='.$type->id.'&sesskey='.sesskey().'"><img src="../../../../pix/i/edit.gif" border="0" alt="'.$stroptions.'" align="absbottom" /></a> '; |
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 ---- |
From: pkiddie <pk...@us...> - 2005-10-05 11:41:38
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang/en/help/quiz In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4316/quiz Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang/en/help/quiz added to the repository |
From: pkiddie <pk...@us...> - 2005-10-05 11:41:29
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang/en/help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4289/help Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang/en/help added to the repository |
From: pkiddie <pk...@us...> - 2005-10-05 11:41:20
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4242/en Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang/en added to the repository |
From: pkiddie <pk...@us...> - 2005-10-05 11:41:03
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4169/lang Log Message: Directory /cvsroot/stack/stack-1-0/scripts/rqp/moodle_16_rqp/lang added to the repository |
From: Chris S. <san...@us...> - 2005-10-03 09:09:59
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11447 Modified Files: vista.php Log Message: Ensure the username from Vista is in lower case! Index: vista.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/vista.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** vista.php 20 Sep 2005 16:32:24 -0000 1.1 --- vista.php 3 Oct 2005 09:09:40 -0000 1.2 *************** *** 48,53 **** if (array_key_exists('?username',$_GET)) { ! $username = $_GET['?username']; ! $userID = $_GET['userID']; $user = stack_user_login_vista($username,$userID); --- 48,53 ---- if (array_key_exists('?username',$_GET)) { ! $username = strtolower($_GET['?username']); ! $userID = strtolower($_GET['userID']); $user = stack_user_login_vista($username,$userID); |
From: Chris S. <san...@us...> - 2005-09-29 11:03:22
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30755/scripts Modified Files: stackUser.php Log Message: Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** stackUser.php 20 Sep 2005 16:32:24 -0000 1.16 --- stackUser.php 29 Sep 2005 11:03:01 -0000 1.17 *************** *** 424,430 **** --- 424,434 ---- } else if (!stack_db_user_confirm_vista($user['idnumber'])) { $user['id'] = stack_db_user_store($user); + } else { + $user = stack_db_user_get($user['username']); + $user['loggedin'] = TRUE; } return $user; + } |
From: Chris S. <san...@us...> - 2005-09-26 10:15:46
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14443/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.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** stackmaxima.mac 17 Sep 2005 11:49:12 -0000 1.35 --- stackmaxima.mac 26 Sep 2005 10:15:34 -0000 1.36 *************** *** 48,51 **** --- 48,53 ---- ALIAS(int,integrate); /* Allows integrate to be called with int() */ ALIAS(simplify,fullratsimp); /* Allows simplify to be something */ + decimalplaces(x,n) := float(round(10^n*float(x))/(10^n)); + /* Synonyms to help students */ *************** *** 738,743 **** 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. */ if listp(SBL) then (tExpr:SBL[1], wrt:SBL[2], quiet:SBL[3]) else --- 740,744 ---- ATPartFrac(SA,SBL) := BLOCK([NEGDISTRIB,val,rawmk,fb,ansnote,SB,v,quiet,facdum], NEGDISTRIB:FALSE, ! val:"true", 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. */ if listp(SBL) then (tExpr:SBL[1], wrt:SBL[2], quiet:SBL[3]) else *************** *** 745,751 **** /* If we don't have an atom as the teacher's variable, then we need to make a substitution */ if atom(v)#TRUE then (SA:subst(facdum,wrt,SA),tExpr:subst(facdum,wrt,tExpr),wrt:facdum), ! BLOCK( ! sExpr: SA, ! [val, rawmk, ansnote, fb], rawmk: 0, fb: "", ansnote: "", ret: StackReturnOb(val,rawmk,ansnote,fb), if factor( expand( sExpr ) ) = factor( expand( tExpr ) ) then --- 746,751 ---- /* If we don't have an atom as the teacher's variable, then we need to make a substitution */ if atom(v)#TRUE then (SA:subst(facdum,wrt,SA),tExpr:subst(facdum,wrt,tExpr),wrt:facdum), ! BLOCK([val, rawmk, ansnote, fb], ! sExpr: SA, rawmk: 0, fb: "", ansnote: "", ret: StackReturnOb(val,rawmk,ansnote,fb), if factor( expand( sExpr ) ) = factor( expand( tExpr ) ) then |
From: Chris S. <san...@us...> - 2005-09-26 10:15:46
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14443/scripts Modified Files: stackQuestion.php Log Message: Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** stackQuestion.php 17 Sep 2005 11:31:04 -0000 1.39 --- stackQuestion.php 26 Sep 2005 10:15:35 -0000 1.40 *************** *** 563,566 **** --- 563,569 ---- $stackAnswerTest['AlgEquiv']['function'] = 'ATAlgEquiv'; + $stackAnswerTest['AlgEquiv_quiet']['imp'] = 'cas'; + $stackAnswerTest['AlgEquiv_quiet']['function'] = 'ATAlgEquiv'; + $stackAnswerTest['CASEqual']['imp'] = 'cas'; $stackAnswerTest['CASEqual']['function'] = 'ATCASEqual'; *************** *** 576,580 **** $stackAnswerTest['PartFrac']['imp'] = 'cas-var'; ! $stackAnswerTest['PartFrac']['function'] = 'AtPartFrac'; $stackAnswerTest['Diff']['imp'] = 'cas-var'; --- 579,583 ---- $stackAnswerTest['PartFrac']['imp'] = 'cas-var'; ! $stackAnswerTest['PartFrac']['function'] = 'ATPartFrac'; $stackAnswerTest['Diff']['imp'] = 'cas-var'; *************** *** 1292,1295 **** --- 1295,1302 ---- if ('cas' == $stackAnswerTest[$atest]['imp']) { $this_attempt = CPProcessAnsTest($sa,$ta,$atest,$options,$errors); + // Quiet tests + if ('AlgEquiv_quiet' == $atest) { + $this_attempt['FeedBack'] = ''; + } } *************** *** 2088,2092 **** if ('' != trim($options['SyntaxHint'])) { ! $ret .= "<br /><font size='-1'><em>".get_string('SyntaxHint','stack','').": </em> <tt>{$options['SyntaxHint']}</tt></font>\n"; } --- 2095,2100 ---- if ('' != trim($options['SyntaxHint'])) { ! $hint = htmlspecialchars($options['SyntaxHint']); ! $ret .= "<br /><font size='-1'><em>".get_string('SyntaxHint','stack','').": </em> <tt>{$hint}</tt></font>\n"; } |
From: Chris S. <san...@us...> - 2005-09-26 10:15:46
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14443/lang/en/doc Modified Files: author_testsuite.php en_doc.php Log Message: Index: author_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_testsuite.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** author_testsuite.php 15 Sep 2005 10:34:56 -0000 1.11 --- author_testsuite.php 26 Sep 2005 10:15:34 -0000 1.12 *************** *** 178,181 **** --- 178,182 ---- $testsuite[] = stack_testsuite_construct('PartFrac','1/(x+1) + 1/(x+2)','1/(x+1) + 2/(x+2)',0,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','1/(x+1) + 1/(x+2)','1/(x+3) + 1/(x+2)',0,'x','Denominator Error'); + $testsuite[] = stack_testsuite_construct('PartFrac','(2*x+1)/(x^2+1)-2/(x-1)','(2*x+1)/(x^2+1)-2/(x-1)',1,'x',''); $testsuite[] = stack_testsuite_construct('SA_factored','1/0','0',0,'x',''); Index: en_doc.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/en_doc.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** en_doc.php 17 Sep 2005 11:31:04 -0000 1.10 --- en_doc.php 26 Sep 2005 10:15:34 -0000 1.11 *************** *** 309,312 **** --- 309,315 ---- we return true."; + $stackAnswerTest['AlgEquiv_quiet']['doc']="This is identical to the answer test + AlgEquiv, except that any feedback is ignored. Useful inside potential respons trees"; + $stackAnswerTest['CASEqual']['doc']="This is test if the CAS returns TRUE when asked to evaluate <tt>StudentAnswer=TeacherAnswer</tt> as a Boolean. |
From: Chris S. <san...@us...> - 2005-09-20 16:32:33
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006 Added Files: vista.php Log Message: --- NEW FILE: vista.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'); /** * 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. * * eg $choosequiz_store = array('1','2'); * where 1 & 2 are the subjectID numbers you wish to release. * * You also need to add a variable $choosequiz_auth to stackConf.php * This is used by VISTA to authorise the page. */ $user = stack_user_guest(); //show_array($_GET); $auth = ''; if (array_key_exists('auth',$_GET)) { $auth = ''; } else { echo "You are not authorized to use this page."; die(); } //if ($auth != md5($choosequiz_auth)) { // echo "You are not authorized to use this page."; // die(); //} if (array_key_exists('?username',$_GET)) { $username = $_GET['?username']; $userID = $_GET['userID']; $user = stack_user_login_vista($username,$userID); $_SESSION['user'] = $user; } 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); $_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']; |
From: Chris S. <san...@us...> - 2005-09-20 16:32:33
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006/scripts Modified Files: stackDatabase.php stackUser.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** stackDatabase.php 17 Sep 2005 11:31:04 -0000 1.50 --- stackDatabase.php 20 Sep 2005 16:32:24 -0000 1.51 *************** *** 1260,1264 **** /** - * Takes the itemSource and returns a PHP array containing the item. * * @param string $username The username of the student. --- 1260,1263 ---- *************** *** 1290,1294 **** /** - * Takes the itemSource and returns a PHP array containing the item. * * @param array $user The array containing the user. --- 1289,1292 ---- *************** *** 1400,1403 **** --- 1398,1422 ---- } + /** + * @param int $quizid The quizid of the quuiz. + * @return boolean + */ + function stack_db_user_confirm_vista($idnumber) { + + $exists = FALSE; + + if ('' != $idnumber ) { + + $query = 'SELECT id FROM stackUser WHERE idnumber = "'.$idnumber.'"'; + $result= stack_db_query($query); + + if(0 != mysql_num_rows($result)) { + $exists = TRUE; + } + } + + return $exists; + } + ////////////////////////////////////////////////////// Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** stackUser.php 4 Sep 2005 19:24:58 -0000 1.15 --- stackUser.php 20 Sep 2005 16:32:24 -0000 1.16 *************** *** 402,404 **** --- 402,431 ---- } + /** + * Return a valid $user array, having checked usernames and passwords. + * Has to cope with two special users: 'guest' and 'admin' + * + */ + function stack_user_login_vista($username,$userID) { + + global $stackUser; + + $user = stack_user_blank(); + + $user['idnumber'] = 'vista '.$userID; + $user['username'] = 'Vista user: '.$username; + $user['password'] = ''; + $user['firstname'] = ''; + $user['lastname'] = ''; + $user['loggedin'] = TRUE; + + if (strpos($user['username'],'webct_demo')>0) { + $user = stack_user_guest(); + } else if (!stack_db_user_confirm_vista($user['idnumber'])) { + $user['id'] = stack_db_user_store($user); + } + + return $user; + } + ?> |
From: Chris S. <san...@us...> - 2005-09-19 08:23:29
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21996 Modified Files: quiz.php user.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** quiz.php 15 Sep 2005 12:08:53 -0000 1.41 --- quiz.php 19 Sep 2005 08:23:22 -0000 1.42 *************** *** 77,81 **** // This prevents further attempts // action = review Review a student's quiz, as the teacher. ! // If there is a quiz stored in the $_SESSION, we should use this. --- 77,87 ---- // This prevents further attempts // action = review Review a student's quiz, as the teacher. ! ! ! if ('new_quiz_version' == $action or 'review' == $action) { ! // Clear any existing quiz and quizInst from the $_SESSION ! session_unregister('quizInst'); ! session_unregister('quiz'); ! } // If there is a quiz stored in the $_SESSION, we should use this. *************** *** 83,89 **** if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; ! } else { ! $action = 'continue_quiz'; ! } //////////////////////////////////////////////// --- 89,93 ---- if (array_key_exists('quiz',$_SESSION)) { $quiz = $_SESSION['quiz']; ! } //////////////////////////////////////////////// *************** *** 115,121 **** // (4.3) construct the $quiz if ('continue_quiz' == $action or 'new_quiz_version' == $action or 'review' == $action) { - // Clear any existing quiz and quizInst from the $_SESSION - session_unregister('quizInst'); - session_unregister('quiz'); if (array_key_exists('quizid',$_POST)) { --- 119,122 ---- Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** user.php 13 Sep 2005 08:48:10 -0000 1.10 --- user.php 19 Sep 2005 08:23:22 -0000 1.11 *************** *** 87,90 **** --- 87,91 ---- $subject_store = stack_zone_subjects_order($subject_store); + $returnurl = ''; include($stack_root.'/html/quizchoose.html'); |
From: Chris S. <san...@us...> - 2005-09-17 11:49:20
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14209/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.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** stackmaxima.mac 17 Sep 2005 11:31:04 -0000 1.34 --- stackmaxima.mac 17 Sep 2005 11:49:12 -0000 1.35 *************** *** 578,584 **** ATGT(SA,SB) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str,ex], ! RawMark:0, FeedBack:"", AnswerNote:"", KEEPFLOAT:TRUE, /* See pg 23 */ ex:trigreduce(trigexpand(trigrat(SA-SB))), if ex>0 then (RawMark:1, AnswerNote:"Correct" ) --- 578,585 ---- ATGT(SA,SB) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str,ex], ! RawMark:0, FeedBack:"", AnswerNote:"Not number", KEEPFLOAT:TRUE, /* See pg 23 */ ex:trigreduce(trigexpand(trigrat(SA-SB))), + if numberp(ex) then if ex>0 then (RawMark:1, AnswerNote:"Correct" ) *************** *** 591,597 **** ATGTE(SA,SB) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str,ex], ! RawMark:0, FeedBack:"", AnswerNote:"", KEEPFLOAT:TRUE, /* See pg 23 */ ex:trigreduce(trigexpand(trigrat(SA-SB))), if ex>=0 then (RawMark:1, AnswerNote:"Correct" ) --- 592,599 ---- ATGTE(SA,SB) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str,ex], ! RawMark:0, FeedBack:"", AnswerNote:"Not number", KEEPFLOAT:TRUE, /* See pg 23 */ ex:trigreduce(trigexpand(trigrat(SA-SB))), + if numberp(ex) then if ex>=0 then (RawMark:1, AnswerNote:"Correct" ) |
From: Chris S. <san...@us...> - 2005-09-17 11:31:12
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11689/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.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** stackmaxima.mac 12 Sep 2005 08:24:02 -0000 1.33 --- stackmaxima.mac 17 Sep 2005 11:31:04 -0000 1.34 *************** *** 575,578 **** --- 575,604 ---- )$ + /* SA>SB? */ + ATGT(SA,SB) := + BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str,ex], + RawMark:0, FeedBack:"", AnswerNote:"", + KEEPFLOAT:TRUE, /* See pg 23 */ + ex:trigreduce(trigexpand(trigrat(SA-SB))), + if ex>0 then + (RawMark:1, AnswerNote:"Correct" ) + else + ( AnswerNote:"Incorrect" ), + RETURN(StackReturnOb("true",STRING(RawMark),AnswerNote,FeedBack)) + )$ + + /* SA>=SB? */ + ATGTE(SA,SB) := + BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str,ex], + RawMark:0, FeedBack:"", AnswerNote:"", + KEEPFLOAT:TRUE, /* See pg 23 */ + ex:trigreduce(trigexpand(trigrat(SA-SB))), + if ex>=0 then + (RawMark:1, AnswerNote:"Correct" ) + else + ( AnswerNote:"Incorrect" ), + RETURN(StackReturnOb("true",STRING(RawMark),AnswerNote,FeedBack)) + )$ + /* irred_Q(p,v) is TRUE iff */ |
From: Chris S. <san...@us...> - 2005-09-17 11:31:12
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11689/lang/en/doc Modified Files: en_doc.php Log Message: Index: en_doc.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/en_doc.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** en_doc.php 12 Sep 2005 08:07:47 -0000 1.9 --- en_doc.php 17 Sep 2005 11:31:04 -0000 1.10 *************** *** 328,331 **** --- 328,335 ---- and false otherwise."; + $stackAnswerTest['Num_SAns>TAns']['doc']="Is SAns>TAns? Both are assumed to be numbers."; + + $stackAnswerTest['Num_SAns>=TAns']['doc']="Is SAns>=TAns? Both are assumed to be numbers."; + $stackAnswerTest['String']['doc']="This is a string match, ignoring leading and trailing white space which are stripped from all answers, using PHP's <tt>trim()</tt> function."; |