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: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/other/adminscripts In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/other/adminscripts Added Files: Tag: question_reporting itemTraverseAndOp.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: itemTraverseAndOp.php --- <?php die();// For one-time use only. Modify, enable, use and disable! /* * Handy script to perform an operation across all Items in the database. * First use was changing the underscores to hyphens in question names. */ session_start(); $configFile = '../../config.php'; require($configFile); $config = new stackConfig(); global $config; $root = $config->get('docroot'); require_once $root.'/lib/database/StackDBADOdb.php'; require_once $root.'/lib/items/Item.php'; $db = new StackDBADOdb(); $db->connect(); // which questions to modify $field = 'questionName'; $sql = "SELECT questionID, $field FROM stackquestion"; $db->query($sql); // get list of questions for ($i=0; $i<$db->noRows(); $i++) { $qList[$db->result($i, 'questionID')] = $db->result($i, $field); } echo "<pre>"; foreach($qList as $qID => $content) { $replacement = str_replace('_', '-', $content); $options = NULL; $item = new Item($options, $qID); $item->questionName->setSelection($replacement); echo $content." -> ".$item->$field->getSelection()."\n"; $db->query("UPDATE stackquestion SET $field='$replacement' WHERE questionID=$qID"); $item->store(); } echo "</pre>"; ?> |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/opaque/datatypes In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/opaque/datatypes Modified Files: Tag: question_reporting QuestionListDT.php StackQuestionPageDT.php StackDeployedInstancesDT.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: StackDeployedInstancesDT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/datatypes/StackDeployedInstancesDT.php,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** StackDeployedInstancesDT.php 23 Jun 2009 14:39:37 -0000 1.2 --- StackDeployedInstancesDT.php 22 Nov 2010 23:05:52 -0000 1.2.4.1 *************** *** 23,33 **** /* string */ public $qNote; public $seed; // generation seed (not deployment selection seed!) ! public function __construct($id, $qNote, $seed) { $this->id = $id; $this->qNote = $qNote; $this->seed = $seed; } } --- 23,37 ---- /* string */ public $qNote; + public $xhtml; public $seed; // generation seed (not deployment selection seed!) + public $isPrimed; // are responses for question tests pre-cached? ! public function __construct($id, $qNote, $xhtml, $seed, $isPrimed) { $this->id = $id; $this->qNote = $qNote; + $this->xhtml = $xhtml; $this->seed = $seed; + $this->isPrimed = $isPrimed; } } Index: StackQuestionPageDT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/datatypes/StackQuestionPageDT.php,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** StackQuestionPageDT.php 27 Aug 2009 16:04:07 -0000 1.5 --- StackQuestionPageDT.php 22 Nov 2010 23:05:52 -0000 1.5.2.1 *************** *** 28,34 **** public $categories; /* array */ ! public $publicQuestions; ! public function __construct($questionItems, $xhtml, $head, $categories) { $this->questionItems = $questionItems; --- 28,36 ---- public $categories; /* array */ ! public $publicQuestions; // not used? ! /* array */ ! public $keywords; ! public function __construct($questionItems, $xhtml, $head, $categories, $keywords) { $this->questionItems = $questionItems; *************** *** 36,39 **** --- 38,42 ---- $this->head = $head; $this->categories = $categories; + $this->keywords = $keywords; } } Index: QuestionListDT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/datatypes/QuestionListDT.php,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** QuestionListDT.php 23 Jun 2009 14:39:37 -0000 1.4 --- QuestionListDT.php 22 Nov 2010 23:05:52 -0000 1.4.4.1 *************** *** 35,40 **** /* int */ public $nodeployed; ! public function __construct($id, $name, $description, $valid, $dateEdited, $moodleCategories, $published, $nodeployed) { $this->id = $id; --- 35,42 ---- /* int */ public $nodeployed; + /* array */ + public $keywords; ! public function __construct($id, $name, $description, $valid, $dateEdited, $moodleCategories, $published, $nodeployed, $keywords) { $this->id = $id; *************** *** 46,49 **** --- 48,52 ---- $this->published = $published; $this->nodeployed = $nodeployed; + $this->keywords = $keywords; } } |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/lib In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/lib Modified Files: Tag: question_reporting AimConverter.php error.php stringUtil.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: error.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/error.php,v retrieving revision 1.21.2.1 retrieving revision 1.21.2.2 diff -C2 -d -r1.21.2.1 -r1.21.2.2 *** error.php 29 Nov 2009 13:24:10 -0000 1.21.2.1 --- error.php 22 Nov 2010 23:05:52 -0000 1.21.2.2 *************** *** 30,34 **** private $fail; //bool if error has occured, should the program fail? private $userError; //array of errors for display to the user. format key=>errormessage ! private $logger; function __construct($fail=false) --- 30,34 ---- private $fail; //bool if error has occured, should the program fail? private $userError; //array of errors for display to the user. format key=>errormessage ! //private static $logger; function __construct($fail=false) *************** *** 37,41 **** $this->status = false; //no error yet $this->userError = array(); ! $this->logger = new Logger('ErrorLog'); } --- 37,41 ---- $this->status = false; //no error yet $this->userError = array(); ! //$this->logger = new Logger('ErrorLog'); } Index: stringUtil.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/stringUtil.php,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** stringUtil.php 27 Aug 2009 16:23:00 -0000 1.19 --- stringUtil.php 22 Nov 2010 23:05:52 -0000 1.19.2.1 *************** *** 226,252 **** } - /** - * Converts a CSV string into an array, removing empty entries. - * - * @param string in - * @return array out - * @access public - */ - public function cvsToArray($token=',') - { - $exploded = explode($token, $this->string); - - //remove any null entries - for($i = 0; $i < count($exploded); $i++) - { - $trim = trim($exploded[$i]); - if(!empty($trim)) - { - $toReturn[] = $exploded[$i]; - } - } - - return $toReturn; - } /** --- 226,229 ---- *************** *** 478,481 **** --- 455,484 ---- } + + /** + * Converts a CSV string into an array, removing empty entries. + * + * @param string in + * @return array out + * @access public + */ + public function cvsToArray($token=',') + { + $exploded = explode($token, $this->string); + + //remove any null entries + for($i = 0; $i < count($exploded); $i++) + { + $trim = trim($exploded[$i]); + if(!empty($trim)) + { + $toReturn[] = $exploded[$i]; + } + } + + return $toReturn; + } + + /** * Converts an array to a CSV *************** *** 515,518 **** --- 518,616 ---- } } + + /** + * Handles complex (comma-containing) list elements, + * i.e. sets {}, functions() and nested lists[[]] + * Strict checking on nesting. + * Helper for listToArrayWorkhorse() + */ + private function nextElement($list) { + if($list == '') return null; + // delimited by next comma at same degree of nesting + $startDelimiter = "[({"; + $endDelimiter = "])}"; + $nesting = array(0=>0, 1=>0, 2=>0); // stores nesting for delimiters above + for($i = 0; $i < strlen($list); $i++) { + $startChar = strpos($startDelimiter, $list[$i]);// which start delimiter + $endChar = strpos($endDelimiter, $list[$i]);// which end delimiter (if any) + + // change nesting for delimiter if specified + if($startChar !== false) $nesting[$startChar]++; + else if($endChar !== false) $nesting[$endChar]--; + + // otherwise, return element if all nestings are zero + else if($list[$i] == ',' + && $nesting[0] == 0 && $nesting[1] == 0 &&$nesting[2] == 0) { + return substr($list, 0, $i); + } + } + + // end of list reached + if($nesting[0] == 0 && $nesting[1] == 0 &&$nesting[2] == 0) { + return $list; + } + else return null; // invalid nesting + } + + /** + * Converts a list structure into an array. + * Handles nested lists, sets and functions with help from nextElement(). + */ + private function listToArrayWorkhorse($list,$rec=true) { + $list = trim($list); + $list = substr($list, 1, strlen($list) - 2);// trims outermost [] only + $e = $this->nextElement($list); + while($e !== null) { + if($e[0]=='[') { + if ($rec) { + $array[] = $this->listToArrayWorkhorse($e,$rec); + } else { + $array[] = $e; + } + } + else $array[] = $e; + $list = substr($list, strlen($e)+1); + $e = $this->nextElement($list); + } + return $array; + } + + /** + * Converts a list structure into an array. + * Handles nested lists, sets and functions with help from nextElement(). + */ + public function listToArray($rec=true) { + $array = $this->listToArrayWorkhorse($this->string,$rec); + return $array; + } + + /** + * Returns a more intuitive datestamp + */ + public static function prettifyDate($datestamp) { + /* + * Rules: + * show time if this week + * show day + month if this year + * show month + year if not this year + */ + + $dayStart = strtotime("00:00"); + $monthAgo = strtotime('-1 month'); + $yearAgo = strtotime('-1 year'); + + //echo "yearstart: $yearStart monthStart: $monthStart dayStart: $dayStart"; + + $time = strtotime($datestamp); + + if($time >= $dayStart) return date("g:ia", $time);// today + if($time > $monthAgo) return date("g:ia, j M", $time);// not today + if($time > $yearAgo) return date("M Y", $time); // not this year + if($time > $yearAgo) return date("j M", $time); // not this month + + + // failed to prettify somehow + return $datestamp; + } } Index: AimConverter.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/AimConverter.php,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** AimConverter.php 11 Sep 2009 08:43:55 -0000 1.6 --- AimConverter.php 22 Nov 2010 23:05:52 -0000 1.6.2.1 *************** *** 167,171 **** case "h": case "hide": ! $questionVariables .= "$text\n"; break; --- 167,184 ---- case "h": case "hide": ! // convert rand function ! $rand_pattern = '/:=rand\((-?\d+)\.\.(-?\d+)\)/'; ! preg_match($rand_pattern, $text, $matches); ! $lower = $matches[1]; ! $upper = $matches[2]; ! /* $questionVariables .= 'rand('.($upper-$lower).')'; // range ! if($lower != 0) { ! if($matches[1] > 0) echo '+'; ! echo $matches[1]; ! }*/ ! $text = preg_replace('/rand\('.$lower.'..'.$upper.'\)/', "rand_with_step($lower, $upper, 1)", $text); ! // change assignment operator ! $text = str_replace(':=', '=', $text); ! $questionVariables .= $text."\n"; break; |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/maxima/gendocs In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/maxima/gendocs Modified Files: Tag: question_reporting genmaximadata.php Removed Files: Tag: question_reporting maximafun-stack-1-0.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: genmaximadata.php =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/gendocs/genmaximadata.php,v retrieving revision 1.1 retrieving revision 1.1.12.1 diff -C2 -d -r1.1 -r1.1.12.1 *** genmaximadata.php 18 Sep 2007 16:23:07 -0000 1.1 --- genmaximadata.php 22 Nov 2010 23:05:52 -0000 1.1.12.1 *************** *** 20,2386 **** <tr><td></td><th align="left">Index Entry</th><th align="left"> Section</th></tr> <tr><td colspan="3"> <hr></td></tr> ! <tr><th><a name="SEC300_0">!</a></th><td></td><td></td></tr> ! <tr><td></td><td valign="top"><a href="maxima_5.html#IDX67"><code>!</code></a></td><td valign="top"><a href="maxima_5.html#SEC19">5.7 General operators</a></td></tr> ! <tr><td></td><td valign="top"><a href="maxima_5.html#IDX68"><code>!!</code></a></td><td valign="top"><a href="maxima_5.html#SEC19">5.7 General operators</a></td></tr> ! <tr><td colspan="3"> <hr></td></tr> ! <tr><th><a name="SEC300_1">"</a></th><td></td><td></td></tr> ! <tr><td colspan="3"> <hr></td></tr> ! <tr><th><a name="SEC300_2">#</a></th><td></td><td></td></tr> ! <tr><td></td><td valign="top"><a href="maxima_5.html#IDX69"><code>#</code></a></td><td valign="top"><a href="maxima_5.html#SEC19">5.7 General operators</a></td></tr> [...2444 lines suppressed...] echo "\n"; } *************** *** 2421,2427 **** } ! echo "</pre>"; ! ?> --- 84,91 ---- } ! //print_r($out[2]); ! //print_r($maxima_cmd); + echo "</pre>"; ?> --- maximafun-stack-1-0.php DELETED --- |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/lib/deployment In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/lib/deployment Modified Files: Tag: question_reporting Deployment.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: Deployment.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/deployment/Deployment.php,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** Deployment.php 6 Oct 2009 18:03:53 -0000 1.8 --- Deployment.php 22 Nov 2010 23:05:52 -0000 1.8.2.1 *************** *** 1,3 **** --- 1,4 ---- <?php + /** * *************** *** 17,128 **** */ ! require_once $root . '/lib/Logger.php'; /** * This class manages the deployment of question instances. ! * It ensures that singletons are deployed only once. */ ! class Deployment { ! private $cache; ! private $questionID; ! private $instances; ! public $autoDeployed; ! private $logger; ! public function __construct($questionID) { ! $this->logger = new Logger("Deployment"); ! // get connection to cache ! $this->cache = new StackDBCache(); ! $this->cache->connect(); ! // assign questionID ! $this->questionID = $questionID; ! // get deployed instances ! $this->instances = $this->cache->getInstances($this->questionID); ! // ensure one instance if a singleton ! $this->ensureSingletonDeployed(); ! } ! public function formXHTML() { ! $xhtml = "<form method='POST' action='?id=".$this->questionID."'> ! <input type='submit' name='add' value='add'> ! <input type='text' name='add' value='1' size='3' maxlength='3'/> ".get_string('FE_deployQuestion_newversions', 'stack')."</form>"; ! return $xhtml; ! } ! public function processOperations($param) { ! // add instances ! if(isset($param['add']) && is_numeric($param['add'])) { ! if (!$this->isSingleton()) { ! $msg = get_string('FE_deployQuestion_adding', 'stack', $param['add']); ! $this->cache->deployCache($this->questionID, $param['add']); ! } ! $this->refreshInstances(); ! } ! // drop requests ! if(isset($param['drop']) && is_numeric($param['drop'])) { ! $msg = get_string('FE_deployQuestion_dropping', 'stack').$_GET['drop'].'<br />'; ! $this->cache->dropState($param['drop']); ! $this->refreshInstances(); ! $this->ensureSingletonDeployed(); // redeploy if dropped a singleton } - return $msg; } ! // ensure singletons are always instantiated ! public function ensureSingletonDeployed() { ! if($this->size() === 0 && $this->isSingleton()) { ! $this->cache->deployCache($this->questionID, 1); ! $this->refreshInstances(); ! $this->autoDeployed = true; ! } else { ! $this->autoDeployed = false; } } ! private function refreshInstances() { ! $this->instances = $this->cache->getInstances($this->questionID); } ! public function listXHTML() { ! //$xhtml = ''; ! if($this->instances == NULL) $xhtml = '<i>'.get_string('FE_deployQuestion_noi', 'stack').'</i>'; ! else { ! if (1 == count($this->instances)) { ! echo '<p>'.get_string('FE_deployQuestion_version', 'stack').'</p>'; ! } else { ! echo '<p>'.count($this->instances).get_string('FE_deployQuestion_versions', 'stack').'</p>'; ! } ! $xhtml = '<table class="deploymentTable" border="1">'; ! $xhtml .= '<tr><th>'; ! $xhtml .= '</th><th>'; ! $xhtml .= get_string('stackQuestion_questionStem', 'stack'); ! $xhtml .= '</th><th>'; ! $xhtml .= get_string('stackQuestion_questionNote', 'stack'); ! $xhtml .= '</th><th>'; ! $xhtml .= '</th></tr>'; ! foreach($this->instances as $instance) { ! $item = $this->cache->getDisplayItem($instance['id']); ! $xhtml .= '<tr>'; ! $xhtml .= '<td>'. $instance['id'] .'</td>'; ! $xhtml .= '<td>'. $instance['xhtml'] .'</td>'; ! $xhtml .= '<td>'.$item->getQuestionNote().'</td>'; ! $xhtml .= '<td>'; ! $xhtml .= "<a href='questionDeploy.php?id=$_GET[id]&drop=$instance[id]'>drop</a> "; ! $xhtml .= "<a href='questionTest.php?id=".$item->getQuestionId()."&seed=".$item->getQuestionSeed()."'>try</a></td>"; ! $xhtml .= '</tr>'; ! } ! $xhtml .= '</table>'; } ! return $xhtml; } --- 18,175 ---- */ ! require_once $root . '/lib/Logger.php'; /** * This class manages the deployment of question instances. ! * It ensures that singletons are deployed only once and all instances are of the same version. */ ! class Deployment { ! private $cache; ! private $version; ! private $line; // lookup on demand ! private $instances; ! public $autoDeployed; ! private $engineID; ! private $logger; ! public function __construct($version, $engineid = NULL) { ! $this->logger = new Logger("Deployment"); ! // get connection to cache ! $this->cache = new StackDBCache(); ! $this->cache->connect(); ! // assign version ! $this->version = $version; ! // get deployed instances ! $this->instances = $this->cache->getInstances($this->version); ! // ensure one instance if a singleton ! $this->ensureSingletonDeployed(); ! $this->engineID = $engineid; ! $this->logger->debug("engine id in Deployment constructor: ".$this->engineID); ! } ! /* this should probably be elsewhere ~ sph 23/10/09 */ ! public function formXHTML() { ! //$xhtml = "<form method='POST' action='?id=".$this->version."'> ! $xhtml = "<input type='submit' name='submit' value='add'> ! <input type='text' name='add' value='1' size='3' maxlength='3'/> " . get_string('FE_deployQuestion_newRandomInstances', 'stack'); ! //" <input type='checkbox' name='autoprime' ".(isset($_POST['autoprime'])?'checked="checked"':"")."> ".get_string('FE_deployQuestion_autoprime', 'stack'); ! /*" <input type='submit' onclick='return confirm(\"" . ! get_string('FE_deployQuestion_confirmUndeployAll', 'stack')."\")' name='dropall' value='" . ! get_string('FE_deployQuestion_undeployAll', 'stack')."'>";*/ ! return $xhtml; ! } ! ! public function processOperations($param) { ! $this->logger->debug("here in processOperations, param = ".print_r($param, 1)." and engineid = ".$this->engineID); ! ! // add requests ! if (isset ($param['add']) && is_numeric($param['add'])) { ! if (!$this->isSingleton()) { ! $msg = get_string('FE_deployQuestion_attemptingDeploy', 'stack', $param['add']); ! $initialStates = $this->cache->deployCache($this->version, $param['add']); ! ! //if in Moodle, update ! //$engineID = $param['engineid']; ! if(!empty($this->engineID)) ! { ! $this->logger->debug('In moodle, checking your engine ids'); ! $db = new MoodleDB(); ! $db->connect(); ! $inMoodle = $db->inMoodleQuestionBank($this->version, $this->engineID); ! if($inMoodle == true) ! { ! /*update Moodle's database. ! $result = $db->updateQuestion($this->version, $this->getLine(), $this->authorId, $engineID, $post['category']); ! if($result == false) ! { ! $this->userMessage .= '<h3>'.get_string('stackAuthor_moodleUpdateFail','stack','').'</h3>'.get_string('stackAuthor_moodleQBFail','stack',''); ! } ! //*/ ! } ! } ! ! $msg .= ' '.get_string('FE_deployQuestion_deployedInstances', 'stack', sizeof($initialStates)); ! } ! $this->refreshInstances(); ! ! if ($param['autoprime']) { // i.e. it equals 1 rather than 0. ! $ids = array (); // get ids only of newly-deployed instances ! foreach ($initialStates as $initialState) { ! $ids[] = $initialState['id']; ! } ! ! $ids = $initialStates; ! //$this->logger->debug("in processOperations, ids = ".print_r($ids, 1)); ! $this->primeResponses($ids); } } ! // drop requests ! if (isset ($param['drop']) && is_numeric($param['drop'])) { ! $msg = get_string('FE_deployQuestion_dropInstance', 'stack', $param['drop']) . '<br />'; ! $this->cache->deinitialiseState($param['drop']);// students may have attempted ! $this->refreshInstances(); ! $this->ensureSingletonDeployed(); // redeploy if dropped a singleton ! } ! ! // undeploy request (version) ! if (isset($param['operation']) && $param['operation'] === 'undeploy' && is_numeric($param['version'])) { ! $toDrop = new Deployment($param['version']); ! $this->logger->debug('trying to drop version'.$param['version']); ! $toDrop->drop($param['engine']); ! } ! ! ! // update request (the caching part - Moddle Question Bank handled elsewhere) ! if (isset($param['operation']) && $param['operation'] == 'update' && is_numeric($param['prior'])) { ! // take id, prior, number, category and update ! ! // undeploy all old ! $toDrop = new Deployment($param['prior']); ! $this->logger->debug('trying to drop version'.$param['version'].' during update'); ! $toDrop->drop($param['engine']); ! ! // Do new deploy last in case of timeout? ! // create new deployment ! if (!$this->isSingleton()) { // should auto-deploy in constructor ! $msg = get_string('FE_deployQuestion_attemptingDeploy', 'stack', $param['number']); ! $initialStates = $this->cache->deployCache($this->version, $param['number']); } } ! // prime requests ! if (isset ($param['operation']) && $param['operation'] == 'prime' && is_numeric($param['instance'])) { ! //$msg = get_string('FE_deployQuestion_prime', 'stack').$param['prime'].'<br />'; ! $this->primeResponses(array($param['instance'])); } ! return $msg; ! } ! // ensure singletons are always instantiated ! public function ensureSingletonDeployed() { ! // check no earlier blocking instances ! if ($this->size() === 0 && $this->isSingleton() && $this->earliestDeployedVersion() === false) { ! $this->cache->deployCache($this->version, 1); ! $this->refreshInstances(); ! $this->autoDeployed = true; ! } else { ! $this->autoDeployed = false; } ! } ! ! private function refreshInstances() { ! $this->instances = $this->cache->getInstances($this->version); ! } *************** *** 132,136 **** // Are random versions of this item available? $options = NULL; ! $item = new Item($options, $this->questionID); return $item->questionVariables->contains_rand() == false; } --- 179,183 ---- // Are random versions of this item available? $options = NULL; ! $item = new Item($options, $this->version); return $item->questionVariables->contains_rand() == false; } *************** *** 144,185 **** } - // return cached responses from question tests - // post the inputs from the question tests to set up the cache - // Would be nice to report number of responses cached also, return this count - // note: need to apply QTs to *each* version of our question - could be heavy? /* ! * List primed responses here: ! for each QT ! look for response in cache for inputs ! display response ! big warning if does not pass test with link to edit. */ ! public function primeResponses() { ! ! // return if there are no QTs $options = NULL; ! $item = new Item($options, $this->questionID); ! $QTs = $item->itemTests->getTests(); ! if($QTs == NULL || empty($QTs)) return NULL; ! // we have tests ! foreach($QTs as $key => $QT) { // get all inputs for each test ! foreach($QT as $field => $value) { ! if(substr($field, 0, 3) == "IE_") $posts[$key]['sAns__'.substr($field, 3)] = $value; ! } } ! // get instances ! $event = 1; // TODO: replace this magic number (submit) ! $newInstances = array(); ! foreach($this->instances as $instance) { // for each instance ! foreach($posts as $post) { // submit each post ! $iid = $instance['id']; ! for($i = 0; $i < 2; $i++) { // submit before loopback $transition = $this->cache->nextTransition($iid, $post, $event); // TODO: bad magic number ! if(NULL == $transition) { // no prior transition $item = $this->cache->getDisplayItem($iid); $xhtml = $item->processQuestion($post, true, 1); --- 191,238 ---- } /* ! * Primes question instances ! * If none given then prime all instances of this question deployment. */ ! public function primeResponses($instanceIDs = NULL) { ! $this->logger->debug('in primeResponses with ids: ' . print_r($instanceIDs, 1)); $options = NULL; ! $item = new Item($options, $this->version); ! if($item->itemTests !== NULL) { // not guaranteed ! // return if there are no QTs ! $QTs = $item->itemTests->getTests(); ! if ($QTs == NULL || empty ($QTs)) ! return NULL; ! } else return true; ! ! // we have tests, let's use them to prime ! foreach ($QTs as $key => $QT) { // get all inputs for each test ! foreach ($QT as $field => $value) { ! if (substr($field, 0, 3) == "IE_") ! $posts[$key]['sAns__' . substr($field, 3)] = $value; ! } } ! //$this->logger->debug('in primeResponses, this = '.print_r($this, 1)); ! if (NULL == $instanceIDs) { ! if (isset ($this->instances)) { ! foreach ($this->instances as $index => $instance) ! $instanceIDs[] = $instance['id']; // id of ALL instances ! } else ! return NULL; ! } ! ! $event = 1; // TODO: replace this magic number (representing 'submit') ! $newStates = array (); ! foreach ($instanceIDs as $instanceID) { ! foreach ($posts as $post) { // take each response ! $iid = $instanceID; // go back to original instance ! for ($i = 0; $i < 2; $i++) { // submit before loopback $transition = $this->cache->nextTransition($iid, $post, $event); // TODO: bad magic number ! if (NULL == $transition) { // no prior transition $item = $this->cache->getDisplayItem($iid); $xhtml = $item->processQuestion($post, true, 1); *************** *** 196,209 **** 0, // expired false); // a little redundancy in this last param.. ! ! $newInstances[] = $this->cache->nextNode($transition); } $iid = $this->cache->nextNode($transition); } - $this->cache->addTransition($iid, $iid, $post, $event); } ! } ! // echo "<pre>".print_r($newInstances, true)."</pre>"; ! return $newInstances; } } --- 249,371 ---- 0, // expired false); // a little redundancy in this last param.. ! $newStates[$instanceID][] = $this->cache->nextNode($transition); } $iid = $this->cache->nextNode($transition); } } ! if ($this->cache->nextTransition($iid, $post, $event) == NULL) { // no prior transition ! $this->cache->addTransition($iid, $iid, $post, $event); // loop back ! } ! } ! $this->logger->debug("newStates in primeResponses() = " . print_r($newStates, 1)); ! return $newStates; ! } ! ! // returns true iff there's a cached response for all the question tests ! function isPrimed($instanceID) { ! ! $item = $this->cache->getDisplayItem($instanceID); ! ! if(NULL == $item) return NULL; // no such instance! ! ! $options = NULL; ! $item = new Item($options, $this->version); ! ! if($item->itemTests !== NULL) { // not guaranteed ! // return true if there are no QTs ! $QTs = $item->itemTests->getTests(); ! if ($QTs == NULL || empty ($QTs)) ! return true; ! } else return true; ! ! // we have tests, let's check them ! foreach ($QTs as $key => $QT) { ! // get all inputs for each test ! foreach ($QT as $field => $value) { ! if (substr($field, 0, 3) == "IE_") ! $posts[$key]['sAns__' . substr($field, 3)] = $value; ! } ! } ! ! $event = 1; // TODO: replace this magic number (representing 'submit') ! foreach ($posts as $post) { // take each response ! $iid = $instanceID; // go back to original instance ! for ($i = 0; $i < 2; $i++) { // submit through loopback ! $transition = $this->cache->nextTransition($iid, $post, $event); // TODO: bad magic number ! if (NULL == $transition) { // no prior transition, so false. ! return false; ! } ! ! $iid = $this->cache->nextNode($transition); ! } ! } ! //$this->logger->debug($instanceID." is primed and good to go!"); ! return true; ! } ! ! function getVersion() { ! return $this->version; ! } ! ! /* ! * Removes all instances from this deployment by deinitialising all the states. ! */ ! function drop($engineID = NULL) { ! if(!empty($this->instances)) { ! foreach($this->instances as $instance) { ! $this->cache->deinitialiseState($instance['id']); ! } ! $this->refreshInstances(); ! } ! ! //if in Moodle, update ! if(!empty($engineID)) ! { ! $db = new MoodleDB(); ! $db->connect(); ! $inMoodle = $db->inMoodleQuestionBank($this->version, $engineID); ! if($inMoodle == true) ! { ! //update Moodle's database. ! /*$result = $db->REMOVEQuestion($this->version, $this->authorId, $engineID, $post['category']); ! if($result == false) ! { ! $this->userMessage .= '<h3>'.get_string('stackAuthor_moodleUpdateFail','stack','').'</h3>'.get_string('stackAuthor_moodleQBFail','stack',''); ! } ! */ ! } ! } ! //*/ ! } ! ! function earliestDeployedVersion() { ! $itemDB = new StackDBItem(); ! $itemDB->connect(); ! $versions = $itemDB->getVersions($itemDB->getLine($this->version)); // returned in descending order ! $itemDB->disconnect(); ! ! $earliest = false; ! ! // requires versions ordered by descending id ! foreach($versions as $date => $id) { ! if($this->cache->instancesDeployed($id)) { ! $earliest = $id; ! } ! } ! return $earliest; ! } ! ! function getLine() { ! if(!isset($this->line)) { ! $itemDB = new StackDBItem(); ! $itemDB->connect(); ! $this->line = $itemDB->getLine($this->version); // returned in descending order ! $itemDB->disconnect(); ! } ! return $this->line; ! } ! ! function getEngineID() { ! return $this->engineID; } } |
Update of /cvsroot/stack/stack-dev/other/jqplot/plugins In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/other/jqplot/plugins Added Files: Tag: question_reporting jqplot.canvasAxisLabelRenderer.js jqplot.categoryAxisRenderer.min.js jqplot.dateAxisRenderer.min.js jqplot.logAxisRenderer.min.js jqplot.barRenderer.min.js jqplot.barRenderer.js jqplot.highlighter.min.js jqplot.cursor.min.js jqplot.trendline.js jqplot.canvasAxisTickRenderer.js jqplot.canvasAxisTickRenderer.min.js jqplot.canvasAxisLabelRenderer.min.js jqplot.mekkoAxisRenderer.min.js jqplot.mekkoRenderer.js jqplot.dragable.min.js jqplot.mekkoRenderer.min.js jqplot.categoryAxisRenderer.js jqplot.cursor.js jqplot.pointLabels.min.js jqplot.highlighter.js jqplot.trendline.min.js jqplot.dateAxisRenderer.js jqplot.ohlcRenderer.js jqplot.dragable.js jqplot.logAxisRenderer.js jqplot.mekkoAxisRenderer.js jqplot.pieRenderer.js jqplot.pieRenderer.min.js jqplot.pointLabels.js jqplot.pointLabels.js.orig jqplot.ohlcRenderer.min.js jqplot.canvasTextRenderer.js .DS_Store jqplot.canvasTextRenderer.min.js Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: jqplot.highlighter.js --- /** * Copyright (c) 2009 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * The author would appreciate an email letting him know of any substantial * use of jqPlot. You can reach the author at: chris dot leonello at gmail * dot com or see http://www.jqplot.com/info.php . This is, of course, * not required. * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . * * Thanks for using jqPlot! * */ (function($) { $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]); /** * Class: $.jqplot.Highlighter * Plugin which will highlight data points when they are moused over. * * To use this plugin, include the js * file in your source: * * > <script type="text/javascript" src="plugins/jqplot.highlighter.js"></script> * * A tooltip providing information about the data point is enabled by default. * To disable the tooltip, set "showTooltip" to false. * * You can control what data is displayed in the tooltip with various * options. The "tooltipAxes" option controls wether the x, y or both * data values are displayed. * * Some chart types (e.g. hi-low-close) have more than one y value per * data point. To display the additional values in the tooltip, set the * "yvalues" option to the desired number of y values present (3 for a hlc chart). * * By default, data values will be formatted with the same formatting * specifiers as used to format the axis ticks. A custom format code * can be supplied with the tooltipFormatString option. This will apply * to all values in the tooltip. * * For more complete control, the "formatString" option can be set. This * Allows conplete control over tooltip formatting. Values are passed to * the format string in an order determined by the "tooltipAxes" and "yvalues" * options. So, if you have a hi-low-close chart and you just want to display * the hi-low-close values in the tooltip, you could set a formatString like: * * > highlighter: { * > tooltipAxes: 'y', * > yvalues: 3, * > formatString:'<table class="jqplot-highlighter"> * > <tr><td>hi:</td><td>%s</td></tr> * > <tr><td>low:</td><td>%s</td></tr> * > <tr><td>close:</td><td>%s</td></tr></table>' * > } * */ $.jqplot.Highlighter = function(options) { // Group: Properties // //prop: show // true to show the highlight. this.show = $.jqplot.config.enablePlugins; // prop: markerRenderer // Renderer used to draw the marker of the highlighted point. // Renderer will assimilate attributes from the data point being highlighted, // so no attributes need set on the renderer directly. // Default is to turn off shadow drawing on the highlighted point. this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false}); // prop: showMarker // true to show the marker this.showMarker = true; // prop: lineWidthAdjust // Pixels to add to the lineWidth of the highlight. this.lineWidthAdjust = 2.5; // prop: sizeAdjust // Pixels to add to the overall size of the highlight. this.sizeAdjust = 5; // prop: showTooltip // Show a tooltip with data point values. this.showTooltip = true; // prop: tooltipLocation // Where to position tooltip, 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw' this.tooltipLocation = 'nw'; // prop: tooltipFade // true = fade in/out tooltip, flase = show/hide tooltip this.fadeTooltip = true; // prop: tooltipFadeSpeed // 'slow', 'def', 'fast', or number of milliseconds. this.tooltipFadeSpeed = "fast"; // prop: tooltipOffset // Pixel offset of tooltip from the highlight. this.tooltipOffset = 2; // prop: tooltipAxes // Which axes to display in tooltip, 'x', 'y' or 'both', 'xy' or 'yx' // 'both' and 'xy' are equivalent, 'yx' reverses order of labels. this.tooltipAxes = 'both'; // prop; tooltipSeparator // String to use to separate x and y axes in tooltip. this.tooltipSeparator = ', '; // prop: useAxesFormatters // Use the x and y axes formatters to format the text in the tooltip. this.useAxesFormatters = true; // prop: tooltipFormatString // sprintf format string for the tooltip. // Uses Ash Searle's javascript sprintf implementation // found here: http://hexmen.com/blog/2007/03/printf-sprintf/ // See http://perldoc.perl.org/functions/sprintf.html for reference. // Additional "p" and "P" format specifiers added by Chris Leonello. this.tooltipFormatString = '%.5P'; // prop: formatString // alternative to tooltipFormatString // will format the whole tooltip text, populating with x, y values as // indicated by tooltipAxes option. So, you could have a tooltip like: // 'Date: %s, number of cats: %d' to format the whole tooltip at one go. // If useAxesFormatters is true, values will be formatted according to // Axes formatters and you can populate your tooltip string with // %s placeholders. this.formatString = null; // prop: yvalues // Number of y values to expect in the data point array. // Typically this is 1. Certain plots, like OHLC, will // have more y values in each data point array. this.yvalues = 1; this._tooltipElem; this.isHighlighting = false; $.extend(true, this, options); }; // axis.renderer.tickrenderer.formatter // called with scope of plot $.jqplot.Highlighter.init = function (target, data, opts){ var options = opts || {}; // add a highlighter attribute to the plot this.plugins.highlighter = new $.jqplot.Highlighter(options.highlighter); }; // called within scope of series $.jqplot.Highlighter.parseOptions = function (defaults, options) { this.showHighlight = true; }; // called within context of plot // create a canvas which we can draw on. // insert it before the eventCanvas, so eventCanvas will still capture events. $.jqplot.Highlighter.postPlotDraw = function() { this.plugins.highlighter.highlightCanvas = new $.jqplot.GenericCanvas(); this.eventCanvas._elem.before(this.plugins.highlighter.highlightCanvas.createElement(this._gridPadding, 'jqplot-highlight-canvas', this._plotDimensions)); var hctx = this.plugins.highlighter.highlightCanvas.setContext(); var p = this.plugins.highlighter; p._tooltipElem = $('<div class="jqplot-highlighter-tooltip" style="position:absolute;display:none"></div>'); this.target.append(p._tooltipElem); }; $.jqplot.preInitHooks.push($.jqplot.Highlighter.init); $.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Highlighter.parseOptions); $.jqplot.postDrawHooks.push($.jqplot.Highlighter.postPlotDraw); function draw(plot, neighbor) { var hl = plot.plugins.highlighter; var s = plot.series[neighbor.seriesIndex]; var smr = s.markerRenderer; var mr = hl.markerRenderer; mr.style = smr.style; mr.lineWidth = smr.lineWidth + hl.lineWidthAdjust; mr.size = smr.size + hl.sizeAdjust; var rgba = $.jqplot.getColorComponents(smr.color); var newrgb = [rgba[0], rgba[1], rgba[2]]; var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]); mr.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')'; mr.init(); mr.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], hl.highlightCanvas._ctx); } function showTooltip(plot, series, neighbor) { // neighbor looks like: {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]} // gridData should be x,y pixel coords on the grid. // add the plot._gridPadding to that to get x,y in the target. var hl = plot.plugins.highlighter; var elem = hl._tooltipElem; if (hl.useAxesFormatters) { var xf = series._xaxis._ticks[0].formatter; var yf = series._yaxis._ticks[0].formatter; var xfstr = series._xaxis._ticks[0].formatString; var yfstr = series._yaxis._ticks[0].formatString; var str; var xstr = xf(xfstr, neighbor.data[0]); var ystrs = []; for (var i=1; i<hl.yvalues+1; i++) { ystrs.push(yf(yfstr, neighbor.data[i])); } if (hl.formatString) { switch (hl.tooltipAxes) { case 'both': case 'xy': ystrs.unshift(xstr); ystrs.unshift(hl.formatString); str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs); break; case 'yx': ystrs.push(xstr); ystrs.unshift(hl.formatString); str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs); break; case 'x': str = $.jqplot.sprintf.apply($.jqplot.sprintf, [hl.formatString, xstr]); break; case 'y': ystrs.unshift(hl.formatString); str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs); break; default: // same as xy ystrs.unshift(xstr); ystrs.unshift(hl.formatString); str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs); break; } } else { switch (hl.tooltipAxes) { case 'both': case 'xy': str = xstr; for (var i=0; i<ystrs.length; i++) { str += hl.tooltipSeparator + ystrs[i]; } break; case 'yx': str = ''; for (var i=0; i<ystrs.length; i++) { str += ystrs[i] + hl.tooltipSeparator; } str += xstr; break; case 'x': str = xstr; break; case 'y': str = ''; for (var i=0; i<ystrs.length; i++) { str += ystrs[i] + hl.tooltipSeparator; } break; default: // same as 'xy' str = xstr; for (var i=0; i<ystrs.length; i++) { str += hl.tooltipSeparator + ystrs[i]; } break; } } } else { var str; if (hl.tooltipAxes == 'both' || hl.tooltipAxes == 'xy') { str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[0]) + hl.tooltipSeparator + $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[1]); } else if (hl.tooltipAxes == 'yx') { str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[1]) + hl.tooltipSeparator + $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[0]); } else if (hl.tooltipAxes == 'x') { str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[0]); } else if (hl.tooltipAxes == 'y') { str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[1]); } } elem.html(str); var gridpos = {x:neighbor.gridData[0], y:neighbor.gridData[1]}; var ms = 0; var fact = 0.707; if (series.markerRenderer.show == true) { ms = (series.markerRenderer.size + hl.sizeAdjust)/2; } switch (hl.tooltipLocation) { case 'nw': var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - fact * ms; var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - fact * ms; break; case 'n': var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2; var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - ms; break; case 'ne': var x = gridpos.x + plot._gridPadding.left + hl.tooltipOffset + fact * ms; var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - fact * ms; break; case 'e': var x = gridpos.x + plot._gridPadding.left + hl.tooltipOffset + ms; var y = gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2; break; case 'se': var x = gridpos.x + plot._gridPadding.left + hl.tooltipOffset + fact * ms; var y = gridpos.y + plot._gridPadding.top + hl.tooltipOffset + fact * ms; break; case 's': var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2; var y = gridpos.y + plot._gridPadding.top + hl.tooltipOffset + ms; break; case 'sw': var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - fact * ms; var y = gridpos.y + plot._gridPadding.top + hl.tooltipOffset + fact * ms; break; case 'w': var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - ms; var y = gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2; break; default: // same as 'nw' var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - fact * ms; var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - fact * ms; break; } elem.css('left', x); elem.css('top', y); if (hl.fadeTooltip) { elem.fadeIn(hl.tooltipFadeSpeed); } else { elem.show(); } } function handleMove(ev, gridpos, datapos, neighbor, plot) { var hl = plot.plugins.highlighter; if (hl.show) { if (neighbor == null && hl.isHighlighting) { var ctx = hl.highlightCanvas._ctx; ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); if (hl.fadeTooltip) { hl._tooltipElem.fadeOut(hl.tooltipFadeSpeed); } else { hl._tooltipElem.hide(); } hl.isHighlighting = false; } if (neighbor != null && plot.series[neighbor.seriesIndex].showHighlight && !hl.isHighlighting) { hl.isHighlighting = true; if (hl.showMarker) { draw(plot, neighbor); } if (hl.showTooltip) { showTooltip(plot, plot.series[neighbor.seriesIndex], neighbor); } } } } })(jQuery); --- NEW FILE: jqplot.cursor.min.js --- /** * Copyright (c) 2009 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * Although not required, the author would appreciate an email letting him * know of any substantial use of jqPlot. You can reach the author at: * chris dot leonello at gmail dot com or see http://www.jqplot.com/info.php . * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . */ (function(i){i.jqplot.Cursor=function(o){this.style="crosshair";this.previousCursor="auto";this.show=i.jqplot.config.enablePlugins;this.showTooltip=true;this.followMouse=false;this.tooltipLocation="se";this.tooltipOffset=6;this.showTooltipGridPosition=false;this.showTooltipUnitPosition=true;this.showTooltipDataPosition=false;this.tooltipFormatString="%.4P, %.4P";this.useAxesFormatters=true;this.tooltipAxisGroups=[];this.zoom=false;this.zoomProxy=false;this.zoomTarget=false;this.clickReset=false;this.dblClickReset=true;this.showVerticalLine=false;this.showHorizontalLine=false;this.constrainZoomTo="none";this.shapeRenderer=new i.jqplot.ShapeRenderer();this._zoom={start:[],end:[],started:false,zooming:false,isZoomed:false,axes:{start:{},end:{}}};this._tooltipElem;this.zoomCanvas;this.cursorCanvas;this.intersectionThreshold=2;this.showCursorLegend=false;this.cursorLegendFormatString=i.jqplot.Cursor.cursorLegendFormatString;i.extend(true,this,o)};i.jqplot.Cursor.cursorLegendFormatString="%s x:%s, y:%s";i.jqplot.Cursor.init=function(t,r,q){var o=q||{};this.plugins.cursor=new i.jqplot.Cursor(o.cursor);var u=this.plugins.cursor;if(u.show){i.jqplot.eventListenerHooks.push(["jqplotMouseEnter",b]);i.jqplot.eventListenerHooks.push(["jqplotMouseLeave",f]);i.jqplot.eventListenerHooks.push(["jqplotMouseMove",h]);if(u.showCursorLegend){q.legend=q.legend||{};q.legend.renderer=i.jqplot.CursorLegendRenderer;q.legend.formatString=this.plugins.cursor.cursorLegendFormatString;q.legend.show=true}if(u.zoom){i.jqplot.eventListenerHooks.push(["jqplotMouseDown",a]);i.jqplot.eventListenerHooks.push(["jqplotMouseUp",n]);if(u.clickReset){i.jqplot.eventListenerHooks.push(["jqplotClick",j])}if(u.dblClickReset){i.jqplot.eventListenerHooks.push(["jqplotDblClick",c])}}this.resetZoom=function(){var x=this.axes;if(!u.zoomProxy){for(var w in x){x[w].reset()}this.redraw()}else{var v=this.plugins.cursor.zoomCanvas._ctx;v.clearRect(0,0,v.canvas.width,v.canvas.height)}this.plugins.cursor._zoom.isZoomed=false;this.target.trigger("jqplotResetZoom",[this,this.plugins.cursor])};if(u.showTooltipDataPosition){u.showTooltipUnitPosition=false;u.showTooltipGridPosition=false;if(o.cursor.tooltipFormatString==undefined){u.tooltipFormatString=i.jqplot.Cursor.cursorLegendFormatString}}}};i.jqplot.Cursor.postDraw=function(){var w=this.plugins.cursor;w.zoomCanvas=new i.jqplot.GenericCanvas();this.eventCanvas._elem.before(w.zoomCanvas.createElement(this._gridPadding,"jqplot-zoom-canvas",this._plotDimensions));var v=w.zoomCanvas.setContext();w._tooltipElem=i('<div class="jqplot-cursor-tooltip" style="position:absolute;display:none"></div>');w.zoomCanvas._elem.before(w._tooltipElem);if(w.showVerticalLine||w.showHorizontalLine){w.cursorCanvas=new i.jqplot.GenericCanvas();this.eventCanvas._elem.before(w.cursorCanvas.createElement(this._gridPadding,"jqplot-cursor-canvas",this._plotDimensions));var v=w.cursorCanvas.setContext()}if(w.showTooltipUnitPosition){if(w.tooltipAxisGroups.length===0){var r=this.series;var t;var o=[];for(var q=0;q<r.length;q++){t=r[q];var u=t.xaxis+","+t.yaxis;if(i.inArray(u,o)==-1){o.push(u)}}for(var q=0;q<o.length;q++){w.tooltipAxisGroups.push(o[q].split(","))}}}};i.jqplot.Cursor.zoomProxy=function(v,q){var o=v.plugins.cursor;var u=q.plugins.cursor;o.zoomTarget=true;o.zoom=true;o.style="auto";o.dblClickReset=false;u.zoom=true;u.zoomProxy=true;q.target.bind("jqplotZoom",t);q.target.bind("jqplotResetZoom",r);function t(x,w,z,y,A){o.doZoom(w,z,v,A)}function r(w,x,y){v.resetZoom()}};i.jqplot.Cursor.prototype.resetZoom=function(u,v){var t=u.axes;var r=v._zoom.axes;if(!u.plugins.cursor.zoomProxy&&v._zoom.isZoomed){for(var q in t){t[q]._ticks=[];t[q].min=r[q].min;t[q].max=r[q].max;t[q].numberTicks=r[q].numberTicks;t[q].tickInterval=r[q].tickInterval;t[q].daTickInterval=r[q].daTickInterval}u.redraw();v._zoom.isZoomed=false}else{var o=v.zoomCanvas._ctx;o.clearRect(0,0,o.canvas.width,o.canvas.height)}u.target.trigger("jqplotResetZoom",[u,v])};i.jqplot.Cursor.resetZoom=function(o){o.resetZoom()};i.jqplot.Cursor.prototype.doZoom=function(w,t,x,B){var z=B;var y=x.axes;var q=z._zoom.axes;var r=q.start;var u=q.end;var v,A;var C=x.plugins.cursor.zoomCanvas._ctx;if((z.constrainZoomTo=="none"&&Math.abs(w.x-z._zoom.start[0])>6&&Math.abs(w.y-z._zoom.start[1])>6)||(z.constrainZoomTo=="x"&&Math.abs(w.x-z._zoom.start[0])>6)||(z.constrainZoomTo=="y"&&Math.abs(w.y-z._zoom.start[1])>6)){if(!x.plugins.cursor.zoomProxy){for(var o in t){if(z._zoom.axes[o]==undefined){z._zoom.axes[o]={};z._zoom.axes[o].numberTicks=y[o].numberTicks;z._zoom.axes[o].tickInterval=y[o].tickInterval;z._zoom.axes[o].daTickInterval=y[o].daTickInterval;z._zoom.axes[o].min=y[o].min;z._zoom.axes[o].max=y[o].max}if((z.constrainZoomTo=="none")||(z.constrainZoomTo=="x"&&o.charAt(0)=="x")||(z.constrainZoomTo=="y"&&o.charAt(0)=="y")){dp=t[o];if(dp!=null){if(dp>r[o]){y[o].min=r[o];y[o].max=dp}else{span=r[o]-dp;y[o].max=r[o];y[o].min=dp}y[o].tickInterval=null;y[o].daTickInterval=null;y[o]._ticks=[]}}}C.clearRect(0,0,C.canvas.width,C.canvas.height);x.redraw();z._zoom.isZoomed=true}x.target.trigger("jqplotZoom",[w,t,x,B])}};i.jqplot.preInitHooks.push(i.jqplot.Cursor.init);i.jqplot.postDrawHooks.push(i.jqplot.Cursor.postDraw);function e(D,q,A){var F=A.plugins.cursor;var v="";var J=false;if(F.showTooltipGridPosition){v=D.x+", "+D.y;J=true}if(F.showTooltipUnitPosition){var C;for(var B=0;B<F.tooltipAxisGroups.length;B++){C=F.tooltipAxisGroups[B];if(J){v+="<br />"}if(F.useAxesFormatters){var z=A.axes[C[0]]._ticks[0].formatter;var o=A.axes[C[1]]._ticks[0].formatter;var G=A.axes[C[0]]._ticks[0].formatString;var u=A.axes[C[1]]._ticks[0].formatString;v+=z(G,q[C[0]])+", "+o(u,q[C[1]])}else{v+=i.jqplot.sprintf(F.tooltipFormatString,q[C[0]],q[C[1]])}J=true}}if(F.showTooltipDataPosition){var t=A.series;var I=d(A,D.x,D.y);var J=false;for(var B=0;B<t.length;B++){if(t[B].show){var x=t[B].index;var r=t[B].label.toString();var E=i.inArray(x,I.indices);var y=undefined;var w=undefined;if(E!=-1){var H=I.data[E].data;if(F.useAxesFormatters){var z=t[B]._xaxis._ticks[0].formatter;var o=t[B]._yaxis._ticks[0].formatter;var G=t[B]._xaxis._ticks[0].formatString;var u=t[B]._yaxis._ticks[0].formatString;y=z(G,H[0]);w=o(u,H[1])}else{y=H[0];w=H[1]}if(J){v+="<br />"}v+=i.jqplot.sprintf(F.tooltipFormatString,r,y,w);J=true}}}}F._tooltipElem.html(v)}function g(C,A){var E=A.plugins.cursor;var z=E.cursorCanvas._ctx;z.clearRect(0,0,z.canvas.width,z.canvas.height);if(E.showVerticalLine){E.shapeRenderer.draw(z,[[C.x,0],[C.x,z.canvas.height]])}if(E.showHorizontalLine){E.shapeRenderer.draw(z,[[0,C.y],[z.canvas.width,C.y]])}var G=d(A,C.x,C.y);if(E.showCursorLegend){var q=i(A.targetId+" td.jqplot-cursor-legend-label");for(var B=0;B<q.length;B++){var v=i(q[B]).data("seriesIndex");var t=A.series[v];var r=t.label.toString();var D=i.inArray(v,G.indices);var x=undefined;var w=undefined;if(D!=-1){var H=G.data[D].data;if(E.useAxesFormatters){var y=t._xaxis._ticks[0].formatter;var o=t._yaxis._ticks[0].formatter;var F=t._xaxis._ticks[0].formatString;var u=t._yaxis._ticks[0].formatString;x=y(F,H[0]);w=o(u,H[1])}else{x=H[0];w=H[1]}}if(A.legend.escapeHtml){i(q[B]).text(i.jqplot.sprintf(E.cursorLegendFormatString,r,x,w))}else{i(q[B]).html(i.jqplot.sprintf(E.cursorLegendFormatString,r,x,w))}}}}function d(w,D,C){var z={indices:[],data:[]};var E,u,q,A,t,o;var v;var B=w.plugins.cursor;for(var u=0;u<w.series.length;u++){E=w.series[u];o=E.renderer;if(E.show){v=B.intersectionThreshold;if(E.showMarker){v+=E.markerRenderer.size/2}for(var t=0;t<E.gridData.length;t++){p=E.gridData[t];if(B.showVerticalLine){if(Math.abs(D-p[0])<=v){z.indices.push(u);z.data.push({seriesIndex:u,pointIndex:t,gridData:p,data:E.data[t]})}}}}}return z}function m(q,t){var v=t.plugins.cursor;var r=v._tooltipElem;switch(v.tooltipLocation){case"nw":var o=q.x+t._gridPadding.left-r.outerWidth(true)-v.tooltipOffset;var u=q.y+t._gridPadding.top-v.tooltipOffset-r.outerHeight(true);break;case"n":var o=q.x+t._gridPadding.left-r.outerWidth(true)/2;var u=q.y+t._gridPadding.top-v.tooltipOffset-r.outerHeight(true);break;case"ne":var o=q.x+t._gridPadding.left+v.tooltipOffset;var u=q.y+t._gridPadding.top-v.tooltipOffset-r.outerHeight(true);break;case"e":var o=q.x+t._gridPadding.left+v.tooltipOffset;var u=q.y+t._gridPadding.top-r.outerHeight(true)/2;break;case"se":var o=q.x+t._gridPadding.left+v.tooltipOffset;var u=q.y+t._gridPadding.top+v.tooltipOffset;break;case"s":var o=q.x+t._gridPadding.left-r.outerWidth(true)/2;var u=q.y+t._gridPadding.top+v.tooltipOffset;break;case"sw":var o=q.x+t._gridPadding.left-r.outerWidth(true)-v.tooltipOffset;var u=q.y+t._gridPadding.top+v.tooltipOffset;break;case"w":var o=q.x+t._gridPadding.left-r.outerWidth(true)-v.tooltipOffset;var u=q.y+t._gridPadding.top-r.outerHeight(true)/2;break;default:var o=q.x+t._gridPadding.left+v.tooltipOffset;var u=q.y+t._gridPadding.top+v.tooltipOffset;break}v._tooltipElem.css("left",o);v._tooltipElem.css("top",u)}function l(u){var r=u._gridPadding;var v=u.plugins.cursor;var t=v._tooltipElem;switch(v.tooltipLocation){case"nw":var q=r.left+v.tooltipOffset;var o=r.top+v.tooltipOffset;t.css("left",q);t.css("top",o);break;case"n":var q=(r.left+(u._plotDimensions.width-r.right))/2-t.outerWidth(true)/2;var o=r.top+v.tooltipOffset;t.css("left",q);t.css("top",o);break;case"ne":var q=r.right+v.tooltipOffset;var o=r.top+v.tooltipOffset;t.css({right:q,top:o});break;case"e":var q=r.right+v.tooltipOffset;var o=(r.top+(u._plotDimensions.height-r.bottom))/2-t.outerHeight(true)/2;t.css({right:q,top:o});break;case"se":var q=r.right+v.tooltipOffset;var o=r.bottom+v.tooltipOffset;t.css({right:q,bottom:o});break;case"s":var q=(r.left+(u._plotDimensions.width-r.right))/2-t.outerWidth(true)/2;var o=r.bottom+v.tooltipOffset;t.css({left:q,bottom:o});break;case"sw":var q=r.left+v.tooltipOffset;var o=r.bottom+v.tooltipOffset;t.css({left:q,bottom:o});break;case"w":var q=r.left+v.tooltipOffset;var o=(r.top+(u._plotDimensions.height-r.bottom))/2-t.outerHeight(true)/2;t.css({left:q,top:o});break;default:var q=r.right-v.tooltipOffset;var o=r.bottom+v.tooltipOffset;t.css({right:q,bottom:o});break}}function j(q,o,u,t,r){q.stopPropagation();q.preventDefault();var v=r.plugins.cursor;if(v.clickReset){v.resetZoom(r,v)}return false}function c(q,o,u,t,r){q.stopPropagation();q.preventDefault();var v=r.plugins.cursor;if(v.dblClickReset){v.resetZoom(r,v)}return false}function f(w,t,o,z,u){var v=u.plugins.cursor;if(v.show){i(w.target).css("cursor",v.previousCursor);if(v.showTooltip){v._tooltipElem.hide()}if(v.zoom){v._zoom.started=false;v._zoom.zooming=false;if(!v.zoomProxy){var B=v.zoomCanvas._ctx;B.clearRect(0,0,B.canvas.width,B.canvas.height)}}if(v.showVerticalLine||v.showHorizontalLine){var B=v.cursorCanvas._ctx;B.clearRect(0,0,B.canvas.width,B.canvas.height)}if(v.showCursorLegend){var A=i(u.targetId+" td.jqplot-cursor-legend-label");for(var r=0;r<A.length;r++){var y=i(A[r]).data("seriesIndex");var q=u.series[y];var x=q.label.toString();if(u.legend.escapeHtml){i(A[r]).text(i.jqplot.sprintf(v.cursorLegendFormatString,x,undefined,undefined))}else{i(A[r]).html(i.jqplot.sprintf(v.cursorLegendFormatString,x,undefined,undefined))}}}}}function b(q,o,u,t,r){var v=r.plugins.cursor;if(v.show){v.previousCursor=q.target.style.cursor;q.target.style.cursor=v.style;if(v.showTooltip){e(o,u,r);if(v.followMouse){m(o,r)}else{l(r)}v._tooltipElem.show()}if(v.showVerticalLine||v.showHorizontalLine){g(o,r)}}}function h(r,q,v,u,t){var w=t.plugins.cursor;var o=w.zoomCanvas._ctx;if(w.show){if(w.showTooltip){e(q,v,t);if(w.followMouse){m(q,t)}}if(w.zoom&&w._zoom.started&&!w.zoomTarget){w._zoom.zooming=true;if(w.constrainZoomTo=="x"){w._zoom.end=[q.x,o.canvas.height]}else{if(w.constrainZoomTo=="y"){w._zoom.end=[o.canvas.width,q.y]}else{w._zoom.end=[q.x,q.y]}}k.call(w)}if(w.showVerticalLine||w.showHorizontalLine){g(q,t)}}}function a(w,r,q,x,t){var v=t.plugins.cursor;var u=t.axes;if(v.zoom){if(!v.zoomProxy){var y=v.zoomCanvas._ctx;y.clearRect(0,0,y.canvas.width,y.canvas.height)}if(v.constrainZoomTo=="x"){v._zoom.start=[r.x,0]}else{if(v.constrainZoomTo=="y"){v._zoom.start=[0,r.y]}else{v._zoom.start=[r.x,r.y]}}v._zoom.started=true;for(var o in q){v._zoom.axes.start[o]=q[o]}}}function n(q,o,u,t,r){var v=r.plugins.cursor;if(v.zoom&&v._zoom.zooming&&!v.zoomTarget){v.doZoom(o,u,r,v)}v._zoom.started=false;v._zoom.zooming=false}function k(){var y=this._zoom.start;var u=this._zoom.end;var r=this.zoomCanvas._ctx;var q,v,x,o;if(u[0]>y[0]){q=y[0];o=u[0]-y[0]}else{q=u[0];o=y[0]-u[0]}if(u[1]>y[1]){v=y[1];x=u[1]-y[1]}else{v=u[1];x=y[1]-u[1]}r.fillStyle="rgba(0,0,0,0.2)";r.strokeStyle="#999999";r.lineWidth=1;r.clearRect(0,0,r.canvas.width,r.canvas.height);r.fillRect(0,0,r.canvas.width,r.canvas.height);r.clearRect(q,v,o,x);r.strokeRect(q,v,o,x)}i.jqplot.CursorLegendRenderer=function(o){i.jqplot.TableLegendRenderer.call(this,o);this.formatString="%s"};i.jqplot.CursorLegendRenderer.prototype=new i.jqplot.TableLegendRenderer();i.jqplot.CursorLegendRenderer.prototype.constructor=i.jqplot.CursorLegendRenderer;i.jqplot.CursorLegendRenderer.prototype.draw=function(){if(this.show){var u=this._series;this._elem=i('<table class="jqplot-legend jqplot-cursor-legend" style="position:absolute"></table>');var x=false;for(var t=0;t<u.length;t++){s=u[t];if(s.show){var o=i.jqplot.sprintf(this.formatString,s.label.toString());if(o){var q=s.color;if(s._stack&&!s.fill){q=""}v.call(this,o,q,x,t);x=true}for(var r=0;r<i.jqplot.addLegendRowHooks.length;r++){var w=i.jqplot.addLegendRowHooks[r].call(this,s);if(w){v.call(this,w.label,w.color,x);x=true}}}}}function v(B,A,D,y){var z=(D)?this.rowSpacing:"0";var C=i('<tr class="jqplot-legend jqplot-cursor-legend"></tr>').appendTo(this._elem);C.data("seriesIndex",y);i('<td class="jqplot-legend jqplot-cursor-legend-swatch" style="padding-top:'+z+';"><div style="border:1px solid #cccccc;padding:0.2em;"><div class="jqplot-cursor-legend-swatch" style="background-color:'+A+';"></div></div></td>').appendTo(C);var E=i('<td class="jqplot-legend jqplot-cursor-legend-label" style="vertical-align:middle;padding-top:'+z+';"></td>');E.appendTo(C);E.data("seriesIndex",y);if(this.escapeHtml){E.text(B)}else{E.html(B)}}return this._elem}})(jQuery); --- NEW FILE: jqplot.logAxisRenderer.min.js --- /** * Copyright (c) 2009 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * Although not required, the author would appreciate an email letting him * know of any substantial use of jqPlot. You can reach the author at: * chris dot leonello at gmail dot com or see http://www.jqplot.com/info.php . * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . */ (function(a){a.jqplot.LogAxisRenderer=function(){a.jqplot.LinearAxisRenderer.call(this);this.axisDefaults={base:10,tickDistribution:"even"}};a.jqplot.LogAxisRenderer.prototype=new a.jqplot.LinearAxisRenderer();a.jqplot.LogAxisRenderer.prototype.constructor=a.jqplot.LogAxisRenderer;a.jqplot.LogAxisRenderer.prototype.init=function(e){a.extend(true,this.renderer,e);for(var h in this.renderer.axisDefaults){if(this[h]==null){this[h]=this.renderer.axisDefaults[h]}}var b=this._dataBounds;for(var f=0;f<this._series.length;f++){var g=this._series[f];var h=g.data;for(var c=0;c<h.length;c++){if(this.name=="xaxis"||this.name=="x2axis"){if(h[c][0]>b.max||b.max==null){b.max=h[c][0]}if(h[c][0]>b.max||b.max==null){b.max=h[c][0]}}else{if(h[c][1]<b.min||b.min==null){b.min=h[c][1]}if(h[c][1]>b.max||b.max==null){b.max=h[c][1]}}}}};a.jqplot.LogAxisRenderer.prototype.createTicks=function(){var A=this._ticks;var x=this.ticks;var D=this.name;var z=this._dataBounds;var s,y;var o,v;var e,d;var b,w;if(x.length){for(w=0;w<x.length;w++){var f=x[w];var k=new this.tickRenderer(this.tickOptions);if(f.constructor==Array){k.value=f[0];k.label=f[1];if(!this.showTicks){k.showLabel=false;k.showMark=false}else{if(!this.showTickMarks){k.showMark=false}}k.setTick(f[0],this.name);this._ticks.push(k)}else{k.value=f;if(!this.showTicks){k.showLabel=false;k.showMark=false}else{if(!this.showTickMarks){k.showMark=false}}k.setTick(f,this.name);this._ticks.push(k)}}this.numberTicks=x.length;this.min=this._ticks[0].value;this.max=this._ticks[this.numberTicks-1].value}else{if(D=="xaxis"||D=="x2axis"){s=this._plotDimensions.width}else{s=this._plotDimensions.height}o=((this.min!=null)?this.min:z.min);v=((this.max!=null)?this.max:z.max);if(o==v){var g=0.05;o=o*(1-g);v=v*(1+g)}if(this.min!=null&&this.min<=0){throw ("log axis minimum must be greater than 0")}if(this.max!=null&&this.max<=0){throw ("log axis maximum must be greater than 0")}var l=v-o;var n,r;if(this.tickDistribution=="even"){n=(this.min!=null)?this.min:o-o*((this.padMin-1)/2);r=(this.max!=null)?this.max:v+v*((this.padMax-1)/2);this.min=n;this.max=r;l=this.max-this.min;if(this.numberTicks==null){if(s>100){this.numberTicks=parseInt(3+(s-100)/75,10)}else{this.numberTicks=2}}var h=Math.pow(this.base,(1/(this.numberTicks-1)*Math.log(this.max/this.min)/Math.log(this.base)));for(var w=0;w<this.numberTicks;w++){b=this.min*Math.pow(h,w);var k=new this.tickRenderer(this.tickOptions);if(!this.showTicks){k.showLabel=false;k.showMark=false}else{if(!this.showTickMarks){k.showMark=false}}k.setTick(b,this.name);this._ticks.push(k)}}else{if(this.tickDistribution=="power"){n=Math.pow(this.base,Math.ceil(Math.log(o*(2-this.padMin))/Math.log(this.base))-1);r=Math.pow(this.base,Math.floor(Math.log(v*this.padMax)/Math.log(this.base))+1);this.min=n;this.max=r;l=this.max-this.min;var q=0;var c=0;if(this.numberTicks==null){if(s>100){this.numberTicks=Math.round(Math.log(this.max/this.min)/Math.log(this.base)+1);if(this.numberTicks<2){this.numberTicks=2}q=parseInt(3+(s-100)/75,10)}else{this.numberTicks=2;q=2}if(this.numberTicks<q-1){c=Math.floor(q/this.numberTicks)}}for(var w=0;w<this.numberTicks;w++){b=Math.pow(this.base,w-this.numberTicks+1)*this.max;var k=new this.tickRenderer(this.tickOptions);if(!this.showTicks){k.showLabel=false;k.showMark=false}else{if(!this.showTickMarks){k.showMark=false}}k.setTick(b,this.name);this._ticks.push(k);if(c&&w<this.numberTicks-1){var m=Math.pow(this.base,w-this.numberTicks+2)*this.max;var B=m-b;var y=m/(c+1);for(var p=c-1;p>=0;p--){var C=m-y*(p+1);var k=new this.tickRenderer(this.tickOptions);if(!this.showTicks){k.showLabel=false;k.showMark=false}else{if(!this.showTickMarks){k.showMark=false}}k.setTick(C,this.name);this._ticks.push(k)}}}}}}};a.jqplot.LogAxisRenderer.prototype.pack=function(n,j){var d=parseInt(this.base,10);var q=this._ticks;var v=function(h){return Math.log(h)/Math.log(d)};var b=function(h){return Math.pow(Math.E,(Math.log(d)*h))};max=v(this.max);min=v(this.min);var g=j.max;var u=j.min;var l=(this._label==null)?false:this._label.show;for(var c in n){this._elem.css(c,n[c])}this._offsets=j;var f=g-u;var s=max-min;this.p2u=function(h){return b((h-u)*s/f+min)};this.u2p=function(h){return(v(h)-min)*f/s+u};if(this.name=="xaxis"||this.name=="x2axis"){this.series_u2p=function(h){return(v(h)-min)*f/s};this.series_p2u=function(h){return b(h*s/f+min)}}else{this.series_u2p=function(h){return(v(h)-max)*f/s};this.series_p2u=function(h){return b(h*s/f+max)}}if(this.show){if(this.name=="xaxis"||this.name=="x2axis"){for(i=0;i<q.length;i++){var r=q[i];if(r.show&&r.showLabel){var k;if(r.constructor==a.jqplot.CanvasAxisTickRenderer&&r.angle){switch(r.labelPosition){case"auto":if(r.angle<0){k=-r.getWidth()+r._textRenderer.height*Math.sin(-r._textRenderer.angle)/2}else{k=-r._textRenderer.height*Math.sin(r._textRenderer.angle)/2}break;case"end":k=-r.getWidth()+r._textRenderer.height*Math.sin(-r._textRenderer.angle)/2;break;case"start":k=-r._textRenderer.height*Math.sin(r._textRenderer.angle)/2;break;case"middle":k=-r.getWidth()/2+r._textRenderer.height*Math.sin(-r._textRenderer.angle)/2;break;default:k=-r.getWidth()/2+r._textRenderer.height*Math.sin(-r._textRenderer.angle)/2;break}}else{k=-r.getWidth()/2}var e=this.u2p(r.value)+k+"px";r._elem.css("left",e);r.pack()}}if(l){var o=this._label._elem.outerWidth(true);this._label._elem.css("left",u+f/2-o/2+"px");if(this.name=="xaxis"){this._label._elem.css("bottom","0px")}else{this._label._elem.css("top","0px")}this._label.pack()}}else{for(i=0;i<q.length;i++){var r=q[i];if(r.show&&r.showLabel){var k;if(r.constructor==a.jqplot.CanvasAxisTickRenderer&&r.angle){switch(r.labelPosition){case"auto":case"end":if(r.angle<0){k=-r._textRenderer.height*Math.cos(-r._textRenderer.angle)/2}else{k=-r.getHeight()+r._textRenderer.height*Math.cos(r._textRenderer.angle)/2}break;case"start":if(r.angle>0){k=-r._textRenderer.height*Math.cos(-r._textRenderer.angle)/2}else{k=-r.getHeight()+r._textRenderer.height*Math.cos(r._textRenderer.angle)/2}break;case"middle":k=-r.getHeight()/2;break;default:k=-r.getHeight()/2;break}}else{k=-r.getHeight()/2}var e=this.u2p(r.value)+k+"px";r._elem.css("top",e);r.pack()}}if(l){var m=this._label._elem.outerHeight(true);this._label._elem.css("top",g-f/2-m/2+"px");if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{this._label._elem.css("right","0px")}this._label.pack()}}}}})(jQuery); --- NEW FILE: jqplot.logAxisRenderer.js --- /** * Copyright (c) 2009 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * The author would appreciate an email letting him know of any substantial * use of jqPlot. You can reach the author at: chris dot leonello at gmail * dot com or see http://www.jqplot.com/info.php . This is, of course, * not required. * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . * * Thanks for using jqPlot! * */ (function($) { /** * class: $.jqplot.LogAxisRenderer * A plugin for a jqPlot to render a logarithmic axis. * * To use this renderer, include the plugin in your source * > <script type="text/javascript" language="javascript" src="plugins/jqplot.logAxisRenderer.js"></script> * * and supply the appropriate options to your plot * * > {axes:{xaxis:{renderer:$.jqplot.LogAxisRenderer}}} **/ $.jqplot.LogAxisRenderer = function() { $.jqplot.LinearAxisRenderer.call(this); // prop: axisDefaults // Default properties which will be applied directly to the series. // // Group: Properties // // Properties // /// base - the logarithmic base, commonly 2, 10 or Math.E // tickDistribution - 'even' or 'power'. 'even' gives equal pixel // spacing of the ticks on the plot. 'power' gives ticks in powers // of 10. this.axisDefaults = { base : 10, tickDistribution :'even' }; }; $.jqplot.LogAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer(); $.jqplot.LogAxisRenderer.prototype.constructor = $.jqplot.LogAxisRenderer; $.jqplot.LogAxisRenderer.prototype.init = function(options) { // prop: tickRenderer // A class of a rendering engine for creating the ticks labels displayed on the plot, // See <$.jqplot.AxisTickRenderer>. // this.tickRenderer = $.jqplot.AxisTickRenderer; // this.labelRenderer = $.jqplot.AxisLabelRenderer; $.extend(true, this.renderer, options); for (var d in this.renderer.axisDefaults) { if (this[d] == null) { this[d] = this.renderer.axisDefaults[d]; } } var db = this._dataBounds; // Go through all the series attached to this axis and find // the min/max bounds for this axis. for (var i=0; i<this._series.length; i++) { var s = this._series[i]; var d = s.data; for (var j=0; j<d.length; j++) { if (this.name == 'xaxis' || this.name == 'x2axis') { if (d[j][0] > db.max || db.max == null) { db.max = d[j][0]; } if (d[j][0] > db.max || db.max == null) { db.max = d[j][0]; } } else { if (d[j][1] < db.min || db.min == null) { db.min = d[j][1]; } if (d[j][1] > db.max || db.max == null) { db.max = d[j][1]; } } } } }; $.jqplot.LogAxisRenderer.prototype.createTicks = function() { // we're are operating on an axis here var ticks = this._ticks; var userTicks = this.ticks; var name = this.name; var db = this._dataBounds; var dim, interval; var min, max; var pos1, pos2; var tt, i; // if we already have ticks, use them. // ticks must be in order of increasing value. if (userTicks.length) { // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed for (i=0; i<userTicks.length; i++){ var ut = userTicks[i]; var t = new this.tickRenderer(this.tickOptions); if (ut.constructor == Array) { t.value = ut[0]; t.label = ut[1]; if (!this.showTicks) { t.showLabel = false; t.showMark = false; } else if (!this.showTickMarks) { t.showMark = false; } t.setTick(ut[0], this.name); this._ticks.push(t); } else { t.value = ut; if (!this.showTicks) { t.showLabel = false; t.showMark = false; } else if (!this.showTickMarks) { t.showMark = false; } t.setTick(ut, this.name); this._ticks.push(t); } } this.numberTicks = userTicks.length; this.min = this._ticks[0].value; this.max = this._ticks[this.numberTicks-1].value; } // we don't have any ticks yet, let's make some! else { if (name == 'xaxis' || name == 'x2axis') { dim = this._plotDimensions.width; } else { dim = this._plotDimensions.height; } min = ((this.min != null) ? this.min : db.min); max = ((this.max != null) ? this.max : db.max); // if min and max are same, space them out a bit if (min == max) { var adj = 0.05; min = min*(1-adj); max = max*(1+adj); } // perform some checks if (this.min != null && this.min <= 0) { throw('log axis minimum must be greater than 0'); } if (this.max != null && this.max <= 0) { throw('log axis maximum must be greater than 0'); } // if (this.pad >1.99) this.pad = 1.99; var range = max - min; var rmin, rmax; if (this.tickDistribution == 'even') { rmin = (this.min != null) ? this.min : min - min*((this.padMin-1)/2); rmax = (this.max != null) ? this.max : max + max*((this.padMax-1)/2); this.min = rmin; this.max = rmax; range = this.max - this.min; if (this.numberTicks == null){ if (dim > 100) { this.numberTicks = parseInt(3+(dim-100)/75, 10); } else { this.numberTicks = 2; } } var u = Math.pow(this.base, (1/(this.numberTicks-1)*Math.log(this.max/this.min)/Math.log(this.base))); for (var i=0; i<this.numberTicks; i++){ tt = this.min * Math.pow(u, i); var t = new this.tickRenderer(this.tickOptions); if (!this.showTicks) { t.showLabel = false; t.showMark = false; } else if (!this.showTickMarks) { t.showMark = false; } t.setTick(tt, this.name); this._ticks.push(t); } } else if (this.tickDistribution == 'power'){ // for power distribution, open up range to get a nice power of axis.renderer.base. // power distribution won't respect the user's min/max settings. rmin = Math.pow(this.base, Math.ceil(Math.log(min*(2-this.padMin))/Math.log(this.base))-1); rmax = Math.pow(this.base, Math.floor(Math.log(max*this.padMax)/Math.log(this.base))+1); this.min = rmin; this.max = rmax; range = this.max - this.min; var fittedTicks = 0; var minorTicks = 0; if (this.numberTicks == null){ if (dim > 100) { this.numberTicks = Math.round(Math.log(this.max/this.min)/Math.log(this.base) + 1); if (this.numberTicks < 2) { this.numberTicks = 2; } fittedTicks = parseInt(3+(dim-100)/75, 10); } else { this.numberTicks = 2; fittedTicks = 2; } // if we don't have enough ticks, add some intermediate ticks // how many to have between major ticks. if (this.numberTicks < fittedTicks-1) { minorTicks = Math.floor(fittedTicks/this.numberTicks); } } for (var i=0; i<this.numberTicks; i++){ tt = Math.pow(this.base, i - this.numberTicks + 1) * this.max; var t = new this.tickRenderer(this.tickOptions); if (!this.showTicks) { t.showLabel = false; t.showMark = false; } else if (!this.showTickMarks) { t.showMark = false; } t.setTick(tt, this.name); this._ticks.push(t); if (minorTicks && i<this.numberTicks-1) { var tt1 = Math.pow(this.base, i - this.numberTicks + 2) * this.max; var spread = tt1 - tt; var interval = tt1 / (minorTicks+1); for (var j=minorTicks-1; j>=0; j--) { var val = tt1-interval*(j+1); var t = new this.tickRenderer(this.tickOptions); if (!this.showTicks) { t.showLabel = false; t.showMark = false; } else if (!this.showTickMarks) { t.showMark = false; } t.setTick(val, this.name); this._ticks.push(t); } } } } } }; $.jqplot.LogAxisRenderer.prototype.pack = function(pos, offsets) { var lb = parseInt(this.base, 10); var ticks = this._ticks; var trans = function (v) { return Math.log(v)/Math.log(lb); }; var invtrans = function (v) { return Math.pow(Math.E, (Math.log(lb)*v)); }; max = trans(this.max); min = trans(this.min); var offmax = offsets.max; var offmin = offsets.min; var lshow = (this._label == null) ? false : this._label.show; for (var p in pos) { this._elem.css(p, pos[p]); } this._offsets = offsets; // pixellength will be + for x axes and - for y axes becasue pixels always measured from top left. var pixellength = offmax - offmin; var unitlength = max - min; // point to unit and unit to point conversions references to Plot DOM element top left corner. this.p2u = function(p){ return invtrans((p - offmin) * unitlength / pixellength + min); }; this.u2p = function(u){ return (trans(u) - min) * pixellength / unitlength + offmin; }; if (this.name == 'xaxis' || this.name == 'x2axis'){ this.series_u2p = function(u){ return (trans(u) - min) * pixellength / unitlength; }; this.series_p2u = function(p){ return invtrans(p * unitlength / pixellength + min); }; } // yaxis is max at top of canvas. else { this.series_u2p = function(u){ return (trans(u) - max) * pixellength / unitlength; }; this.series_p2u = function(p){ return invtrans(p * unitlength / pixellength + max); }; } if (this.show) { if (this.name == 'xaxis' || this.name == 'x2axis') { for (i=0; i<ticks.length; i++) { var t = ticks[i]; if (t.show && t.showLabel) { var shim; if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) { switch (t.labelPosition) { case 'auto': // position at end if (t.angle < 0) { shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2; } // position at start else { shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2; } break; case 'end': shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2; break; case 'start': shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2; break; case 'middle': shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2; break; default: shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2; break; } } else { shim = -t.getWidth()/2; } // var shim = t.getWidth()/2; var val = this.u2p(t.value) + shim + 'px'; t._elem.css('left', val); t.pack(); } } if (lshow) { var w = this._label._elem.outerWidth(true); this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px'); if (this.name == 'xaxis') { this._label._elem.css('bottom', '0px'); } else { this._label._elem.css('top', '0px'); } this._label.pack(); } } else { for (i=0; i<ticks.length; i++) { var t = ticks[i]; if (t.show && t.showLabel) { var shim; if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) { switch (t.labelPosition) { case 'auto': // position at end case 'end': if (t.angle < 0) { shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2; } else { shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2; } break; case 'start': if (t.angle > 0) { shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2; } else { shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2; } break; case 'middle': // if (t.angle > 0) { // shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2; // } // else { // shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2; // } shim = -t.getHeight()/2; break; default: shim = -t.getHeight()/2; break; } } else { shim = -t.getHeight()/2; } var val = this.u2p(t.value) + shim + 'px'; t._elem.css('top', val); t.pack(); } } if (lshow) { var h = this._label._elem.outerHeight(true); this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px'); if (this.name == 'yaxis') { this._label._elem.css('left', '0px'); } else { this._label._elem.css('right', '0px'); } this._label.pack(); } } } }; })(jQuery); --- NEW FILE: jqplot.canvasTextRenderer.js --- /** * Copyright (c) 2009 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * The author would appreciate an email letting him know of any substantial * use of jqPlot. You can reach the author at: chris dot leonello at gmail * dot com or see http://www.jqplot.com/info.php . This is, of course, * not required. * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . * * Thanks for using jqPlot! * */ (function($) { // This code is a modified version of the canvastext.js code, copyright below: // // This code is released to the public domain by Jim Studt, 2007. // He may keep some sort of up to date copy at http://www.federated.com/~jim/canvastext/ // $.jqplot.CanvasTextRenderer = function(options){ this.fontStyle = 'normal'; // normal, italic, oblique [not implemented] this.fontVariant = 'normal'; // normal, small caps [not implemented] this.fontWeight = 'normal'; // normal, bold, bolder, lighter, 100 - 900 this.fontSize = '10px'; this.fontFamily = 'sans-serif'; this.fontStretch = 1.0; this.fillStyle = '#666666'; this.angle = 0; this.textAlign = 'start'; this.textBaseline = 'alphabetic'; this.text; this.width; this.height; this.pt2px = 1.28; $.extend(true, this, options); this.normalizedFontSize = this.normalizeFontSize(this.fontSize); this.setHeight(); }; $.jqplot.CanvasTextRenderer.prototype.init = function(options) { $.extend(true, this, options); this.normalizedFontSize = this.normalizeFontSize(this.fontSize); this.setHeight(); }; // convert css spec into point size // returns float $.jqplot.CanvasTextRenderer.prototype.normalizeFontSize = function(sz) { sz = String(sz); n = parseFloat(sz); if (sz.indexOf('px') > -1) { return n/this.pt2px; } else if (sz.indexOf('pt') > -1) { return n; } else if (sz.indexOf('em') > -1) { return n*12; } else if (sz.indexOf('%') > -1) { ... [truncated message content] |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/lib/blocks/active In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/lib/blocks/active Added Files: Tag: question_reporting IfBlock.php ForEachBlock.php SizeBlock.php BoldBlock.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: IfBlock.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * * This file is licensed under the GPL License. * * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * * * @author Matti Harjula * */ global $config; $root = $config->get('docroot'); require_once($root.'/lib/blocks/BlockInterface.php'); require_once($root.'/lib/ui/BlockHandler.php'); /** * A Block to handle if-else-if structures of this form: * {% if test1 %}... * {% else if test2 %}... * {% else %}... * {% end if %} */ class IfBlock extends BlockInterface { public function getSubBlockIdentifiers(){return array("else");} public function getBlockIdentifier(){return "if";} public function processBlock($content,$vars,$casTextHandler){ $theReturn=""; // This would be so simple if there were no else or else if... as now we need to take in to account nested ifs that may also have elses. // but as our parser can already handle these things rather well this is not that big of an deal $parsedContent=BlockHandler::blockHandlerParser($content,array("else")); $branches=array("true"=>""); $whichBranch="true"; $weHaveElseBranch=false; $weHaveElseIfBranch=false; foreach($parsedContent as $bloc) if(is_array($bloc)){ $branches[$whichBranch].=self::backToStringForm(array($bloc)); }else{ // Now then is there an else of elseif $i=0; while(true){ $startOfFirstBlock=strpos($bloc,"{%",$i); if($startOfFirstBlock>0){ $branches[$whichBranch].=substr($bloc,$i,$startOfFirstBlock-$i); }else if($startOfFirstBlock===FALSE){ $branches[$whichBranch].=substr($bloc,$i); break; } $endOfFirstStartBlock=strpos($bloc,"%}",$startOfFirstBlock+2); $firstStartBlock=substr($bloc,$startOfFirstBlock,$endOfFirstStartBlock-$startOfFirstBlock+2); $blockTokens=self::tokenCleaner(explode(" ",trim(substr($firstStartBlock,2,-2)))); if(count($blockTokens)==1){ // just the else $weHaveElseBranch=true; $whichBranch="false"; $branches["false"]=""; $i=$endOfFirstStartBlock+2; }else{ $weHaveElseIfBranch=true; $whichBranch=implode(" ",array_splice($blockTokens,1)); $branches[$whichBranch]=""; $i=$endOfFirstStartBlock+2; } } } if($vars[0] === 'true') $theReturn.=$branches['true']; else{ // if we have an "else if" there we need to build a new if block so that it can be evaluated if($weHaveElseIfBranch){ $first=true; $second=false; foreach($branches as $test => $content){ if($first){ $first=false; //skipping the true branch $second=true; } else if($second){ $second=false; // The second one is special $theReturn.="{% ".$test." %}$content"; }else if($test=="false") $theReturn.="{% else %}$content"; else $theReturn.="{% else ".$test." %}$content"; } $theReturn.="{% end if %}"; }else if($weHaveElseBranch) $theReturn.=$branches["false"]; } return $theReturn; } private static function backToStringForm($blocks){ $R=""; foreach($blocks as $block) if(is_array($block)){ if(count($block['vars'])>0) $R.="{% ".$block['block_type']." ".implode(" ",$block['vars'])." %}"; else $R.="{% ".$block['block_type']." %}"; $R.=$block['content']; $R.="{% end ".$block['block_type']." %}"; }else $R.=$block; return $R; } private static function tokenCleaner($a){ $b=array(); foreach($a as $t) if(trim($t)!="") $b[]=$t; return $b; } } ?> --- NEW FILE: BoldBlock.php --- <?php global $config; $root = $config->get('docroot'); require_once($root.'/lib/blocks/BlockInterface.php'); class BoldBlock extends BlockInterface{ public function getSubBlockIdentifiers(){return False;} public function getBlockIdentifier(){return "bold";} public function processBlock($content,$vars,$casTextHandler){ return "<b>".$content."</b>"; } } ?> --- NEW FILE: SizeBlock.php --- <?php global $config; $root = $config->get('docroot'); require_once($root.'/lib/blocks/BlockInterface.php'); class SizeBlock extends BlockInterface{ public function getSubBlockIdentifiers(){return False;} public function getBlockIdentifier(){return "size";} public function processBlock($content,$vars,$casTextHandler){ return "<font size='".$vars[0]."'>".$content."</font>"; } } ?> --- NEW FILE: ForEachBlock.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * * This file is licensed under the GPL License. * * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * * * @author Matti Harjula * */ global $config; $root = $config->get('docroot'); require_once($root.'/lib/blocks/BlockInterface.php'); /** * A Block to handle foreach structures of this form: * {% foreach [1,2,3,4] as XXX %} * Something XXX * {% end foreach %} * * The block takes any comma-separated list of things that has been wrapped in * something and splits it to values that are injected to a place in the contents * of the block the marker of that place can be freely selected and can be any * continuous string. The contents are repeated as many times as there are items * in the list. * * The use of the "as"-keyword is mandatory. One can define multiple lists to be * iterated and they will be iterated in sync. If these lists are not of the same * length the iteration stops when the first list stops. * * {% foreach [1,2,3,4] as XXX * [2,3,4,5] as YYY %} * Something XXX and YYY * {% end foreach %} * * Something 1 and 2 * Something 2 and 3 * Something 3 and 4 * Something 4 and 5 */ class ForEachBlock extends BlockInterface { public function getSubBlockIdentifiers(){return array("else");} public function getBlockIdentifier(){return "foreach";} public function processBlock($content,$vars,$casTextHandler){ $replacements=array(); $minLength=99999; for($i=0;$i*3<=count($vars);$i+=3){ $items=self::tokenizer(substr($vars[$i],1,-1)); $replacements[$vars[$i+2]]=$items; $minLength=min($minLength,count($items)); } $r=""; for($i=0;$i<$minLength;$i++){ $t=$content; foreach($replacements as $token => $values) $t=str_replace($token,$values[$i],$t); $r.=$t; } return $r; } /** * StringUtil probably has something for this task... */ public static function tokenizer($in) { $braceCount = 0; $parenthesisCount = 0; $bracketCount = 0; $out = array (); $current = ''; $unPlaced = 0; for ($i = 0; $i < strlen($in); $i++) { $unPlaced++; $char = $in[$i]; switch ($char) { case '{' : $braceCount++; $current .= $char; break; case '}' : $braceCount--; $current .= $char; break; case '(' : $parenthesisCount++; $current .= $char; break; case ')' : $parenthesisCount--; $current .= $char; break; case '[' : $bracketCount++; $current .= $char; break; case ']' : $bracketCount--; $current .= $char; break; case ',' : if ($bracketCount == 0 && $parenthesisCount == 0 && $braceCount == 0) { $out[] = $current; $current = ''; $unPlaced = 0; } else $current .= $char; break; default; $current .= $char; } } if ($unPlaced > 0 && $bracketCount == 0 && $parenthesisCount == 0 && $braceCount == 0) $out[] = $current; return $out; } } ?> |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/lib/CAS In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/lib/CAS Modified Files: Tag: question_reporting maximaXMLConnector.php displayCASText.php maximaCLIConnector.php casText.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: maximaXMLConnector.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/CAS/maximaXMLConnector.php,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -C2 -d -r1.22 -r1.22.2.1 *** maximaXMLConnector.php 27 Aug 2009 16:23:00 -0000 1.22 --- maximaXMLConnector.php 22 Nov 2010 23:05:52 -0000 1.22.2.1 *************** *** 238,242 **** } ! $returnArray; $returnArray['key'] = (string)$this->parser->anstestresult->key; --- 238,242 ---- } ! //$returnArray; $returnArray['key'] = (string)$this->parser->anstestresult->key; Index: maximaCLIConnector.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/CAS/maximaCLIConnector.php,v retrieving revision 1.35 retrieving revision 1.35.2.1 diff -C2 -d -r1.35 -r1.35.2.1 *** maximaCLIConnector.php 27 Aug 2009 16:23:00 -0000 1.35 --- maximaCLIConnector.php 22 Nov 2010 23:05:52 -0000 1.35.2.1 *************** *** 233,238 **** $cs ='cab:block([ RANDOM_SEED'; $cs .= $this->csNames; ! $cs .='], RANDOM_SEED:'; ! $cs .= $this->seed.$this->csVars; $cs .= ", print(\"[TimeStamp= [ $this->seed ], Locals= [ \") "; $cs .= $this->csCmds; --- 233,238 ---- $cs ='cab:block([ RANDOM_SEED'; $cs .= $this->csNames; ! $cs .='], stack_randseed('; ! $cs .= $this->seed.')'.$this->csVars; $cs .= ", print(\"[TimeStamp= [ $this->seed ], Locals= [ \") "; $cs .= $this->csCmds; *************** *** 255,262 **** { ! $cs = "cab:block([ ans1983,ans1984,str{$this->csNames}] {$this->csVars}, "; ! $cs .= " print(\"[ Timestamp = [ $this->seed ], Ans= [ error = [\"), cte(\"ans1983\",errcatch(ans1983:$exp1)),"; ! $cs .= " print(\" TAAns= [ error = [\"), cte(\"ans1984\",errcatch(ans1984:$exp2)),"; ! $cs .= " print(\" AnswerTestError = [ \"), str:$ansTest(ans1983,ans1984), print(\" ], \"), print(str), return(true)); \n"; $this->rawcommand = $cs; return $cs; --- 255,262 ---- { ! $cs = "cab:block([ STACK_SA,STACK_TA,str{$this->csNames}] {$this->csVars}, "; ! $cs .= " print(\"[ Timestamp = [ $this->seed ], Ans= [ error = [\"), STACK_SA:cte(\"STACK_SA\",errcatch($exp1)),"; ! $cs .= " print(\" TAAns= [ error = [\"), STACK_TA:cte(\"STACK_TA\",errcatch(STACK_TA:$exp2)),"; ! $cs .= " print(\" AnswerTestError = [ \"), str:$ansTest(STACK_SA,STACK_TA), print(\" ], \"), print(str), return(true)); \n"; $this->rawcommand = $cs; return $cs; *************** *** 364,368 **** $val = trim($val); ! if (ereg('[A-Za-z0-9].*',substr($strin,$offset,$eqpos-$offset),$regs)) { $var = trim($regs[0]); } else { --- 364,368 ---- $val = trim($val); ! if (preg_match('/[A-Za-z0-9].*/',substr($strin,$offset,$eqpos-$offset),$regs)) { $var = trim($regs[0]); } else { *************** *** 409,413 **** // Now we need to turn the (error,key,value,display) tuple into an array foreach ($locals_raw as $var => $valdval) { ! if (ereg('.*\[.*\].*',$valdval)) { // There are some []'s in the string. $loc = $this->CASParsePreparse($valdval); if ('' == trim($loc['error'])) { --- 409,413 ---- // Now we need to turn the (error,key,value,display) tuple into an array foreach ($locals_raw as $var => $valdval) { ! if (preg_match('/.*\[.*\].*/',$valdval)) { // There are some []'s in the string. $loc = $this->CASParsePreparse($valdval); if ('' == trim($loc['error'])) { *************** *** 469,474 **** //for latex mode, remove the mbox ! $parsedArray[$i]['display'] = str_replace('\mbox{{} <html>', '<html>', $parsedArray[$i]['display']); ! $parsedArray[$i]['display'] = str_replace('</html> {}}', '</html>', $parsedArray[$i]['display']); } $this->maximaAnsArray[] = new maximaAns($parsedArray[$i]['key'], $parsedArray[$i]['value'], $parsedArray[$i]['display'], $error); --- 469,474 ---- //for latex mode, remove the mbox ! // handles forms: \mbox{image} and (earlier?) \mbox{{} {image} {}} ! $parsedArray[$i]['display'] = preg_replace("|\\\mbox{({})? (<html>.+</html>) ({})?}|", "$2", $parsedArray[$i]['display']); } $this->maximaAnsArray[] = new maximaAns($parsedArray[$i]['key'], $parsedArray[$i]['value'], $parsedArray[$i]['display'], $error); *************** *** 490,494 **** $unp = $this->CASParsePreparse($instr); ! // echo "<pre>";print_r($unp);echo "</pre>"; if (array_key_exists('Ans',$unp)) { --- 490,494 ---- $unp = $this->CASParsePreparse($instr); ! //echo "<pre>";print_r($unp);echo "</pre>"; if (array_key_exists('Ans',$unp)) { *************** *** 509,513 **** } - if (''!=$unp['AnswerTestError']) { $unp['error'].=$unp['AnswerTestError']; --- 509,512 ---- *************** *** 515,540 **** unset($unp['AnswerTestError']); ! ! if (array_key_exists('Valid',$unp)) { ! $unp['Valid'] = strtolower($unp['Valid']); } - // Sort out translations of the feedback. - if (array_key_exists('FeedBack',$unp)) { - $strin = str_replace("\n","",$unp['FeedBack'] ); - $strin = str_replace('\\','\\\\',$strin); - $strin = str_replace('$','\$',$strin); - $strin = str_replace("<QUOT>",'"',$strin); - - //echo "STRIN: <pre>$strin</pre><br>"; - - ob_start(); - eval($strin); - $strin = ob_get_contents(); - ob_end_clean(); - - $unp['FeedBack'] = $strin; - } //echo "<pre>";print_r($unp);echo "</pre>"; return $unp; --- 514,539 ---- unset($unp['AnswerTestError']); + //echo "<pre>";print_r($unp);echo "</pre>"; ! /* If the fields are not here, Maxima didn't generate them = problem! */ ! if(!array_key_exists('rawmark',$unp)) { ! $unp['rawmark'] = 0; ! if (array_key_exists('feedback',$unp)) { ! $unp['feedback'] .= ' stack_trans("TEST_FAILED");'; ! } else { ! $unp['feedback'] = ' stack_trans("TEST_FAILED");'; ! } ! if (array_key_exists('answernote',$unp)) { ! $unp['answernote'] .= ' TEST_FAILED '; ! } else { ! $unp['answernote'] = ' TEST_FAILED'; ! } ! if (array_key_exists('error',$unp)) { ! $unp['error'] .= ' TEST_FAILED'; ! } else { ! $unp['error'] = ' TEST_FAILED'; ! } } //echo "<pre>";print_r($unp);echo "</pre>"; return $unp; *************** *** 558,564 **** $trimResult = str_replace('(%o1) true','', $trimResult); - $result = $this->CASAnsTestParse($trimResult); - return $result; } --- 557,561 ---- *************** *** 691,695 **** //of the format [label] -> error ! $returnArray; $noObjects = count($this->maximaAnsArray); --- 688,692 ---- //of the format [label] -> error ! $returnArray = array(); $noObjects = count($this->maximaAnsArray); Index: displayCASText.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/CAS/displayCASText.php,v retrieving revision 1.37 retrieving revision 1.37.4.1 diff -C2 -d -r1.37 -r1.37.4.1 *** displayCASText.php 26 Jun 2009 18:08:36 -0000 1.37 --- displayCASText.php 22 Nov 2010 23:05:52 -0000 1.37.4.1 *************** *** 254,258 **** foreach ($this->feedbackData as $key => $loc) { ! if (substr($key,$this->mathmlString)) { $this->mathmlString=str_replace($key,"<IEfeedback>$loc</IEfeedback>",$this->mathmlString); --- 254,258 ---- foreach ($this->feedbackData as $key => $loc) { ! if (strpos($this->mathmlString, $key) !== false) { $this->mathmlString=str_replace($key,"<IEfeedback>$loc</IEfeedback>",$this->mathmlString); *************** *** 279,283 **** foreach ($this->PRTfeedbackData as $key => $loc) { ! if (substr($key,$this->mathmlString)) { $this->mathmlString=str_replace($key,"<PRTfeedback>$loc</PRTfeedback>",$this->mathmlString); --- 279,283 ---- foreach ($this->PRTfeedbackData as $key => $loc) { ! if (strpos($this->mathmlString, $key) !== false) { $this->mathmlString=str_replace($key,"<PRTfeedback>$loc</PRTfeedback>",$this->mathmlString); *************** *** 316,323 **** foreach ($this->htmlData as $key => $loc) { ! $dummy = $key; ! if (substr($dummy,$this->mathmlString)) { ! $this->mathmlString=str_replace($dummy,$loc,$this->mathmlString); } } --- 316,322 ---- foreach ($this->htmlData as $key => $loc) { ! if (strpos($this->mathmlString, $key) !== false) { ! $this->mathmlString=str_replace($key, $loc, $this->mathmlString); } } Index: casText.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/CAS/casText.php,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -C2 -d -r1.36 -r1.36.2.1 *** casText.php 27 Aug 2009 16:23:00 -0000 1.36 --- casText.php 22 Nov 2010 23:05:52 -0000 1.36.2.1 *************** *** 169,172 **** --- 169,173 ---- function checkValidCASCommands() { + $toReturn = true; foreach($this->cmdArray as $cmd) *************** *** 185,189 **** foreach($this->cmdArray as $cmd) { ! $pat = "|([A-za-z0-9\(\)]+) ([A-za-z0-9\(\)]+)|"; if (preg_match($pat,$cmd)) { --- 186,190 ---- foreach($this->cmdArray as $cmd) { ! $pat = "|([A-Za-z0-9\(\)]+) ([A-Za-z0-9\(\)]+)|"; if (preg_match($pat,$cmd)) { *************** *** 204,208 **** foreach ($found[0] as $match) { ! if((strpos($match, '%e') !== false) || (strpos($match, '%pi') !== false) || (strpos($match, '%i') !== false) || (strpos($match, '%gamma') !== false) || (strpos($match, '%phi') !== false)) { //%e and %pi are allowed. Any other percentages dissallowed. --- 205,209 ---- foreach ($found[0] as $match) { ! if((strpos($match, '%e') !== false) || (strpos($match, '%pi') !== false) || (strpos($match, '%i') !== false) || (strpos($match, '%j') !== false) || (strpos($match, '%gamma') !== false) || (strpos($match, '%phi') !== false)) { //%e and %pi are allowed. Any other percentages dissallowed. *************** *** 266,270 **** } ! //check final character is not / * + - ^ £ # = & ~ | , ? foreach($this->cmdArray as $cmd) --- 267,271 ---- } ! //check final character is not / * + - ^ £ # = & ~ | , ? : ; foreach($this->cmdArray as $cmd) *************** *** 274,278 **** $lastChar = $cmd[($length -1)]; ! $disallowedChars = array('/','+','*','/','-','^','£','#','~','=','?','|',',','_','&','"','`','¬'); if(in_array($lastChar, $disallowedChars)) --- 275,279 ---- $lastChar = $cmd[($length -1)]; ! $disallowedChars = array('/','+','*','/','-','^','£','#','~','=','?',',','_','&','"','`','¬',';',':','$'); if(in_array($lastChar, $disallowedChars)) *************** *** 436,443 **** $i++; - $str = new stringUtil($cmd); - $cmd = $str->trimCommands(); - //$cmd = $this->trimCommands($cmd); - unset($str); $this->cmdArray[$label] = $cmd; } --- 437,440 ---- *************** *** 528,541 **** // We assume f and g are single letter functions. $patterns[] = "|(\))(\()|"; // Simply the pattern ")(". Must be wrong! ! $patterns[] = "|([0-9]+)([A-Za-eh-z])|"; // eg 3x ! $patterns[] = "|([0-9])([A-Za-z]\()|"; // eg 3 x ( ! $patterns[] = "|([0-9]+)(\()|"; // eg 3212 ( ! $patterns[] = "|(\))([0-9A-Za-z])|"; // eg )a if ($this->security == 's') { // Teachers have more options for functions ! $patterns[] = "|(^[A-Za-eh-z])(\()|"; // eg a( , that is a single letter. ! $patterns[] = "|(\*[A-Za-eh-z])(\()|"; } --- 525,538 ---- // We assume f and g are single letter functions. $patterns[] = "|(\))(\()|"; // Simply the pattern ")(". Must be wrong! ! $patterns[] = "|([0-9]+)([A-DF-Za-eh-z])|"; // eg 3x ! $patterns[] = "|([0-9])([A-DF-Za-z]\()|"; // eg 3 x ( ! $patterns[] = "|(\))([0-9A-DF-Za-z])|"; // eg )a if ($this->security == 's') { // Teachers have more options for functions ! $patterns[] = "|([0-9]+)(\()|"; // eg 3212 ( ! $patterns[] = "|(^[A-DF-Za-eh-z])(\()|"; // eg a( , that is a single letter. ! $patterns[] = "|(\*[A-DF-Za-eh-z])(\()|"; } *************** *** 598,612 **** { // We assume f and g are single letter functions. $patterns[] = "|(\))(\()|"; // Simply the pattern ")(". Must be wrong! ! $patterns[] = "|([0-9]+)([A-Za-eh-z])|"; // eg 3x ! $patterns[] = "|([0-9])([A-Za-z]\()|"; // eg 3 x ( ! $patterns[] = "|([0-9]+)(\()|"; // eg 3212 ( ! $patterns[] = "|(\))([0-9A-Za-z])|"; // eg )a if ($this->security == 's') { // Teachers have more options for functions ! $patterns[] = "|(^[A-Za-eh-z])(\()|"; // eg a( , that is a single letter. ! $patterns[] = "|(\*[A-Za-eh-z])(\()|"; } --- 595,610 ---- { // We assume f and g are single letter functions. + // We exclude E (capital eee) to enable 24E+1 to be a floating point number. $patterns[] = "|(\))(\()|"; // Simply the pattern ")(". Must be wrong! ! $patterns[] = "|([0-9]+)([A-DF-Za-eh-z])|"; // eg 3x ! $patterns[] = "|([0-9])([A-DF-Za-z]\()|"; // eg 3 x ( ! $patterns[] = "|(\))([0-9A-DF-Za-z])|"; // eg )a if ($this->security == 's') { // Teachers have more options for functions ! $patterns[] = "|([0-9]+)(\()|"; // eg 3212 ( ! $patterns[] = "|(^[A-DF-Za-eh-z])(\()|"; // eg a( , that is a single letter. ! $patterns[] = "|(\*[A-DF-Za-eh-z])(\()|"; } |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/opaque In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/opaque Modified Files: Tag: question_reporting newWSDL.wsdl MoodleQuestionList.php MoodleQuestionDeployment.php MoodleDisplayItem.php soapServer.php CheckPassKey.php StackServer.php MoodleStackReport.php Added Files: Tag: question_reporting StackAttemptServer.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. Index: newWSDL.wsdl =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/newWSDL.wsdl,v retrieving revision 1.8 retrieving revision 1.8.4.1 diff -C2 -d -r1.8 -r1.8.4.1 *** newWSDL.wsdl 23 Jun 2009 14:39:36 -0000 1.8 --- newWSDL.wsdl 22 Nov 2010 23:05:51 -0000 1.8.4.1 *************** *** 111,122 **** <complexType name="QuestionItem"> <sequence> ! <element name="id" nillable="true" type="xsd:int"/> ! <element name="name" nillable="true" type="soapenc:string"/> ! <element name="description" nillable="true" type="soapenc:string"/> ! <element name="valid" nillable="true" type="xsd:int"/> ! <element name="dateEdited" nillable="true" type="soapenc:string"/> ! <element name="moodleCategories" nillable="true" type="impl:ArrayOf_soapenc_string"/> ! <element name="published" nillable="true" type="soapenc:string"/> ! <element name="nodeployed" nillable="true" type="xsd:int"/> </sequence> </complexType> --- 111,124 ---- <complexType name="QuestionItem"> <sequence> ! <element name="id" nillable="true" type="xsd:int" /> ! <element name="version" nillable="true" type="xsd:int" /> ! <element name="name" nillable="true" type="soapenc:string" /> ! <element name="description" nillable="true" type="soapenc:string" /> ! <element name="valid" nillable="true" type="xsd:int" /> ! <element name="dateEdited" nillable="true" type="soapenc:string" /> ! <element name="moodleCategories" nillable="true" type="impl:ArrayOf_soapenc_string" /> ! <element name="published" nillable="true" type="soapenc:string" /> ! <element name="nodeployed" nillable="true" type="xsd:int" /> ! <element name="keywords" nillable="true" type="impl:ArrayOf_soapenc_string" /> </sequence> </complexType> *************** *** 147,155 **** <complexType name="StackQuestionPage"> <sequence> ! <element name="questionItems" nillable="true" type="impl:ArrayOfQuestionItem"/> ! <element name="publicQuestions" nillable="true" type="impl:ArrayOfQuestionItem"/> ! <element name="xhtml" nillable="true" type="soapenc:base64Binary"/> ! <element name="head" nillable="true" type="soapenc:string"/> ! <element name="categories" nillable="true" type="impl:ArrayOfCategories"/> </sequence> </complexType> --- 149,158 ---- <complexType name="StackQuestionPage"> <sequence> ! <element name="questionItems" nillable="true" type="impl:ArrayOfQuestionItem" /> ! <element name="publicQuestions" nillable="true" type="impl:ArrayOfQuestionItem" /> ! <element name="xhtml" nillable="true" type="soapenc:base64Binary" /> ! <element name="head" nillable="true" type="soapenc:string" /> ! <element name="categories" nillable="true" type="impl:ArrayOfCategories" /> ! <element name="keywords" nillable="true" type="impl:ArrayOf_soapenc_string" /> </sequence> </complexType> *************** *** 161,166 **** type="impl:ArrayOfDeployedInstances"> </element> ! <element name="xhtml" type="string"></element> ! <element name="head" type="string"></element> </sequence> --- 164,169 ---- type="impl:ArrayOfDeployedInstances"> </element> ! <element name="xhtml" type="string" /> ! <element name="head" type="string" /> </sequence> *************** *** 176,179 **** --- 179,183 ---- </complexContent> </complexType> + </schema> *************** *** 811,813 **** </wsdl:service> ! </wsdl:definitions> --- 815,817 ---- </wsdl:service> ! </wsdl:definitions> \ No newline at end of file Index: MoodleStackReport.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleStackReport.php,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** MoodleStackReport.php 16 Sep 2009 12:05:13 -0000 1.4 --- MoodleStackReport.php 22 Nov 2010 23:05:51 -0000 1.4.2.1 *************** *** 40,85 **** { ! if(!empty($param['type'])) ! { $reportType = $param['type']; $xhtml .= $this->report->displayResults($param); - } - $xhtml .= '<br />'; ! if($reportType == NULL) //if still null, display options ! { ! //display filter selector ! $xhtml = "<em>Only very simple reports are currently available</em><br />"; ! $xhtml .= '<p><a href="stackSessionPage.php?page=report&type=question">'.get_string('stackReport_question','stack').'</a></p>'; ! $xhtml .= '<p><a href="stackSessionPage.php?page=report&type=student">'.get_string('stackReport_student','stack').'</a></p>'; ! //$xhtml .= '<p><a href="stackSessionPage.php?page=report&type=markbook">'.get_string('stackReport_markbook','stack').'</a></p>'; ! } ! else ! { ! unset($param['type']); ! unset($param['page']); ! //switch($_GET['reportType']) ! switch($reportType) ! { ! case 'question': ! $xhtml .= $this->report->questionFilterInterface($param); ! break; ! case 'student': ! $xhtml .= $this->report->studentFilterInterface($param); ! break; ! case 'quiz': ! $xhtml .= $this->report->quizFilterInterface($param); ! break; ! case 'markbook': ! $xhtml .= $this->report->markbookFilterInterface($param); ! break; ! } ! $xhtml .= '<br /><br />'; ! $xhtml .= '<a href="stackSessionPage.php?page=report">'.get_string('stackReport_reportType','stack').'</a>'; ! } return $xhtml; --- 40,67 ---- { ! if (isset($param['type'])) { ! $reportType = $param['type']; $xhtml .= $this->report->displayResults($param); ! $xhtml .= '<p><a href="stackSessionPage.php?page=report">'.get_string('stackReport_reportType','stack').'</a></p>'; ! } else { ! ! $xhtml .= '<h1>Select a report type</h1>'; ! $xhtml .= '<div class="section"> ! <h3>Interactive report</h3> ! <p> <a href="stackSessionPage.php?page=report&type=interactive"><button >Load the interactive interface</button></a> </p> ! </div>'; ! $xhtml .= '<form action="stackSessionPage.php?page=report&type=question" method="post">' ! . $report->questionFilterInterface($param) ! . '</form>'; ! $xhtml .= '<form action="stackSessionPage.php?page=report&type=student" method="post">' ! . $report->studentFilterInterface($param) ! . '</form>'; ! } return $xhtml; Index: MoodleDisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleDisplayItem.php,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** MoodleDisplayItem.php 30 Sep 2009 10:36:36 -0000 1.11 --- MoodleDisplayItem.php 22 Nov 2010 23:05:51 -0000 1.11.2.1 *************** *** 54,58 **** * @param int quizId */ ! public function __construct($userId, $questionId, $reconstruct=false, $seed=NULL, $quizId=NULL) { $cache = new StackDBCache(); --- 54,58 ---- * @param int quizId */ ! public function __construct($userId, $versionId, $reconstruct=false, $seed=NULL, $quizId=NULL) { $cache = new StackDBCache(); *************** *** 65,69 **** } // Remember: a stateID of 0 indicates no questions deployed. ! $this->stateID = $cache->selectInitialState($seed, $questionId); $this->userID = $userId; $this->progress = 0; --- 65,69 ---- } // Remember: a stateID of 0 indicates no questions deployed. ! $this->stateID = $cache->selectInitialState($seed, $versionId); $this->userID = $userId; $this->progress = 0; *************** *** 168,175 **** // Extract and remove action from posted. ! $action = $posted['stackaction']; unset($posted['stackaction']); - $moodle_event = $posted['event']; unset($posted['event']); if(8 == $moodle_event) $action = 'Finish';// submission hack if(3 == $moodle_event) $action = 'Grade';// review hack --- 168,209 ---- // Extract and remove action from posted. ! $event = MoodleDisplayItem::mapStackEvent($posted); unset($posted['stackaction']); unset($posted['event']); + + // Either return xhtml for current state or invoke process to use cache. + if(0 == $event) { + $xhtml = $cache->getXHTML($this->stateID); + } else { + $xhtml = $this->processItem($posted, true, $event); + } + + $xhtml = $this->fillInputFields($posted, $xhtml); + + // add STACK buttons + // See bug #2890734 + $xhtml .= "<div class='mdl-align'>"; // submitbtns to be hidden in CSS styles.php + $xhtml .= "<input id='stacksubmit' name='stackaction' type='submit' value='".get_string('stackQuiz_button_submit','stack','')."' />"; + /* Some JavaScript hackery below to ensure we don't have to mess with attempt.php: + * We activate the (hidden) finish button with our own and hide our own on + * the review page. Tested with FF and IE. + */ + $xhtml .= "<input type=\"button\" id=\"stackfinish\" value=\"".get_string('stackQuiz_button_finishQuiz','stack','')."\" name=\"finishattempt\" " . + "onclick=\"document.getElementsByName('finishattempt')[0].click();\" />"; + $xhtml .= "<script>if(window.location.href.indexOf('attempt.php') == -1) {" . + "document.getElementById('stacksubmit').style.display = 'none'; " . + "document.getElementById('stackfinish').style.display = 'none'; " . + "}</script>"; + $xhtml .= "</div>"; + return $xhtml; + } + + /** + * Infers our internal STACK event from the post data supplied by Moodle. + * Factored static function to allow other access, e.g. for Diagnostic reporting + */ + public static function mapStackEvent($posted) { + $action = $posted['stackaction']; + $moodle_event = $posted['event']; if(8 == $moodle_event) $action = 'Finish';// submission hack if(3 == $moodle_event) $action = 'Grade';// review hack *************** *** 197,225 **** $event = 0; // default e.g. by navigating away } ! ! // Either return xhtml for current state or invoke process to use cache. ! if(0 == $event) { ! $xhtml = $cache->getXHTML($this->stateID); ! } else { ! $xhtml = $this->processItem($posted, true, $event); ! } ! ! $xhtml = $this->fillInputFields($posted, $xhtml); ! ! // add STACK buttons ! $xhtml .= "<div class='mdl-align'>"; // submitbtns to be hidden in CSS styles.php ! $xhtml .= "<input id='stacksubmit' name='stackaction' type='submit' value='Submit' />"; ! /* Some JavaScript hackery below to ensure we don't have to mess with attempt.php: ! * We activate the (hidden) finish button with our own and hide our own on ! * the review page. Tested with FF and IE. ! */ ! $xhtml .= "<input type=\"button\" id=\"stackfinish\" value=\"Finish Quiz\" name=\"finishattempt\" " . ! "onclick=\"document.getElementsByName('finishattempt')[0].click();\" />"; ! $xhtml .= "<script>if(window.location.href.indexOf('attempt.php') == -1) {" . ! "document.getElementById('stacksubmit').style.display = 'none'; " . ! "document.getElementById('stackfinish').style.display = 'none'; " . ! "}</script>"; ! $xhtml .= "</div>"; ! return $xhtml; } --- 231,235 ---- $event = 0; // default e.g. by navigating away } ! return $event; } Index: StackServer.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/StackServer.php,v retrieving revision 1.47 retrieving revision 1.47.2.1 diff -C2 -d -r1.47 -r1.47.2.1 *** StackServer.php 22 Oct 2009 17:37:56 -0000 1.47 --- StackServer.php 22 Nov 2010 23:05:51 -0000 1.47.2.1 *************** *** 30,33 **** --- 30,34 ---- require_once $root . '/lib/items/Item.php'; require_once $root . '/lib/searching/StackSearch.php'; + require_once $root . '/lib/reporting/DiagnosticReport.php'; require_once $root . '/lib/Logger.php'; *************** *** 85,90 **** } ! public function getQuestionMetadata($questionID, $questionVersion, $questionBaseURL) { ! return 'Question Metadata for ' . "$questionID, $questionVersion, $questionBaseURL"; } --- 86,91 ---- } ! public function getQuestionMetadata($questionID, $line, $questionBaseURL) { ! return 'Question Metadata for ' . "$questionID, $line, $questionBaseURL"; } *************** *** 108,112 **** * */ ! public function start($questionID, $questionVersion, $questionBaseURL, $initialParamNames, $initialParamValues, $cachedResources) { $initialParams = array_combine($initialParamNames, $initialParamValues); --- 109,113 ---- * */ ! public function start($versionID, $version, $questionBaseURL, $initialParamNames, $initialParamValues, $cachedResources) { $initialParams = array_combine($initialParamNames, $initialParamValues); *************** *** 120,125 **** } ! //$this->logger->debug("init params in start ".print_r($initialParams, 1)); ! //$this->logger->debug("timeclose = $timeclose"); $startReturn = new StartReturnDT(); --- 121,130 ---- } ! //$this->logger->debug("init params in start ".print_r($initialParams, 1)); ! //$this->logger->debug("timeclose = $timeclose"); ! //$this->logger->debug("version is ".$version." and lineID is ".$lineID); ! ! // $questionID = substr($version, 1 + strpos($version, '.')); // quicker than regex match ! $questionID = substr($versionID, 1); // lop off leading q $startReturn = new StartReturnDT(); *************** *** 127,131 **** $keyCheck = new CheckPassKey($passKey, $userId); ! if ($keyCheck->checkPasskey() == true) { //generate a session uid for the question --- 132,136 ---- $keyCheck = new CheckPassKey($passKey, $userId); ! if ($keyCheck->isValid()) { //generate a session uid for the question *************** *** 133,138 **** $startReturn->questionSession = $sessionID; - $questionID = substr($questionID, 1); - //check question exists $db = new StackDBItem(); --- 138,141 ---- *************** *** 251,254 **** --- 254,258 ---- global $config; $root = $config->get('docroot'); + $weburl = $config->get('weburl'); $param = array_combine($paramKey, $paramVal); *************** *** 259,263 **** $keyCheck = new CheckPassKey($passkey, $userID); ! if ($keyCheck->checkPasskey() == true) { switch ($pageName) { case 'exporter' : --- 263,267 ---- $keyCheck = new CheckPassKey($passkey, $userID); ! if ($keyCheck->isValid()) { switch ($pageName) { case 'exporter' : *************** *** 299,303 **** case 'search' : - $search = new StackSearch($param, $param['userID'], true); $xhtml .= $search->displaySearchForm(); --- 303,306 ---- *************** *** 309,312 **** --- 312,327 ---- break; + case 'diagnostic' : + $diagnostic = new DiagnosticReport($param['userID'], $param['quiz']); + //$xhtml .= "param=".print_r($param,1); + $xhtml .= $diagnostic->display(); + $head = '<link rel="stylesheet" type="text/css" href="'.$weburl.'/other/jqplot/jquery.jqplot.css" />' . + '<!--[if IE]><script language="javascript" type="text/javascript" src="'.$weburl.'/other/jqplot/excanvas.js"></script><![endif]--> + <script type="text/javascript" src="'.$weburl.'/other/jqplot/jquery-1.3.2.min.js"></script>' . + '<script type="text/javascript" src="'.$weburl.'/other/jqplot/jquery.jqplot.min.js"></script>' . + '<script type="text/javascript" src="'.$weburl.'/other/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>' . + '<script type="text/javascript" src="'.$weburl.'/other/jqplot/plugins/jqplot.barRenderer.min.js"></script>'; + break; + default : $xhtml = 'Could not find page "' . $pageName . '".'; *************** *** 329,333 **** public function stackStartAuthor($passKey, $userID, $questionID = NULL) { $keyCheck = new CheckPassKey($passKey, $userID); ! if ($keyCheck->checkPasskey() == true) { $authorStackQuestion = new AuthorDisplay($userID, $questionID); //$author = new AuthorDisplay('1'); --- 344,348 ---- public function stackStartAuthor($passKey, $userID, $questionID = NULL) { $keyCheck = new CheckPassKey($passKey, $userID); ! if ($keyCheck->isValid()) { $authorStackQuestion = new AuthorDisplay($userID, $questionID); //$author = new AuthorDisplay('1'); *************** *** 378,382 **** /** ! * Returns an array of question id's to question names & description * * @access public --- 393,397 ---- /** ! * Returns an array of question ids to question names & description * * @access public *************** *** 387,391 **** $qList->processOperations(); $returning = $qList->getList(); - return $returning; } --- 402,405 ---- *************** *** 406,412 **** $param = array_combine($paramKey, $paramVal); } ! $this->logger->critical("processing deployment with param:".print_r($param, true)); $checkKey = new CheckPassKey($passKey, $userId); ! if ($checkKey->checkPassKey() == true) { $deployment = new MoodleQuestionDeployment($passKey, $paramKey, $paramVal, $this->getHTMLHead()); $deployment->processOperations($param); --- 420,431 ---- $param = array_combine($paramKey, $paramVal); } ! $this->logger->debug("in stackDeployOperation with param:".print_r($param, true)); $checkKey = new CheckPassKey($passKey, $userId); ! if ($checkKey->isValid()) { ! $paramKey[] = 'userID'; ! $paramVal[] = $userId; ! $param['userID'] = $userId; ! //$paramKey[] = 'engineID'; ! //$paramVal[] = ''? $deployment = new MoodleQuestionDeployment($passKey, $paramKey, $paramVal, $this->getHTMLHead()); $deployment->processOperations($param); *************** *** 433,437 **** $checkKey = new CheckPassKey($passKey, $userId); ! if ($checkKey->checkPassKey() == true) { switch ($pageName) { case '' : --- 452,456 ---- $checkKey = new CheckPassKey($passKey, $userId); ! if ($checkKey->isValid()) { switch ($pageName) { case '' : *************** *** 555,558 **** --- 574,578 ---- } + /* Separated into StackAttemptServer */ private function loadQuestion($sessionID) { $db = new StackDBOpaque(); *************** *** 588,591 **** --- 608,612 ---- } + private function storeQuestion($question, $sessionID = NULL, $timeclose = 0) { $db = new StackDBOpaque(); *************** *** 603,606 **** --- 624,628 ---- return $result; } + //*/ private function generateSessionId($qid, $uid) { *************** *** 666,670 **** <script type="text/javascript" src="' . $webroot . '/other/moo.fx/prototype.lite.js"></script> <script type="text/javascript" src="' . $webroot . '/other/moo.fx/moo.fx.js"></script> ! <script type="text/javascript" src="' . $webroot . '/other/moo.fx/moo.fx.js"></script> <script type="text/javascript" src="' . $webroot . '/other/jquery.js"></script> --- 688,692 ---- <script type="text/javascript" src="' . $webroot . '/other/moo.fx/prototype.lite.js"></script> <script type="text/javascript" src="' . $webroot . '/other/moo.fx/moo.fx.js"></script> ! <script type="text/javascript" src="' . $webroot . '/other/flyfeedback.js"></script> <script type="text/javascript" src="' . $webroot . '/other/jquery.js"></script> Index: MoodleQuestionDeployment.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleQuestionDeployment.php,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** MoodleQuestionDeployment.php 30 Jun 2009 15:12:07 -0000 1.3 --- MoodleQuestionDeployment.php 22 Nov 2010 23:05:51 -0000 1.3.4.1 *************** *** 45,48 **** --- 45,49 ---- require_once($root.'/opaque/datatypes/CategoryDT.php'); + require_once $root . '/lib/Logger.php'; class MoodleQuestionDeployment *************** *** 55,58 **** --- 56,60 ---- private $db; + private $logger; /** * *************** *** 79,83 **** private $xhtml; - /** * Constructs the question deployment --- 81,84 ---- *************** *** 91,94 **** --- 92,97 ---- public function __construct($passKey, $paramKey, $paramVal, $head, $title=NULL) { + $this->logger = new Logger("MoodleQuestionDeployment"); + $this->db = new StackDBCache(); $this->db->connect(); *************** *** 100,104 **** $this->xhtml = ''; ! $this->deployment = new Deployment($this->param['id']); } --- 103,108 ---- $this->xhtml = ''; ! $this->logger->debug("in MQD constructor: ".print_r($this->param, 1)); ! $this->deployment = new Deployment($this->param['id'], $this->param['engineID']); } *************** *** 109,113 **** // no checking for singleton status required ! // add elements to fit form expected by Deployment switch($param['operation']) { case 'add': --- 113,117 ---- // no checking for singleton status required ! // add elements where necessary to fit form expected by Deployment switch($param['operation']) { case 'add': *************** *** 120,123 **** --- 124,145 ---- } $this->deployment->processOperations($param); + + // Handle Moodle question bank operations here + if($param['operation'] == 'update') { + $this->logger->debug("about to call hideQuestion with $stackID and engine:".$this->deployment->getEngineID()); + // add new and remove old + $mDB = new MoodleDB(); + $mDB->connect(); + + $mDB->hideQuestion($param['prior'], $this->deployment->getEngineID()); + $mDB->addQuestion($param['id'], $this->deployment->getLine(), $param['userID'], $this->deployment->getEngineID(), $param['category']); + } + + if($param['operation'] == 'move') { + $mDB = new MoodleDB(); + $mDB->connect(); + + $mDB->addQuestion($param['id'], $this->deployment->getLine(), $param['userID'], $this->deployment->getEngineID(), $param['category']); + } } *************** *** 125,138 **** * List instances */ ! public function getList() { ! if(!$this->deployment->isSingleton()) { ! $this->xhtml .= '<p>'.$this->deployment->size().get_string('FE_deployQuestion_versions', 'stack').'<br />'.$this->deployment->formXHTML().'</p>'; ! } else { ! $this->xhtml .= '<p>'.get_string('FE_deployQuestion_singletonDeployed', 'stack').'<br />'; } foreach($this->deployment->getInstances() as $instance) { $item = $this->db->getDisplayItem($instance['id']); ! $instancesReturn[] = new StackDeployedInstancesDT($instance['id'], $item->getQuestionnote(), $item->getQuestionSeed()); } return new StackDeploymentPageDT($this->head, $this->xhtml, $instancesReturn); } --- 147,223 ---- * List instances */ ! public function getList() { ! $itemDB = new StackDBItem(); ! $itemDB->connect(); ! $currentVersion = $itemDB->getLatestVersion($this->param['id']); ! ! $earliest = $this->deployment->earliestDeployedVersion(); ! ! $mDB = new MoodleDB(); ! $mDB->connect(); ! // Grab info here before later queries hijack connection ! $attempts = $mDB->attemptsOnQuestion($earliest); ! $categories = $mDB->getQuestionCategory($earliest); ! ! //$this->xhtml .= print_r($categories, 1); ! $selector = $mDB->categorySelector('category', $categories[0]); ! ! if($currentVersion == $this->deployment->getVersion()) { // this is latest version ! //$earliest = $this->deployment->earliestDeployedVersion(); ! if($currentVersion == $earliest || false == $earliest) { // no earlier deployment exists ! if($this->deployment->isSingleton()) $this->xhtml .= get_string('FE_deployQuestion_singletonDeployed', 'stack'); ! else $this->xhtml .= $this->deployment->formXHTML(); ! if($this->deployment->size() > 0) { // don't want to deploy empty versions! ! $this->xhtml .= '<p /><input type="submit" name="submit" value="'.get_string('FE_deployQuestion_moveTo', 'stack').'" '.$selector; ! } ! } else { // earlier version has been deployed - must drop it before we can deploy latest ! //$this->xhtml .= '<div class="warning">'.get_string('FE_deployQuestion_oldVersionDeployed', 'stack')."</div>"; ! $this->xhtml .= "<div class='warning'>Question $currentVersion is a newer version of question $earliest which has already been deployed into a Moodle question bank.<p>You can update the Moodle question bank in a single step with the form below.</div>"; ! $this->deployment = new Deployment($earliest); ! if($this->deployment->size() > 0) { ! //$this->xhtml .= '<p><a href="?id='.$this->param['id'].'&dropall='.$earliest.'">'.get_string('FE_deployQuestion_undeployAll', 'stack').'</a>'; ! //get_string('stackDeploy_button_update', 'qtype_opaque') ! $this->xhtml .= '<p><form action="?id='.$this->param['id'].'&dropall='.$earliest.'">'; ! $this->xhtml .= 'Remove question '.$earliest.' and deploy '.$currentVersion.' with '; ! //$this->xhtml .= ' <input type="checkbox"> Replace in Moodle question bank'; ! ! $this->xhtml .= '<input type="text" name="add" id="add" value="'.$this->deployment->size().'" size="3" maxlength="3"/> '.get_string('FE_deployQuestion_newRandomInstances', 'stack'); ! $this->xhtml .= ' into '.$selector;//'category',$mDB->getQuestionCategory($earliest)); ! /*if($attempts) { ! $this->xhtml .= "<br>Already in use in a quiz!"; ! //$this->xhtml .= '<br />Also replace in Moodle quizzes <input onclick="if(this.checked == true) alert(\'Only do this for minor changes to ensure stored student attempts are still valid!\')" type="checkbox">'; // list them and warn! ! } else $this->xhtml .= "<br>Fortunately not in use in a quiz!"; ! */ ! $this->xhtml .= '<br /><input type="submit" onclick="if($(\'#add\').val() == \'0\') {alert(\'zero\'); return false;}" name="submit" value="'.get_string('stackDeploy_button_update', 'stack').'">'; ! $this->xhtml .= '<input type="hidden" name="prior" value="'.$earliest.'"></form>'; ! } ! } ! } else { // this is an old version ! $this->xhtml .= get_string('FE_deployQuestion_newerVersionCannotDeploy', 'stack', $currentVersion); ! $this->xhtml .= '<a href="?id='.$currentVersion.'">deploy latest</a>'; ! } ! ! // original stuff below ! /* ! if($this->deployment->size() > 0 && $this->deployment->getVersion() != $currentVersion) { // out-of-date instances exist ! $this->xhtml .= '<p>'.get_string('FE_deployQuestion_newerVersion', 'stack', $currentVersion).'</p>'; } + else { // can deploy more of this version + if(!$this->deployment->isSingleton()) { + $this->xhtml .= '<p>'.get_string('FE_deployQuestion_xInstances', 'stack', $this->deployment->size()).get_string('FE_deployQuestion_ofVersionXdeployed', 'stack', $this->deployment->getVersion()).'</p>'.$this->deployment->formXHTML(); + } else { + $this->xhtml .= get_string('FE_deployQuestion_singletonDeployed', 'stack'); + } + } + */ + + $this->xhtml .= '<h3 class="main">'.get_string('FE_deployQuestion_instancesOfQuestion', 'stack', $this->deployment->getVersion()).'</h3>'; + foreach($this->deployment->getInstances() as $instance) { $item = $this->db->getDisplayItem($instance['id']); ! ! $instancesReturn[] = new StackDeployedInstancesDT($instance['id'], $item->getQuestionNote(), $instance['xhtml'], $item->getQuestionSeed(), $this->deployment->isPrimed($instance['id'])); } + return new StackDeploymentPageDT($this->head, $this->xhtml, $instancesReturn); } --- NEW FILE: StackAttemptServer.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * * This file is licensed under the GPL License. * * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * * @author Simon Hammond (s.h...@bh...) * * @package stackOpaque */ require_once ('../config.php'); $config = new stackConfig(); global $config; $root = $config->get('docroot'); require_once ($root . '/lib/ui/DisplayItem.php'); require_once ($root . '/lib/error.php'); require_once ($root . '/lib/stackLegacy.php'); require_once $root . '/lib/items/Item.php'; require_once $root . '/lib/Logger.php'; require_once ('MoodleDisplayItem.php'); require_once 'CheckPassKey.php'; require_once ($root . '/lib/database/StackDBOpaque.php'); require_once ($root . '/lib/database/StackDBItem.php'); require_once ($root . '/opaque/datatypes/Score.php'); require_once ($root . '/opaque/datatypes/StackSoapPageReturn.php'); require_once ($root . '/opaque/datatypes/QuestionListDT.php'); require_once ($root . '/opaque/datatypes/StackQuestionPageDT.php'); require_once ($root . '/opaque/datatypes/CategoryDT.php'); /* * This is a streamlined SOAP server just for handling student attempts. */ class StackAttemptServer { private $errorlog; private $logger; public function __construct() { $this->errorLog = new error(); $this->logger = new Logger('StackAttemptServer'); } private function loadQuestion($sessionID) { $db = new StackDBOpaque(); $db->connect(); $result = $db->getSessionData($sessionID); // fields as an array if ($result['cacheID'] > 0) { // cached MoodleDisplayItem $session = new MoodleDisplayItem($result['userID'], 0); // get new item $session->setStateID($result['cacheID']); // move to right place in cache $session->setProgress($result['progress']); $this->logger->debug("result? ".print_r($result, true)); // get the expired status from the cache state NOT the session $cache = new StackDBCache(); $cache->connect(); $expired = $cache->getExpired($result['cacheID']); // setting a new expired state if necessary if($result['timeclose'] > 0 && $result['timeclose'] < time() && !$expired){ // moving to expired status $session->expire(); // will set expired to true } else { // No change since already expired or not yet time //$this->logger->debug("NOT expiring solution since timeclose is either 0 or >= ".time().")"); $session->setExpired($expired); } } else { $session = $db->base64_unserialize($result['data']); // some other object, e.g. Item } $db->disconnect(); return $session; } private function storeQuestion($question, $sessionID = NULL, $timeclose = 0) { $db = new StackDBOpaque(); $db->connect(); $serialised = $db->base64_serialize($question); if (get_class($question) == 'MoodleDisplayItem') { // can pass $serialised first arg (or NULL, since it'll be cached) $result = $db->storeSession(NULL, $sessionID, $question->getStateID(), $question->getUserID(), $question->getProgress(), $timeclose); } else { $result = $db->storeSession($serialised, $sessionID); // e.g. Authoring session } $db->disconnect(); return $result; } } ?> Index: MoodleQuestionList.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleQuestionList.php,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** MoodleQuestionList.php 22 Oct 2009 17:37:56 -0000 1.7 --- MoodleQuestionList.php 22 Nov 2010 23:05:51 -0000 1.7.2.1 *************** *** 110,114 **** $keyCheck = new CheckPassKey($this->passKey, $param['userID']); ! if($keyCheck->checkPasskey() == true) { --- 110,114 ---- $keyCheck = new CheckPassKey($this->passKey, $param['userID']); ! if($keyCheck->isValid()) { *************** *** 158,162 **** $this->db->connect(); ! $questions = $this->db->getListOfQuestions($param['userID'],true); $this->db->disconnect(); --- 158,162 ---- $this->db->connect(); ! $questions = $this->db->getLines($param['userID'], true, $param['filter'], $param['keywords']); $this->db->disconnect(); *************** *** 191,206 **** else { foreach($questions as $question) { // apply filter if(stack_questionbank_simple_question_filter($param['filter'], $question, isset($param['casesensitive']))) { ! $qlistArray[] = new QuestionListDT($question['id'], $question['questionName'], $question['questionDescription'], $question['valid'], $question['questionDateLastEdited'], $question['moodleCategories'], $question['published'], $question['nodeployed']); } } ! //$this->logger->finest(print_r($qlistArray,true)); $xhtml .= '<hr />'.$this->HTMLHead; ! $questionPage = new StackQuestionPageDT($qlistArray, $xhtml, $this->HTMLHead, $categories); return $questionPage; } --- 191,213 ---- else { + $kwdb = new StackDBKeywords(); + $kwdb->connect(); + foreach($questions as $question) { // apply filter if(stack_questionbank_simple_question_filter($param['filter'], $question, isset($param['casesensitive']))) { ! // get keywords array ! $keywords = $kwdb->getQuestionsKeywords($question['id']); ! $qlistArray[] = new QuestionListDT($question['id'], $question['questionName'], $question['questionDescription'], $question['valid'], stringUtil::prettifyDate($question['questionDateLastEdited']), $question['moodleCategories'], $question['published'], $question['nodeployed'], $keywords); } } ! $this->logger->debug(print_r($qlistArray,true)); $xhtml .= '<hr />'.$this->HTMLHead; ! $keywords = $kwdb->getAllKeywords(true); // active only ! $this->logger->debug($keywords); ! $questionPage = new StackQuestionPageDT($qlistArray, $xhtml, $this->HTMLHead, $categories, $keywords); return $questionPage; } *************** *** 276,279 **** --- 283,287 ---- $mdb = new MoodleDB(); $mdb->connect(); + //$this->logger->debug("cats:".print_r($param['categories'],1)); $result = $mdb->batchAdd($questions, $param['userID'], $param['stackEngine'], $param['categories']); $mdb->disconnect(); Index: soapServer.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/soapServer.php,v retrieving revision 1.10 retrieving revision 1.10.12.1 diff -C2 -d -r1.10 -r1.10.12.1 *** soapServer.php 20 Dec 2007 14:42:56 -0000 1.10 --- soapServer.php 22 Nov 2010 23:05:51 -0000 1.10.12.1 *************** *** 25,29 **** ! $ini = ini_set("soap.wsdl_cache_enabled","0"); //$soap = new SoapServer(null, array('uri' => "http://localhost/opaquetest")); --- 25,29 ---- ! // $ini = ini_set("soap.wsdl_cache_enabled","0"); //$soap = new SoapServer(null, array('uri' => "http://localhost/opaquetest")); Index: CheckPassKey.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/CheckPassKey.php,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** CheckPassKey.php 23 Jun 2009 14:39:36 -0000 1.4 --- CheckPassKey.php 22 Nov 2010 23:05:51 -0000 1.4.4.1 *************** *** 48,52 **** * @return bool */ ! public function checkPasskey() { global $config; --- 48,52 ---- * @return bool */ ! public function isValid() { global $config; |
From: Ben H. <bdv...@us...> - 2010-11-22 23:06:00
|
Update of /cvsroot/stack/stack-dev/opaque/moodleModule/stack_diagnostic/lang/en_utf8 In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/opaque/moodleModule/stack_diagnostic/lang/en_utf8 Added Files: Tag: question_reporting block_stack_diagnostic.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: block_stack_diagnostic.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * * This file is licensed under the GPL License. * * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * * @author Jonathan Hart (j.p...@bh...) * * @package stackBlock * * Language files for stack's moodle block */ $string['title'] = 'Stack Diagnostic Reporting'; $string['reports'] = 'Reports'; $string['questions'] = 'Stack Questions'; $string['new'] = 'New Question'; $string['import'] = 'Import Question'; $string['caschat'] = 'CasChat'; $string['report'] = 'Stack Reports'; $string['editOpt'] = 'Edit Question Options'; $string['stack_not_installed'] = 'Please install STACK question type.'; $string['settings'] = 'STACK Diagnostic Reporting Settings'; $string['noSettings'] = 'The STACK Diagnostic Reporting block has no configuration options.'; ?> |
From: Ben H. <bdv...@us...> - 2010-11-22 23:05:59
|
Update of /cvsroot/stack/stack-dev/pix In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/pix Added Files: Tag: question_reporting transparent16x16.gif Published.png Unpublished.png gradient.jpg Private.png pencil.png arrow_out.png help.png disk.png xhtml.png wrench_orange.png arrow_right.png eye.png lorry.png Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: transparent16x16.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Private.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: eye.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: arrow_right.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Unpublished.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: pencil.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: help.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: disk.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: xhtml.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: wrench_orange.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Published.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lorry.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: arrow_out.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: gradient.jpg --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/stack/stack-dev/sample_questions/oer In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/sample_questions/oer Added Files: Tag: question_reporting CR_Int_16_trigonometric.xml CR_Diff_03_higher.xml CR_Diff_01_basic.xml licence.txt CR_Diff_05_quotient.xml CR_Int_15_partialfrac.xml CR_Int_11_linearity.xml CR_all.xml CR_Int_12_definite.xml CR_Int_10_basic.xml CR_Diff_06_chain.xml CR_Diff_02_linearity.xml CR_Int_17_misc.xml AlgMap.xml CR_Int_13_parts.xml Barnard.tex CR_Diff_09_misc.xml CR_Diff_04_product.xml CR_Diff_07_implicit.xml CR_Int_14_substitution.xml CR_Diff_08_parametrical.xml readme.txt Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: licence.txt --- License THIS WORK IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. 1. Definitions a."Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. b."Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined below) for the purposes of this License. c."Creative Commons Compatible License" means a license that is listed at http://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as being essentially equivalent to this License, including, at a minimum, because that license: (i) contains terms that have the same purpose, meaning and effect as the License Elements of this License; and, (ii) explicitly permits the relicensing of adaptations of works made available under that license under this License or a Creative Commons jurisdiction license with the same License Elements as this License. d."Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership. e."License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike. f."Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. g."Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. h."Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. i."You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. j."Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. k."Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. 2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. 3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: a.to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; b.to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified."; c.to Distribute and Publicly Perform the Work including as incorporated in Collections; and, d.to Distribute and Publicly Perform Adaptations. e.For the avoidance of doubt: i.Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; ii.Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and, iii.Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License. The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved. 4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: a.You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested. b.You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons Compatible License. If you license the Adaptation under one of the licenses mentioned in (iv), you must comply with the terms of that license. If you license the Adaptation under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), you must comply with the terms of the Applicable License generally and the following provisions: (I) You must include a copy of, or the URI for, the Applicable License with every copy of each Adaptation You Distribute or Publicly Perform; (II) You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License; (III) You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License. c.If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. d.Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise. 5. Representations, Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. Termination a.This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. b.Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. 8. Miscellaneous a.Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. b.Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License. c.If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. d.No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. e.This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. f.The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. --- NEW FILE: readme.txt --- This folder contains STACK questions which are released as Open Educational Resources. ==Licence== These materials are released under the Creative Commons Attribution-Share Alike 3.0 Unported http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/legalcode Chris Sangwin, 5 November 2009 University of Birmingham ==Background== Each of these questions should have * randomly generated versions * full worked solution ==AlgMap: Algebra questions== These are approximately 140 questions in algebra, taken from A Pocket Map of Algebraic Manipulation, by Dr Tony Barnard, Department of Mathematics. King's College London. They are designed to demonstrate many of the major problems in elementary algebra. The LaTeX source file of this "Map" is also included as Barnard.tex ==CR: Calculus refresher.== These are approximately 215 questions in calculus. They are inspired by, with permission, the questions in the Calculus Refresher http://www.mathcentre.ac.uk/resources.php/1 CR_all is a single file with all questions, but this might be difficult to upload. The following files have questions grouped by topic. CR_Diff_01_basic Derivatives of basic functions CR_Diff_02_linearity Linearity in differentiation CR_Diff_03_higher Higher derivatives CR_Diff_04_product The product rule for differentiation CR_Diff_06_chain The chain rule for differentiation CR_Diff_07_implicit Differentiation of functions defined implicitly CR_Diff_08_parametrical Differentiation of functions defined perimetrically CR_Diff_09_misc Miscellaneous differentiation exercises CR_Int_10_basic Integrals of basic functions CR_Int_11_linearity Linearity in integration CR_Int_12_definite Evaluating definite integrals CR_Int_13_parts Integration by parts CR_Int_14_substitution Integration by substitution CR_Int_15_partialfrac Integration using partial fractions CR_Int_16_trigonometric Integration using trigonometrical identities CR_Int_17_misc Miscellaneous integration exercises ===Acknowledgements=== The work on the calculus refresher has been made possible, in part, by support from the FETLAR Project. http://www.fetlar.bham.ac.uk/ The FETLAR project is the MSOR community's bid through the Subject Centre strand for the Open Educational Resources (OER) call from HEFCE/JISC. http://www.jisc.ac.uk/fundingopportunities/funding_calls/2008/12/grant1408.aspx == AlgMap == These questions are based on Tony Barnard's "Map of Algebraic Manipulation". --- NEW FILE: CR_Diff_09_misc.xml --- <?xml version="1.0" encoding="UTF-8"?> <mathQuiz version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Find the following derivative: \[ \frac{d}{d@v@}\left[ @p@\right]. \] #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>v = x; rdm1 = 2+rand(4); rdm2 = 2+rand(5); rdm3 = 2+rand(5); ppp1 = sin(rdm1*v); ppp2 = cos(rdm2*v); pp1 = ppp1*ppp2; pp2 = tan(rdm3*v); p = pp1/pp2</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>To solve this problem you will need to use the product rule <hint>calc_product_rule</hint> and the quotient rule<hint>calc_quotient_rule</hint>. Let $f(@v@)=@pp1@$ and $g(@v@)=@pp2@$. Then, \[\frac{d}{d@v@}\left[@p@\right] = \frac{\frac{df}{d@v@}\cdot g - f\cdot \frac{dg}{d@v@}}{g^2}.\] In order to calculate $\frac{df}{d@v@}$ you need to use the product rule, by defining two new functions: $h(@v@)=@ppp1@$ and $i(@v@)=@ppp2@$ so that $f(@v@)=h(@v@)i(@v@)$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@pp1@] &\displaystyle =&\displaystyle \frac{dh}{dx}\cdot i + h\cdot \frac{di}{dx}\\ &\displaystyle =&\displaystyle [@diff(ppp1,v)@]@ppp2@ + @ppp1@[@diff(ppp2,v)@] \\ &\displaystyle =&\displaystyle @diff(ppp1,v)*ppp2@ + @ppp1*diff(ppp2,v)@ \\ &\displaystyle =&\displaystyle @diff(pp1,v)@ \end{array}\] Hence, \[\begin{array}{rcl}\displaystyle \frac{d}{dx}\left[@p@\right] &\displaystyle =&\displaystyle \frac{\frac{df}{d@v@}\cdot g - f\cdot \frac{dg}{d@v@}}{g^2} \\ &\displaystyle =&\displaystyle \frac{[@diff(pp1,v)@]@pp2@ - @pp1@[@diff(pp2,v)@]}{[@pp2@]^2} \\ &\displaystyle =&\displaystyle \frac{@diff(pp1,v)*pp2@ - @pp1*diff(pp2,v)@}{@pp2^2@} \\ &\displaystyle =&\displaystyle @factor(diff(p,v))@ \end{array}\] </castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>\[\frac{d}{d@v@}(@p@) = @diff(p,v)@ \]</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>factor(diff(p,v))</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>q = pp2/pp1</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>Diff</answerTest><teachersAns>factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions>v</testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>-factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have lost the minus sign as your answer is the negative of what was expected.</feedback><ansnote>Result-1-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-1-F </ansnote><nextPR>2</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>factor(diff(q,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have differentiated @q@ instead of the other way up!</feedback><ansnote>Result-2-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-2-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>CR-Diff-09-misc-2.c</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Miscellaneous differentiation exercises</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://stack.bham.ac.uk/new-stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-18 18:40:53</selection><default>2009-10-20 11:47:02</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Published</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>Differentiation, CR, Miscellaneous</selection><default>Differentiation, CR, Miscellaneous</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect'>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-T </value></col></test><test><col><key>IE_ans1</key><value>-factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-1-T </value></col></test><test><col><key>IE_ans1</key><value>factor(diff(pp2/pp1,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-T </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Find the following derivative: \[ \frac{d}{d@v@}\left[\left(@pp@\right)^{@rdm2@}\right]. \] #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>v = x; rdm1 = 2+rand(7); rdm2 = (2+2*rand(5))/(3+2*rand(5)); ppp1 = 1-v^rdm1; ppp2 = 1+v^rdm1; pp = ppp1/ppp2; p = pp^(rdm2)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>To solve this problem you will need to use the chain rule <hint>calc_chain_rule</hint> and the quotient rule <hint>calc_quotient_rule</hint>. Let \[f(@v@)=@p@\] and \[g(@v@)=@pp@.\] Then $f(@v@)=[g(@v@)]^{@rdm2@}$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}\left[@p@\right] &\displaystyle =&\displaystyle \frac{df}{dg}\cdot \frac{dg}{dx} \\ &\displaystyle =&\displaystyle \frac{d}{dg}[g^{@rdm2@}]\cdot \frac{d}{d@v@}[g] \end{array}\] In order to find $\frac{dg}{d@v@}$ you have to define two new functions: $h(@v@)=@ppp1@$ and $i(@v@)=@ppp2@$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}(g) &\displaystyle =&\displaystyle \frac{d}{d@v@}\left[@pp@\right] \\ &\displaystyle =&\displaystyle \frac{d}{d@v@}\left(\frac{h}{i}\right) \\ &\displaystyle =&\displaystyle \frac{\frac{dh}{d@v@}\cdot i - h\cdot \frac{di}{d@v@}}{i^2} \\ &\displaystyle =&\displaystyle \frac{\left[\frac{d}{d@v@}(@ppp1@)\right]\cdot (@ppp2@) - (@ppp1@)\cdot \left[\frac{d}{d@v@}(@ppp2@)\right]}{(@ppp2@)^2} \\ &\displaystyle =&\displaystyle \frac{[@diff(ppp1,v)@]\cdot (@ppp2@) - (@ppp1@)\cdot [@diff(ppp2,v)@]}{@ppp2^2@} \\ &\displaystyle =&\displaystyle \frac{@factor(diff(ppp1,v)*ppp2-ppp1*diff(ppp2,v))@}{@ppp2^2@}. \end{array}\] Now, \[\begin{array}{rcl}\displaystyle \frac{d}{dg}[g^{@rdm2@}] &\displaystyle =&\displaystyle @rdm2@g^@rdm2-1@ \\ &\displaystyle =&\displaystyle @rdm2*pp^(rdm2-1)@ \end{array}\] Hence, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}\left[@p@\right] &\displaystyle =&\displaystyle \frac{d}{dg}[g^{@rdm2@}]\cdot \frac{d}{d@v@}[g] \\ &\displaystyle =&\displaystyle \frac{@factor(diff(ppp1,v)*ppp2-ppp1*diff(ppp2,v))@}{@ppp2^2@}\cdot @rdm2*pp^(rdm2-1)@ \\ &\displaystyle =&\displaystyle @factor(diff(p,v))@ \end{array}\] </castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>\[\frac{d}{d@v@}(@p@) = @diff(p,v)@ \]</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>factor(diff(p,v))</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>q = (ppp2/ppp1)^(rdm2)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>Diff</answerTest><teachersAns>factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions>v</testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>-factor(diff(p,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have lost the minus sign as your answer is the negative of what was expected. </feedback><ansnote>Result-1-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-1-F </ansnote><nextPR>2</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>factor(diff(p,v))/diff(pp,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You need to use the chain rule <hint>calc_chain_rule</hint> as \[@p@\] is a function of @v@.</feedback><ansnote>Result-2-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-2-F </ansnote><nextPR>3</nextPR></false><teacherNote></teacherNote></PR><PR id="3"><answerTest>AlgEquiv</answerTest><teachersAns>factor(diff(q,v))</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have differentiated \[@q@\] instead of the other way up.</feedback><ansnote>Result-3-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-3-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>CR-Diff-09-misc-3.c</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Miscellaneous differentiation exercises</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://stack.bham.ac.uk/new-stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-18 18:57:02</selection><default>2009-10-20 11:47:15</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Published</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>Differentiation, CR, Miscellaneous</selection><default>Differentiation, CR, Miscellaneous</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect'>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-T </value></col></test><test><col><key>IE_ans1</key><value>-factor(diff(p,v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-1-T </value></col></test><test><col><key>IE_ans1</key><value>factor(diff(p,v))/diff(pp,v)</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-T </value></col></test><test><col><key>IE_ans1</key><value>factor(diff((ppp2/ppp1)^(rdm2),v))</value></col><col><key>PRT_PotResTree_Result</key><value>Result-3-T </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Find the following derivative: \[ \frac{d}{d@v@}[@p@]. \] #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>v = x; rdm1 = 2+rand(2); rdm2 = 1/(2+rand(5)); ppp = v-v^rdm1; pp = ppp^rdm2; p = exp(pp)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>To solve this question, you will have to use the chain rule <hint>calc_chain_rule</hint> more than once. Let $f(@v@)=@p@$ and $g(@v@)=@pp@$. Then, $f(@v@)=e^{(g(@v@))}$ \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@p@] &\displaystyle =&\displaystyle \frac{df}{dg}\cdot \frac{dg}{dx} \\ &\displaystyle =&\displaystyle \frac{d}{dg}(e^{g})\cdot \frac{d}{dx}[@pp@] \end{array}\] To find \[\frac{d}{dx}[@pp@]\] you have to define a new function: $h(@v@)=@ppp@$, so that $g(@v@)=h^{@rdm2@}$. So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@pp@] &\displaystyle =&\displaystyle \frac{dg}{dh}\cdot \frac{dh}{d@v@} \\ &\displaystyle =&\displaystyle \frac{d}{dh}(h^{@rdm2@})\cdot \frac{d}{d@v@}(@ppp@) \\ &\displaystyle =&\displaystyle @rdm2@h^{@rdm2-1@}\cdot (@diff(ppp,v)@) \\ &\displaystyle =&\displaystyle @diff(pp,v)@ \end{array}\] So, \[\begin{array}{rcl}\displaystyle \frac{d}{d@v@}[@p@] &\displaystyle =&\displaystyle \frac{d}{dg}(e^{g})\cdot \frac{d}{dx}[@pp@] \\ &\displaystyle =&\displaystyle e^g \cdot @diff(pp,v)@ \\ &\displaystyle =&\displaystyle e^{@pp@}@diff(pp,v)@ \\ &\displaystyle =&\displaystyle @diff(p,v)@ \end{array}\] </castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>\[\frac{d}{d@v@}(@p@) = @diff(p,v)@ \]</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>diff(p,v)</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>q3 = v+v^rdm1; q2 = q3^rdm2; q = exp(q2)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>Diff</answerTest><teachersAns>diff(p,v)</teachersAns><studentAns>ans1</studentAns><testoptions>v</testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>-diff(p,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have lost the minus sign as your answer is the negative of what was expected.</feedback><ansnote>Result-1-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-1-F </ansnote><nextPR>2</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>diff(q,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You appear to have differentiated @ppp@ incorrectly - there is a sign wrong.</feedback><ansnote>Result-2-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-2-F </ansnote><nextPR>3</nextPR></false><teacherNote></teacherNote></PR><PR id="3"><answerTest>AlgEquiv</answerTest><teachersAns>diff(p,v)/diff(pp,v)</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark></rawMark><feedback>You need to use the chain rule <hint>calc_chain_rule</hint> to differentiate @p@ with respect to @v@.</feedback><ansnote>Result-3-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark></rawMark><feedback></feedback><ansnote>Result-3-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>CR-Diff-09-misc-4.b</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Miscellaneous differentiation exercises</selection><default></default><values/></dc:description><dc:publi... [truncated message content] |
From: Ben H. <bdv...@us...> - 2010-11-22 23:05:56
|
Update of /cvsroot/stack/stack-dev/sample_questions/examples In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/sample_questions/examples Added Files: Tag: question_reporting examples_ODEs.xml examples_create-examples.xml examples_unary-minus.xml examples_random_strings.xml examples_matrix_parameter.xml Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: examples_random_strings.xml --- <?xml version="1.0" encoding="UTF-8"?> <assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>The winner is @p@. \[\int @p1@ = @log(1/p1)@.\]</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>p = rand(["Tom", "Dick", "Harry"]); p1 = 1/"cabin"+0</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts/><PotentialResponseTrees/><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>examples_random_strings</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection></selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection>http://localhost/stack-dev</selection><default>http://localhost/stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection>text/xml; charset="utf-8"</selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2009-10-28 13:22:38</selection><default>2009-10-28 10:44:23</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Unpublished</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection></selection><default></default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect'>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption></ItemOptions><ItemTests/></assessmentItem> --- NEW FILE: examples_create-examples.xml --- <?xml version="1.0" encoding="UTF-8"?> <mathQuiz version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Give an example of an even function. #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals></rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>Remember, a function $f(x)$ is said to be {\em even} if \[ f(x) = f(-x) \] for all values of $x$. Hence, there are many examples which satisfy this definition, $\cos(x)$, $3*x^4$, and even $f(x)=c$ for any constant.</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>.</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>3*x^4</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>p = ans1-subst(-x,x,ans1)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>AlgEquiv</answerTest><teachersAns>0</teachersAns><studentAns>p</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>ce_evenf</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Give me an even function</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://localhost/stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-03 18:48:59</selection><default>2010-03-02 08:42:05</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Unpublished</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>demo, create, examples</selection><default>demo, create, examples</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value><value>symi</value><value>symj</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption><stackoption><name>OptWorkedSol</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>x^2</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-T </value></col></test><test><col><key>IE_ans1</key><value>x^3</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-F </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Find a function of $f(x)$ which satisfies \[ f(a+b)=f(a)+f(b)\] for all values of $a$ and $b$. #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals></rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>.</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>x</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>p1 = subst(a,x,ans1); p2 = subst(b,x,ans1); p3 = subst(a+b,x,ans1)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>AlgEquiv</answerTest><teachersAns>p3</teachersAns><studentAns>p1+p2</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback></feedback><ansnote>Result-0-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>ce_functional_relation</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Find $f(a+b)=f(a)+f(b)$</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://localhost/stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-03 18:52:24</selection><default>2010-03-02 08:42:05</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Unpublished</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>demo, create, examples</selection><default>demo, create, examples</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value><value>symi</value><value>symj</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption><stackoption><name>OptWorkedSol</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>x</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-T </value></col></test><test><col><key>IE_ans1</key><value>x^2</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-F </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Give an example of a function $f(x)$ with a stationary point at $x=@n@$ and which is continuous but not differentiable at $x=0$. <br /> <br /> $f(x)=$ #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>n = 2+rand(4)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>@n@</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>abs(x)*(x-2*n)</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/><forbiddenWords><Forbid>diff</Forbid><Forbid> diff</Forbid><Forbid> diff</Forbid><Forbid> diff</Forbid></forbiddenWords></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>p = subst(n,x,diff(ans1,x))</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>AlgEquiv</answerTest><teachersAns>0</teachersAns><studentAns>p</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>0.34</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback>Your answer does not have a stationary point at $x=@n@$ but should do.</feedback><ansnote>No stationary point.</ansnote><nextPR>1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>true</teachersAns><studentAns>continuousp(ans1,x,0)</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>+</rawModMark><rawMark>0.33</rawMark><feedback></feedback><ansnote>Result-1-T </ansnote><nextPR>2</nextPR></true><false><rawModMark>+</rawModMark><rawMark>0</rawMark><feedback>Your answer is not continuous at $x=0$, but needs to be.</feedback><ansnote>Not continuous</ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>false</teachersAns><studentAns>diffp(ans1,x,0)</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>+</rawModMark><rawMark>0.33</rawMark><feedback></feedback><ansnote>Result-2-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>+</rawModMark><rawMark>0</rawMark><feedback>Your answer is differentiable at $x=0$ but should not be. Consider using $|x|$, which is entered as <tt>abs(x)</tt>, somewhere in your answer.</feedback><ansnote>Result-2-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>ce_non-diff</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Give a function which is continuous but not diferentiable</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://localhost/stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-02 08:55:58</selection><default>2010-03-02 08:42:05</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Unpublished</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>demo, create, examples</selection><default>demo, create, examples</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value><value>symi</value><value>symj</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption><stackoption><name>OptWorkedSol</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>abs(x)*(x-2*n)</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-T </value></col></test><test><col><key>IE_ans1</key><value>x*(x-2*n)</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-F </value></col></test><test><col><key>IE_ans1</key><value>(x-2*n)</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-F </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Give an example of an odd function. #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals></rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext>Remember, a function $f(x)$ is said to be {\em odd} if \[ f(x) = -f(-x) \] for all values of $x$. Hence, there are many examples which satisfy this definition, $\sin(x)$, $4*x^5$, and even $f(x)=0$.</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>.</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>4*x^3</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>forbidFloats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>insertStars</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>false</selected></stackoption><stackoption><name>sameType</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>lowestTerms</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_LowestTerms</casKey><casType>ex</casType><selected>true</selected></stackoption><inputTypesParameters/></questionpart></questionparts><PotentialResponseTrees><PotentialResponseTree><prtname>PotResTree_Result</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables>p = ans1+subst(-x,x,ans1)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>AlgEquiv</answerTest><teachersAns>0</teachersAns><studentAns>p</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback>Your function should have a symmetry in the $y$ axis, but does not. </feedback><ansnote>Result-0-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection>2</selection><default></default><values/></dc:Publisher><dc:language stackname="language" type="Meta"><selection>en</selection><default>en</default><values><value key="en">en</value><value key="fr">fr</value><value key="nl">nl</value><value key="es">es</value><value key="unspecified">Unspecified</value></values></dc:language><dc:title stackname="questionName" type="Meta"><selection>ce_oddf</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Give me an odd function</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection></selection><default>http://localhost/stack-dev</default><values/></dc:publisher><dc:format stackname="questionFormat" type="Meta"><selection></selection><default>text/xml; charset="utf-8"</default><values><value key="0">application</value><value key="1">audio</value><value key="2">image</value><value key="3">message</value><value key="4">model</value><value key="5">text</value><value key="6">video</value><value key="7">multipart</value></values></dc:format><lom:context stackname="questionLearningContext" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="PrimaryEducation">Primary Education</value><value key="SecondaryEducation">Secondary Education</value><value key="HigherEducation">Higher Education</value><value key="UniversityFirstCycle">University First Cycle</value><value key="UniversitySecondCycle">University Second Cycle</value><value key="UniversityPostGrade">University Post Grade</value><value key="TechnicalSchoolFirstCycle">Technical School First Cycle</value><value key="TechnicalSchoolSecondCycle">Technical School Second Cycle</value><value key="ProfessionalFormation">Professional Formation</value><value key="ContinuousFormation">Continuous Formation</value><value key="VocationalTraining">Vocational Training</value><value key="unspecified">Unspecified</value></values></lom:context><lom:difficulty stackname="questionDifficulty" type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="VeryEasy">Very Easy</value><value key="Easy">Easy</value><value key="Medium">Medium</value><value key="Difficult">Difficult</value><value key="VeryDifficult">Very Difficult</value><value key="unspecified">Unspecified</value></values></lom:difficulty><questionCompetency type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Think">Think</value><value key="Argue">Argue</value><value key="Solve">Solve</value><value key="Represent">Represent</value><value key="Language">Language</value><value key="Communicate">Communicate</value><value key="Tools">Tools</value><value key="unspecified">Unspecified</value></values></questionCompetency><questionCompentencyLevel type="Meta"><selection>unspecified</selection><default>unspecified</default><values><value key="Elementary">Elementary</value><value key="SimpleConceptual">Simple conceptual</value><value key="Multi-step">Multi-step</value><value key="Complex">Complex</value><value key="unspecified">Unspecified</value></values></questionCompentencyLevel><lom:typicallearningtime stackname="questionTimeAllocated" type="Meta"><selection>00:00:00</selection><default>00:00:00</default><values/></lom:typicallearningtime><dc:rights stackname="questionRights" type="Meta"><selection>http://www.gnu.org/copyleft/gpl.html</selection><default>http://www.gnu.org/copyleft/gpl.html</default><values/></dc:rights><questionExerciseType type="Meta"><selection>AlgebraicExpression</selection><default>AlgebraicExpression</default><values><value key="AlgebraicExpression">Algebraic Expression</value><value key="MCQSingleAnswer">MCQ Single Answer</value><value key="MCQMultpleAnswer">MCQ Multiple Answer</value><value key="FillInBlank">Fill in blank</value><value key="Unspecified">Unspecified</value></values></questionExerciseType><dc:date stackname="questionDateLastEdited" type="Meta"><selection>2010-03-03 18:54:23</selection><default>2010-03-02 08:42:05</default><values/></dc:date><lom:status stackname="questionStatus" type="Meta"><selection>Draft</selection><default>Draft</default><values><value key="Draft">Draft</value><value key="Deployed">Deployed</value><value key="Buggy">Buggy</value></values></lom:status><published type="Meta"><selection>Unpublished</selection><default>Unpublished</default><values><value key="Unpublished">Unpublished</value><value key="Published">Published</value><value key="Private">Private</value></values></published><lom:keyword stackname="keywords" type="Meta"><selection>demo, create, examples</selection><default>demo, create, examples</default><values/></lom:keyword></MetaData><ItemOptions><stackoption><name>Display</name><type>list</type><default>LaTeX</default><values><value>LaTeX</value><value>MathML</value></values><casKey>OPT_OUTPUT</casKey><casType>string</casType><selected>LaTeX</selected></stackoption><stackoption><name>MultiplicationSign</name><type>list</type><default>dot</default><values><value>(none)</value><value>dot</value><value>cross</value></values><casKey>make_multsgn</casKey><casType>fun</casType><selected>dot</selected></stackoption><stackoption><name>ComplexNo</name><type>list</type><default>i</default><values><value>i</value><value>j</value><value>symi</value><value>symj</value></values><casKey>make_complexJ</casKey><casType>fun</casType><selected>i</selected></stackoption><stackoption><name>Floats</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>OPT_NoFloats</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>SqrtSign</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>sqrtdispflag</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>Simplify</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey>simp</casKey><casType>ex</casType><selected>true</selected></stackoption><stackoption><name>MarkModMethod</name><type>list</type><default>Penalty</default><values><value>Penalty</value><value>First Answer</value><value>Last Answer</value></values><casKey></casKey><casType></casType><selected>Penalty</selected></stackoption><stackoption><name>AssumePos</name><type>list</type><default>false</default><values><value>true</value><value>false</value></values><casKey>assume_pos</casKey><casType>ex</casType><selected>false</selected></stackoption><stackoption><name>TeacherEmail</name><type>string</type><default></default><casKey></casKey><casType></casType><selected></selected></stackoption><stackoption><name>Feedback</name><type>list</type><default>TGS</default><values><value>TGS</value><value>TG</value><value>GS</value><value>T</value><value>G</value><value>S</value><value>none</value></values><casKey></casKey><casType></casType><selected>TGS</selected></stackoption><stackoption><name>FeedbackGenericCorrect</name><type>html</type><default><span class='correct'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correct'>Correct answer, well done.</span></selected></stackoption><stackoption><name>FeedbackGenericIncorrect</name><type>html</type><default><span class='incorrect'>Incorrect answer.</span></default><casKey></casKey><casType></casType><selected><span class='incorrect>Incorrect answer.</span></selected></stackoption><stackoption><name>FeedbackGenericPCorrect</name><type>html</type><default><span class='partially'>Your answer is partially correct.</span></default><casKey></casKey><casType></casType><selected><span class='partially'>Your answer is partially correct.</span></selected></stackoption><stackoption><name>OptWorkedSol</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption></ItemOptions><ItemTests><test><col><key>IE_ans1</key><value>x^3</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-T </value></col></test><test><col><key>IE_ans1</key><value>x^2</value></col><col><key>PRT_PotResTree_Result</key><value>Result-0-F </value></col></test></ItemTests></assessmentItem><assessmentItem version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2"><questionCasValues><questionStem type="CasText"><castext>Give an example of a quadratic with roots at $x=@n@$ and $x=@m@$. #ans1# <IEfeedback>ans1</IEfeedback> <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>n = rand(3)+1; m = n+2*(rand(3)+1)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>$@(x-n)*(x-m)@=@expand((x-n)*(x-m))@$</castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionNote></questionCasValues><questionparts><questionpart><name>ans1</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>(x-n)*(x-m)</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans1</studentAnsKey><syntax type="Meta"><selection></selection><default></default><values/></syntax><stackoption><name>formalSyntax</name><type>list</type><default>true</default><values><value>true</value><value>false</value></values><casKey></casKey><casType></casType><selected>true</selected></stackoption><stackoption><name>for... [truncated message content] |
Update of /cvsroot/stack/stack-dev/other/flot In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/other/flot Removed Files: Tag: question_reporting jquery.min.js jquery.flot.min.js jquery.flot.js README.txt API.txt excanvas.min.js jquery.flot.selection.min.js jquery.flot.threshold.js Makefile jquery.flot.selection.js jquery.flot.crosshair.min.js PLUGINS.txt jquery.flot.stack.js jquery.flot.crosshair.js jquery.flot.image.js jquery.flot.stack.min.js jquery.colorhelpers.min.js jquery.flot.navigate.min.js LICENSE.txt jquery.flot.threshold.min.js jquery.js jquery.flot.navigate.js FAQ.txt NEWS.txt excanvas.js jquery.flot.image.min.js jquery.colorhelpers.js Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- API.txt DELETED --- --- jquery.min.js DELETED --- --- excanvas.min.js DELETED --- --- Makefile DELETED --- --- jquery.flot.threshold.min.js DELETED --- --- jquery.flot.crosshair.min.js DELETED --- --- NEWS.txt DELETED --- --- jquery.flot.stack.js DELETED --- --- LICENSE.txt DELETED --- --- README.txt DELETED --- --- jquery.flot.crosshair.js DELETED --- --- jquery.flot.image.js DELETED --- --- jquery.flot.image.min.js DELETED --- --- FAQ.txt DELETED --- --- jquery.js DELETED --- --- jquery.flot.stack.min.js DELETED --- --- PLUGINS.txt DELETED --- --- jquery.flot.threshold.js DELETED --- --- jquery.colorhelpers.min.js DELETED --- --- jquery.flot.js DELETED --- --- jquery.flot.selection.js DELETED --- --- jquery.colorhelpers.js DELETED --- --- jquery.flot.selection.min.js DELETED --- --- excanvas.js DELETED --- --- jquery.flot.navigate.js DELETED --- --- jquery.flot.navigate.min.js DELETED --- --- jquery.flot.min.js DELETED --- |
Update of /cvsroot/stack/stack-dev/other/flot/examples In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/other/flot/examples Removed Files: Tag: question_reporting data-japan-gdp-growth.json selection.html image.html turning-series.html data-eu-gdp-growth-3.json data-eu-gdp-growth-4.json time.html data-eu-gdp-growth-1.json interacting.html annotating.html data-usa-gdp-growth.json dual-axis.html arrow-up.gif thresholding.html hs-2004-27-a-large_web.jpg basic.html tracking.html arrow-left.gif visitors.html arrow-right.gif zooming.html data-eu-gdp-growth-2.json graph-types.html layout.css setting-options.html index.html data-eu-gdp-growth.json data-eu-gdp-growth-5.json navigate.html stacking.html arrow-down.gif ajax.html Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- navigate.html DELETED --- --- selection.html DELETED --- --- visitors.html DELETED --- --- arrow-up.gif DELETED --- --- data-eu-gdp-growth-2.json DELETED --- --- data-eu-gdp-growth-1.json DELETED --- --- data-usa-gdp-growth.json DELETED --- --- data-eu-gdp-growth-4.json DELETED --- --- data-eu-gdp-growth-5.json DELETED --- --- data-japan-gdp-growth.json DELETED --- --- interacting.html DELETED --- --- zooming.html DELETED --- --- graph-types.html DELETED --- --- annotating.html DELETED --- --- setting-options.html DELETED --- --- turning-series.html DELETED --- --- thresholding.html DELETED --- --- arrow-left.gif DELETED --- --- ajax.html DELETED --- --- tracking.html DELETED --- --- time.html DELETED --- --- arrow-down.gif DELETED --- --- image.html DELETED --- --- index.html DELETED --- --- data-eu-gdp-growth.json DELETED --- --- arrow-right.gif DELETED --- --- data-eu-gdp-growth-3.json DELETED --- --- stacking.html DELETED --- --- dual-axis.html DELETED --- --- basic.html DELETED --- --- hs-2004-27-a-large_web.jpg DELETED --- --- layout.css DELETED --- |
From: Simon H. <sim...@us...> - 2010-11-19 18:16:31
|
Update of /cvsroot/stack/stack-dev/opaque In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv23798/opaque Modified Files: Tag: item_state_separation MoodleDisplayItem.php Log Message: Index: MoodleDisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleDisplayItem.php,v retrieving revision 1.11.6.1.2.2 retrieving revision 1.11.6.1.2.3 diff -C2 -d -r1.11.6.1.2.2 -r1.11.6.1.2.3 *** MoodleDisplayItem.php 18 Nov 2010 14:21:15 -0000 1.11.6.1.2.2 --- MoodleDisplayItem.php 19 Nov 2010 18:16:19 -0000 1.11.6.1.2.3 *************** *** 263,267 **** $state = $cache->getState($this->stateID); ! if(is_a($state, "DisplayItem")) { // retrofitting to populated caches $item = $state; } else { --- 263,267 ---- $state = $cache->getState($this->stateID); ! if(is_a($state, "DisplayItem")) { // retrofitting to prior caches $item = $state; } else { |
From: Simon H. <sim...@us...> - 2010-11-19 18:16:27
|
Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv23798/lib/items Modified Files: Tag: item_state_separation InstantiatedItem.php Log Message: Index: InstantiatedItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/InstantiatedItem.php,v retrieving revision 1.81.8.5 retrieving revision 1.81.8.6 diff -C2 -d -r1.81.8.5 -r1.81.8.6 *** InstantiatedItem.php 9 Nov 2010 16:51:37 -0000 1.81.8.5 --- InstantiatedItem.php 19 Nov 2010 18:16:19 -0000 1.81.8.6 *************** *** 176,180 **** } ! $state = new ItemState($seed, $userID); } --- 176,180 ---- } ! //$state = new ItemState($seed, $userID); } *************** *** 641,645 **** * @access public */ ! public function getFeedback() // to itemState { return $this->feedback; --- 641,645 ---- * @access public */ ! public function getFeedback() { return $this->feedback; *************** *** 652,656 **** * @access public */ ! public function getMark() // to itemState { return $this->mark; --- 652,656 ---- * @access public */ ! public function getMark() { return $this->mark; *************** *** 825,833 **** /* * Saves the state to the state cache. ! */ public function saveState($stateID) { $state->save($$stateID); } ! /* * Attempts to load the state from the state cache. --- 825,833 ---- /* * Saves the state to the state cache. ! * public function saveState($stateID) { $state->save($$stateID); } ! */ /* * Attempts to load the state from the state cache. *************** *** 894,900 **** * */ ! public function getAnswerNote() // to ItemState { - $an = array(); if (!empty($this->attempts)) { --- 894,899 ---- * */ ! public function getAnswerNote() { $an = array(); if (!empty($this->attempts)) { *************** *** 906,915 **** } ! public function getpreCalculated() // to ItemState { return $this->preCalculated; } ! public function getAttempts() // to ItemState { return $this->attempts; --- 905,914 ---- } ! public function getpreCalculated() { return $this->preCalculated; } ! public function getAttempts() { return $this->attempts; |
From: Simon H. <sim...@us...> - 2010-11-19 18:16:27
|
Update of /cvsroot/stack/stack-dev/lib/ui In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv23798/lib/ui Modified Files: Tag: item_state_separation DisplayItem.php Log Message: Index: DisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/DisplayItem.php,v retrieving revision 1.91.2.4.2.4 retrieving revision 1.91.2.4.2.5 diff -C2 -d -r1.91.2.4.2.4 -r1.91.2.4.2.5 *** DisplayItem.php 18 Nov 2010 14:21:15 -0000 1.91.2.4.2.4 --- DisplayItem.php 19 Nov 2010 18:16:19 -0000 1.91.2.4.2.5 *************** *** 82,93 **** * * - * @var string - * @access protected - */ - protected $questionForDisplay; - - /** - * - * * @var StudentAns * @access protected --- 82,85 ---- *************** *** 1681,1693 **** public function getState() { $state = array(); ! } /** ! * Sets the mutable state (probabaly obtained from the cache) for this DisplayItem. * */ public function setState($state) { // options, etc have already been loaded. just need current state. } } --- 1673,1705 ---- public function getState() { $state = array(); ! $state['userId'] = $this->userId; ! $state['feedback'] = $this->feedback = $state['feedback']; ! $state['mark'] = $this->mark; ! $state['cachedQuestionStem'] = $this->cachedQuestionStem; ! $state['cachedQuestionNote'] = $this->cachedQuestionNote; ! $state['attempts'] = $this->attempts; ! $state['studentsLastAns'] = $this->studentsLastAns; ! $state['preCalculated'] = $this->preCalculated; } /** ! * Sets the mutable state (probably obtained from the cache) for this DisplayItem. * */ public function setState($state) { // options, etc have already been loaded. just need current state. + // Still wondering if it would be better to properly encapsulate state in ItemState object... + + // state elements + // attempts + // feedback + $this->userId = $state['userId']; + $this->feedback = $state['feedback']; + $this->mark = $state['mark']; + $this->cachedQuestionStem = $state['cachedQuestionStem']; + $this->cachedQuestionNote = $state['cachedQuestionNote']; + $this->attempts = $state['attempts']; + $this->studentsLastAns = $state['studentsLastAns']; + $this->preCalculated = $state['preCalculated']; } } |
From: Simon H. <sim...@us...> - 2010-11-18 14:21:23
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv5138/lib/database Modified Files: Tag: item_state_separation StackDBCache.php Log Message: Index: StackDBCache.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBCache.php,v retrieving revision 1.12.6.2.2.4 retrieving revision 1.12.6.2.2.5 diff -C2 -d -r1.12.6.2.2.4 -r1.12.6.2.2.5 *** StackDBCache.php 16 Nov 2010 19:04:31 -0000 1.12.6.2.2.4 --- StackDBCache.php 18 Nov 2010 14:21:14 -0000 1.12.6.2.2.5 *************** *** 46,51 **** if($transition == NULL) { // go ahead and extend cache ! //$state->trimToStateonly(); ! $this->logger->debug("state in add: ".print_r($state, true)); // add the new state --- 46,52 ---- if($transition == NULL) { // go ahead and extend cache ! //$state->reduceToState(); ! $this->logger->debug("state size in add: ".strlen($this->base64_serialize($state))); ! $this->logger->debug("DI in add(): ".print_r($state, 1)); // add the new state *************** *** 193,200 **** //$this->logger->debug('in deployCache, id='.$id); ! //$logger->debug("pre-reduce size:".strlen($db->base64_serialize($instance))); $instance->reduceToState(); //$logger->debug("whole DI:".print_r($instance, 1)); ! //$logger->debug("post-reduce size:".strlen($db->base64_serialize($instance))); $db->query("UPDATE display_cache" . --- 194,201 ---- //$this->logger->debug('in deployCache, id='.$id); ! $logger->debug("pre-reduce size:".strlen($db->base64_serialize($instance))); $instance->reduceToState(); //$logger->debug("whole DI:".print_r($instance, 1)); ! $logger->debug("post-reduce size:".strlen($db->base64_serialize($instance))); $db->query("UPDATE display_cache" . *************** *** 284,288 **** public function getDisplayItem($id) { $this->query("SELECT state FROM display_cache WHERE id = $id"); ! return $this->base64_unserialize($this->result(0, 'state')); } --- 285,290 ---- public function getDisplayItem($id) { $this->query("SELECT state FROM display_cache WHERE id = $id"); ! $state = $this->base64_unserialize($this->result(0, 'state')); ! return $state; } |
From: Simon H. <sim...@us...> - 2010-11-18 14:21:23
|
Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv5138/lib/items Modified Files: Tag: item_state_separation Item.php Log Message: Index: Item.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/Item.php,v retrieving revision 1.61.8.3 retrieving revision 1.61.8.4 diff -C2 -d -r1.61.8.3 -r1.61.8.4 *** Item.php 16 Nov 2010 19:04:31 -0000 1.61.8.3 --- Item.php 18 Nov 2010 14:21:15 -0000 1.61.8.4 *************** *** 552,556 **** //unset($this->itemTests); ! /* unset($this->lastUserEditor); unset($this->language); --- 552,556 ---- //unset($this->itemTests); ! unset($this->lastUserEditor); unset($this->language); *************** *** 585,589 **** //unset($this->workedSolution); //*/ ! //unset($this->errorLog); unset($this->questionNote); --- 585,589 ---- //unset($this->workedSolution); //*/ ! unset($this->errorLog); unset($this->questionNote); |
From: Simon H. <sim...@us...> - 2010-11-18 14:21:23
|
Update of /cvsroot/stack/stack-dev/lib/ui In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv5138/lib/ui Modified Files: Tag: item_state_separation DisplayItem.php Log Message: Index: DisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/DisplayItem.php,v retrieving revision 1.91.2.4.2.3 retrieving revision 1.91.2.4.2.4 diff -C2 -d -r1.91.2.4.2.3 -r1.91.2.4.2.4 *** DisplayItem.php 16 Nov 2010 19:04:31 -0000 1.91.2.4.2.3 --- DisplayItem.php 18 Nov 2010 14:21:15 -0000 1.91.2.4.2.4 *************** *** 1674,1677 **** --- 1674,1694 ---- } } + + /** + * Return array of the state of the display item, useful for caching. + * + */ + public function getState() { + $state = array(); + + } + + /** + * Sets the mutable state (probabaly obtained from the cache) for this DisplayItem. + * + */ + public function setState($state) { + // options, etc have already been loaded. just need current state. + } } ?> \ No newline at end of file |
From: Simon H. <sim...@us...> - 2010-11-18 14:21:23
|
Update of /cvsroot/stack/stack-dev/opaque In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv5138/opaque Modified Files: Tag: item_state_separation MoodleDisplayItem.php MoodleQuestionDeployment.php Log Message: Index: MoodleQuestionDeployment.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleQuestionDeployment.php,v retrieving revision 1.3.8.1.2.2 retrieving revision 1.3.8.1.2.3 diff -C2 -d -r1.3.8.1.2.2 -r1.3.8.1.2.3 *** MoodleQuestionDeployment.php 16 Nov 2010 19:04:31 -0000 1.3.8.1.2.2 --- MoodleQuestionDeployment.php 18 Nov 2010 14:21:15 -0000 1.3.8.1.2.3 *************** *** 104,108 **** //$this->logger->debug("in MQD constructor: ".print_r($this->param, 1)); ! $this->deployment = new Deployment($this->param['id'], $this->param['engineID']); } --- 104,109 ---- //$this->logger->debug("in MQD constructor: ".print_r($this->param, 1)); ! // foo change ! $this->deployment = new Deployment($this->param['id'], $this->param['engineID']); } Index: MoodleDisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleDisplayItem.php,v retrieving revision 1.11.6.1.2.1 retrieving revision 1.11.6.1.2.2 diff -C2 -d -r1.11.6.1.2.1 -r1.11.6.1.2.2 *** MoodleDisplayItem.php 9 Nov 2010 16:51:39 -0000 1.11.6.1.2.1 --- MoodleDisplayItem.php 18 Nov 2010 14:21:15 -0000 1.11.6.1.2.2 *************** *** 260,264 **** // get current state from cache ! $item = $cache->getDisplayItem($this->stateID); // bring Item expired status uptodate to ensure worked solution shown --- 260,272 ---- // get current state from cache ! //$item = $cache->getDisplayItem($this->stateID); ! $state = $cache->getState($this->stateID); ! ! if(is_a($state, "DisplayItem")) { // retrofitting to populated caches ! $item = $state; ! } else { ! $item = new DisplayItem($state['ItemOptions'], $state['qID']); // base question ! $item->setState($state); // specific state ! } // bring Item expired status uptodate to ensure worked solution shown |
From: Matthew B. <ba...@us...> - 2010-11-18 09:54:00
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv14270/maxima Modified Files: Tag: grobner stackmaxima.mac Log Message: Put plot function back. Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84.2.5 retrieving revision 1.84.2.6 diff -C2 -d -r1.84.2.5 -r1.84.2.6 *** stackmaxima.mac 17 Nov 2010 13:11:00 -0000 1.84.2.5 --- stackmaxima.mac 18 Nov 2010 09:53:52 -0000 1.84.2.6 *************** *** 30,34 **** /*Reload plot commands */ ! /*load("stackPlot.mac"),*/ MAXIMA_VERSION:map(parse_string, tokens(?\*autoconf\-version\*, 'digitcharp)), --- 30,34 ---- /*Reload plot commands */ ! load("stackPlot.mac"), MAXIMA_VERSION:map(parse_string, tokens(?\*autoconf\-version\*, 'digitcharp)), |
From: Matthew B. <ba...@us...> - 2010-11-17 13:11:08
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv14143/maxima Modified Files: Tag: grobner stackmaxima.mac Log Message: Updates to the ATSysEquiv function and those which it calls. Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84.2.4 retrieving revision 1.84.2.5 diff -C2 -d -r1.84.2.4 -r1.84.2.5 *** stackmaxima.mac 15 Nov 2010 14:28:52 -0000 1.84.2.4 --- stackmaxima.mac 17 Nov 2010 13:11:00 -0000 1.84.2.5 *************** *** 30,34 **** /*Reload plot commands */ ! load("stackPlot.mac"), MAXIMA_VERSION:map(parse_string, tokens(?\*autoconf\-version\*, 'digitcharp)), --- 30,34 ---- /*Reload plot commands */ ! /*load("stackPlot.mac"),*/ MAXIMA_VERSION:map(parse_string, tokens(?\*autoconf\-version\*, 'digitcharp)), *************** *** 1113,1117 **** SAB:errcatch(ev(SB,simp,fullratsimp,nouns)), if (is(SAB=[STACKERROR]) or is(SAB=[])) then return(StackReturnOb("0","ATLowestTerms_STACKERROR_TAns","")), ! /* Are both answers lists? */ if not listp(SA) then --- 1113,1117 ---- SAB:errcatch(ev(SB,simp,fullratsimp,nouns)), if (is(SAB=[STACKERROR]) or is(SAB=[])) then return(StackReturnOb("0","ATLowestTerms_STACKERROR_TAns","")), ! /* Are both answers lists? */ if not listp(SA) then *************** *** 1151,1155 **** varlist: listofvars(S2), ! if not is(listofvars(S1)=varlist) then return(ATSysEquivVars(S1,S2)), --- 1151,1155 ---- varlist: listofvars(S2), ! if not is(ev(setify(listofvars(S1)),simp)=ev(setify(varlist), simp)) then return(ATSysEquivVars(S1,S2)), *************** *** 1189,1193 **** return(StackReturnOb("0","ATSysEquiv_SA_missing_variables",StackAddFeedback("","ATSysEquiv_SA_missing_variables"))), if subsetp(XB,XA) then ! return(StackReturnOb("0","ATSysEquiv_SA_extra_variables",StackAddFeedback("","ATSysEquiv_SA_extra_variables"))) )$ --- 1189,1194 ---- return(StackReturnOb("0","ATSysEquiv_SA_missing_variables",StackAddFeedback("","ATSysEquiv_SA_missing_variables"))), if subsetp(XB,XA) then ! return(StackReturnOb("0","ATSysEquiv_SA_extra_variables",StackAddFeedback("","ATSysEquiv_SA_extra_variables"))), ! return(StackReturnOb("0","ATSysEquiv_SA_wrong_variables",StackAddFeedback("","ATSysEquiv_SA_wrong_variables"))) )$ *************** *** 1201,1205 **** */ ! ATSysEquivGrob(GA,GB,S1,varlist):=block([retl,ret], /* Is the student's system underdetermined? */ --- 1202,1206 ---- */ ! ATSysEquivGrob(GA,GB,SA,varlist):=block([retl,ret], /* Is the student's system underdetermined? */ *************** *** 1215,1223 **** ret:[], ! for k:1 thru length(S1) do block([], ! if ev(poly_grobner_member(stack_eqnprepare(stack_eval_assignments(exdowncase(S1[k]))), GB, varlist),simp) then ! ret:append(ret,[S1[ev(k,simp)]]) else ! ret:append(ret,[texcolor("red", S1[ev(k,simp)])])), return(StackReturnOb("0","ATSysEquiv_SA_system_overdetermined",StackAddFeedback("","ATSysEquiv_SA_system_overdetermined", StackDISP(ret, "\$\$")))) --- 1216,1224 ---- ret:[], ! for k:1 thru length(SA) do block([], ! if ev(poly_grobner_member(stack_eqnprepare(stack_eval_assignments(exdowncase(SA[k]))), GB, varlist),simp) then ! ret:append(ret,[SA[ev(k,simp)]]) else ! ret:append(ret,[texcolor("red", SA[ev(k,simp)])])), return(StackReturnOb("0","ATSysEquiv_SA_system_overdetermined",StackAddFeedback("","ATSysEquiv_SA_system_overdetermined", StackDISP(ret, "\$\$")))) |
From: Simon H. <sim...@us...> - 2010-11-17 11:28:39
|
Update of /cvsroot/stack/stack-dev/lib/ui In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv16996/lib/ui Modified Files: DisplayItem.php Log Message: Index: DisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/DisplayItem.php,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** DisplayItem.php 30 Sep 2010 16:56:15 -0000 1.100 --- DisplayItem.php 17 Nov 2010 11:28:30 -0000 1.101 *************** *** 82,93 **** * * - * @var string - * @access protected - */ - protected $questionForDisplay; - - /** - * - * * @var StudentAns * @access protected --- 82,85 ---- *************** *** 178,189 **** private $logger; - /** - * - * - * @var state - * @access protected - */ - protected $state; - /** * --- 170,173 ---- *************** *** 247,253 **** $this->updateAnsBoxes(); } - - // set question display state - $this->state = new ItemState($this->studentAnswers, $this->answerBox, $this->itemOpts); } --- 231,234 ---- |