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: Simon H. <sim...@us...> - 2010-11-17 11:28:39
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv16996/lib/database Modified Files: StackDBCache.php Log Message: Index: StackDBCache.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBCache.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** StackDBCache.php 1 Oct 2010 15:02:54 -0000 1.23 --- StackDBCache.php 17 Nov 2010 11:28:31 -0000 1.24 *************** *** 270,274 **** */ public function getDisplayItem($id) { ! $this->query("SELECT state FROM display_cache WHERE id = $id"); return $this->base64_unserialize($this->result(0, 'state')); } --- 270,274 ---- */ public function getDisplayItem($id) { ! $this->query("SELECT state FROM display_cache WHERE id = $id LIMIT 1"); return $this->base64_unserialize($this->result(0, 'state')); } |
From: Simon H. <sim...@us...> - 2010-11-16 19:04:39
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7337/lib/database Modified Files: Tag: item_state_separation StackDBCache.php Log Message: Implemented reduceToState optimisation. To test. Index: StackDBCache.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBCache.php,v retrieving revision 1.12.6.2.2.3 retrieving revision 1.12.6.2.2.4 diff -C2 -d -r1.12.6.2.2.3 -r1.12.6.2.2.4 *** StackDBCache.php 9 Nov 2010 18:26:59 -0000 1.12.6.2.2.3 --- StackDBCache.php 16 Nov 2010 19:04:31 -0000 1.12.6.2.2.4 *************** *** 46,49 **** --- 46,52 ---- if($transition == NULL) { // go ahead and extend cache + //$state->trimToStateonly(); + $this->logger->debug("state in add: ".print_r($state, true)); + // add the new state $stateID = $this->addState($qID, $state, $post, $xhtml, $questionNote, $currentTotalMark, $totalPossibleMarks, $expired); *************** *** 159,162 **** --- 162,169 ---- $instance = new DisplayItem($userID, $qID, false, $seed); // non user-specific starter question + //$instance->reduceToState(); + //$logger = new Logger("STATIC deploy cache"); + //$logger->debug("state in deployCache: ".print_r($instance, true)); + // discard if this duplicates an existing instance (defined by question note) $sql = "SELECT * FROM display_cache, display_cache_sequence WHERE qID = ".$instance->getQuestionID(). *************** *** 168,171 **** --- 175,179 ---- // create a cache state $xhtml = $instance->processQuestion(NULL, true, false); + $sql = "INSERT INTO display_cache(qID, state, xhtml, questionNote, currentTotalMark, totalPossibleMarks, expired, lastActive) VALUES ($qID," . "'STATE GOES HERE'".//$this->dbSafeString($this->base64_serialize($instance)) . later... *************** *** 185,188 **** --- 193,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" . " SET state=".$db->dbSafeString($db->base64_serialize($instance)). |
From: Simon H. <sim...@us...> - 2010-11-16 19:04:39
|
Update of /cvsroot/stack/stack-dev/lib/ui/inputTypes In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7337/lib/ui/inputTypes Modified Files: Tag: item_state_separation InputTypeController.php Log Message: Implemented reduceToState optimisation. To test. Index: InputTypeController.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/InputTypeController.php,v retrieving revision 1.12.8.1 retrieving revision 1.12.8.2 diff -C2 -d -r1.12.8.1 -r1.12.8.2 *** InputTypeController.php 9 Nov 2010 16:51:35 -0000 1.12.8.1 --- InputTypeController.php 16 Nov 2010 19:04:31 -0000 1.12.8.2 *************** *** 45,49 **** * @access private */ ! private $availableTypes; /** --- 45,49 ---- * @access private */ ! private static $availableTypes; /** *************** *** 118,135 **** } //set list of avaliable input types, in a format that can be translated ! $this->availableTypes['Algebraic Input'] = get_string('stackInputType_Algebraic', 'stack', ''); ! $this->availableTypes['True/False'] = get_string('stackInputType_truefalse', 'stack', ''); ! $this->availableTypes['Single Character'] = get_string('stackInputType_singlechar', 'stack', ''); ! $this->availableTypes['DropDownList'] = get_string('stackInputType_dropdownlist', 'stack', ''); ! $this->availableTypes['Matrix'] = get_string('stackInputType_matrix', 'stack', ''); ! $this->availableTypes['List'] = get_string('stackInputType_list', 'stack', ''); ! $this->availableTypes['Textarea'] = get_string('stackInputType_Textarea', 'stack', ''); ! $this->availableTypes['Slider'] = get_string('stackInputType_slider', 'stack', ''); ! // We currently don't allow strings to be passed to the CAS, so remove this type. ! //$this->availableTypes['String'] = get_string('stackInputType_String', 'stack', ''); ! // Currently there are too many bugs with DragMath - so don't offer it! ! //$this->avaliableTypes['Dragmath with input box'] = get_string('stackInputType_dragmathInputBox', 'stack', ''); ! //$this->avaliableTypes['Dragmath only'] = get_string('stackInputType_dragmathOnly', 'stack', ''); ! } --- 118,136 ---- } //set list of avaliable input types, in a format that can be translated ! if(empty(self::$availableTypes)){ ! self::$availableTypes['Algebraic Input'] = get_string('stackInputType_Algebraic', 'stack', ''); ! self::$availableTypes['True/False'] = get_string('stackInputType_truefalse', 'stack', ''); ! self::$availableTypes['Single Character'] = get_string('stackInputType_singlechar', 'stack', ''); ! self::$availableTypes['DropDownList'] = get_string('stackInputType_dropdownlist', 'stack', ''); ! self::$availableTypes['Matrix'] = get_string('stackInputType_matrix', 'stack', ''); ! self::$availableTypes['List'] = get_string('stackInputType_list', 'stack', ''); ! self::$availableTypes['Textarea'] = get_string('stackInputType_Textarea', 'stack', ''); ! self::$availableTypes['Slider'] = get_string('stackInputType_slider', 'stack', ''); ! // We currently don't allow strings to be passed to the CAS, so remove this type. ! //$this->availableTypes['String'] = get_string('stackInputType_String', 'stack', ''); ! // Currently there are too many bugs with DragMath - so don't offer it! ! //$this->avaliableTypes['Dragmath with input box'] = get_string('stackInputType_dragmathInputBox', 'stack', ''); ! //$this->avaliableTypes['Dragmath only'] = get_string('stackInputType_dragmathOnly', 'stack', ''); ! } } *************** *** 172,176 **** //display a drop down list $widget = '<select name="'.$prefix.'">'; ! foreach($this->availableTypes as $key => $val) { //if indexed array of values, use val for both display and return --- 173,177 ---- //display a drop down list $widget = '<select name="'.$prefix.'">'; ! foreach(InputTypeController::availableTypes as $key => $val) { //if indexed array of values, use val for both display and return |
From: Simon H. <sim...@us...> - 2010-11-16 19:04:39
|
Update of /cvsroot/stack/stack-dev/lib/ui In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7337/lib/ui Modified Files: Tag: item_state_separation DisplayItem.php Log Message: Implemented reduceToState optimisation. To test. Index: DisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/DisplayItem.php,v retrieving revision 1.91.2.4.2.2 retrieving revision 1.91.2.4.2.3 diff -C2 -d -r1.91.2.4.2.2 -r1.91.2.4.2.3 *** DisplayItem.php 9 Nov 2010 16:51:37 -0000 1.91.2.4.2.2 --- DisplayItem.php 16 Nov 2010 19:04:31 -0000 1.91.2.4.2.3 *************** *** 1320,1323 **** --- 1320,1329 ---- } + public function reduceToState() { + //unset($this->itemOpts); + unset($this->errorLog); + unset($this->logger); + $this->item->reduceToState(); + } public function getTestInput($test) |
From: Simon H. <sim...@us...> - 2010-11-16 19:04:39
|
Update of /cvsroot/stack/stack-dev/opaque In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7337/opaque Modified Files: Tag: item_state_separation MoodleQuestionDeployment.php Log Message: Implemented reduceToState optimisation. To test. Index: MoodleQuestionDeployment.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleQuestionDeployment.php,v retrieving revision 1.3.8.1.2.1 retrieving revision 1.3.8.1.2.2 diff -C2 -d -r1.3.8.1.2.1 -r1.3.8.1.2.2 *** MoodleQuestionDeployment.php 9 Nov 2010 16:51:39 -0000 1.3.8.1.2.1 --- MoodleQuestionDeployment.php 16 Nov 2010 19:04:31 -0000 1.3.8.1.2.2 *************** *** 103,107 **** $this->xhtml = ''; ! $this->logger->debug("in MQD constructor: ".print_r($this->param, 1)); $this->deployment = new Deployment($this->param['id'], $this->param['engineID']); } --- 103,107 ---- $this->xhtml = ''; ! //$this->logger->debug("in MQD constructor: ".print_r($this->param, 1)); $this->deployment = new Deployment($this->param['id'], $this->param['engineID']); } |
From: Simon H. <sim...@us...> - 2010-11-16 19:04:39
|
Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7337/lib/items Modified Files: Tag: item_state_separation Item.php Log Message: Implemented reduceToState optimisation. To test. Index: Item.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/Item.php,v retrieving revision 1.61.8.2 retrieving revision 1.61.8.3 diff -C2 -d -r1.61.8.2 -r1.61.8.3 *** Item.php 9 Nov 2010 16:51:37 -0000 1.61.8.2 --- Item.php 16 Nov 2010 19:04:31 -0000 1.61.8.3 *************** *** 544,547 **** --- 544,601 ---- } + + /** + * Unsets all data associated with this Item that is not required for processing. + * Reduces cache storage and handling overhead. + */ + public function reduceToState() { + + //unset($this->itemTests); + /* + unset($this->lastUserEditor); + unset($this->language); + + unset($this->questionName); + unset($this->questionDescription); + + unset($this->questionKeywords); + unset($this->questionPublisher); + unset($this->questionFormat); + unset($this->questionLearningContext); + unset($this->questionDifficulty); + unset($this->questionCompetency);//ok + + unset($this->questionCompentencyLevel); + unset($this->questionTimeAllocated); + unset($this->questionExerciseType); + unset($this->questionRights); + //unset($this->questionPenalty); // sure? + + unset($this->questionDateLastEdited); + + unset($this->questionStatus); + + unset($this->published); // sure? + //unset($this->PRTrees); + unset($this->questionGUID); + unset($this->logger); + unset($this->line); + //unset($this->questionStem); + + //unset($this->workedSolution); + //*/ + //unset($this->errorLog); + unset($this->questionNote); + + //unset($this->itemOptions); + + // Go through question parts: can pick this up from static question also + foreach($this->questionPart as $key => $val) { + //$this->questionPart[$key] = 'foo'; + } + + //unset($this->preCalculated); + } + /** * Stores the question revision in the the database, if $asNew is set to true, adds as a new question line. |
From: Chris S. <san...@us...> - 2010-11-15 14:29:00
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29425/maxima Modified Files: Tag: grobner stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84.2.3 retrieving revision 1.84.2.4 diff -C2 -d -r1.84.2.3 -r1.84.2.4 *** stackmaxima.mac 15 Nov 2010 14:18:25 -0000 1.84.2.3 --- stackmaxima.mac 15 Nov 2010 14:28:52 -0000 1.84.2.4 *************** *** 422,428 **** )$ decimalplaces(x,n) := block([simp:true,fpprintprec],fpprintprec:n,float(round(10^n*float(x))/(10^n)))$ - /* Write numbers in significant figures */ significantfigures(x,n) := block([fpprec:128,fpprintprec,simp:true,ex,ex2], --- 422,428 ---- )$ + /* Write the number x in n decimal places */ decimalplaces(x,n) := block([simp:true,fpprintprec],fpprintprec:n,float(round(10^n*float(x))/(10^n)))$ /* Write numbers in significant figures */ significantfigures(x,n) := block([fpprec:128,fpprintprec,simp:true,ex,ex2], |
From: Chris S. <san...@us...> - 2010-11-15 14:18:33
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv26802/maxima Modified Files: Tag: grobner stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.84.2.2 retrieving revision 1.84.2.3 diff -C2 -d -r1.84.2.2 -r1.84.2.3 *** stackmaxima.mac 9 Nov 2010 14:50:41 -0000 1.84.2.2 --- stackmaxima.mac 15 Nov 2010 14:18:25 -0000 1.84.2.3 *************** *** 2011,2040 **** )$ ! /* ===================== ATEquations ===================== */ ! ATEquations(SA,SBl) := ! block([old_simp,keepfloat,RawMark,FeedBack,AnswerNote,cont:true,ret,SB,AT,var:0], ! old_simp:simp, simp:true, RawMark:0, FeedBack:"", AnswerNote:"", ! /* SBL is a list: the teacher's answer, the variable, and whether formative feedback is to be provided. */ ! if listp(SBl) then ! (var:SBl[2], SB:SBl[1], cont:true) ! else ! (cont:false, ret:[false,0,"ATEquation_list","ATEquation_list"]), ! if listp(var) then ! (AT:var[2], var:var[1],cont:true) ! else ! (cont:false, ret:[false,0,"ATEquation_list_var","ATEquation_list_var"]), ! /* Check we really do have a variable */ ! if not(AT="AE") then ! if atom(var) then ! (if stringp(var) or numberp(var) then ! (cont:false, ret:[false,0,"ATEquation_var_wrong",""]) ! ) ! else ! (cont:false, ret:[false,0,"ATEquation_var_wrong",""]), ! /* If ok, we perform the test */ ! if cont then ret:ATEquationfun(SA,SB,var,AT), ! ret:StackReturnOb(string(ret[2]),ret[3],ret[4]), ! return(ret) ! )$ /* --- 2011,2018 ---- )$ ! ! /*********************/ ! /* Matrix operations */ ! /*********************/ /* |
From: Simon H. <sim...@us...> - 2010-11-12 10:11:15
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv8281/lib/database Modified Files: MoodleDB.php Log Message: Towards 'hot' updates of questions in Moodle. Index: MoodleDB.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/MoodleDB.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MoodleDB.php 1 Nov 2010 18:18:29 -0000 1.16 --- MoodleDB.php 12 Nov 2010 10:11:06 -0000 1.17 *************** *** 757,764 **** $result = $this->query($sql); $n = $this->noRows(); //return $n; //return $this->noRows(); if($this->noRows() === false) return "noRows() === false for $sql"; ! else return "$this->noRows() attempt states for this question"; } } --- 757,765 ---- $result = $this->query($sql); $n = $this->noRows(); + //return $sql.$this->getErrors(); //return $n; //return $this->noRows(); if($this->noRows() === false) return "noRows() === false for $sql"; ! else return $this->noRows()." attempt states for this question"; } } |
From: Simon H. <sim...@us...> - 2010-11-12 10:11:15
|
Update of /cvsroot/stack/stack-dev/opaque In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv8281/opaque Modified Files: MoodleQuestionDeployment.php Log Message: Towards 'hot' updates of questions in Moodle. Index: MoodleQuestionDeployment.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/MoodleQuestionDeployment.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MoodleQuestionDeployment.php 2 Nov 2010 18:07:49 -0000 1.7 --- MoodleQuestionDeployment.php 12 Nov 2010 10:11:06 -0000 1.8 *************** *** 156,160 **** --- 156,163 ---- $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]); *************** *** 181,191 **** $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($mDB->attemptsOnQuestion()) { $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>Attempts on question: ".$mDB->attemptsOnQuestion($earliest); ! */ $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>'; --- 184,192 ---- $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>'; |
From: Simon H. <sim...@us...> - 2010-11-09 18:27:08
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv13494/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.2 retrieving revision 1.12.6.2.2.3 diff -C2 -d -r1.12.6.2.2.2 -r1.12.6.2.2.3 *** StackDBCache.php 9 Nov 2010 16:51:35 -0000 1.12.6.2.2.2 --- StackDBCache.php 9 Nov 2010 18:26:59 -0000 1.12.6.2.2.3 *************** *** 722,728 **** return $this->base64_unserialize($this->result(0, 'state')); } ! public function setState($id) { ! $this->query("UPDATE display_cache") } } --- 722,728 ---- return $this->base64_unserialize($this->result(0, 'state')); } ! public function setState($id) { ! $this->query("UPDATE display_cache"); } } |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:24
|
Update of /cvsroot/stack/stack-dev/other In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/other Modified Files: Tag: item_state_separation load.js jquery.js Added Files: Tag: item_state_separation flyfeedback.js jquery.dataTables.js jquery.ui.js Log Message: Brought back up to date with big HEAD merge. Index: load.js =================================================================== RCS file: /cvsroot/stack/stack-dev/other/load.js,v retrieving revision 1.2 retrieving revision 1.2.10.1 diff -C2 -d -r1.2 -r1.2.10.1 *** load.js 23 Jun 2009 14:39:37 -0000 1.2 --- load.js 9 Nov 2010 16:51:35 -0000 1.2.10.1 *************** *** 17,20 **** --- 17,21 ---- * **********************************************************************/ + if (!window.jsMath) {window.jsMath = {}} *************** *** 43,47 **** // 0 means always load jsMath // ! autoload: 1, // --- 44,50 ---- // 0 means always load jsMath // ! // The load flag is used in reporting since jsMath elements are generated dynamically after page load. ! // ! autoload: (loadFlag != null ? 1 : 0), // *************** *** 74,80 **** // // Show TeX source when mathematics is double-clicked? // ! allowDoubleClicks: 0, // --- 77,92 ---- // + // Disallow the use of the @(...) mechanism for including raw HTML + // in the contents of \hbox{}? (If used in a content-management system + // where users are allowed to enter mathematics, setting this to 0 + // would allow them to enter arbitrary HTML code within their + // math formulas, and that poses a security risk.) + // + safeHBoxes: 1, + + // // Show TeX source when mathematics is double-clicked? // ! allowDoubleClicks: 1, // *************** *** 106,109 **** --- 118,136 ---- // + // List of macros to define. These are of the form + // name: value + // where 'value' is the replacement text for the macro \name. + // The 'value' can also be [value,n] where 'value' is the replacement + // text and 'n' is the number of parameters for the macro. + // Note that backslashes must be doubled in the replacement string. + // E.g., + // { + // RR: '{\\bf R}', + // bold: ['{\\bf #1}', 1] + // } + // + macros: {}, + + // // Allow jsMath to enter global mode? // (Uses frames, so may not always work with complex web sites) *************** *** 167,170 **** jsMath.Easy.root = jsMath.Easy.root.replace(/\/$/,""); // trim trailing "/" if any ! document.write('<SCRIPT SRC="'+jsMath.Easy.root+'/jsMath-easy-load.js"><'+'/SCRIPT>'); --- 194,197 ---- jsMath.Easy.root = jsMath.Easy.root.replace(/\/$/,""); // trim trailing "/" if any ! document.write('<script src="'+jsMath.Easy.root+'/jsMath-easy-load.js"><'+'/script>'); --- NEW FILE: jquery.ui.js --- /*! * jQuery UI 1.8.2 * * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://docs.jquery.com/UI */ (function(c){c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.2",plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")== "hidden")return false;b=b&&b=="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,f,g){return c.ui.isOverAxis(a,d,f)&&c.ui.isOverAxis(b,e,g)},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108, NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect", "none")},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x", 1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==undefined)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b=="absolute"||b=="relative"||b=="fixed"){b=parseInt(a.css("zIndex"));if(!isNaN(b)&&b!=0)return b}a=a.parent()}}return 0}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");return(/input|select|textarea|button|object/.test(b)? !a.disabled:"a"==b||"area"==b?a.href||!isNaN(d):!isNaN(d))&&!c(a)["area"==b?"parents":"closest"](":hidden").length},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}})}})(jQuery); (function(b){var j=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add(this).each(function(){b(this).triggerHandler("remove")});return j.call(b(this),a,c)})};b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend({},c.options);b[e][a].prototype= b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==undefined){h=i;return false}}):this.each(function(){var g= b.data(this,a);if(g){d&&g.option(d);g._init()}else b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){this.element=b(c).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create(); this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===undefined)return this.options[a];d={};d[a]=c}b.each(d,function(f, h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a= b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery); (function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(a._preventClickEvent){a._preventClickEvent=false;b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&& this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault(); return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);c.browser.safari||a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&& this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=a.target==this._mouseDownEvent.target;this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX- a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); (function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== "original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top- this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions(); d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis|| this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if(!this.element[0]||!this.element[0].parentNode)return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element, b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this== a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]|| 0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top- (parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment== "parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&& a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"), 10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft(): f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+ this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+ Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left- this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs= this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.2"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable"); if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper; c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver= 1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left; this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper= this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a= d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options; if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!= "HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX- b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()- c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this, width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&& o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t= p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&& (p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"), 10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery); (function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this); a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&& this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass); this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g= d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop", a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.2"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height; switch(c){case "fit":return i<e&&g<k&&j<f&&h<l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=i&& e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!= "none";if(c[f].visible){c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight};e=="mousedown"&&c[f]._activate.call(c[f],b)}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem|| a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e= d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery); (function(d){d.widget("ui.resizable",d.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");d.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element, _proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&d.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(d('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!d(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var e=0;e<c.length;e++){var g=d.trim(c[e]),f=d('<div class="ui-resizable-handle '+("ui-resizable-"+g)+'"></div>');/sw|se|ne|nw/.test(g)&&f.css({zIndex:++a.zIndex});"se"==g&&f.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[g]=".ui-resizable-"+g;this.element.append(f)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== String)this.handles[i]=d(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=d(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}d(this.handles[i])}};this._renderAxis(this.element);this._handles=d(".ui-resizable-handle",this.element).disableSelection(); this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();d(this.element).addClass("ui-resizable-autohide").hover(function(){d(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){d(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){d(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()}; if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(d(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(), e=this.element;this.resizing=true;this.documentScroll={top:d(document).scrollTop(),left:d(document).scrollLeft()};if(e.is(".ui-draggable")||/absolute/.test(e.css("position")))e.css({position:"absolute",top:c.top,left:c.left});d.browser.opera&&/relative/.test(e.css("position"))&&e.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var g=m(this.helper.css("top"));if(a.containment){c+=d(a.containment).scrollLeft()||0;g+=d(a.containment).scrollTop()||0}this.offset= this.helper.offset();this.position={left:c,top:g};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:c,top:g};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio: this.originalSize.width/this.originalSize.height||1;a=d(".ui-resizable-"+this.axis).css("cursor");d("body").css("cursor",a=="auto"?this.axis+"-resize":a);e.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,e=this._change[this.axis];if(!e)return false;c=e.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize", b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var e=this._proportionallyResizeElements,g=e.length&&/textarea/i.test(e[0].nodeName);e=g&&d.ui.hasScroll(e[0],"left")?0:c.sizeDiff.height; g={width:c.size.width-(g?0:c.sizeDiff.width),height:c.size.height-e};e=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var f=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(d.extend(g,{top:f,left:e}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}d("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop", b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(k(b.left))this.position.left=b.left;if(k(b.top))this.position.top=b.top;if(k(b.height))this.size.height=b.height;if(k(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,e=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(e=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(e=="nw"){b.top= a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,e=k(b.width)&&a.maxWidth&&a.maxWidth<b.width,g=k(b.height)&&a.maxHeight&&a.maxHeight<b.height,f=k(b.width)&&a.minWidth&&a.minWidth>b.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(f)b.width=a.minWidth;if(h)b.height=a.minHeight;if(e)b.width=a.maxWidth;if(g)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height, l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(f&&l)b.left=i-a.minWidth;if(e&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(g&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var e=[c.css("borderTopWidth"), c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],g=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=d.map(e,function(f,h){f=parseInt(f,10)||0;h=parseInt(g[h],10)||0;return f+h})}d.browser.msie&&(d(b).is(":hidden")||d(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset= this.element.offset();if(this._helper){this.helper=this.helper||d('<div style="overflow:hidden;"></div>');var a=d.browser.msie&&d.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+ a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return d.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return d.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return d.extend(this._change.n.apply(this, arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return d.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){d.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});d.extend(d.ui.resizable, {version:"1.8.2"});d.ui.plugin.add("resizable","alsoResize",{start:function(){var b=d(this).data("resizable").options,a=function(c){d(c).each(function(){d(this).data("resizable-alsoresize",{width:parseInt(d(this).width(),10),height:parseInt(d(this).height(),10),left:parseInt(d(this).css("left"),10),top:parseInt(d(this).css("top"),10)})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else d.each(b.alsoResize,function(c){a(c)}); else a(b.alsoResize)},resize:function(){var b=d(this).data("resizable"),a=b.options,c=b.originalSize,e=b.originalPosition,g={height:b.size.height-c.height||0,width:b.size.width-c.width||0,top:b.position.top-e.top||0,left:b.position.left-e.left||0},f=function(h,i){d(h).each(function(){var j=d(this),l=d(this).data("resizable-alsoresize"),p={};d.each((i&&i.length?i:["width","height","top","left"])||["width","height","top","left"],function(n,o){if((n=(l[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(/relative/.test(j.css("position"))&& d.browser.opera){b._revertToRelativePosition=true;j.css({position:"absolute",top:"auto",left:"auto"})}j.css(p)})};typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?d.each(a.alsoResize,function(h,i){f(h,i)}):f(a.alsoResize)},stop:function(){var b=d(this).data("resizable");if(b._revertToRelativePosition&&d.browser.opera){b._revertToRelativePosition=false;el.css({position:"relative"})}d(this).removeData("resizable-alsoresize-start")}});d.ui.plugin.add("resizable","animate",{stop:function(b){var a= d(this).data("resizable"),c=a.options,e=a._proportionallyResizeElements,g=e.length&&/textarea/i.test(e[0].nodeName),f=g&&d.ui.hasScroll(e[0],"left")?0:a.sizeDiff.height;g={width:a.size.width-(g?0:a.sizeDiff.width),height:a.size.height-f};f=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(d.extend(g,h&&f?{top:h,left:f}:{}),{duration:c.animateDuration,easing:c.animateEasing, step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};e&&e.length&&d(e[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});d.ui.plugin.add("resizable","containment",{start:function(){var b=d(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof d?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= d(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:d(document),left:0,top:0,width:d(document).width(),height:d(document).height()||document.body.parentNode.scrollHeight}}else{var e=d(a),g=[];d(["Top","Right","Left","Bottom"]).each(function(i,j){g[i]=m(e.css("padding"+j))});b.containerOffset=e.offset();b.containerPosition=e.position();b.containerSize={height:e.innerHeight()-g[3],width:e.innerWidth()-g[1]};c=b.containerOffset; var f=b.containerSize.height,h=b.containerSize.width;h=d.ui.hasScroll(a,"left")?a.scrollWidth:h;f=d.ui.hasScroll(a)?a.scrollHeight:f;b.parentData={element:a,left:c.left,top:c.top,width:h,height:f}}}},resize:function(b){var a=d(this).data("resizable"),c=a.options,e=a.containerOffset,g=a.position;b=a._aspectRatio||b.shiftKey;var f={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))f=e;if(g.left<(a._helper?e.left:0)){a.size.width+=a._helper?a.position.left-e.left: a.position.left-f.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?e.left:0}if(g.top<(a._helper?e.top:0)){a.size.height+=a._helper?a.position.top-e.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?e.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-f.left:a.offset.left-f.left)+a.sizeDiff.width);e=Math.abs((a._helper?a.offset.top-f.top:a.offset.top- e.top)+a.sizeDiff.height);g=a.containerElement.get(0)==a.element.parent().get(0);f=/relative|absolute/.test(a.containerElement.css("position"));if(g&&f)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(e+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-e;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=d(this).data("resizable"),a=b.options,c=b.containerOffset,e=b.containerPosition, g=b.containerElement,f=d(b.helper),h=f.offset(),i=f.outerWidth()-b.sizeDiff.width;f=f.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(g.css("position"))&&d(this).css({left:h.left-e.left-c.left,width:i,height:f});b._helper&&!a.animate&&/static/.test(g.css("position"))&&d(this).css({left:h.left-e.left-c.left,width:i,height:f})}});d.ui.plugin.add("resizable","ghost",{start:function(){var b=d(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25, display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=d(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=d(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});d.ui.plugin.add("resizable","grid",{resize:function(){var b= d(this).data("resizable"),a=b.options,c=b.size,e=b.originalSize,g=b.originalPosition,f=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-e.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-e.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(f)){b.size.width=e.width+h;b.size.height=e.height+a}else if(/^(ne)$/.test(f)){b.size.width=e.width+h;b.size.height=e.height+a;b.position.top=g.top-a}else{if(/^(sw)$/.test(f)){b.size.width=e.width+h;b.size.height= e.height+a}else{b.size.width=e.width+h;b.size.height=e.height+a;b.position.top=g.top-a}b.position.left=g.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery); (function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting"); b.unselecting=true;f._trigger("unselecting",c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f= this;this.dragged=true;if(!this.options.disabled){var d=this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected"); a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting= true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&&!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected= false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.2"})})(jQuery); (function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable"); this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this, arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem= c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset, {click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment(); if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start", a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute"); if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+ this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+ b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+ "px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for... [truncated message content] |
Update of /cvsroot/stack/stack-dev/lib/ui In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/ui Modified Files: Tag: item_state_separation questionTest.php authorTest.php questionBank.php AuthorDisplay.php questionReview.php questionExporter.php OptionsEdit.php OptionsEditor.php questionDeploy.php DisplayItem.php questionImporter.php report.php GhostWriter.php AdminInterface.php frontend.php Added Files: Tag: item_state_separation report.js report.css Removed Files: Tag: item_state_separation BlockHandler.php Log Message: Brought back up to date with big HEAD merge. Index: questionImporter.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/questionImporter.php,v retrieving revision 1.17 retrieving revision 1.17.10.1 diff -C2 -d -r1.17 -r1.17.10.1 *** questionImporter.php 28 Jul 2009 15:39:26 -0000 1.17 --- questionImporter.php 9 Nov 2010 16:51:37 -0000 1.17.10.1 *************** *** 21,28 **** --- 21,40 ---- */ + session_start(); + require_once('../../config.php'); $config = new stackConfig(); global $config; + $url = $config->get('weburl'); + $diemessage = "Please <a href='$url'>login</a>."; + if (array_key_exists('loggedin',$_SESSION)) { + $loggedin = $_SESSION['loggedin']; + if (!$loggedin) { die($diemessage); } + } else { + die($diemessage); + } + + $root = $config->get('docroot'); $webroot = $config->get('webroot'); Index: questionDeploy.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/questionDeploy.php,v retrieving revision 1.8.6.1 retrieving revision 1.8.6.1.2.1 diff -C2 -d -r1.8.6.1 -r1.8.6.1.2.1 *** questionDeploy.php 3 Nov 2009 16:03:28 -0000 1.8.6.1 --- questionDeploy.php 9 Nov 2010 16:51:37 -0000 1.8.6.1.2.1 *************** *** 23,26 **** --- 23,36 ---- global $config; + $url = $config->get('weburl'); + $diemessage = "Please <a href='$url'>login</a>."; + if (array_key_exists('loggedin',$_SESSION)) { + $loggedin = $_SESSION['loggedin']; + if (!$loggedin) { die($diemessage); } + } else { + die($diemessage); + } + + $root = $config->get('docroot'); require_once('DisplayItem.php'); *************** *** 31,81 **** require_once $root.'/lib/deployment/Deployment.php'; $cache = new StackDBCache(); $cache->connect(); ! echo html_head(get_string('FE_deployQuestion', 'stack'),'../../',"@import \"../../styles.css\";\n"); ! $qid = $_GET['id']; // TODO: needs sanitization ?> - <body> ! <h1><?php echo get_string('FE_deployQuestion', 'stack').' '.$qid; ?></h1> <p><a href="../../index.php"><?php echo get_string('FE_index_main','stack','') ?></a> ! <a href="authorTest.php?id=<?php echo $qid ?>"><?php echo get_string('stackQuestion_filterLinkEdit','stack'); ?></a></p> <div class="section80"> ! <h3 class="section"><?php echo get_string('FE_deployQuestion_instancesOfQuestion', 'stack').' '.$qid; ?></h3> <p> <?php - $deployment = new Deployment($qid); // will auto-deploy as necessary - $request = $_POST + $_GET; // POST from this page with possible GET via Opaque if(!$deployment->isSingleton()) { // multiple versions - $result = $deployment->processOperations($request); if(!empty($result)) echo "<div class='warning'>".$result."</div>"; ! echo "<form method='POST' action='?id=".$qid."'>".$deployment->formXHTML()."</form"; } else { // single version echo "<div class='warning'>"; ! echo $deployment->processOperations($request); if($deployment->autoDeployed) { echo get_string('FE_deployQuestion_auto', 'stack'); } echo "</div>"; } ! //echo $deployment->listXHTML(); ! if($deployment->getInstances() == NULL) { echo '<i>'.get_string('FE_deployQuestion_noi', 'stack').'</i>'; } else { ! if (1 == count($deployment->getInstances())) { ! echo '<p>'.get_string('FE_deployQuestion_version', 'stack').'</p>'; } else { ! echo '<p>'.count($deployment->getInstances()).get_string('FE_deployQuestion_versions', 'stack').'</p>'; } echo '<table class="deploymentTable" border="1">'; echo '<tr><th>'; ! echo '</th><th>'; echo get_string('stackQuestion_questionStem', 'stack'); echo '</th><th>'; --- 41,121 ---- require_once $root.'/lib/deployment/Deployment.php'; + $id = $_GET['id']; // TODO: needs sanitization + + $itemDB = new StackDBItem(); + $itemDB->connect(); + $latestVersion = $itemDB->getLatestVersion($id); + $cache = new StackDBCache(); $cache->connect(); ! $deployment = new Deployment($id); // will auto-deploy as necessary ! $request = $_POST + $_GET; // POST from this page with possible GET via Opaque ! $result = $deployment->processOperations($request); + echo html_head(get_string('FE_deployVersion', 'stack'),'../../',"@import \"../../styles.css\";\n"); ?> <body> ! <h1><?php echo get_string('FE_deployVersion', 'stack').' '.$id; ?></h1> <p><a href="../../index.php"><?php echo get_string('FE_index_main','stack','') ?></a> ! <a href="authorTest.php?id=<?php echo $id ?>"><?php echo get_string('stackQuestion_filterLinkEdit','stack'); ?></a></p> <div class="section80"> ! <h3 class="section"> ! <?php ! if(isset($_GET['dropall'])) { ! $undeployment = new Deployment($_GET['dropall']); ! $undeployment->drop(); ! } ! ! echo get_string('FE_deployQuestion_instancesOfVersion', 'stack').' '.$id; ! ?></h3> <p> <?php + $earliest = $deployment->earliestDeployedVersion(); // any stale deployments? if(!$deployment->isSingleton()) { // multiple versions if(!empty($result)) echo "<div class='warning'>".$result."</div>"; ! if($latestVersion == $deployment->getVersion()) { // this is latest version ! if($latestVersion == $earliest || false == $earliest) { ! echo "<form method='POST' action='?id=".$id."'>".$deployment->formXHTML()."</form>"; ! } else { ! echo get_string('FE_deployQuestion_oldVersionDeployed', 'stack'); ! $deployment = new Deployment($earliest); ! echo '<p><a href="?id='.$id.'&dropall='.$earliest.'">'.get_string('FE_deployQuestion_undeployAll', 'stack').'</a>'; ! } ! } else { // this is an old version ! echo get_string('FE_deployQuestion_newerVersionCannotDeploy', 'stack', $latestVersion); ! echo '<a href="?id='.$latestVersion.'">deploy latest</a>'; ! } } else { // single version echo "<div class='warning'>"; ! echo $result;//$deployment->processOperations($request); if($deployment->autoDeployed) { echo get_string('FE_deployQuestion_auto', 'stack'); + } else { + echo get_string('FE_deployQuestion_oldVersionDeployed', 'stack'); + $deployment = new Deployment($earliest); } echo "</div>"; } ! $instances = $deployment->getInstances(); ! ! if($instances == NULL) { echo '<i>'.get_string('FE_deployQuestion_noi', 'stack').'</i>'; } else { ! if (1 == count($instances)) { ! echo '<p>'.get_string('FE_deployQuestion_instanceDeployed', 'stack').'</p>'; } else { ! echo '<p>'.get_string('FE_deployQuestion_xInstances', 'stack', $deployment->size()); } + echo get_string('FE_deployQuestion_ofVersionXdeployed', 'stack', $deployment->getVersion()).'</p>'; echo '<table class="deploymentTable" border="1">'; echo '<tr><th>'; ! //echo 'v';//get_string('stackQuestion_id.revision', 'stack'); ! //echo '</th><th>'; echo get_string('stackQuestion_questionStem', 'stack'); echo '</th><th>'; *************** *** 84,91 **** echo '</th></tr>'; ! foreach($deployment->getInstances() as $instance) { $item = $cache->getDisplayItem($instance['id']); echo '<tr>'; ! echo '<td>'. $instance['id'] .'</td>'; echo '<td>'. $instance['xhtml'] .'</td>'; echo '<td>'.$item->getQuestionNote().'</td>'; --- 124,132 ---- echo '</th></tr>'; ! foreach($instances as $instance) { ! //print_r($instance); $item = $cache->getDisplayItem($instance['id']); echo '<tr>'; ! //echo "<td>$instance[version]</td>"; echo '<td>'. $instance['xhtml'] .'</td>'; echo '<td>'.$item->getQuestionNote().'</td>'; *************** *** 99,113 **** ?> </div> - <div class="section80"> - <h3 class="section"><?php echo get_string('FE_deployQuestion_primedResponses', 'stack')?></h3> - Pregenerated from the question tests, they can include correct answers as well as common mistakes. The cache can be primed to include their straightforward submission to save the work at quiz time. - <form method="POST" action="questionDeploy.php?id=<?php echo $qid ?>"> - <input type="submit" value="Regenerate"> - </form> <?php $responses = $deployment->primeResponses(); if($responses === NULL) echo "No question tests defined!"; else echo sizeof($responses)." new responses primed."; // should output responses defined (counted) and their test result ?> </div> \ No newline at end of file --- 140,155 ---- ?> </div> <?php + if($earliest == $latestVersion) { + echo '<div class="section80">'; + echo '<h3 class="section">'.get_string('FE_deployQuestion_primedResponses', 'stack').'</h3>'; + echo get_string('FE_deployQuestion_primedResponsesBlurb', 'stack'); + echo '<form method="POST" action="questionDeploy.php?id='.$id.'"><input type="submit" value="Regenerate"></form>'; + $responses = $deployment->primeResponses(); if($responses === NULL) echo "No question tests defined!"; else echo sizeof($responses)." new responses primed."; // should output responses defined (counted) and their test result + } ?> </div> \ No newline at end of file Index: OptionsEdit.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/OptionsEdit.php,v retrieving revision 1.5 retrieving revision 1.5.20.1 diff -C2 -d -r1.5 -r1.5.20.1 *** OptionsEdit.php 4 Oct 2007 12:58:48 -0000 1.5 --- OptionsEdit.php 9 Nov 2010 16:51:37 -0000 1.5.20.1 *************** *** 19,23 **** $config = new stackConfig(); global $config; ! require_once('OptionsEditor.php'); $editor = new OptionsEditor(); --- 19,33 ---- $config = new stackConfig(); global $config; ! ! $url = $config->get('weburl'); ! $diemessage = "Please <a href='$url'>login</a>."; ! if (array_key_exists('loggedin',$_SESSION)) { ! $loggedin = $_SESSION['loggedin']; ! if (!$loggedin) { die($diemessage); } ! } else { ! die($diemessage); ! } ! ! require_once('OptionsEditor.php'); $editor = new OptionsEditor(); *************** *** 25,29 **** ?> ! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> --- 35,39 ---- ?> ! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> *************** *** 41,51 **** var optionsContainer; var copyContainer; ! window.onload = function() { optionsContainer = new fx.Height('options', {duration: 400}); copyContainer = new fx.Height('copy', {duration: 400}); ! //copyContainer.hide(); ! //optionsContainer.hide(); ! <?php //display last edited page. if(!empty($_POST['edit_new']) || !empty($_POST['edit_overwrite'])) --- 51,61 ---- var optionsContainer; var copyContainer; ! window.onload = function() { optionsContainer = new fx.Height('options', {duration: 400}); copyContainer = new fx.Height('copy', {duration: 400}); ! //copyContainer.hide(); ! //optionsContainer.hide(); ! <?php //display last edited page. if(!empty($_POST['edit_new']) || !empty($_POST['edit_overwrite'])) *************** *** 59,63 **** ?> } ! function toggleBoth() { --- 69,73 ---- ?> } ! function toggleBoth() { *************** *** 66,72 **** optionsContainer.toggle('optIcon', iconPath); } ! ! </script> ! <title>Question test</title> </head> --- 76,82 ---- optionsContainer.toggle('optIcon', iconPath); } ! ! </script> ! <title>Question test</title> </head> Index: authorTest.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/authorTest.php,v retrieving revision 1.15.10.1 retrieving revision 1.15.10.2 diff -C2 -d -r1.15.10.1 -r1.15.10.2 *** authorTest.php 2 Dec 2009 20:13:03 -0000 1.15.10.1 --- authorTest.php 9 Nov 2010 16:51:37 -0000 1.15.10.2 *************** *** 17,26 **** --- 17,39 ---- */ session_start(); + require_once('../../config.php'); $config = new stackConfig(); global $config; + $url = $config->get('weburl'); + $diemessage = "Please <a href='$url'>login</a>."; + if (array_key_exists('loggedin',$_SESSION)) { + $loggedin = $_SESSION['loggedin']; + if (!$loggedin) { die($diemessage); } + } else { + die($diemessage); + } + + require_once('AuthorDisplay.php'); + require_once $config->get('docroot').'/lib/ui/frontend.php'; + if(empty($_SESSION['authorItem']) || ($_POST == NULL)) { *************** *** 48,104 **** //unset($_SESSION['authorItem']); $_SESSION['authorItem'] = serialize($author); - ?> - - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html> - <head> - <style type="text/css" media="all"> - @import "../../styles.css"; - </style> - <script type="text/javascript" src="../../other/moo.fx/prototype.lite.js"></script> - <script type="text/javascript" src="../../other/moo.fx/moo.fx.js"></script> - <script type="text/javascript" src="../../other/jquery.js"></script> - <script type="text/javascript"> - // Initialise the effects - var metaContainer; - var optionsContainer; - var moodleContainer; - var prtContainer; - var qpContainer; - - - window.onload = function() { - metaContainer = new fx.Height('meta', {duration: 400}); - metaContainer.hide(); - optionsContainer = new fx.Height('options', {duration: 400}); - optionsContainer.hide(); - moodleContainer = new fx.Height('moptions', {duration: 400}); - moodleContainer.hide(); - prtContainer = new fx.Height('prtContainer', {duration: 400}); - qpContainer = new fx.Height('qpContainer', {duration: 400}); - - } ! </script> ! <script type="text/javascript"> ! function swapper(container, icon) ! { ! var iconPath = '<?php echo $config->get('weburl'); ?>/pix/'; ! container.toggle(icon, iconPath); ! } ! ! function toggleIcon(container) { ! var iconPath = '<?php echo $config->get('weburl'); ?>/pix/'; ! alert($(container).child()); ! } ! </script> ! <title>Question test</title> ! </head> <body> <form action="authorTest.php" method="POST"> <div id="authoringControls"> ! <h2><?php echo get_string('stackAuthor_title'.$key,'stack').' #'.$_GET['id'] ?></h2> ! <p><a href="../../index.php"><?php echo get_string('FE_index_main','stack','') ?></a></p> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_update','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_save','stack'); ?>" /> --- 61,71 ---- //unset($_SESSION['authorItem']); $_SESSION['authorItem'] = serialize($author); ! echo html_head(get_string('stackQuestion_authorEditQuestion', 'stack'),'../../',"@import \"../../styles.css\";\n", 'LaTeX', true); ! ?> <body> <form action="authorTest.php" method="POST"> <div id="authoringControls"> ! <a href="../../index.php"><?php echo get_string('FE_index_main','stack','') ?></a><p /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_update','stack'); ?>" /> <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_save','stack'); ?>" /> *************** *** 107,116 **** <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_exportAsXml','stack'); ?>" /> <p> ! <a href="#stem">Stem</a> ! <br /><a href="#parts" onClick="$('#partContainer').slideDown();">Interactions</a> ! <br /><a href="#prts" onClick="$('#prtContainer').slideDown();">Responses</a> ! <br /><a href="#options" onClick="$('#optionContainer').slideDown();">Options</a> ! <br /><a href="#tests" onClick="$('#testContainer').slideDown();">Tests</a> ! <br /><a href="#meta" onClick="$('#metaContainer').slideDown();">Meta</a> </div> <?php --- 74,90 ---- <input type="submit" name="submit" value="<?php echo get_string('stackAuthor_button_exportAsXml','stack'); ?>" /> <p> ! <ul> ! <li><a href="#stem">Stem</a></li> ! <li><a href="#parts" onClick="$('#partContainer').slideDown();">Interactions</a></li> ! <li><a href="#prts" onClick="$('#prtContainer').slideDown();">Responses</a></li> ! <li><a href="#options" onClick="$('#optionContainer').slideDown();">Options</a></li> ! <li><a href="#tests" onClick="$('#testContainer').slideDown();">Tests</a></li> ! <li><a href="#meta" onClick="$('#metaContainer').slideDown();">Meta</a></li> ! </ul> ! <?php ! // line history ! //echo $author->displayVersionHistory(); ! ?> ! </div> <?php *************** *** 118,122 **** ?> </form> ! <?php --- 92,100 ---- ?> </form> ! <script language="JavaScript" type="text/javascript"> ! $(document).ready(function() { ! $('#authoringControls').append($('#versionHistory').detach().html()); ! }); ! </script> <?php Index: DisplayItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/DisplayItem.php,v retrieving revision 1.91.2.4.2.1 retrieving revision 1.91.2.4.2.2 diff -C2 -d -r1.91.2.4.2.1 -r1.91.2.4.2.2 *** DisplayItem.php 4 Dec 2009 10:11:14 -0000 1.91.2.4.2.1 --- DisplayItem.php 9 Nov 2010 16:51:37 -0000 1.91.2.4.2.2 *************** *** 41,46 **** require_once $root.'/lib/database/StackDBCache.php'; - // Block Handler - require_once $root.'/lib/ui/BlockHandler.php'; /** * Creates instantiated item & provides methods for displaying it. --- 41,44 ---- *************** *** 311,315 **** /** Processes the question inserting in the students answer, answerboxes and feedback as needed. * Returns the XHTML representation of the question. ! * No caching; that logic is handled higher up. * * @param array $posted values --- 309,313 ---- /** Processes the question inserting in the students answer, answerboxes and feedback as needed. * Returns the XHTML representation of the question. ! * No display caching; that logic is handled higher up. * * @param array $posted values *************** *** 387,390 **** --- 385,389 ---- //check status, $status = $IE->getStatus(); + $hideFeedback = 'true' == $this->item->questionPart[$label]->getHideFeedback()->getSelected(); switch($status) *************** *** 405,408 **** --- 404,410 ---- //$full .= '<span class="solutionButton"> '.get_string('stackQuestionDisplay_viewSolution','stack','').'<input type="checkbox" value="true" name="'."SR__$label".'" />'; + if($hideFeedback) { + $full = ''; + } $xhtml = str_replace("<IEfeedback>$label</IEfeedback>", $full, $xhtml); break; *************** *** 425,428 **** --- 427,433 ---- $full .= "</div>\n\n"; + if($hideFeedback) { + $full = ''; + } $xhtml = str_replace("<IEfeedback>$label</IEfeedback>", $full, $xhtml); break; *************** *** 438,441 **** --- 443,449 ---- } $full .= "</div>\n\n"; + if($hideFeedback) { + $full = ''; + } $xhtml = str_replace("<IEfeedback>$label</IEfeedback>", $full, $xhtml); break; *************** *** 454,457 **** --- 462,468 ---- $full .= '<br />'.get_string('stackQuestionDisplay_ThisCanDisplay','stack','').' <span class="SyntaxExample2">'.$this->cachedTAnsValue[$label].'</span> '; $full .= "</div>\n\n"; + if($hideFeedback) { + $full = ''; + } $xhtml = str_replace("<IEfeedback>$label</IEfeedback>", $full, $xhtml); *************** *** 495,499 **** // but first check that there is a worked solution to display $rawWS = $this->item->workedSolution->getRawCasText(); ! if(($this->workedSolutionRequested == true || $this->expired == true) && !empty($rawWS)) { $xhtml .= '<div class="secondaryFeedback">'; --- 506,517 ---- // but first check that there is a worked solution to display $rawWS = $this->item->workedSolution->getRawCasText(); ! $OptWorkedSol = $this->item->getItemOption('OptWorkedSol'); ! ! if(null !== $OptWorkedSol) { ! $OptWorkedSol = $OptWorkedSol->getSelected(); ! } else { ! $OptWorkedSol = 'true'; ! } ! if(($this->workedSolutionRequested == true || $this->expired == true) && !empty($rawWS)) { $xhtml .= '<div class="secondaryFeedback">'; *************** *** 507,511 **** //.get_string('stackQuestionDisplay_requestWS','stack','').' <input type="checkbox" name="workedSolution" value="true" />'; } ! elseif(!empty($rawWS) && $all_elements_at_score_WS) { $xhtml .= '<div class="secondaryFeedback">'.get_string('stackQuestionDisplay_requestWS','stack','').' <input type="checkbox" name="workedSolution" value="true" /></div>'; --- 525,529 ---- //.get_string('stackQuestionDisplay_requestWS','stack','').' <input type="checkbox" name="workedSolution" value="true" />'; } ! elseif(!empty($rawWS) && $all_elements_at_score_WS && 'true'===$OptWorkedSol) { $xhtml .= '<div class="secondaryFeedback">'.get_string('stackQuestionDisplay_requestWS','stack','').' <input type="checkbox" name="workedSolution" value="true" /></div>'; *************** *** 679,683 **** foreach($posted as $label => $post) { ! $exploded = explode('-', $label); if(count($exploded) == 1) --- 697,701 ---- foreach($posted as $label => $post) { ! $exploded = explode('|', $label); if(count($exploded) == 1) *************** *** 729,739 **** protected function updateSAnswer($posted, $process=true) { ! //preprocess the students answers, if required by the answertest used //for example the matrix input type needs to join multiple answers into one maxima command. $posted = $this->filterInputs($posted); //update the studentsAnswers or create if does not exist - if($this->studentAnswers === NULL) { --- 747,758 ---- protected function updateSAnswer($posted, $process=true) { ! //preprocess the students answers, if required by the input element used //for example the matrix input type needs to join multiple answers into one maxima command. + //echo "<pre>";print_r($posted); $posted = $this->filterInputs($posted); + //print_r($posted);echo "</pre>"; //update the studentsAnswers or create if does not exist if($this->studentAnswers === NULL) { *************** *** 763,766 **** --- 782,786 ---- //var_dump($implicitForbid); $this->studentAnswers->syntaxCheck($this->itemOpts, $this->item->getQuestionPartsByStudentAnsKey(), $implicitForbid); + $this->studentAnswers->scoreIfValid($this->item->getQuestionPartsByStudentAnsKey()); $this->studentAnswers->casValidate($this->itemOpts, $this->item->getSeed(), $this->item->getQuestionPartsByStudentAnsKey(), $this->cachedTAnsValue); *************** *** 856,859 **** --- 876,880 ---- } + /** * Sends the question stem to the cas, then caches it for later use. *************** *** 881,884 **** --- 902,906 ---- } + //add in the teachers answers $tansStartAt = $count; //index teachers answer start at. *************** *** 886,889 **** --- 908,912 ---- if($questionPart != NULL) { + foreach($questionPart as $label => $part) { *************** *** 903,920 **** } } - $castextheader = $castext; // may need this for conditional cas calls // Mark the point in the text before which we need to ignore. $castext .= '<qv_end>'; ! // process blocks in stem before adding it ! $bh = new BlockHandler($this->item->questionStem->getRawCasText(), $this->seed, $castextheader, $this->itemOpts->getSelected('Display')); ! $castext .= $bh->getProcessed(); ! $ct = new casText($castext, 't', false, true); //send to cas with teacher privilages $casCommands = $ct->extractCASCommands($this->errorLog); - //var_dump($casCommands); - $displayFormat = $this->itemOpts->getSelected('Display'); if ($casCommands === false) --- 926,939 ---- } } // Mark the point in the text before which we need to ignore. $castext .= '<qv_end>'; + $castext .= $this->item->questionStem->getRawCasText(); ! //echo 'Question stem raw: '.$this->item->questionStem->getRawCasText(); ! //$ct = new casText($this->item->questionStem->getRawCasText(), 't', false, true); //send to cas with teacher privilages $ct = new casText($castext, 't', false, true); //send to cas with teacher privilages $casCommands = $ct->extractCASCommands($this->errorLog); $displayFormat = $this->itemOpts->getSelected('Display'); if ($casCommands === false) *************** *** 937,945 **** //extract out and store the teachers answers $maximaOptions = new maximaPreferences($displayFormat, $this->itemOpts); $mconn = new maximaConnector($maximaOptions, 't', $this->seed); //WARNING: using teacher security level. $displayResults = $mconn->sendCASCommands($casCommands); $errs = $mconn->returnErrors(); $valuesResults = $mconn->returnValues(); - //var_dump($valuesResults); if($mconn->displayErrorString() !== NULL) --- 956,964 ---- //extract out and store the teachers answers $maximaOptions = new maximaPreferences($displayFormat, $this->itemOpts); + $mconn = new maximaConnector($maximaOptions, 't', $this->seed); //WARNING: using teacher security level. $displayResults = $mconn->sendCASCommands($casCommands); $errs = $mconn->returnErrors(); $valuesResults = $mconn->returnValues(); if($mconn->displayErrorString() !== NULL) *************** *** 1106,1115 **** } } - $castextheader = $castext; // may need this for conditional cas calls $castext .= '<qv_end>'; ! ! // process blocks in worked solution before adding it ! $bh = new BlockHandler($this->item->workedSolution->getRawCasText(), $this->seed, $castextheader, $this->itemOpts->getSelected('Display')); ! $castext .= $bh->getProcessed(); $ct = new casText($castext, 't', false, true); //send to cas with teacher privilages --- 1125,1130 ---- } } $castext .= '<qv_end>'; ! $castext .= $this->item->workedSolution->getRawCasText(); $ct = new casText($castext, 't', false, true); //send to cas with teacher privilages *************** *** 1305,1308 **** --- 1320,1324 ---- } + public function getTestInput($test) { *************** *** 1361,1368 **** } ! //echo "<pre>"; print_r($postcalc); echo "</pre>"; ! foreach ($test as $key => $val) { ! $test_post[$key] = $postcalc[$key]; ! } return $test_post; --- 1377,1396 ---- } ! ! //echo "<pre>.."; print_r($testIE); echo "..</pre>"; ! $questionParts = $this->item->getQuestionPartsByStudentAnsKey(); ! $test_post=array(); ! if(!empty($questionParts)) ! { ! foreach($questionParts as $SA => $QP) ! { ! $type = $QP->getInputType(); ! $inputType = new InputTypeController($type,$SA); ! $result = $inputType->getTestPostData($postcalc[$SA]); ! foreach($result as $key => $val) { ! $test_post['sAns__'.$key] = $val; ! } ! } ! } return $test_post; *************** *** 1386,1390 **** // Generate header row for table. ! $table .="\n<table class='interactionElementsTable' border='1' cellpadding='2' cellspacing='0''>\n<tr>\n"; foreach($qpNames as $name) { $table .= '<td class="tableTitle" colspan="3">'.$name.'</td>'; --- 1414,1418 ---- // Generate header row for table. ! $table .="\n<table class='interactionElementsTable' border='1' cellpadding='2' cellspacing='0'>\n<tr>\n"; foreach($qpNames as $name) { $table .= '<td class="tableTitle" colspan="3">'.$name.'</td>'; *************** *** 1406,1412 **** if($PRTs != NULL) { foreach($PRTs as $name => $PRT) { ! $table .= '<td class="tableTitle">M</td>'; ! $table .= '<td class="tableTitle">P</td>'; ! $table .= '<td class="tableTitle">N</td>'; } } --- 1434,1440 ---- if($PRTs != NULL) { foreach($PRTs as $name => $PRT) { ! $table .= '<td class="tableTitle">Mark</td>'; ! $table .= '<td class="tableTitle">Penalty</td>'; ! $table .= '<td class="tableTitle">Answer note and feedback</td>'; } } *************** *** 1458,1467 **** $table .= '<td>'.$attempt->getPenalty($name).'</td>'; $table .= "\n<td>"; ! if (array_key_exists($name,$feedback)) { ! $table .= '<img src="'.$config->get('weburl').'/pix/page.png" alt="'.htmlentities($feedback[$name]).'" width="16" height="16" />'; ! } ! if (array_key_exists($name,$ansNote)) { $table .= ' '.$ansNote[$name]; } $table .= "\n</td>\n"; } --- 1486,1497 ---- $table .= '<td>'.$attempt->getPenalty($name).'</td>'; $table .= "\n<td>"; ! if (array_key_exists($name,$ansNote)) { $table .= ' '.$ansNote[$name]; } + if (array_key_exists($name,$feedback)) { + //$table .= '<img src="'.$config->get('weburl').'/pix/page.png" alt="'.htmlentities($feedback[$name]).'" width="16" height="16" />'; + $table .= '<a href="#" onClick="javascript:$(this).siblings(\'div\').slideToggle(\'fast\'); return false;" />'.get_string('stack_show/hide_feedback','stack','').'</a><div style="display:none">'.$feedback[$name].'</div>'; + } + $table .= "\n</td>\n"; } *************** *** 1489,1493 **** } } ! if($showKey) { $table .="<table>\n"; --- 1519,1523 ---- } } ! /* if($showKey) { $table .="<table>\n"; *************** *** 1499,1502 **** --- 1529,1533 ---- $table .="\n</table>\n"; } + */ } *************** *** 1555,1559 **** foreach($qpNames as $name) { if (array_key_exists('IE_'.$name,$QT)) { ! $tests[$key]['IE']['sAns__'.$name] = $QT['IE_'.$name]; } } --- 1586,1590 ---- foreach($qpNames as $name) { if (array_key_exists('IE_'.$name,$QT)) { ! $tests[$key]['IE'][$name] = $QT['IE_'.$name]; } } *************** *** 1581,1584 **** --- 1612,1619 ---- } + public function getVersion() { + return $this->item->getVersion(); + } + /* Actually perform the tests on the item */ private function getTestOutcomes() *************** *** 1604,1608 **** // If a PRT is not traversed then the answernote should not exist. // This is different from an answernote existing with the value "NONE", so unset where necessary. ! if (!empty($test['PRT'])) { foreach($test['PRT'] as $key=>$val){ if ('NONE'==trim($val)) --- 1639,1643 ---- // If a PRT is not traversed then the answernote should not exist. // This is different from an answernote existing with the value "NONE", so unset where necessary. ! if (array_key_exists('PRT',$test)) { foreach($test['PRT'] as $key=>$val){ if ('NONE'==trim($val)) *************** *** 1610,1615 **** unset($test['PRT'][$key]); } ! } ! } // Slight hack to ensure we have a clean version of the instantiated item without the effort of creating it again! --- 1645,1650 ---- unset($test['PRT'][$key]); } ! } ! } // Slight hack to ensure we have a clean version of the instantiated item without the effort of creating it again! Index: AuthorDisplay.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/AuthorDisplay.php,v retrieving revision 1.65.8.1 retrieving revision 1.65.8.2 diff -C2 -d -r1.65.8.1 -r1.65.8.2 *** AuthorDisplay.php 2 Dec 2009 20:13:03 -0000 1.65.8.1 --- AuthorDisplay.php 9 Nov 2010 16:51:37 -0000 1.65.8.2 *************** *** 26,33 **** --- 26,35 ---- require_once $root.'/lib/ui/DisplayItem.php'; require_once $root.'/lib/translator.php'; + require_once $root.'/lib/stringUtil.php'; require_once $root.'/lib/XML/ExportStackTwoItem.php'; require_once $root.'/lib/ui/inputTypes/InputTypeController.php'; require_once($root.'/lib/database/MoodleDB.php'); require_once($root.'/lib/database/StackDBCache.php'); + require_once($root.'/lib/database/StackDBItem.php'); /** *************** *** 109,113 **** else { ! //load a question from the database, if it exists. (loads the itemOptions form the database too. $this->item = new Item(NULL, $questionId); } --- 111,115 ---- else { ! //load a question from the database, if it exists (loads the itemOptions form the database too). $this->item = new Item(NULL, $questionId); } *************** *** 138,141 **** --- 140,146 ---- $display = ''; } + + $display .= $this->displayJS(); + $display .= $this->displayStem(); *************** *** 152,155 **** --- 157,161 ---- $display .= $this->displayMeta(); $display .= $this->displayMoodleAuthor($engineID); + $display .= $this->displayVersionHistory($engineID); return $display; *************** *** 166,182 **** private function displayStem() { $stem = '<div id="stem" class="section">'; ! // var_dump($this); ! ! if($this->item->getQuestionId() != NULL) ! { ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_qid', 'stack','').' </span><span class="formw">'.$this->item->getQuestionId().'</span></div>'; ! } ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_name', 'stack','').' </span><span class="formw">'.$this->item->questionName->editWidget('questionName', 64).'</span></div>'; $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_description', 'stack','').' </span><span class="formw"> '.$this->item->questionDescription->editWidget('questionDescription', 65,2,12).'</span></div>'; $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_keywords', 'stack','').' </span><span class="formw"> '.$this->item->questionKeywords->editWidget('questionKeywords', 64).'</span></div>'; ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_qvariables', 'stack','').' </span><span class="formw"> '.$this->item->questionVariables->editWidget('questionVariables', 65, 4, 12).'</span></div>'; if(!empty($this->authoringErrors['questionVariables']) && ($this->refreshCycle > 0)) --- 172,184 ---- private function displayStem() { + global $config; $stem = '<div id="stem" class="section">'; + // <h3>'.get_string('stackAuthor_stem', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack').'" href="http://stack.bham.ac.uk/wiki/index.php/Stem"><img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" /></a></h3>'; ! $stem .= '<div id="authoringVersionID">v.'.$this->item->getQuestionId().'</div>'; $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_name', 'stack','').' </span><span class="formw">'.$this->item->questionName->editWidget('questionName', 64).'</span></div>'; $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_description', 'stack','').' </span><span class="formw"> '.$this->item->questionDescription->editWidget('questionDescription', 65,2,12).'</span></div>'; $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_keywords', 'stack','').' </span><span class="formw"> '.$this->item->questionKeywords->editWidget('questionKeywords', 64).'</span></div>'; ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_qvariables', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack').'"href="http://stack.bham.ac.uk/wiki/index.php/KeyVals#Question_variables"><img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" /></a> </span> <span class="formw"> '.$this->item->questionVariables->editWidget('questionVariables', 65, 4, 12).'</span></div>'; if(!empty($this->authoringErrors['questionVariables']) && ($this->refreshCycle > 0)) *************** *** 188,192 **** //the question stem itself ! $stem .= '<br /><br /><div class="row"><span class="label"><strong>'.get_string('stackAuthor_stem', 'stack','').'</strong> <br /><br /><code>'.get_string('stackAuthor_stemInfo', 'stack','').'</code></span><span class="formw"> '.$this->item->questionStem->editWidget('questionStem', 65, 15, 30).'</span></div>'; $stem .= '<div class="clearer"> </div>'; --- 190,199 ---- //the question stem itself ! $stem .= '<br /><br /><div class="row"><span class="label"><strong>'.get_string('stackAuthor_questionStem', 'stack','') ! .'</strong> <br /><br /><code>'.get_string('stackAuthor_stemInfo', 'stack','').'</code>' ! .'<p />Preview<input onclick="$(\'#stemPreview\').slideToggle(\'fast\')" type="checkbox" name="previewstem"></span>'; ! $stem .= '<span class="formw" onkeyup="authorPreview(\'questionStem\',\'#stemPreview\')">'.$this->item->questionStem->editWidget('questionStem', 65, 15, 30).'</span></div>'; ! $stem .= '<div class="row"><span class="label"> </span><span class="formw"><div id="stemPreview" class="authorMath"></div></div></span>'; ! $stem .= '<script>authorPreview(\'questionStem\',\'#stemPreview\')</script>'; $stem .= '<div class="clearer"> </div>'; *************** *** 197,201 **** } ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_workedSolution', 'stack','').'</span><span class="formw"> '.$this->item->workedSolution->editWidget('workedSolution', 65, 2, 10).'</span></div>'; $stem .= '<div class="clearer"> </div>'; if(!empty($this->authoringErrors['workedSolution']) && ($this->refreshCycle > 0)) --- 204,211 ---- } ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_workedSolution', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack').'"href="http://stack.bham.ac.uk/wiki/index.php/CASText#Worked_solution"><img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" /></a>'; ! $stem .= '<p />Preview<input onclick="$(\'#workedSolutionPreview\').slideToggle(\'fast\')" type="checkbox" name="previewstem"></span></span><span class="formw" onkeyup="authorPreview(\'workedSolution\',\'#workedSolutionPreview\')" class="formw"> '.$this->item->workedSolution->editWidget('workedSolution', 65, 2, 10).'</span></div>'; ! $stem .= '<div class="row"><span class="label"> </span><span class="formw"><div id="workedSolutionPreview" class="authorMath"></div></div></span>'; ! $stem .= '<script>authorPreview(\'workedSolution\',\'#workedSolutionPreview\')</script>'; $stem .= '<div class="clearer"> </div>'; if(!empty($this->authoringErrors['workedSolution']) && ($this->refreshCycle > 0)) *************** *** 204,208 **** } ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_qnote', 'stack','').' </span><span class="formw"> '.$this->item->questionNote->editWidget('questionNote', 65, 2, 10).'</span></div>'; $stem .= '<div class="clearer"> </div>'; --- 214,218 ---- } ! $stem .= '<div class="row"><span class="label">'.get_string('stackAuthor_qnote', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack').'"href="http://stack.bham.ac.uk/wiki/index.php/Question_note"><img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" /></a></span><span class="formw"> '.$this->item->questionNote->editWidget('questionNote', 65, 2, 10).'</span></div>'; $stem .= '<div class="clearer"> </div>'; *************** *** 215,218 **** --- 225,229 ---- //$stem .= '<div class="row"><span class="label"><input type="submit" name="submit" value="'.get_string('stackAuthor_button_update','stack').'" /></span></div>'; + $stem .= '<div class="clearer"> </div><br /> </div>'; return $stem; *************** *** 228,232 **** { global $config; ! $form = '<div id="prts" class="section"><h3><a onclick="$(\'#prtContainer\').slideToggle();swapper(prtContainer, \'prtIcon\');"><img src="'.$config->get('weburl').'/pix/triangleDown.gif" name="prtIcon" />'.get_string('stackAuthor_potentialResponseTrees', 'stack','').'</a></h3>'; //$form = '<div class="section"><h3><a onclick="prtContainer.toggle();"> '.get_string('stackAuthor_potentialResponseTrees', 'stack','').'</a></h3>'; $form .= '<div id="prtContainer">'; --- 239,249 ---- { global $config; ! $form = '<div id="prts" class="section"> ! <h3><a onclick="$(\'#prtContainer\').slideToggle();swapper(prtContainer, \'prtIcon\');"> ! <img src="'.$config->get('weburl').'/pix/triangleDown.gif" name="prtIcon" /> '. ! get_string('stackAuthor_potentialResponseTrees', 'stack','').'</a> ! <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Potential_response_trees"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></h3>'; //$form = '<div class="section"><h3><a onclick="prtContainer.toggle();"> '.get_string('stackAuthor_potentialResponseTrees', 'stack','').'</a></h3>'; $form .= '<div id="prtContainer">'; *************** *** 245,253 **** } - $PRTs = $this->item->getPRTs(); if($PRTs != NULL) { - foreach($PRTs as $name => $PRT) { --- 262,268 ---- *************** *** 272,276 **** $widget = $PRT->feedbackVariables->editWidget($prefix.'-feedbackVariables', 65, 2, 6); ! $form .= '<div class="row"><span class="label">'.get_string('stackAuthor_feedbackVariables', 'stack','').' <br /><br /></span><span class="formw">'.$widget.'</span></div>'; $form .= '<div style="clear: both"> </div>'; --- 287,291 ---- $widget = $PRT->feedbackVariables->editWidget($prefix.'-feedbackVariables', 65, 2, 6); ! $form .= '<div class="row"><span class="label">'.get_string('stackAuthor_feedbackVariables', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack').'"href="http://stack.bham.ac.uk/wiki/index.php/KeyVals#Feedback_variables"><img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" /></a><br /><br /></span><span class="formw">'.$widget.'</span></div>'; $form .= '<div style="clear: both"> </div>'; *************** *** 325,329 **** { global $config; ! $xhtml = '<div id="parts" class="section"><h3><a onclick="$(\'#partContainer\').slideToggle();swapper(qpContainer, \'qpIcon\');"><img src="'.$config->get('weburl').'/pix/triangleDown.gif" name="qpIcon" />'.get_string('stackAuthor_interactionElements', 'stack','').'</a></h3>'; //$xhtml = '<div class="section"><h3><a onclick="qpContainer.toggle();">'.get_string('stackAuthor_interactionElements', 'stack','').'</a></h3>'; $xhtml .= '<div id="partContainer">'; --- 340,346 ---- { global $config; ! $xhtml = '<div id="parts" class="section"><h3><a onclick="$(\'#partContainer\').slideToggle();swapper(qpContainer, \'qpIcon\');"><img src="'.$config->get('weburl').'/pix/triangleDown.gif" name="qpIcon" />'.get_string('stackAuthor_interactionElements', 'stack','').'</a> <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></h3>'; //$xhtml = '<div class="section"><h3><a onclick="qpContainer.toggle();">'.get_string('stackAuthor_interactionElements', 'stack','').'</a></h3>'; $xhtml .= '<div id="partContainer">'; *************** *** 335,340 **** $xhtml .= '<table class="interactionElementsTable" border="1" cellpadding="2" cellspacing="0"> <tbody> ! <tr> ! <td class="tableTitle">'.get_string('stackAuthor_studentAnsKey', 'stack','').'</td>'; foreach($qpNames as $name) --- 352,359 ---- $xhtml .= '<table class="interactionElementsTable" border="1" cellpadding="2" cellspacing="0"> <tbody> ! <tr><td class="IElabel"> </td> ! <td colspan="'.$noQPs.'">'.get_string('stackAuthor_studentAnsKey', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Students.27s_Answer_Key"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td></tr><tr><td class="IElabel"> </td>'; foreach($qpNames as $name) *************** *** 342,346 **** $xhtml .= '<td class="tableTitle">'.$name.'</td>'; } ! $xhtml .= "</tr><tr><td>".get_string('stackAuthor_inputType', 'stack','')."</td>"; //inputtypes --- 361,367 ---- $xhtml .= '<td class="tableTitle">'.$name.'</td>'; } ! $xhtml .= '</tr><tr><td class="IElabel">'.get_string('stackAuthor_inputType', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Input_Type"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; //inputtypes *************** *** 354,358 **** } ! $xhtml .= '</tr><tr><td>'.get_string('stackAuthor_teachersAns', 'stack','').'</td>'; //teachers answer foreach($qpNames as $name) --- 375,381 ---- } ! $xhtml .= '</tr><tr><td class="IElabel">'.get_string('stackAuthor_teachersAns', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Teacher.27s_Answer"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; //teachers answer foreach($qpNames as $name) *************** *** 366,370 **** //box size ! $xhtml .= '</tr><tr><td>'.get_string('stackAuthor_boxsize', 'stack','').'</td>'; foreach($qpNames as $name) { --- 389,395 ---- //box size ! $xhtml .= '</tr><tr><td class="IElabel">'.get_string('stackAuthor_boxsize', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Box_Size"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) { *************** *** 374,378 **** } //allow informal syntax ! $xhtml .='</tr><tr><td>'.get_string('stackAuthor_strictsyntax', 'stack','').'</td>'; foreach($qpNames as $name) --- 399,405 ---- } //allow informal syntax ! $xhtml .='</tr><tr><td class="IElabel">'.get_string('stackAuthor_strictsyntax', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Strict_Syntax"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 385,389 **** //allow informal syntax ! $xhtml .='</tr><tr><td>'.get_string('stackAuthor_insertStars', 'stack','').'</td>'; foreach($qpNames as $name) --- 412,418 ---- //allow informal syntax ! $xhtml .='</tr><tr><td class="IElabel">'.get_string('stackAuthor_insertStars', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Insert_Stars"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 397,401 **** //syntax hint ! $xhtml .= '</tr><td>'.get_string('stackAuthor_syntaxHint', 'stack','').'</td>'; foreach($qpNames as $name) --- 426,432 ---- //syntax hint ! $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_syntaxHint', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Syntax_Hint"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 408,412 **** //forbidden words, comma separated. ! $xhtml .= '</tr><td>'.get_string('stackAuthor_forbiddenWords', 'stack','').'</td>'; foreach($qpNames as $name) --- 439,445 ---- //forbidden words, comma separated. ! $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_forbiddenWords', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Forbidden_words"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 430,434 **** //allowed words, same as forbidden words ! $xhtml .= '</tr><td>'.get_string('stackAuthor_allowedWords', 'stack','').'</td>'; foreach($qpNames as $name) --- 463,469 ---- //allowed words, same as forbidden words ! $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_allowedWords', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Allowed_words"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 452,456 **** //forbid floats ! $xhtml .= '</tr><td>'.get_string('stackAuthor_forbidFloats', 'stack','').'</td>'; foreach($qpNames as $name) --- 487,493 ---- //forbid floats ! $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_forbidFloats', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Forbid_Floats"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 463,467 **** //Require in lowest terms ! $xhtml .= '</tr><td>'.get_string('stackAuthor_LowestTerms', 'stack','').'</td>'; foreach($qpNames as $name) --- 500,506 ---- //Require in lowest terms ! $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_LowestTerms', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Require_lowest_terms"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 474,478 **** //SameType ! $xhtml .= '</tr><td>'.get_string('stackAuthor_sameType', 'stack','').'</td>'; foreach($qpNames as $name) --- 513,519 ---- //SameType ! $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_sameType', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Check_Students_answer.27s_type"> ! <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; foreach($qpNames as $name) *************** *** 487,493 **** } //finally add in any input type options ! $xhtml .= '</tr><td>'.get_string('stackAuthor_inputTypeOpt', 'stack').'</td>'; foreach($qpNames as $name) --- 528,568 ---- } + //StudentVerify + $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_studentVerify', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). + '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Student_must_verify"> + <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; + + foreach($qpNames as $name) + { + $prefix = 'qp-'.$name.'-studentVerify'; + $studentVerify = $this->item->questionPart[$name]->getStudentVerify(); + if($studentVerify !== NULL) + { + $widget = $studentVerify->editWidget($prefix); + $xhtml .= '<td>'.$widget.'</td>'; + } + } + + //HideFeedback + $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_hideFeedback', 'stack','').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). + '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements#Hide_feedback"> + <img title="'.get_string('stackAuthor_onlineGuide','stack').'" src="'.$config->get('weburl').'/pix/help.png" name="help" /></a></td>'; + + foreach($qpNames as $name) + { + $prefix = 'qp-'.$name.'-hideFeedback'; + $hideFeedback = $this->item->questionPart[$name]->getHideFeedback(); + if($hideFeedback !== NULL) + { + $widget = $hideFeedback->editWidget($prefix); + $xhtml .= '<td>'.$widget.'</td>'; + } + } + //finally add in any input type options ! $xhtml .= '</tr><td class="IElabel">'.get_string('stackAuthor_inputTypeOpt', 'stack').' <a target="_blank" alt="'.get_string('stackAuthor_onlineGuide','stack'). ! '" href="http://stack.bham.ac.uk/wiki/index.php/Interaction_elements"> ! <img title="'.get_string('stackAuthor_onlineGuide... [truncated message content] |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:17
|
Update of /cvsroot/stack/stack-dev/lib/reporting In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/reporting Modified Files: Tag: item_state_separation StackReport.php ReportWidgets.php MarksAttempt.php UserAttempts.php Added Files: Tag: item_state_separation SkillsResources.php json.php DiagnosticReport.php Log Message: Brought back up to date with big HEAD merge. --- NEW FILE: SkillsResources.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 Chris Sangwin (C.J...@bh...) * * @package stackReport */ class SkillsResources { private $stackurl; private $skills; private $skillTags; private $skillMajor; private $resources; private $resourceMap; public function __construct($url) { $this->stackurl = $url; $this->loadSkills(); $this->loadResources(); } private function loadSkills() { $skills = array(); $skills['LOG'] = 'Logic'; $skills['FOR'] = 'Using conventional forms of notation'; $skills['NUM'] = 'Number'; $skills['NUM-REL'] = 'Relative size'; $skills['NUM-RTP'] = 'Ratio / Proportion'; $skills['NUM-FRC'] = 'Fractions'; $skills['NUM-DEC'] = 'Decimals'; $skills['NUM-IND'] = 'Indices'; $skills['NUM-NEG'] = 'Negative Numbers'; $skills['ART'] = 'Arithmetic Operations'; $skills['ART-ADD'] = 'Addition'; $skills['ART-SUB'] = 'Subtraction'; $skills['ART-MUL'] = 'Multiplication'; $skills['ART-DIV'] = 'Division'; $skills['ART-RUL'] = 'Rules'; $skills['ALG'] = 'Algebra'; $skills['ALG-GNO'] = 'Generalised number'; $skills['ALG-VAR'] = 'Variable'; $skills['ALG-FEQ'] = 'Forming Equations'; $skills['ALG-TRN'] = 'Transposition'; $skills['ALG-UNC'] = 'Unclosed Forms'; $skills['ALG-GAT'] = 'Gathering of like terms'; $skills['ALG-SMP'] = 'Simplification'; $skills['ALG-EXB'] = 'Expand Brackets'; $skills['ALG-FAC'] = 'Factorisation'; $skills['ALG-RSD'] = 'Rationalisation of Surds'; $skills['ALG-BEX'] = 'Binomial Expansion'; $skills['ALG-SPF'] = 'Simple Partial Fractions'; $skills['ALG-RPF'] = 'Partial Fractions involving a repeated term'; $skills['ALG-QPF'] = 'Partial Fractions involving a quadratic term'; $skills['ALG-IPF'] = 'Improper Partial Fractions'; $skills['EST'] = 'Estimation'; $skills['EST-EST'] = 'Estimating'; $skills['EST-RND'] = 'Rounding'; $skills['EQN'] = 'Equations'; $skills['EQN-LIN'] = 'Solve Linear Equations'; $skills['EQN-SIM'] = 'Solve Simultaneous Equations'; $skills['EQN-QUD'] = 'Solve Quadratic Equations'; $skills['EQN-INQ'] = 'Solve Inequations'; $skills['WRP'] = 'Analysis of Word Problems'; $skills['FNC'] = 'Functions'; $skills['FNC-EVL'] = 'Evaluate a function'; $skills['FNC-CMP'] = 'Composite Functions'; $skills['FNC-INV'] = 'Inverse Functions'; $skills['FNC-MOD'] = 'Modulus Functions'; $skills['FNC-HYP'] = 'Hyperbolic Functions'; $skills['GEO'] = 'Geometry'; $skills['GEO-CRD'] = 'Coordinates'; $skills['GEO-DST'] = 'Distances'; $skills['GEO-GRD'] = 'Gradients'; $skills['GEO-EQL'] = 'Equations of lines'; $skills['GEO-ANM'] = 'Angular Measure'; $skills['GEO-TRG'] = 'Right-angle Trig'; $skills['GEO-TFN'] = 'Trigonometric Functions'; $skills['GEO-CRC'] = 'Circles'; $skills['GEO-TID'] = 'Trigonometric Identities'; $skills['GRP'] = 'Interpreting Graphs'; $skills['DIG'] = 'Analysis of Diagrams'; $skills['SEQ'] = 'Sequences and Series'; $skills['SEQ-TER'] = 'Terms in Series'; $skills['SEQ-ART'] = 'Arithmetic Series'; $skills['SEQ-ASM'] = 'Partial Sums of arithmetic Series'; $skills['SEQ-GEO'] = 'Geometric Series'; $skills['SEQ-SGM'] = 'Partial Sums of Geometric Series'; $skills['SEQ-SNF'] = 'Sum to Infinity of Geometric Series'; $skills['SEQ-BIS'] = 'Binomial Series'; $skills['LGE'] = 'Logarithms and Exponentials'; $skills['LGE-EXP'] = 'Exponential Function'; $skills['LGE-LWE'] = 'Laws of Exponentials'; $skills['LGE-LOG'] = 'The Logarithmic Function'; $skills['LGE-LLG'] = 'Laws of Logarithms'; $skills['DIF'] = 'Differentiation'; $skills['DIF-CON'] = 'Concept of Differentiation'; $skills['DIF-TAN'] = 'Gradient of Tangent'; $skills['DIF-MON'] = 'Derivative of monomial'; $skills['DIF-POL'] = 'Derivative of Polynomial'; $skills['DIF-MXN'] = 'Maxima and Minima'; $skills['DIF-EXP'] = 'Derivative of Exponential'; $skills['DIF-LOG'] = 'Derivative of Logarithm'; $skills['DIF-TAB'] = 'Table of Derivatives'; $skills['DIF-PRD'] = 'Product Rule'; $skills['DIF-QUT'] = 'Quotient Rule'; $skills['DIF-CHN'] = 'Chain Rule'; $skills['DIF-TRG'] = 'Derivatives of Trig Functions'; $skills['DIF-IMP'] = 'Implicit Differentiation'; $skills['DIF-PRM'] = 'Parametric Differentiation'; $skills['INT'] = 'Integration'; $skills['INT-CON'] = 'Concept and constant of integration'; $skills['INT-DEF'] = 'Definite Integrals'; $skills['INT-MON'] = 'Integrals of monomials'; $skills['INT-POL'] = 'Integrals of polynomials and sums'; $skills['INT-TRG'] = 'Integrals of trig functions'; $skills['INT-EXP'] = 'Integrals of exponential functions'; $skills['INT-XM1'] = 'Integrals of 1/x'; $skills['INT-AUC'] = 'Area under curve'; $skills['INT-ABC'] = 'Area between curves'; $skills['INT-PRT'] = 'Integration by parts'; $skills['INT-SUB'] = 'Integration by substitution'; $skills['INT-VSR'] = 'Volume of Solid of Revolution'; $skills['VEC'] = 'Vectors'; $skills['VEC-ADD'] = 'Vector Addition'; $skills['VEC-SUB'] = 'Vector Subtraction'; $skills['VEC-VXS'] = 'Vector Multiplied by Scalar'; $skills['VEC-PNT'] = 'Vector from point to point'; $skills['VEC-MAG'] = 'Magnitude of Vector'; $skills['VEC-UNT'] = 'Unit Vector'; $skills['VEC-EQL'] = 'Vector Equation of Line'; $skills['VEC-SCP'] = 'Scalar Product'; $skillTags = array_keys($skills); $skillMajor = array(); foreach ($skillTags as $skill) { if (strstr($skill, '-') !== false) { $skillMajor[]=$skill; } } $this->skills = $skills; $this->skillMajor = $skillMajor; $this->skillTags = $skillTags; } // end loadSkills() private function loadResources() { // title // url // skills (as comma separated list) // type, e.g. pdf, video, etc. // $resources[] = $this->constructResource('','','',''); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: The Chain Rule','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_5.pdf','DIF-CHN','pdf'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: The Chain Rule','','DIF-CHN','pdf'); $resources[] = $this->constructResource('Simultaneous equations','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-simult-2009-1.pdf','EQN-SIM','pdf'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Simultaneous equations','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_13.pdf','EQN-SIM','pdf'); $resources[] = $this->constructResource('Factoring simple expressions','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-factorsimple-2009-1.pdf','ALG-FAC','pdf'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Factoring simple expressions','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_5.pdf','ALG-FAC','pdf'); $resources[] = $this->constructResource('Decimals','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-decimals-2009-1.pdf','NUM-DEC','pdf'); $resources[] = $this->constructResource('Introduction to differentiation','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-introtodiff-2009-1.pdf','DIF-CON','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Introduction to differentiation','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_1.pdf','DIF-CON','PDF'); $resources[] = $this->constructResource('Expanding or removing brackets','http://www.mathcentre.ac.uk/resources/Algebra%20leaflets/mc-expandbrack-2009-1.pdf','ALG-EXB','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: The exponential constant e','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/3_4.pdf','LGE-EXP','PDF'); $resources[] = $this->constructResource('The exponential constant e','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-expconstant-2009-1.pdf','LGE-EXP','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: The logarithm function','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/3_7.pdf','LGE-LOG','PDF'); $resources[] = $this->constructResource('Factorising quadratics','http://www.mathcentre.ac.uk/resources/Algebra%20leaflets/mc-factorisingquadratics-2009-1.pdf','ALG-FAC','PDF'); $resources[] = $this->constructResource('Fractions','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-fractions-2009-1.pdf','NUM-FRC','PDF'); $resources[] = $this->constructResource('Addition and subtraction of fractions','http://www.mathcentre.ac.uk/resources/leaflets/mathcentre/business/mc-bus-addsub-2009-1.pdf','NUM-FRC','PDF'); $resources[] = $this->constructResource('Multiplication and division of fractions','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-mult-and-div-2009-1.pdf','NUM-FRC','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: The hyperbolic functions','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/3_5.pdf','FNC-HYP','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: The hyperbolic identities','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/3_6.pdf','FNC-HYP','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Integration as summation','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_12.pdf','INT-CON','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Integration as the reverse of differentiation','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_6.pdf','INT-CON','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Integration by parts','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_10.pdf','INT-PRT','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Integration by substitution','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_11.pdf','INT-SUB','PDF'); $resources[] = $this->constructResource('The equation of a straight line','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-slope-2009-1.pdf','GEO-EQL','PDF'); $resources[] = $this->constructResource('Logarithms','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-logarithms-2009-1.pdf','LGE-LOG','PDF'); $resources[] = $this->constructResource('The laws of logarithms','http://www.mathcentre.ac.uk/resources/Algebra%20leaflets/mc-logs2-2009-1.pdf','LGE-LLG','PDF'); $resources[] = $this->constructResource('Sigma notation','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-sigma-2009-1.pdf','SEQ','PDF'); $resources[] = $this->constructResource('The modulus of a number','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/1_5.pdf','FNC-MOD','PDF'); $resources[] = $this->constructResource('Approaching Numeracy as an Adult','http://www.mathcentre.ac.uk/resources/uploaded/mccp-samuels-refno1.pdf','ART','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Partial Fractions 1','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_23.pdf','ALG-RPF,ALG-QPF,ALG-SPF','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Partial Fractions 2','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_24.pdf','ALG-RPF,ALG-QPF','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Partial Fractions 3','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_25.pdf','ALG-IPF','PDF'); $resources[] = $this->constructResource('Percentages','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-percentage-2009-1.pdf','NUM','PDF'); $resources[] = $this->constructResource('Indices or Powers','http://www.mathcentre.ac.uk/resources/Algebra%20leaflets/mc-indices1-2009-1.pdf','NUM-IND','PDF'); $resources[] = $this->constructResource('Negative and fractional powers','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-negfracpower-2009-1.pdf','NUM-IND','PDF'); $resources[] = $this->constructResource('Laws of indices','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-lawsindices-2009-1.pdf','NUM-IND','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Product and quotient rules','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_4.pdf','DIF-PRD,DIF-QUT','PDF'); $resources[] = $this->constructResource('Pythagoras theorem','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/4_5.pdf','GEO','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Degrees and radians','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/4_1.pdf','GEO-ANM','PDF'); $resources[] = $this->constructResource('Ratios','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-ratios-2009-1.pdf','NUM-RTP','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Addition and subtraction','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-ratios-2009-1.pdf','ART-ADD,ART-SUB','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Multiplication and division','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_9.pdf','ART-MUL,ART-DIV','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Evaluating definite integrals','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_9.pdf','INT-DEF','PDF'); $resources[] = $this->constructResource('What is a function?','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-function-2009-1.pdf','FNC','PDF'); $resources[] = $this->constructResource('x-y plots','http://www.mathcentre.ac.uk/resources/mc-healthsciences/mc-xyplots-2009-1.pdf','FNC','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Inequalities','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_16.pdf','EQN-INQ','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Graphical solution of inequalities','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_18.pdf','EQN-INQ','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Quadratic equations 1','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_14.pdf','EQN-QUD','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Quadratic equations 2','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_15.pdf','EQN-QUD','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Rearranging formulas 1','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_10.pdf','ALG-TRN,EQN-LIN','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Rearranging formulas 2','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_11.pdf','ALG-TRN','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: What is a surd?','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/2_27.pdf','ALG-RSD','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Scientific notation','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/1_3.pdf','FOR,NUM-DEC,NUM-IND','PDF'); $resources[] = $this->constructResource('Symbols','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-symbols-2009-1.pdf','FOR','PDF'); $resources[] = $this->constructResource('Rearranging formulas 1','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-formulas1-2009-1.pdf','ALG-TRN','PDF'); $resources[] = $this->constructResource('Rearranging formulas 2','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-formulas2-2009-1.pdf','ALG-TRN','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Graphs of the trig functions','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/4_3.pdf','GEO-TFN','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Trigonometrical Identities','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/4_4.pdf','GEO-TID','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Evaluating definite integrals','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_9.pdf','INT-DEF','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Linearity rules of integration','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_8.pdf','INT-POL','PDF'); $resources[] = $this->constructResource('Engineering Maths First Aid Kit. Quick Reference Leaflet: Table of Integrals','http://www.mathcentre.ac.uk/resources/Engineering%20maths%20first%20aid%20kit/latexsource%20and%20diagrams/8_7.pdf','INT','PDF'); $resources[] = $this->constructResource('Table of derivatives','http://www.mathcentre.ac.uk/resources/uploaded/mc-bus-tableofderiv-2009-1.pdf','DIF','PDF'); $resources[] = $this->constructResource('Teach Yourself Workbook: The Chain Rule','http://www.mathcentre.ac.uk/resources/uploaded/mc-ty-chain-2009-1.pdf','DIF-CHN','pdf'); $resources[] = $this->constructResource('mathtutor: Video tutorial: The Chain Rule','http://www.mathcentre.ac.uk/video/405','DIF-CHN','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: The Product Rule','http://www.mathcentre.ac.uk/video/404','DIF-PRD','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: The Quotient Rule','http://www.mathcentre.ac.uk/video/403','DIF-QUT','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: The standard functions','http://www.mathcentre.ac.uk/video/402','DIF','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: The derivatives of further functions','http://www.mathcentre.ac.uk/video/409','DIF','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: Parametric Differentiation','http://www.mathcentre.ac.uk/video/406','DIF-PRM','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: Implicit Differentiation','http://www.mathcentre.ac.uk/video/408','DIF-IMP','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: Equation of the tangent line','http://www.mathcentre.ac.uk/video/410','DIF-TAN','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: The area under a curve','http://www.mathcentre.ac.uk/video/412','INT-AUC','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: The anti-derivative','http://www.mathcentre.ac.uk/video/413','INT-CON','video'); $resources[] = $this->constructResource('mathtutor: Video tutorial: Mathematical language','http://www.mathcentre.ac.uk/video/294','FOR','video'); $resourceMap = array(); foreach ($resources as $res) { foreach ($res['skill'] as $tskill) { $resourceMap[$tskill][] = array('title'=>$res['title'],'URL'=>$res['URL'],'type'=>$res['type']); } } $this->resources=$resources; $this->resourceMap=$resourceMap; } // end loadResources() private function constructResource($title,$URL,$skills,$type) { $res['title'] = $title; $res['URL'] = $URL; $skills=explode(',',$skills); foreach ($skills as $skill) { $res['skill'][] = trim(strtoupper($skill)); } $res['type'] = strtoupper($type); return $res; } private function typeToIcon($type) { if ('PDF'==$type) { $icon = 'page_white_acrobat.png'; } else if ('VIDEO'==$type) { $icon = 'page_white_camera.png'; } else { $icon = 'page_white_go.png'; } return $icon; } private function getDiagnosticQuestions($keyword) { $db = new StackDBADOdb(); $db -> connect(); // Ought to go via StackDBItem, really! $sql = "SELECT questionID, questionName FROM stackquestion, question_keyword, keywords, question_lines WHERE (keyword LIKE ".$db->dbSafeString($keyword)." ) AND (question_keyword.kwid = keywords.id) AND (question_keyword.qid = stackquestion.questionID) AND (stackquestion.line = question_lines.id) AND (stackquestion.questionID = question_lines.latestVersion) ORDER BY stackquestion.questionID"; $query = $db->query($sql); $result=array(); foreach($query as $row) { $result[] = array($row[0],$row[1]); } return $result; } private function getDiagnosticStems($keyword) { $db = new StackDBADOdb(); $db -> connect(); // Ought to go via StackDBItem, really! $sql = "SELECT stackquestion.questionID, stackquestion.questionName, display_cache.xhtml FROM question_keyword, keywords, display_cache, display_cache_sequence, question_lines, stackquestion WHERE (keyword LIKE ".$db->dbSafeString($keyword)." ) AND (question_keyword.kwid = keywords.id) AND (stackquestion.line = question_lines.id) AND (stackquestion.questionID = question_keyword.qid) AND (stackquestion.questionID = question_lines.latestVersion) AND (stackquestion.questionID = display_cache.qID) AND (display_cache_sequence.nextNode = display_cache.id) AND (display_cache_sequence.event = 0)"; $query = $db->query($sql); $result=array(); foreach($query as $row) { $result[$row[0]] = array($row[1],$row[2]); } return $result; } private function getQuestionStem($qname) { $db = new StackDBADOdb(); $db -> connect(); $sql = "SELECT stackquestion.questionID,stackquestion.questionName, display_cache.xhtml FROM display_cache, display_cache_sequence, question_lines, stackquestion WHERE (stackquestion.questionName = ".$db->dbSafeString($qname).") AND (stackquestion.line = question_lines.id) AND (stackquestion.questionID = question_lines.latestVersion) AND (stackquestion.questionID = display_cache.qID) AND (display_cache_sequence.nextNode = display_cache.id) AND (display_cache_sequence.event = 0)"; $query = $db->query($sql); $result=array(); foreach($query as $row) { $result = array($row[0],$row[1],$row[2]); } return $result; } private function getSkillsResources($qid){ $kwdb = new StackDBKeywords(); $kwdb->connect(); $keywords = $kwdb->getQuestionsKeywords($qid); $skills = array(); if(!empty($keywords)) { asort($keywords); foreach($keywords as $keyword) { if (in_array($keyword,$this->skillTags)) { $skills[]=$keyword; } } } return $skills; } public function generateSkillsTable(){ $skillsTable="<ol><ol>\n"; foreach ($this->skills as $skill => $name) { $res_links=''; if (array_key_exists($skill,$this->resourceMap)) { foreach($this->resourceMap[$skill] as $res) { $rtitle = $res['title']; $rurl = $res['URL']; $icon = $this->typeToIcon($res['type']); $res_links .= '<a target="_blank" href="'.$rurl.'"><img border=0 alt="'.$rtitle.'" src="'.$icon.'" /></a>'; } } $questions = $this->getDiagnosticQuestions($skill); $qno = count($questions); $links = ''; if (0==$qno) { $col = '#FF3300'; } else { $col = '#000000'; foreach($questions as $question) { $qid = $question[0]; $qname = $question[1]; $links .= ' <a target="_blank" href="'.$this->stackurl.'/lib/ui/questionTest.php?id='.$qid.'"><img border=0 src="'.$this->stackurl.'/pix/eye.png" title="'.$qname.'" alt="'.$qname.'" /></a>'."\n "; } } if (strstr($skill, '-') !== false) { $skillsTable .= " <li><font color='$col'>$name ($skill)</font> $qno $res_links $links</li>\n"; } else { $skillsTable .= "</ol>\n <li><b><font color='$col'>$name ($skill)</font></b> $qno $res_links $links</li>\n<ol>\n"; } } $skillsTable.="</ol></ol>\n\n\n"; return $skillsTable; } public function generateQuiz($quizlist){ $questions = $this->getDiagnosticStems('diagnostic'); $kwdb = new StackDBKeywords(); $kwdb->connect(); $quiz=''; foreach ($questions as $qid => $question) { $quiz.= "<font size=+2><b>($qid) {$question[0]}</b>:</font> <font color=orange>"; $keywords = $kwdb->getQuestionsKeywords($qid); if(!empty($keywords)) { asort($keywords); $firstKeyword = true; foreach($keywords as $keyword) { if(!$firstKeyword) { $quiz.= ', '; } else $firstKeyword = false; $quiz.= $keyword; } } $quiz.= "</font>"; $quiz.= "<p>".$question[1]."</p>"; $quiz.= "<p><hr /></p>"; } return $quiz; } public function generateWikiPage() { $wiki=''; foreach ($this->skills as $skill => $name) { if (strstr($skill, '-') !== false) { $wiki.= "## $name ($skill)\n"; } else { $wiki.= "# $name ($skill)\n"; } } return $wiki; } public function generateLaTeX() { $tot = 0; $toplevelonly = TRUE; $LaTeX="\begin{enumerate}\n"; foreach ($this->skills as $skill => $name) { if (strstr($skill, '-') !== false) { $tot ++; $toplevelonly = TRUE; $LaTeX.= " \item $name ($skill)\n"; } else { if ($toplevelonly) { $tot ++; } $toplevelonly = FALSE; $LaTeX.= "\end{enumerate}\n \item $name ($skill)\n \begin{enumerate}\n"; } } $LaTeX.=" \end{enumerate}\n\end{enumerate}"; return $LaTeX.$tot; } public function generateTestedSkillsPage($test) { $skills_tested=array(); $skillsTable='<h2>Test questions</h2>'; $skillsTable.='<ol>'; foreach ($test as $qname){ $qid = getQuestionID($qname); $qskills = $this->getSkillsResources($qid); $link = ' <a target="_blank" href="'.$this->stackurl.'/lib/ui/questionTest.php?id='.$qid.'"><img border=0 src="'.$this->stackurl.'/pix/eye.png" title="'.$qname.'" alt="'.$qname.'" /></a>'."\n "; $sk = ''; if (empty($qskills)){ $sk = 'NONE! '; } else { foreach($qskills as $qskill){ $skills_tested[$qskill]++; $sk .= $qskill.' '; } } $skillsTable.= '<li>'.$qname.' ('.$qid.') '.$sk.' '.$link.' </li>'; } $skillsTable.='</ol>'; $skillsTable.='<h2>Skills tested</h2>'; $skillsTable.="<ol><ol>\n"; foreach ($this->skills as $skill => $name) { if (array_key_exists($skill,$skills_tested)) { $col = '#000000'; $qnum = $skills_tested[$skill]; } else { $col = '#FF3300'; $qnum = ''; } if (strstr($skill, '-') !== false) { $skillsTable .= " <li><font color='$col'>$name ($skill) $qnum </font></li>\n"; } else { $skillsTable .= "</ol>\n <li><b><font color='$col'>$name ($skill)</b> $qnum </font></li>\n<ol>\n"; } } $skillsTable.="</ol></ol>\n\n\n"; // Generate the text of the quiz. $quiz=''; foreach ($test as $qname){ $question = $this->getQuestionStem($qname); //$quiz.= "<h2><b>($question[0]) {$question[1]}</b>:</h2>"; $quiz.= "\n\n \item"; $qtp = strpos($question[2],'How'); $qt = substr($question[2],0,$qtp); $quiz.= "<p>".$qt."</p>"; $quiz.= "<p><hr /></p>"; } $skillsTable .= $quiz; return $skillsTable; } public function getSkills() { return $this->skills; } // return a (ranked?) list of resources for the passed skills public function getResourcesForSkills($skills) { $return = array(); foreach($skills as $skill) { if(!empty($this->resourceMap[$skill])) $return[] = $this->resourceMap[$skill]; } return $return; } } Index: MarksAttempt.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/reporting/MarksAttempt.php,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** MarksAttempt.php 27 Aug 2009 16:23:01 -0000 1.5 --- MarksAttempt.php 9 Nov 2010 16:51:37 -0000 1.5.8.1 *************** *** 17,197 **** */ ! /** ! * Class for holding and sorting marks from a report ! * ! * @author ! * @version ! * @copyright ! */ ! class MarksAttempt { ! // Attributes ! /** ! * ! * ! * @var int ! * @access private ! */ ! private $userID; ! ! /** ! * ! * ! * @var int ! * @access private ! */ ! private $questionID; ! ! /** ! * ! * ! * @var array ! * @access private ! */ ! private $attempt; ! ! private $noPartAttempts; ! ! private $noAttempts; ! ! // Associations ! // Operations ! /** ! * ! * ! * @param int $userID ! * @param $questionID ! * @access public ! */ ! public function __construct($userID, $questionID) ! { ! $this->userID = $userID; ! $this->questionID = $questionID; ! $this->noAttempts = 0; ! $this->noPartAttempts = 0; ! } ! ! /** ! * ! * ! * @return array ! * @access public ! */ ! public function getAttempts() ! { ! return $this->attempt; ! } ! ! /** ! * ! * ! * @return array ! * @access public ! */ ! public function getLastAttempt() ! { ! if(!empty($this->attempt)) ! { ! $attemptIds = array_keys($this->attempt); ! rsort($attemptIds); //reverse sort ! $id = $attemptIds[0]; ! $value = $this->attempt[$id]; ! return array($id => $value); ! } ! else ! { ! return NULL; ! } ! } ! ! public function lastAttemptNoParts() ! { ! $last = $this->getLastAttempt(); ! if($last != NULL) ! { ! foreach($last as $l) ! { ! $count = count($l); ! //echo 'COUNT: '.$count; ! return $count; ! } ! ! } ! else ! { ! return NULL; ! } ! ! } ! ! /** ! * ! * ! * @return array ! * @access public ! */ ! public function getFirstAttempt() ! { ! if(!empty($this->attempt)) ! { ! $attemptIds = array_keys($this->attempt); ! sort($attemptIds); ! $id = $attemptIds[0]; ! $value = $this->attempt[$id]; ! return array($id => $value); ! } ! else ! { ! return NULL; ! } ! } ! ! public function firstAttemptNoParts() ! { ! $first = $this->getFirstAttempt(); ! if($first != NULL) ! { ! foreach($first as $f) ! { ! $count = count($f); ! //echo 'COUNT: '.$count; ! return $count; ! } ! ! } ! else ! { ! return NULL; ! } ! ! } ! ! /** ! * ! * ! * @param int $attemptID ! * @param string $PRTName ! * @param float $rawmark ! * @param float $modmark ! * @return void ! * @access public ! */ ! public function addAttempt($attemptID, $PRTName, $rawmark, $modmark) ! { ! $this->attempt[$attemptID][$PRTName] = array('RawMark' => $rawmark, 'ModMark' => $modmark); ! $this->noPartAttempts++; ! } ! ! ! public function noPartAttempts() ! { ! return $this->noPartAttempts; ! } ! ! public function noAttempts() ! { ! return count($this->attempt); ! } ! ! } ?> \ No newline at end of file --- 17,199 ---- */ ! // It is believed that this entire file is legacy code. ! // ! // /** ! // * Class for holding and sorting marks from a report ! // * ! // * @author ! // * @version ! // * @copyright ! // */ ! // class MarksAttempt { ! // // Attributes ! // /** ! // * ! // * ! // * @var int ! // * @access private ! // */ ! // private $userID; ! // ! // /** ! // * ! // * ! // * @var int ! // * @access private ! // */ ! // private $questionID; ! // ! // /** ! // * ! // * ! // * @var array ! // * @access private ! // */ ! // private $attempt; ! // ! // private $noPartAttempts; ! // ! // private $noAttempts; ! // ! // // Associations ! // // Operations ! // /** ! // * ! // * ! // * @param int $userID ! // * @param $questionID ! // * @access public ! // */ ! // public function __construct($userID, $questionID) ! // { ! // $this->userID = $userID; ! // $this->questionID = $questionID; ! // $this->noAttempts = 0; ! // $this->noPartAttempts = 0; ! // } ! // ! // /** ! // * ! // * ! // * @return array ! // * @access public ! // */ ! // public function getAttempts() ! // { ! // return $this->attempt; ! // } ! // ! // /** ! // * ! // * ! // * @return array ! // * @access public ! // */ ! // public function getLastAttempt() ! // { ! // if(!empty($this->attempt)) ! // { ! // $attemptIds = array_keys($this->attempt); ! // rsort($attemptIds); //reverse sort ! // $id = $attemptIds[0]; ! // $value = $this->attempt[$id]; ! // return array($id => $value); ! // } ! // else ! // { ! // return NULL; ! // } ! // } ! // ! // public function lastAttemptNoParts() ! // { ! // $last = $this->getLastAttempt(); ! // if($last != NULL) ! // { ! // foreach($last as $l) ! // { ! // $count = count($l); ! // //echo 'COUNT: '.$count; ! // return $count; ! // } ! // ! // } ! // else ! // { ! // return NULL; ! // } ! // ! // } ! // ! // /** ! // * ! // * ! // * @return array ! // * @access public ! // */ ! // public function getFirstAttempt() ! // { ! // if(!empty($this->attempt)) ! // { ! // $attemptIds = array_keys($this->attempt); ! // sort($attemptIds); ! // $id = $attemptIds[0]; ! // $value = $this->attempt[$id]; ! // return array($id => $value); ! // } ! // else ! // { ! // return NULL; ! // } ! // } ! // ! // public function firstAttemptNoParts() ! // { ! // $first = $this->getFirstAttempt(); ! // if($first != NULL) ! // { ! // foreach($first as $f) ! // { ! // $count = count($f); ! // //echo 'COUNT: '.$count; ! // return $count; ! // } ! // ! // } ! // else ! // { ! // return NULL; ! // } ! // ! // } ! // ! // /** ! // * ! // * ! // * @param int $attemptID ! // * @param string $PRTName ! // * @param float $rawmark ! // * @param float $modmark ! // * @return void ! // * @access public ! // */ ! // public function addAttempt($attemptID, $PRTName, $rawmark, $modmark) ! // { ! // $this->attempt[$attemptID][$PRTName] = array('RawMark' => $rawmark, 'ModMark' => $modmark); ! // $this->noPartAttempts++; ! // } ! // ! // ! // public function noPartAttempts() ! // { ! // return $this->noPartAttempts; ! // } ! // ! // public function noAttempts() ! // { ! // return count($this->attempt); ! // } ! // ! // } ?> \ No newline at end of file --- NEW FILE: DiagnosticReport.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 stackReport */ global $config; $root = $config->get('docroot'); //require_once $root.'/lib/dateTime.php'; //require_once $root.'/lib/items/Meta.php'; require_once $root.'/lib/database/StackDBReporting.php'; require_once $root.'/lib/database/MoodleDB.php'; require_once $root.'/lib/database/StackDBAttemptPRTMeta.php'; //require_once 'QuestionFinder.php'; require_once $root . '/lib/Logger.php'; require_once $root.'/opaque/MoodleDisplayItem.php'; require_once $root . '/lib/reporting/SkillsResources.php'; class DiagnosticReport { /* TODO: * - Get distribution of scores and confidences for skills across all attempts * - Reference mapping of weak/unconfident outcomes to external resources * */ private $skill; private $resources; private $student; private $quiz; //private $answerNotes; public function __construct($student = NULL, $quiz = NULL) { $this->logger = new Logger('DiagnosticReport'); $this->student = $student; $this->quiz = $quiz; $reporting = new StackDBReporting(); //$this->answerNotes = $reporting->studentAnswerNotes($this->student, $this->quiz); $this->loadResources(); } /** * one-to-many or many-to-many mapping? Latter would be nice. * Could even rank them then, based on skills profile. * www.123.com will help you with [NUM] numbers */ private function loadResources() { $skillsResources = new SkillsResources(); $this->skill = $skillsResources->getSkills(); // then learning resource links $this->resources = array(); $this->resources[] = array("Sesame Street Learning About Numbers 4", "http://www.youtube.com/watch?v=Qxm6c7U8gxc", "NUM-ADD"); $this->resources[] = array("BBC - KS2 Bitesize: Maths - Fractions - activity", "http://www.bbc.co.uk/schools/ks2bitesize/maths/number/fractions/play.shtml", "NUM-FRC"); $this->resources[] = array("Wikipedia Numbers", "http://en.wikipedia.org/wiki/Number", "NUM-DEC, NUM-REL, NUM-NEG"); } public function resourcesFor($subskills) { $skillsResources = new SkillsResources(); //$this->logger->debug(print_r($skillsResources->getResourcesForSkills(array('EQN-SIM')), 1)); //$subskills = array('EQN-SIM'); $this->logger->debug("subskills:".print_r($subskills,1)); $resources = $skillsResources->getResourcesForSkills($subskills); return $resources; /* foreach($subskills as $subskill) { foreach($this->resources as $resource) { if(strpos($resource[2], $subskill) !== false) { $toReturn[] = $resource; } } } // sort by frequency return $toReturn;*/ } public function getString($key) { return isset($this->skill[$key]) ? $this->skill[$key] : "[$key]"; } public function display() { $reporting = new StackDBReporting(); $out = "";//"<p>This is a report based on your latest attempts for diagnostic questions.</p>"; // link to quiz-specific results $mdb = new MoodleDB(); $mdb->connect(); $attempts = $mdb->getQuizAttempts($this->student); $quizzes = array_keys($attempts); if($attempts) { // links to each and all quizzes $out .= "<b>Show quiz:</b> <a href='soapPage.php?page=diagnostic'>All</a>, "; foreach($quizzes as $quiz) { $out .= "<a href='soapPage.php?page=diagnostic&quiz=$quiz'>$quiz</a> (".count($attempts[$quiz])." attempts), "; } } if($this->quiz !== NULL) { // possibly restrict to a single quiz $a = $attempts[$this->quiz]; unset($attempts); $attempts[$this->quiz] = $a; } $quizzes = array_keys($attempts); // revise quizzes // going and getting those answer notes $answerNotes = $this->traverseAnswerNotes($attempts); //$answerNotes = array(end($answerNotes));// take last answer only //$out .= "<br>Collated answer notes: ".print_r($answerNotes, 1); // get array of skills mapping to array of subskills mapping to scores foreach($answerNotes as $note) { //$out .= "answernote:".print_r($answer,1); //preg_match("|diagnostic:(.*)|sxi", $note, $m); // indentifier now optional $m = preg_replace('|diagnostic:|sxi', '', $note); if(!empty($m)) { $changes = explode(',', $m);//$m[1]); //$this->logger->debug("CHANGES:".print_r($changes,1)); foreach($changes as $change) { // each skill mark $change = strtoupper($change); //$out .= $change.'<br/>'; /* // assuming format aaa-bbb=n if(preg_match("|^([a-z]{3})-([a-z]{3})[:=](-?\d+)|xi", $change, $m)) { $profile[$m[1]][$m[1].'-'.$m[2]] += $m[3]; } */ // assuming format aaa-bbb-[true|false] if(preg_match("/^([a-z]{3})-([a-z]{3})-(true|false)/xi", $change, $m)) { //$this->logger->debug("M:".print_r($m,1)); if($m[3] == 'TRUE') $value = 1; elseif($m[3] == 'FALSE') $value = -1; $profile[$m[1]][$m[1].'-'.$m[2]] += $value; } // assuming format aaa-[true|false] else if(preg_match("/^([a-z]{3})-(true|false)/xi", $change, $m)) { //$this->logger->debug("M:".print_r($m,1)); if($m[2] == 'TRUE') $value = 1; elseif($m[2] == 'FALSE') $value = -1; $profile[$m[1]][$m[1]] += $value; } } } } //$this->logger->debug("PROFILE:".print_r($profile,1)); // for each skill foreach($profile as $skill => $subskill) { $out .= "<div class='skillBox'>"; // container for graphs $out .= "<table><tr><td>"; // include report $out .= "<h1>".$this->getString($skill)."</h1>"; // include graph // get value bounds $max = max(0, max($subskill)); $min = min(0, min($subskill)); $labels = array(); foreach($subskill as $label => $value) { $labels[] = "'".$this->getString($label)."'"; } $out .= "<div id='chart-$skill' style='height:200px;width:300px; '></div> <script type='text/javascript'> line = [".implode(', ',$subskill)."]; conf = [4,3,1]; plot = $.jqplot('chart-$skill', [line, conf], { seriesDefaults:{ renderer:$.jqplot.BarRenderer, fill:true,fillToZero: true, showMarker: true, pointLabel:true}, legend:{show:true, location:'se'}, series:[ {label:'Feedback sum', renderer:$.jqplot.BarRenderer}, {label:'Confidence (dummy)', renderer:$.jqplot.BarRenderer} ], axes: { xaxis:{renderer:$.jqplot.CategoryAxisRenderer, ticks:[".implode(',',$labels)."]}, yaxis:{padMax:1.3, padMin:1.3, autoscale:true, numberTicks:1, showTicks:false, ticks:[-10, 0, 10]} } //,title: { text: '".$this->getString($skill)."' }, }) </script>"; $out .= "</td><td>"; // textual feedback $out .= "<h3>Raw Scores</h3>"; foreach($subskill as $label => $value) { $out .= $this->getString($label).': '.$value.'<br />'; } $out .= "<h3>Recommended Resources</h3>"; $recommendations = $this->resourcesFor(array_keys($subskill)); if(!empty($recommendations)) { //$out .= print_r($recommendations, 1); $out .= "<ul>"; foreach($recommendations[0] as $recommendation) { $out .= "<li><a href='".$recommendation['URL']."'>".$recommendation['title']."</a></li>"; } $out .= "</ul>"; } else { $out .= "<i>No resources to recommend.</i>"; } $out .= "</td></tr></table>"; $out .= "</div>";// close graph container } // Summary feedback and recommendations return $out; } /** * Returns an array of answer notes for specified map for attempts. * * @access public * @param array attempts map of quiz to attempts. * @return array list of answer notes */ public function traverseAnswerNotes($quizAttempts, $latestOnly = false) { // get ALL answernotes if there are no constraints // otherwise constrain by student // and quiz // or just quiz? $out = array(); $mdb = new MoodleDB(); $mdb->connect(); // will need some db objects... $cache = new StackDBCache(); $cache->connect(); $prtMetaDB = new StackDBAttemptPRTMeta(); $prtMetaDB->connect(); // Remember: this is initially a student-centric report card! $this->logger->debug("quizAttempts:".print_r($quizAttempts, 1)); // get all responses // for each quiz that has been attempted, get the response sequence that comprises that attempt foreach($quizAttempts as $quiz => $quizAttempt) { // for each quiz in scope, get attempts foreach($quizAttempt as $questionAttempts) { // for each quiz attempt // $attemptResponses = $mdb->getAttemptResponses($quizAttempt); // $this->logger->debug("attemptResponses:".print_r($attemptResponses, 1)); // $responses[$quizAttempt] = $attemptResponses['responses']; // $versionForAttempt[$quizAttempt] = $attemptResponses['version']; $questionResponses = $mdb->getQuestionAttemptResponses($questionAttempts); // } // } // parse responses for each attempt and use to traverse the cache, collating the answer notes - either last or all - question by question // attemptResponses would be better named questionResponses //$responses $this->logger->debug("questionResponses:".print_r($questionResponses, 1)); foreach($questionResponses as $question => $response) { // get initial state using randomseed and questionid preg_match('|__randomseed-(\d+)|',$response[0]['answer'], $match); $seed = $match[1]; $state = $cache->selectInitialState($seed, $response['version']); $this->logger->debug("init state: $state"); // iterate through sucessive cache states with parsed responses, collating answernotes $seqNumber = 1; while(isset($response[$seqNumber])) {// $state != NULL or isset($response[$seqNumber]) $this->logger->debug("one step beyond:".print_r($response[$seqNumber], 1)); $step = $response[$seqNumber++]; // decode the response into a post $encodedResponse = $step['answer']; $this->logger->debug('encodedResponse = '.$encodedResponse); $encodedArray = preg_split('/(?<!\\\\)\,/', $encodedResponse); // Split the responses on non-backslash-escaped commas. $post = array(); foreach($encodedArray as $e) { // $this->logger->debug("e = $e"); list($key, $value) = explode('-', $e, 2); $post[$key] = str_replace('\\\\,', ',', $value); } // temporarily insert event to map it $post['event'] = $step['event']; $this->logger->debug('moodle event'.$post['event']); $event = MoodleDisplayItem::mapStackEvent($post); $this->logger->debug("mapped post=".print_r($post,1)); unset($post['event']); unset($post['stackaction']); $transition = $cache->nextTransition($state, $post, $event); $oldstate = $state; $state = $cache->nextNode($transition); //if($state === NULL) $this->logger->critical("STATE IS NULL!"); $this->logger->debug("post: ".print_r($post,1)." with event: $event from state: $oldstate goes to state $state"); $details = $prtMetaDB->getAttemptDetails($state); // get the answer notes from potentially more than one PRT unset($notes);// = array(); foreach($details as $detail) { $notes[] = $detail['AnsNote']; $out[] = $detail['AnsNote']; } $this->logger->debug("notes=".print_r($notes, 1)); //$this->logger->debug("$notes=".print_r($notes, 1)); //$merge = array_merge($out, $notes); // assuming ALL results } $merge = array_merge($merge, $notes); $this->logger->debug("merge=".print_r($notes, 1)); } } }//*/ // return array of answernotes return $out; } } ?> Index: ReportWidgets.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/reporting/ReportWidgets.php,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** ReportWidgets.php 27 Aug 2009 16:23:01 -0000 1.7 --- ReportWidgets.php 9 Nov 2010 16:51:37 -0000 1.7.8.1 *************** *** 17,114 **** */ ! /** ! * detailed description ! * ! * @author ! * @version ! * @copyright ! */ ! global $config; $root = $config->get('docroot'); require_once $root.'/lib/translator.php'; class ReportWidgets { ! /** ! * ! * ! * @access public */ ! public function __construct() ! { ! } ! /** ! * Returns xhtml for a selector of which attempts to display (all, scored, last...) ! * @access public ! * @return string ! */ ! public function displayAttemptsSelector($selected=NULL, $name='attemptType') ! { ! $options['all'] = get_string('stackReport_allAttempts','stack'); ! $options['last'] = get_string('stackReport_lastAttempt','stack'); ! $options['firstscored'] = get_string('stackReport_firstScoreAttempt','stack'); ! $options['first'] = get_string('stackReport_firstAttempt','stack'); ! return $this->optionSelector($options, $selected, $name); } ! /** ! * As above, but without 'first scored' ! * ! */ ! public function displayPRTAttemptSelector($selected=NULL, $name='attemptType') ! { ! $options['all'] = get_string('stackReport_allAttempts','stack'); ! $options['last'] = get_string('stackReport_lastAttempt','stack'); ! $options['first'] = get_string('stackReport_firstAttempt','stack'); ! return $this->optionSelector($options, $selected, $name); } ! public function displayStatusSelector($selected=NULL, $name='status') ! { ! $options['all'] = get_string('stackReport_all','stack'); ! $options['null'] = get_string('stackReport_null','stack'); ! $options['valid'] = get_string('stackReport_valid','stack'); ! $options['invalid'] = get_string('stackReport_invalid','stack'); ! $options['score'] = get_string('stackReport_score','stack'); ! $options['solutionSeen'] = get_string('stackReport_score','stack'); ! return $this->optionSelector($options, $selected, $name); ! } ! public function displayMarksSelector($selected=NULL, $name='marks') ! { ! $options['any'] = get_string('stackReport_all','stack'); ! $options['zero'] = get_string('stackReport_zeroMarks','stack'); ! $options['notZero'] = get_string('stackReport_notZeroMarks','stack'); ! $options['notFull'] = get_string('stackReport_notFullMarks','stack'); ! $options['full'] = get_string('stackReport_fullMarks','stack'); ! return $this->optionSelector($options, $selected, $name); } ! private function optionSelector($options, $selected, $name) ! { ! $xhtml .= '<select name="'.$name.'">'; ! foreach($options as $value => $text) ! { ! if($value == $selected) ! { ! $xhtml .= '<option value="'.$value.'" selected="selected">'.$text.'</option>'; ! } ! else ! { ! $xhtml .= '<option value="'.$value.'">'.$text.'</option>'; ! } ! } ! $xhtml .= '</select>'; ! return $xhtml; } } ?> \ No newline at end of file --- 17,149 ---- */ ! global $config; $root = $config->get('docroot'); + require_once $root.'/lib/error.php'; require_once $root.'/lib/translator.php'; + require_once $root.'/lib/database/StackDBReporting.php'; class ReportWidgets { ! ! private $errorlog; ! ! public function __construct() { ! $this->errorLog = new error(); ! } ! ! /** ! * Makes an html selector given an array of value : text pairs. */ ! private function selector($options, $name, $selected = null) { ! $sel .= "<select name=\"$name\">"; ! foreach ($options as $value => $text) { ! $sel .= "<option value=\"$value\"" ! . ($value == $selected ? ' selected="selected"' : '') // Makes the option selected if it's got the right value ! . ">$text</option>\n"; ! } ! $sel .= '</select>'; ! return $sel; } + + /** + * Makes an HTML select element with questions as options + */ + public function questionSelector ($selected = null) { + + $db = new StackDBReporting(); + $qs = $db->questionList(); ! if (!isset($qs)) { ! $options['error'] = 'Couldn\'t get questions'; ! } else { ! foreach ($qs as $q) { ! $options[$q[0]] = $q[0] . ' - ' . substr($q[1], 0, 40); // abreviate the name ! } ! } ! return $this->selector($options, 'questionSelector', $selected); } ! /** ! * Makes an HTML select element with questions as options ! */ ! public function studentSelector ($selected = null) { ! ! $db = new StackDBReporting(); ! $students = $db->studentList(); ! if (!isset($students)) { ! $options['error'] = 'Couldn\'t get students'; ! } else { ! foreach ($students as $s) { ! $options[$s[0]] = $s[0] . ' - ' . $s[2] . ' ' . $s[3]; // abreviate the name ! } ! } + return $this->selector($options, 'studentSelector', $selected); + } ! /** ! * Returns xhtml for a selector of which attempts to display (all, scored, last...) ! */ ! public function attemptsSelector ($selected = null) { ! ! $options['all'] = get_string('stackReport_allAttempts', 'stack'); ! $options['last'] = get_string('stackReport_lastAttempt', 'stack'); ! $options['firstScored'] = get_string('stackReport_firstScoreAttempt', 'stack'); ! $options['first'] = get_string('stackReport_firstAttempt', 'stack'); ! return $this->selector($options, 'attemptsSelector', $selected); } + public function statusSelector($selected) { + + $options['all'] = get_string('stackReport_all','stack'); + $options['null'] = get_string('stackReport_null','stack'); + $options['valid'] = get_string('stackReport_valid','stack'); + $options['invalid'] = get_string('stackReport_invalid','stack'); + $options['score'] = get_string('stackReport_score','stack'); + $options['solutionSeen'] = get_string('stackReport_score','stack'); ! return $this->selector($options, 'statusSelector', $selected); } } + + // It is believed that the rest of this file is legacy co... [truncated message content] |
Update of /cvsroot/stack/stack-dev/lib/items In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/items Modified Files: Tag: item_state_separation ItemTests.php StudentAns.php ItemOption.php QuestionPart.php StackOption.php CasString.php InstantiatedItem.php InteractionElement.php CasTextType.php RawKeyVal.php Item.php Meta.php ItemState.php PotentialResponse.php PotentialResponseTree.php QuestionType.php Log Message: Brought back up to date with big HEAD merge. Index: InteractionElement.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/InteractionElement.php,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** InteractionElement.php 27 Aug 2009 16:23:00 -0000 1.9 --- InteractionElement.php 9 Nov 2010 16:51:37 -0000 1.9.8.1 *************** *** 106,110 **** */ public function getLabel() ! { return $this->label; } --- 106,110 ---- */ public function getLabel() ! { return $this->label; } *************** *** 117,121 **** */ public function getRawAns() ! { //strip $, ;, or : from answer $str = new stringUtil($this->rawAns); --- 117,121 ---- */ public function getRawAns() ! { //strip $, ;, or : from answer $str = new stringUtil($this->rawAns); *************** *** 130,134 **** */ public function getStatus() ! { return $this->status; } --- 130,134 ---- */ public function getStatus() ! { return $this->status; } *************** *** 141,145 **** */ public function getCasAns() ! { return $this->casValue; } --- 141,145 ---- */ public function getCasAns() ! { return $this->casValue; } *************** *** 152,156 **** */ public function getDisplayValue() ! { return $this->displayValue; } --- 152,156 ---- */ public function getDisplayValue() ! { return $this->displayValue; } *************** *** 164,168 **** */ public function setStatus($changedStatus) ! { $nullStatus = array(NULL,'new','solutionSeen'); //changes that are valid if status is Null now $newStatus = array(NULL,'new','valid','invalid'); --- 164,168 ---- */ public function setStatus($changedStatus) ! { $nullStatus = array(NULL,'new','solutionSeen'); //changes that are valid if status is Null now $newStatus = array(NULL,'new','valid','invalid'); *************** *** 241,245 **** */ public function setCasAns($ans) ! { $this->casValue = $ans; } --- 241,245 ---- */ public function setCasAns($ans) ! { $this->casValue = $ans; } *************** *** 253,257 **** */ public function setRawAns($ans) ! { $this->rawAns = $ans; } --- 253,257 ---- */ public function setRawAns($ans) ! { $this->rawAns = $ans; } *************** *** 265,269 **** */ public function setDisplayValue($disp) ! { $this->displayValue = $disp; } --- 265,269 ---- */ public function setDisplayValue($disp) ! { $this->displayValue = $disp; } *************** *** 277,281 **** */ public function getFeedback() ! { return $this->feedback; } --- 277,281 ---- */ public function getFeedback() ! { return $this->feedback; } *************** *** 289,293 **** */ public function setFeedback($feedback) ! { $this->feedback = $feedback; } --- 289,293 ---- */ public function setFeedback($feedback) ! { $this->feedback = $feedback; } Index: QuestionPart.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/QuestionPart.php,v retrieving revision 1.32 retrieving revision 1.32.8.1 diff -C2 -d -r1.32 -r1.32.8.1 *** QuestionPart.php 27 Aug 2009 16:23:00 -0000 1.32 --- QuestionPart.php 9 Nov 2010 16:51:37 -0000 1.32.8.1 *************** *** 129,133 **** private $insertStars; - /** * Whether to enable type checking on students answer or not. --- 129,132 ---- *************** *** 138,141 **** --- 137,155 ---- private $sameType; + /** + * Whether student answer needs to be visually verified by student + * + * @var boolean + * @access private + */ + private $studentVerify; + + /** + * Whether student receives feedback for this question part + * + * @var boolean + * @access private + */ + private $hideFeedback; /** *************** *** 145,148 **** --- 159,163 ---- * @access private */ + private $inputTypeParam; *************** *** 180,185 **** $this->insertStars = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); $this->sameType = new StackOption('list', 'true', array('true' => get_string('stackOption_checkType','stack',''), 'false' => get_string('stackOption_doNotCheckType','stack',''))); ! //set the default input type paramters for the selected input type $this->loadITDefaults(); } --- 195,202 ---- $this->insertStars = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); $this->sameType = new StackOption('list', 'true', array('true' => get_string('stackOption_checkType','stack',''), 'false' => get_string('stackOption_doNotCheckType','stack',''))); + $this->studentVerify = new StackOption('list','true',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); + $this->hideFeedback = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); ! //set the default input type parameters for the selected input type $this->loadITDefaults(); } *************** *** 374,378 **** { $this->inputType->setSelection($inputType); ! } /** --- 391,395 ---- { $this->inputType->setSelection($inputType); ! } /** *************** *** 617,620 **** --- 634,680 ---- } + /** + * Returns the stackoption for controlling whether to check students needs to verify their valid answer + * @access public + * @return stackOption studentVerify + */ + public function getStudentVerify() { + return $this->studentVerify; + } + + /** + * Sets the studentVerify value + * @access public + * @param string new value + * @return void + */ + public function setStudentVerify($val) { + if($this->studentVerify !== NULL) + { + $this->studentVerify->setSelected($val); + } + } + + /* Returns the stackoption for controlling whether to check students needs to verify their valid answer + * @access public + * @return stackOption studentVerify + */ + public function getHideFeedback() { + return $this->hideFeedback; + } + + /** + * Sets the studentVerify value + * @access public + * @param string new value + * @return void + */ + public function setHideFeedback($val) { + if($this->hideFeedback !== NULL) + { + $this->hideFeedback->setSelected($val); + } + } + /** * Sets the sameType value *************** *** 654,658 **** /** ! * set the default input type paramters for the selected input type * * @param array $parameters The set values, if any. --- 714,718 ---- /** ! * set the default input type options and parameters for the selected input type * * @param array $parameters The set values, if any. *************** *** 661,670 **** public function loadITDefaults($parameters=NULL) { ! $inputType = $this->inputType->getSelection(); $iType = new InputTypeController($inputType); $this->inputTypeParam = $iType->getDefaultParam($parameters); } - /** * Updates the Input Type parameters with the passed in values from an associative array. --- 721,729 ---- public function loadITDefaults($parameters=NULL) { ! $inputType = $this->inputType->getSelection(); $iType = new InputTypeController($inputType); $this->inputTypeParam = $iType->getDefaultParam($parameters); } /** * Updates the Input Type parameters with the passed in values from an associative array. *************** *** 685,692 **** if(array_key_exists($label, $this->inputTypeParam)) { - /*echo '<pre>'; - var_dump($this->inputTypeParam); - echo '</pre>';*/ - $this->inputTypeParam[$label]->setSelection($value); } --- 744,747 ---- *************** *** 799,802 **** --- 854,885 ---- } + public function equals($other) { + return $this->allowedWords == $other->allowedWords + && $this->boxSize == $other->boxSize + && $this->forbiddenWords == $other->forbiddenWords + && $this->forbidFloats == $other->forbidFloats + && $this->formalSyntax == $other->formalSyntax + && $this->inputType == $other->inputType + && $this->inputTypeParam == $other->inputTypeParam + && $this->insertStars == $other->insertStars + && $this->lowestTerms == $other->lowestTerms + && $this->qpName == $other->qpName + && $this->sameType == $other->sameType + && $this->studentAnsKey == $other->studentAnsKey + && $this->syntaxHint == $other->syntaxHint + && $this->teacherAns == $other->teacherAns + && $this->studentVerify == $other->studentVerify + && $this->hideFeedback == $other->hideFeedback; + } + + /** + * Ensure this Question Part has all latest options. For legacy Items. + * @param none + * @return none + */ + public function ensureCompleteOptions() { + if(!isset($this->studentVerify)) $this->studentVerify = new StackOption('list','true',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); + if(!isset($this->hideFeedback)) $this->hideFeedback = new StackOption('list','false',array('true' => get_string('stack_True', 'stack', ''), 'false' => get_string('stack_False', 'stack', ''))); + } } Index: QuestionType.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/QuestionType.php,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** QuestionType.php 27 Aug 2009 16:23:00 -0000 1.11 --- QuestionType.php 9 Nov 2010 16:51:37 -0000 1.11.8.1 *************** *** 75,79 **** /** ! * The questionType type, may be keyval,castext,caschat, or meta. Fixed at the class level. * Used so each questiontype subclass can identify its own type. * --- 75,79 ---- /** ! * The questionType type, may be keyval,castext, caschat or meta. Fixed at the class level. * Used so each questiontype subclass can identify its own type. * *************** *** 87,94 **** * @access protected */ ! protected $errorLog; /** ! * Whether this questiontype forbids floats (ofcourse pointless in the meta class. * @var bool * @access protected --- 87,94 ---- * @access protected */ ! protected static $errorLog; /** ! * Whether this questiontype forbids floats (of course pointless in the meta class). * @var bool * @access protected *************** *** 97,101 **** /** ! * Where this questionType should be simplyfied when sent to the cas or not. * * @access protected --- 97,101 ---- /** ! * Where this questionType should be simplified when sent to the cas or not. * * @access protected *************** *** 125,129 **** $this->metaType = $metatype; $this->xmlType = $xmlType; ! $this->errorLog = new error(); } --- 125,130 ---- $this->metaType = $metatype; $this->xmlType = $xmlType; ! //$this->errorLog = new error(); ! if(self::$errorLog == null) self::$errorLog = new error(); } *************** *** 210,214 **** $toReturn = false; $msg = $this->required.' is an invalid option for a required field. Must be either optional, required or system.'; ! $this->errorLog->addError($msg); } --- 211,215 ---- $toReturn = false; $msg = $this->required.' is an invalid option for a required field. Must be either optional, required or system.'; ! self::$errorLog->addError($msg); } *************** *** 220,224 **** $msg = $this->xmlType.' is an invalid XML type'; ! $this->errorLog->addError($msg); } return $toReturn; --- 221,225 ---- $msg = $this->xmlType.' is an invalid XML type'; ! self::$errorLog->addError($msg); } return $toReturn; *************** *** 245,249 **** //var_dump($this->errorLog); ! return $this->errorLog->toString(); } --- 246,250 ---- //var_dump($this->errorLog); ! return self::$errorLog->toString();//$this->errorLog->toString(); } *************** *** 262,266 **** { //display a simple text box ! $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->default.'"'; } else --- 263,267 ---- { //display a simple text box ! $widget = '<input type="text" name="'.$name.'" id="'.$name.'" size="'.$size.'" value="'.$this->default.'"'; } else *************** *** 334,340 **** return $node->textContent; } - - - } --- 335,338 ---- Index: ItemTests.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/ItemTests.php,v retrieving revision 1.3 retrieving revision 1.3.8.1 diff -C2 -d -r1.3 -r1.3.8.1 *** ItemTests.php 27 Aug 2009 16:23:00 -0000 1.3 --- ItemTests.php 9 Nov 2010 16:51:37 -0000 1.3.8.1 *************** *** 218,222 **** --- 218,231 ---- } + public function equals($other) { + if(!empty($this->tests)) { + if(empty($other->tests)) return false; + foreach($this->tests as $key => $val) { + if($val != $other->tests[$key]) return false; + } + } else if(!empty($other->tests)) return false; + return true; + } } Index: PotentialResponse.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/PotentialResponse.php,v retrieving revision 1.48 retrieving revision 1.48.10.1 diff -C2 -d -r1.48 -r1.48.10.1 *** PotentialResponse.php 27 Jun 2009 08:51:41 -0000 1.48 --- PotentialResponse.php 9 Nov 2010 16:51:37 -0000 1.48.10.1 *************** *** 583,586 **** --- 583,608 ---- /** + * Returns the quiet setting. + * + * @access public + * @return string + */ + public function getQuiet() + { + return $this->quiet; + } + + /** + * Returns the teacher note. + * + * @access public + * @return string + */ + public function getTeacherNote() + { + return $this->teacherNote; + } + + /** * Returns the answertest used in this PR. * *************** *** 665,669 **** $form = '<div class="PR">'; $form .= "<strong>".get_string('stack_num','stack','')." $id</strong><br />"; - $form .= '<span style="float: right">'.get_string('stackQuestion_PR_remove','stack','').'<input type="checkbox" name="'.$prefix.'-remove" value="true"></span> '; $form .= get_string('stackQuestion_PR_SAns2','stack','').': <input type="text" size="10" name="'.$prefix.'-sans" value="'.$this->sAns.'" /> '; //sans $form .= get_string('stackQuestion_PR_TAns2','stack','').': <input type="text" size="10" name="'.$prefix.'-tans" value="'.$this->tAns.'" /> '; //tans --- 687,690 ---- *************** *** 704,721 **** } ! ! //True Array ! $form .= '<div class="PRTTrue"><strong>'.get_string('stack_true','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-trueModMark">'; - $modOpts = array('=','+','-','=AT'); foreach($modOpts as $mod) { ! if($mod == $this->trueArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected>$mod</option>"; } else --- 725,743 ---- } + $modOpts = array('=','+','-','=AT'); ! // False PR box output first for rendering reasons ! $form .= "<div>";// container for true/false boxes ! //if false ! $form .= '<div class="PRTFalse"><strong>'.get_string('stack_false','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-falseModMark">'; foreach($modOpts as $mod) { ! if($mod == $this->falseArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected='selected'>$mod</option>"; } else *************** *** 727,740 **** $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-trueMark" value="'.$this->trueArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-truePenalty" value="'.$this->trueArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-trueNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRTrue) { ! $form .= "<option value=\"$ppr\" selected>$ppr</option>"; } else --- 749,762 ---- $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-falseMark" value="'.$this->falseArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-falsePenalty" value="'.$this->falseArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-falseNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRFalse) { ! $form .= "<option value=\"$ppr\" selected='selected'>$ppr</option>"; } else *************** *** 745,779 **** $form .= '</select>'; $form .= '<br /><br />'; ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-trueFeedback" >'.$this->trueArray['feedback'].'</textarea>'; //feedback ! //$form .= 'Feedback: '.$this->trueArray['feedback']->editWidget("$prefix-trueFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->trueArray['AnsNote']; ! if ('' === $the_an) { ! $the_an = substr($prefix,14).'-T '; } ! $form .= get_string('ShowAt_AnswerNote','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-trueAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! ! if(!empty($validationErrors['truefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['truefeedback'].'</p>'; } - $form .= '</div>'; ! ! //if false ! $form .= '<div class="PRTFalse"><strong>'.get_string('stack_false','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-falseModMark">'; foreach($modOpts as $mod) { ! if($mod == $this->falseArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected='selected'>$mod</option>"; } else --- 767,800 ---- $form .= '</select>'; $form .= '<br /><br />'; ! ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-falseFeedback" >'.$this->falseArray['feedback'].'</textarea>'; ! //$form .= 'Feedback: '.$this->falseArray['feedback']->editWidget("$prefix-falseFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->falseArray['AnsNote']; ! if ('' == $the_an) { ! // knock off "PR-PotResTree_" ! $the_an = substr($prefix,14).'-F '; } + $form .= '<br />'.get_string('ShowAt_AnswerNote','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-falseAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! if(!empty($validationErrors['falsefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['falsefeedback'].'</p>'; } $form .= '</div>'; ! //True Array ! $form .= '<div class="PRTTrue"><strong>'.get_string('stack_true','stack','').'</strong><br />'; //rawmarkmod dropdown box ! $form .= get_string('stackQuestion_PR_RawMarkMod2','stack','').': <select name="'.$prefix.'-trueModMark">'; foreach($modOpts as $mod) { ! if($mod == $this->trueArray['rawModMark']) { ! $form .= "<option value=\"$mod\" selected>$mod</option>"; } else *************** *** 785,798 **** $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-falseMark" value="'.$this->falseArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-falsePenalty" value="'.$this->falseArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-falseNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRFalse) { ! $form .= "<option value=\"$ppr\" selected='selected'>$ppr</option>"; } else --- 806,819 ---- $form .= '</select> '; ! $form .= get_string('Mark','stack','').': <input type="text" size="2" name="'.$prefix.'-trueMark" value="'.$this->trueArray['rawmark'].'" /> '; //mark ! $form .= get_string('ShowAt_Penalty','stack','').': <input type="text" size="2" name="'.$prefix.'-truePenalty" value="'.$this->trueArray['penalty'].'" /> '; //penalty ! $form .= get_string('stackQuestion_PR_nextPR','stack','').' <select name="'.$prefix.'-trueNextPR">'; foreach($potentialPRs as $ppr) { ! if($ppr == $this->nextPRTrue) { ! $form .= "<option value=\"$ppr\" selected>$ppr</option>"; } else *************** *** 803,827 **** $form .= '</select>'; $form .= '<br /><br />'; ! ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-falseFeedback" >'.$this->falseArray['feedback'].'</textarea>'; ! //$form .= 'Feedback: '.$this->falseArray['feedback']->editWidget("$prefix-falseFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->falseArray['AnsNote']; ! if ('' == $the_an) { ! // knock off "PR-PotResTree_" ! $the_an = substr($prefix,14).'-F '; } - $form .= get_string('ShowAt_AnswerNote','stack','').': <textarea cols="45" rows="1" name="'.$prefix.'-falseAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! if(!empty($validationErrors['falsefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['falsefeedback'].'</p>'; } $form .= '</div>'; $form .= '<div class="row"><span class="label">'.get_string('stackAuthor_teachersNote','stack','').' <br></span><span class="formw"><textarea cols="65" rows="1" name="'.$prefix.'-teacherNotes">'.$this->teacherNote.'</textarea></span></div>'; ! $form .= '<div class="clearer"> </div>'; $form .= '</div>'; --- 824,850 ---- $form .= '</select>'; $form .= '<br /><br />'; ! $form .= get_string('ShowAt_FeedBack','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-trueFeedback" >'.$this->trueArray['feedback'].'</textarea>'; //feedback ! //$form .= 'Feedback: '.$this->trueArray['feedback']->editWidget("$prefix-trueFeedback", 45, 1); // CJS 10/10/2008 // If the AnswerNote is empty, we should add something useful. ! $the_an = $this->trueArray['AnsNote']; ! if ('' === $the_an) { ! $the_an = substr($prefix,14).'-T '; } ! $form .= '<br />'.get_string('ShowAt_AnswerNote','stack','').': <textarea cols="40" rows="1" name="'.$prefix.'-trueAnsNote" >'.$the_an.'</textarea>'; //Ansnote ! ! if(!empty($validationErrors['truefeedback'])) { ! $form .= '<p class="error">'.get_string('ShowAt_FeedBack','stack','').': '.$validationErrors['truefeedback'].'</p>'; } + $form .= '</div>'; + $form .= '</div>'; // close true/false container $form .= '<div class="row"><span class="label">'.get_string('stackAuthor_teachersNote','stack','').' <br></span><span class="formw"><textarea cols="65" rows="1" name="'.$prefix.'-teacherNotes">'.$this->teacherNote.'</textarea></span></div>'; ! //$form .= '<div class="clearer"> </div>'; ! $form .= '<span style="float: right">'.get_string('stackQuestion_PR_remove','stack','').'<input type="checkbox" name="'.$prefix.'-remove" value="true"></span> '; $form .= '</div>'; Index: Meta.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/Meta.php,v retrieving revision 1.18 retrieving revision 1.18.8.1 diff -C2 -d -r1.18 -r1.18.8.1 *** Meta.php 27 Aug 2009 16:23:00 -0000 1.18 --- Meta.php 9 Nov 2010 16:51:37 -0000 1.18.8.1 *************** *** 58,62 **** //set selected to default initially $this->selection = $default; ! $this->errorLog = new error(); } --- 58,62 ---- //set selected to default initially $this->selection = $default; ! // done in parent (and statically) $this->errorLog = new error(); } *************** *** 288,292 **** } } - ?> \ No newline at end of file --- 288,294 ---- } + public function equals($other) { + return $this->forbidFloats == $other->forbidFloats; + } } ?> \ No newline at end of file Index: RawKeyVal.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/RawKeyVal.php,v retrieving revision 1.28 retrieving revision 1.28.8.1 diff -C2 -d -r1.28 -r1.28.8.1 *** RawKeyVal.php 27 Aug 2009 16:23:00 -0000 1.28 --- RawKeyVal.php 9 Nov 2010 16:51:37 -0000 1.28.8.1 *************** *** 79,83 **** public function __construct($rawstring, $required = 'optional', $default = NULL, $values = NULL, $metatag = NULL, $metatype = NULL, $xmlType = NULL) { ! //generic $this->required = $required; --- 79,83 ---- public function __construct($rawstring, $required = 'optional', $default = NULL, $values = NULL, $metatag = NULL, $metatype = NULL, $xmlType = NULL) { ! // can we not just invoke the parent contructor for the below? //generic $this->required = $required; *************** *** 87,91 **** $this->metaType = $metatype; $this->xmlType = $xmlType; ! $this->errorLog = new error(); //rawKeyVal specific --- 87,91 ---- $this->metaType = $metatype; $this->xmlType = $xmlType; ! if(self::$errorLog == null) self::$errorLog = new error(); //rawKeyVal specific *************** *** 518,522 **** { $kv = trim($pair->getMaximaPair()); ! $castext .= '@ev(stack_validate_typeless('.$kv.', '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; --- 518,522 ---- { $kv = trim($pair->getMaximaPair()); ! $castext .= '@ev(stack_validate_typeless(['.$kv.'], '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; *************** *** 640,644 **** public function contains_rand() { ! if (false===strpos($this->raw,'rand(')) return false; else --- 640,646 ---- public function contains_rand() { ! if (false===strpos($this->raw,'rand(') && ! false===strpos($this->raw,'rand_with_step(') && ! false===strpos($this->raw,'rand_with_prohib(')) return false; else *************** *** 646,650 **** --- 648,661 ---- } + public function equals($other) { + if(count($other->keyVals) != count($this->keyVals)) return false; + + foreach($this->keyVals as $v) { + // look for keyVal with same key and value in other + } + } + } + ?> \ No newline at end of file Index: PotentialResponseTree.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/PotentialResponseTree.php,v retrieving revision 1.71 retrieving revision 1.71.10.1 diff -C2 -d -r1.71 -r1.71.10.1 *** PotentialResponseTree.php 27 Jun 2009 08:51:41 -0000 1.71 --- PotentialResponseTree.php 9 Nov 2010 16:51:37 -0000 1.71.10.1 *************** *** 289,302 **** $preCalcValues = $this->prtPreCalc($preCalcValues, $maximaPreferences, $seed); - //requirements have been met, traverse the tree. - $nextPR = 0; //always start at PR 0 - //find the PR with the lowest id to start with. - $PRkeys = array_keys($this->PResponses); - sort($PRkeys); - $nextPR = $PRkeys[0]; - - //var_dump($this->PResponses); - //echo '<br><br>'; while($nextPR != -1) { --- 289,304 ---- $preCalcValues = $this->prtPreCalc($preCalcValues, $maximaPreferences, $seed); + // Do we have errors from the above? + if (-1==$preCalcValues) { + $nextPR=-1; + } else { + //requirements have been met, traverse the tree. + $nextPR = 0; //always start at PR 0 + //find the PR with the lowest id to start with. + $PRkeys = array_keys($this->PResponses); + sort($PRkeys); + $nextPR = $PRkeys[0]; + } while($nextPR != -1) { *************** *** 1045,1049 **** /** ! * Sends the student & teachers answers from each PR to the cas * @param array $precalc * @return array --- 1047,1051 ---- /** ! * Sends the student & teacher's answers from each PR to the CAS * @param array $precalc * @return array *************** *** 1140,1148 **** if($mconn->displayErrorString() !== NULL) { ! echo '<div class="error">'; ! echo '<p>'.'The Potential response tree caused the following problems:'.'</p>';; ! echo $mconn->displayErrorString(); ! echo '</div>'; ! die(); } else --- 1142,1155 ---- if($mconn->displayErrorString() !== NULL) { ! $err = '<div class="error">'; ! $err .= '<p>'.get_string('PR_ERROR','STACK').'</p>';; ! $err .= $mconn->displayErrorString(); ! $err .= '</div>'; ! $this->ansNote .='|PR_ERROR|'; ! $this->feedback .= $err; ! $this->penalty =0; ! $this->mark =0; ! //die(); ! return -1; } else *************** *** 1386,1389 **** --- 1393,1450 ---- return $node; } + + public function equals($other) { + // test PResponses first + if(!empty($this->PResponses)) + { + if(empty($other->PResponses) + || sizeof($this->PResponses) != sizeof($other->PResponses)) { + return false; + } + + if($this->penalty != $other->penalty) return false; + + foreach($this->PResponses as $name => $pr) + { + $opr = $other->PResponses[$name]; + if(empty($opr)) return false; + if($pr->getAnsTest() != $opr->getAnsTest() + || $pr->getTAns() != $opr->getTAns() + || $pr->getSAns() != $opr->getSAns() + || $pr->getTrueAN() != $opr->getTrueAN() + || $pr->getFalseAN() != $opr->getFalseAN() + || $pr->getTestOp() != $opr->getTestOp() + || $pr->getQuiet() != $opr->getQuiet() + || $pr->getTeacherNote() != $opr->getTeacherNote() + ) return false; + + // compare trueArray and falseArray + foreach($pr->ifTrue() as $key => $val) { + $array = $opr->ifTrue(); + if($array[$key] != $val) return false; + } + + foreach($pr->ifFalse() as $key => $val) { + $array = $opr->ifFalse(); + if($array[$key] != $val) return false; + } + } + + return true; + } + + return $this->ansNote == $other->ansNote + && $this->ansRequirements == $other->ansRequirements + && $this->ansTestError == $other->ansTestError + && $this->autoSimplify == $other->autoSimplify + && $this->description == $other->description + && $this->feedback == $other->feedback + && $this->feedbackVariables == $other->feedbackVariables + && $this->genericFeedback == $other->genericFeedback + && $this->mark == $other->mark + && $this->penalty == $other->penalty + && $this->PRTName == $other->PRTName + && $this->questionValue == $other->questionValue; + } } Index: CasString.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/CasString.php,v retrieving revision 1.16 retrieving revision 1.16.8.1 diff -C2 -d -r1.16 -r1.16.8.1 *** CasString.php 27 Aug 2009 16:23:00 -0000 1.16 --- CasString.php 9 Nov 2010 16:51:37 -0000 1.16.8.1 *************** *** 257,261 **** { $cs = trim($this->casString); ! $validString = '@ev(stack_validate_typeless('.$cs.', '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; return $validString; } --- 257,261 ---- { $cs = trim($this->casString); ! $validString = '@ev(stack_validate_typeless(['.$cs.'], '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; return $validString; } Index: StackOption.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/StackOption.php,v retrieving revision 1.12 retrieving revision 1.12.8.1 diff -C2 -d -r1.12 -r1.12.8.1 *** StackOption.php 27 Aug 2009 16:23:00 -0000 1.12 --- StackOption.php 9 Nov 2010 16:51:37 -0000 1.12.8.1 *************** *** 18,22 **** /** ! * A option for a question. Some options are kept seperate from the item itself * as these may be changed at a quiz or higher level * --- 18,22 ---- /** ! * An option for a question. Some options are kept separate from the item itself * as these may be changed at a quiz or higher level * *************** *** 69,74 **** * @var error * @access private ! */ ! private $errorLog; /** --- 69,76 ---- * @var error * @access private ! */ ! private static $errorLog; ! ! //private $logger; /** *************** *** 89,94 **** $this->casType = $casType; $this->selected = $default; ! $this->errorLog = new error(); ! } --- 91,96 ---- $this->casType = $casType; $this->selected = $default; ! //$this->errorLog = new error(); ! if(self::$errorLog == null) self::$errorLog = new error(); } *************** *** 177,181 **** { $msg = 'Invalid StackOption type: '.$this->type; ! $this->errorLog->addError($msg); $toReturn = false; } --- 179,183 ---- { $msg = 'Invalid StackOption type: '.$this->type; ! self::$errorLog->addError($msg); $toReturn = false; } *************** *** 184,188 **** { $msg = 'Undefined casKey for casType: '.$this->casType; ! $this->errorLog->addError($msg); $toReturn = false; } --- 186,190 ---- { $msg = 'Undefined casKey for casType: '.$this->casType; ! self::$errorLog->addError($msg); $toReturn = false; } *************** *** 192,196 **** $msg = 'Undefined casType for casKey: '.$this->casKey; //echo $msg; ! $this->errorLog->addError($msg); $toReturn = false; } --- 194,198 ---- $msg = 'Undefined casType for casKey: '.$this->casKey; //echo $msg; ! self::$errorLogaddError($msg); $toReturn = false; } *************** *** 207,211 **** public function getErrors() { ! return $this->errorLog->toString(); } --- 209,213 ---- public function getErrors() { ! return self::$errorLog->toString(); } *************** *** 223,227 **** if(empty($this->values)) { ! //display a text imput box $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->selected.'"/>'; } --- 225,229 ---- if(empty($this->values)) { ! //display a text input box $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->selected.'"/>'; } *************** *** 334,337 **** } } - ?> \ No newline at end of file --- 336,338 ---- Index: StudentAns.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/StudentAns.php,v retrieving revision 1.42.6.2 retrieving revision 1.42.6.2.2.1 diff -C2 -d -r1.42.6.2 -r1.42.6.2.2.1 *** StudentAns.php 3 Nov 2009 11:57:56 -0000 1.42.6.2 --- StudentAns.php 9 Nov 2010 16:51:37 -0000 1.42.6.2.2.1 *************** *** 118,122 **** if($ans == '') { - //echo 'here'; $this->studentAnswers[$label]->setRawAns($ans); $this->studentAnswers[$label]->setStatus(NULL); --- 118,121 ---- *************** *** 128,132 **** //if answer has changed, but not blank $prev = $this->studentAnswers[$label]->getRawAns(); ! if($ans != $prev) { $this->studentAnswers[$label]->setRawAns($ans); --- 127,131 ---- //if answer has changed, but not blank $prev = $this->studentAnswers[$label]->getRawAns(); ! if($ans !== $prev) { $this->studentAnswers[$label]->setRawAns($ans); *************** *** 221,226 **** foreach($this->studentAnswers as $label => $sAns) { - // echo "<hr>Checking $label<br>"; - //override items standard itemOptions with those specified in the question part related to this questionpart. if($questionPart !== NULL && array_key_exists($label, $questionPart)) --- 220,223 ---- *************** *** 321,335 **** } } - - // check for passed-through qmchar - if(false !== strpos('qmchar', $sym)) $valid = $sym.' contains question marks.'; - } - } } //check against implicitly forbidden words (IE the question variables and tans) - if(($valid === true) && (!empty($implictForbid))) { --- 318,326 ---- *************** *** 360,363 **** --- 351,360 ---- } + // Check for ?s in an answer, passed-through Maxima as "qmchar". These are not permitted + $qm_pos = strpos($sAns->getRawAns(),'?'); + if (false !== $qm_pos) { + $valid = $valid.get_string('stackCas_qmchar', 'stack', ''); + } + if($valid === true) { *************** *** 398,402 **** { //we only want answers that have passed the syntax checks ! if($sAns->getStatus() == 'valid') { $casText .= '@'; --- 395,399 ---- { //we only want answers that have passed the syntax checks ! if($sAns->getStatus() == 'valid' || $sAns->getStatus() == 'score') { $casText .= '@'; *************** *** 406,410 **** } - /*commands are send with insert stars on and strict syntax off, the least strict settings * this is to allow us to send all students answers through at the same time to the cas --- 403,406 ---- *************** *** 421,426 **** //echo $sAns->getRawAns(); //echo $sAns->getStatus(); ! //echo "<pre>";print_r($questionPart[$label]);echo "</pre>"; ! if($sAns->getStatus() == 'valid') { //create a castext string, for checking float status --- 417,422 ---- //echo $sAns->getRawAns(); //echo $sAns->getStatus(); ! //echo "<pre>";print_r($questionPart[$label]);echo "</pre>"; ! if($sAns->getStatus() == 'valid' || $sAns->getStatus() == 'score') { //create a castext string, for checking float status *************** *** 446,454 **** if($sameType == 'false') { ! $casCommands["caschat$i"] = 'stack_validate_typeless('.$starredAnswer.','.$ForbidFloats.','.$LowestTerms.')'; } else { ! $casCommands["caschat$i"] = 'stack_validate('.$starredAnswer.','.$ForbidFloats.','.$LowestTerms.','.$TAns.')'; } $validLabels[] = $label; --- 442,450 ---- if($sameType == 'false') { ! $casCommands["caschat$i"] = 'stack_validate_typeless(['.$starredAnswer.'],'.$ForbidFloats.','.$LowestTerms.')'; } else { ! $casCommands["caschat$i"] = 'stack_validate(['.$starredAnswer.'],'.$ForbidFloats.','.$LowestTerms.','.$TAns.')'; } $validLabels[] = $label; *************** *** 463,467 **** elseif ($casCommands === NULL) { ! //no cas commands to extract, valid = true, in a manor of thinking. } else --- 459,463 ---- elseif ($casCommands === NULL) { ! //no cas commands to extract, valid = true, in a manner of thinking. } else *************** *** 469,473 **** $displayFormat = $itemOptions->getSelected('Display'); ! //Student answers should not be simplyfied for display. $itemOptions->setSelected('Simplify','false'); --- 465,469 ---- $displayFormat = $itemOptions->getSelected('Display'); ! //Student answers should not be simplified for display. $itemOptions->setSelected('Simplify','false'); *************** *** 481,485 **** //echo "<pre>";print_r($displayResults);echo "</pre>"; - $i = 0; foreach($validLabels as $vLabel) --- 477,480 ---- *************** *** 555,558 **** --- 550,566 ---- } + /** + * Where an IE status can be fastracked from valid to score, do it. + */ + public function scoreIfValid($questionPart = NULL) { + if(!empty($this->studentAnswers)) { + foreach($this->studentAnswers as $label => $sAns) { + if($sAns->getStatus() == 'valid' && $questionPart[$label]->getStudentVerify()->getSelected() == 'false') { + $sAns->setStatus('score'); + } + } + } + } + /** * If casString not set will return null. Index: InstantiatedItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/InstantiatedItem.php,v retrieving revision 1.81.8.4 retrieving revision 1.81.8.5 diff -C2 -d -r1.81.8.4 -r1.81.8.5 *** InstantiatedItem.php 4 Dec 2009 17:48:06 -0000 1.81.8.4 --- InstantiatedItem.php 9 Nov 2010 16:51:37 -0000 1.81.8.5 *************** *** 334,338 **** if(!empty($this->PRTrees)) { - $this->updatePreCalc($sAns); //update precalculated values --- 334,337 ---- *************** *** 354,357 **** --- 353,357 ---- if(!empty($prtRequirements)) { + foreach($PRT->getRequirements() as $ansKey) { *************** *** 365,368 **** --- 365,371 ---- $changed = true; } + elseif(isset($previously[$ansKey]) && isset($currently[$ansKey]) && $previously[$ansKey] !== $currently[$ansKey]) { + $changed = true; + } } } Index: CasTextType.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/CasTextType.php,v retrieving revision 1.25 retrieving revision 1.25.8.1 diff -C2 -d -r1.25 -r1.25.8.1 *** CasTextType.php 20 Oct 2009 10:15:28 -0000 1.25 --- CasTextType.php 9 Nov 2010 16:51:37 -0000 1.25.8.1 *************** *** 261,265 **** { //display text input ! $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.$this->casText.'"/>'; } else --- 261,265 ---- { //display text input ! $widget = '<input type="text" name="'.$name.'" size="'.$size.'" value="'.stripslashes(htmlspecialchars($this->casText)).'"/>'; } else *************** *** 403,407 **** { $cmd = trim($cmd); ! $castext .= '@ev(stack_validate_typeless('.$cmd.', '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; --- 403,407 ---- { $cmd = trim($cmd); ! $castext .= '@ev(stack_validate_typeless(['.$cmd.'], '.$forbidFloats.', '.$lowestTerms.'), simp: '.$simplify.')@'; } return $castext; *************** *** 426,430 **** $selection = $dom->createElement("castext"); ! $selectionText = $dom->createTextNode($this->casText); $selection->appendChild($selectionText); --- 426,430 ---- $selection = $dom->createElement("castext"); ! $selectionText = $dom->createTextNode(utf8_encode($this->casText)); $selection->appendChild($selectionText); Index: ItemOption.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/ItemOption.php,v retrieving revision 1.19 retrieving revision 1.19.8.1 diff -C2 -d -r1.19 -r1.19.8.1 *** ItemOption.php 27 Aug 2009 16:23:00 -0000 1.19 --- ItemOption.php 9 Nov 2010 16:51:37 -0000 1.19.8.1 *************** *** 76,80 **** $this->addOption('Display','list','LaTeX',array('LaTeX','MathML'),'OPT_OUTPUT','string'); $this->addOption('MultiplicationSign','list','dot',array('(none)' => get_string('stackOption_none', 'stack', ''),'dot'=> get_string('stackOption_dot', 'stack', ''),'cross'=> get_string('stackOption_cross', 'stack', '')),'make_multsgn','fun'); ! $this->addOption('ComplexNo','list','i',array('i','j'),'make_complexJ','fun'); $this->addOption('Floats','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'OPT_NoFloats','ex'); $this->addOption('SqrtSign','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'sqrtdispflag','ex'); --- 76,80 ---- $this->addOption('Display','list','LaTeX',array('LaTeX','MathML'),'OPT_OUTPUT','string'); $this->addOption('MultiplicationSign','list','dot',array('(none)' => get_string('stackOption_none', 'stack', ''),'dot'=> get_string('stackOption_dot', 'stack', ''),'cross'=> get_string('stackOption_cross', 'stack', '')),'make_multsgn','fun'); ! $this->addOption('ComplexNo','list','i',array('i','j','symi','symj'),'make_complexJ','fun'); $this->addOption('Floats','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'OPT_NoFloats','ex'); $this->addOption('SqrtSign','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'sqrtdispflag','ex'); *************** *** 97,100 **** --- 97,101 ---- $this->addOption('FeedbackGenericIncorrect','html',get_string('stackOptions_FeedBackGenericIncorrect_def','stack',''),''); $this->addOption('FeedbackGenericPCorrect','html',get_string('stackOptions_FeedBackGenericPCorrect_def','stack',''),''); + $this->addOption('OptWorkedSol','list','true',array('true' => get_string('stack_True','stack',''),'false' => get_string('stack_False', 'stack','')),'',''); } *************** *** 430,434 **** return $node; } - } ?> \ No newline at end of file --- 431,469 ---- return $node; } + /* Copies values from passed ItemOption to this. + * Useful where default options are an extension of stored ones. + * i.e. for updating old question instances. + */ + public function copyFrom($src) { + if(!empty($src->options)) + { + foreach($src->options as $optName => $option) + { + // check src option even exists in this + if(array_key_exists($optName, $this->options)) { + + $selected = $src->options[$optName]->getSelected(); + + // copy value over, involves checks. + $this->options[$optName]->setSelected($src->options[$optName]->getSelected()); + + } else { + $this->errorLog->addError('Attempted to copy selection of '.$optName.' which does not exist in current item.'); + } + } + } + } + + public function equals($other) { + if(empty($this->options) != empty($other->options)) return false; + if(!empty($this->options)) + { + foreach($this->options as $optName => $option) { + if($other->options[$optName]->getSelected() != $option->getSelected()) return false; + } + } + return true; + } + } ?> \ No newline at end of file Index: Item.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/items/Item.php,v retrieving revision 1.61.8.1 retrieving revision 1.61.8.2 diff -C2 -d -r1.61.8.1 -r1.61.8.2 *** Item.php 4 Dec 2009 10:11:14 -0000 1.61.8.1 --- Item.php 9 Nov 2010 16:51:37 -0000 1.61.8.2 *************** *** 40,44 **** * -holds potential response trees * -Used for editing & displaying questions ! * -Superclass of instatiated item. Instatiated item is the class which creates * a question for display, and answering by the student. * --- 40,44 ---- * -holds potential response trees * -Used for editing & displaying questions ! * -Superclass of instantiated item. Instantiated item is the class which creates * a question for display, and answering by the student. * *************** *** 53,56 **** --- 53,63 ---- protected $qID; + // Attributes + /** + * @var String + * @access protected + */ + protected $line; + /** * @var Array *************** *** 331,334 **** --- 338,342 ---- $this->questionStatus = $questionVariables['questionStatus']; $this->published = $questionVariables['published']; + $this->line = $questionVariables['line']; } else *************** *** 339,342 **** --- 347,356 ---- } + // handle legacy items + if(NULL !== $this->questionPart) { + foreach($this->questionPart as $qp) { + $qp->ensureCompleteOptions(); + } + } //load in the keywords from the database *************** *** 361,365 **** //$db->connect(); ! //because of how PHP does database connections $db and $kwDB's connections are essencially combinded into one connection. if($itemOpt == NULL) { --- 375,379 ---- //$db->connect(); ! //because of how PHP does database connections $db and $kwDB's connections are essentially combined into one connection. if($itemOpt == NULL) { *************** *** 371,385 **** die(); } ! $this->itemOptions = $db->base64_unserialize($serialised); // CJS 6/1/9. Not needed in the long term. New option added. if (NULL === $this->itemOptions->getOption('Feedback')) { $this->itemOptions->addOption('Feedback','list','TGS',array('TGS' => get_string('stackOption_Feedback_TGS', 'stack', ''),'TG'=> get_string('stackOption_Feedback_TG', 'stack', ''),'GS'=> get_string('stackOption_Feedback_GS', 'stack', ''),'G'=> get_string('stackOption_Feedback_G', 'stack', ''),'S'=> get_string('stackOption_Feedback_S', 'stack', ''),'none'=> get_string('stackOption_Feedback_none', 'stack', ''))); } ! } else { ! $this->itemOptions = $itemOpt; } --- 385,407 ---- die(); } ! /* ! * Approach is to overwrite default options rather than just ! * clone them. Allows us to extend options without fear. ! */ ! $this->itemOptions = new ItemOption(); // future-proofing ! $this->itemOptions->copyFrom($db->base64_unserialize($serialised)); + /* + * SPH 18/2/10. Covered by overwriting approach above. // CJS 6/1/9. Not needed in the long term. New option added. if (NULL === $this->itemOptions->getOption('Feedback')) { $this->itemOptions->addOption('Feedback','list','TGS',array('TGS' => get_string('stackOption_Feedback_TGS', 'stack', ''),'TG'=> get_string('stackOption_Feedback_TG', 'stack', ''),'GS'=> get_string('stackOption_Feedback_GS', 'stack', ''),'G'=> get_string('stackOption_Feedback_G', 'stack', ''),'S'=> get_string('stackOption_Feedback_S', 'stack', ''),'none'=> get_string('stackOption_Feedback_none', 'stack', ''))); } ! **/ } else { ! $this->itemOptions = new ItemOption(); // see 'future-proofing' above ! $this->itemOptions->copyFrom($itemOpt); } *************** *** 418,421 **** --- 440,444 ---- global $config; $this->qID = NULL; //not yet been assigned, once stored gets a question ID + //$this->version = 0; // set according to version scheme $this->PRTrees = array(); *************** *** 522,526 **** /** ! * Stores the question in the the database, if $asnew is set to true, adds as a new question. * * @param bool $asNew --- 545,549 ---- /** ! * Stores the question revision in the the database, if $asNew is set to true, adds as a new question line. * * @param bool $asNew *************** *** 549,554 **** return false; } ! else ! { //serialize variables --- 572,598 ---- return false; } ! ! if($asNew == true || !isset($this->line)) { // need to start a new line ! $this->line = $db->newLine(); ! $this->logger->debug('Started a new line: '.$this->line); ! ! } else $line = $this->line; ! ! $statusChangedOnly = false; ! if(!$asNew){ // just saving ! // check item has been changed ! $prior = new Item(null, $this->qID); ! if($this->equals($prior)) { ! $this->logger->debug('Item content unchanged.'); ! if($this->equalStatus($prior)) { ! return false; ! } else { ! $statusChangedOnly = true; ! } ! } ! $this->logger->debug('Saving item '.$this->qID); ! } ! //to store in the database the item is wrapped up into an array, then serialised. ! //PRTrees are stored in a separate table. //serialize variables *************** *** 557,560 **** --- 601,606 ---- $questionVariables['qID'] = $this->qID; + + $questionVariables['line'] = $this->line; $questionVariables['lastUserEditor'] = $this->lastUserEditor; $questionVariables['language'] = $this->language; *************** *** 595,599 **** --- 641,658 ---- $this->questionGUID = new Meta('system',$GUID,NULL,'identifier','dc','string'); $questionVariables['questionGUID'] = $this->questionGUID; + + // avoid obvious duplicate names + $name = $this->questionName->getSelection(); + if($db->nameExists($name)) { + $np = strpos($name," (new:"); + /*if (false!==$np) { + $name = substr($name,0,$np); } + */ + ... [truncated message content] |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:16
|
Update of /cvsroot/stack/stack-dev/install In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/install Modified Files: Tag: item_state_separation installStyles.css healthcheck.php answer_test_testsuite.php p2.php p3.php p4.php installTranslator.php adodbinit.php installFunctions.php Log Message: Brought back up to date with big HEAD merge. Index: installTranslator.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/installTranslator.php,v retrieving revision 1.1 retrieving revision 1.1.18.1 diff -C2 -d -r1.1 -r1.1.18.1 *** installTranslator.php 5 Apr 2007 14:02:29 -0000 1.1 --- installTranslator.php 9 Nov 2010 16:51:37 -0000 1.1.18.1 *************** *** 1,14 **** <?php ! /* ! Usual translator is no good for us, as config.php not been wrote yet. Instead pull language straight from session. */ ! session_start(); ! ! function get_string($identifier, $module='', $a=NULL) { ! //global $config; //return '['. $identifier .']'; --- 1,14 ---- <?php ! /* ! Usual translator is no good for us, as config.php not been wrote yet. Instead pull language straight from session. */ ! if(session_id() == '') session_start(); ! ! function get_string($identifier, $module='', $a=NULL) { ! //global $config; //return '['. $identifier .']'; *************** *** 20,24 **** // Get the current language if(!empty($_SESSION['Slang'])) ! { $lang = $_SESSION['Slang']; } --- 20,24 ---- // Get the current language if(!empty($_SESSION['Slang'])) ! { $lang = $_SESSION['Slang']; } *************** *** 27,32 **** $lang = 'en'; } ! ! /*if (is_array($options)) { if (array_key_exists('Language',$options)) { --- 27,32 ---- $lang = 'en'; } ! ! /*if (is_array($options)) { if (array_key_exists('Language',$options)) { Index: p3.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/p3.php,v retrieving revision 1.24 retrieving revision 1.24.8.1 diff -C2 -d -r1.24 -r1.24.8.1 *** p3.php 1 Sep 2009 08:45:50 -0000 1.24 --- p3.php 9 Nov 2010 16:51:37 -0000 1.24.8.1 *************** *** 17,33 **** */ //check we have the required settings to be here, else bounce to start ! session_start(); ! $configFile = '../config.php'; ! if(file_exists($configFile)) ! { ! require($configFile); ! $config = new stackConfig(); ! global $config; ! $root = $config->get('docroot'); ! // Ensure admin is logged in. ! require $root.'/lib/ui/AdminInterface.php'; ! } --- 17,33 ---- */ //check we have the required settings to be here, else bounce to start ! if(session_id() == '') session_start(); ! $configFile = '../config.php'; ! if(file_exists($configFile)) ! { ! require($configFile); ! $config = new stackConfig(); ! global $config; ! $root = $config->get('docroot'); ! // Ensure admin is logged in. ! require $root.'/lib/ui/AdminInterface.php'; ! } *************** *** 104,108 **** require_once($_SESSION['Sdocroot'].'/maxima/initMaxima.php'); ! $errorMessgage = ''; //form has been sent, check all complete foreach($_SESSION as $label => $val) --- 104,108 ---- require_once($_SESSION['Sdocroot'].'/maxima/initMaxima.php'); ! $errorMessage = ''; //form has been sent, check all complete foreach($_SESSION as $label => $val) *************** *** 215,219 **** <div class="content"> <?php ! if ($errorMessage != '') echo '<div class="box"> <p>'.$errorMessage.'</p> --- 215,219 ---- <div class="content"> <?php ! if (!empty($errorMessage)) echo '<div class="box"> <p>'.$errorMessage.'</p> *************** *** 265,269 **** <?php ! $maximaVersions = array('5.19.2','5.18.1','5.17.0','5.16.3','5.15.0','5.13.0','5.12.0','5.11.0'); foreach($maximaVersions as $mVer) { --- 265,269 ---- <?php ! $maximaVersions = array('5.22.1','5.21.1','5.20.1','5.19.2','5.18.1','5.17.0','5.16.3','5.15.0'); foreach($maximaVersions as $mVer) { *************** *** 284,290 **** <div class="row"> <span class="label">Platform:</span><span class="formw"> <input type="radio" name="platform" value="win" <?php if($_SESSION['Splatform'] == 'win'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_win','stack'); ?><br /> ! <input type="radio" name="platform" value="unix" <?php if($_SESSION['Splatform'] == 'unix'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_unix','stack'); ?><br /> ! <input type="radio" name="platform" value="server" <?php if($_SESSION['Splatform'] == 'server'){echo 'checked';} ?> onclick="containerHeight.toggle();" /> <?php echo get_string('stackInstall_serverMode','stack'); ?><br /> </span> </div> --- 284,291 ---- <div class="row"> <span class="label">Platform:</span><span class="formw"> + <?php if(!isset($_SESSION['Splatform'])) $_SESSION['Splatform'] = 'win'; ?> <input type="radio" name="platform" value="win" <?php if($_SESSION['Splatform'] == 'win'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_win','stack'); ?><br /> ! <input type="radio" name="platform" value="unix" <?php if($_SESSION['Splatform'] == 'unix'){echo 'checked';} ?> onclick="containerHeight.hide();" /> <?php echo get_string('stackInstall_unix','stack'); ?><br /> ! <input type="radio" name="platform" value="server" <?php if($_SESSION['Splatform'] == 'server'){echo 'checked';} ?> onclick="containerHeight.toggle();" /> <?php echo get_string('stackInstall_serverMode','stack'); ?><br /> </span> </div> *************** *** 363,371 **** <?php echo get_string('stackInstall_externalProgInfo','stack'); ?> </div> ! <div class="box"> ! <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_submit','stack'); ?></span><span class="formw"><input type="submit" value="<?php echo get_string('stackInstall_submit','stack'); ?>" /></span> ! </div> ! </div> <input type="hidden" name="sent" value="sent" /> --- 364,368 ---- <?php echo get_string('stackInstall_externalProgInfo','stack'); ?> </div> ! <span class="formw"><span class="formw"><input type="submit" value="<?php echo get_string('stackInstall_contButton','stack'); ?>" /></span> <input type="hidden" name="sent" value="sent" /> Index: p2.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/p2.php,v retrieving revision 1.23 retrieving revision 1.23.10.1 diff -C2 -d -r1.23 -r1.23.10.1 *** p2.php 26 Jun 2009 18:08:21 -0000 1.23 --- p2.php 9 Nov 2010 16:51:37 -0000 1.23.10.1 *************** *** 19,24 **** if(!isset($_POST['submitted'])) { ! session_start(); ! $configFile = '../config.php'; if(file_exists($configFile)) --- 19,24 ---- if(!isset($_POST['submitted'])) { ! if(session_id() == '') session_start(); ! $configFile = '../config.php'; if(file_exists($configFile)) *************** *** 28,43 **** global $config; $root = $config->get('docroot'); ! // Ensure admin is logged in. require $root.'/lib/ui/AdminInterface.php'; } ! $_SESSION['Senv'] = $_POST['env']; ! if ($_SESSION['Senv'] != 'ok') { header('Location: index.php'); } ! $server = 'localhost'; $db = 'stack'; --- 28,43 ---- global $config; $root = $config->get('docroot'); ! // Ensure admin is logged in. require $root.'/lib/ui/AdminInterface.php'; } ! $_SESSION['Senv'] = $_POST['env']; ! if ($_SESSION['Senv'] != 'ok') { header('Location: index.php'); } ! $server = 'localhost'; $db = 'stack'; *************** *** 49,53 **** $moodlepassword = ''; $moodleprefix = 'mdl_'; ! } --- 49,53 ---- $moodlepassword = ''; $moodleprefix = 'mdl_'; ! } *************** *** 55,65 **** { //attempt to load variables from the session ! session_start(); ! $server = $_SESSION['Sdbserver']; $db = $_SESSION['Sdb']; $username = $_SESSION['Sdbusername']; $password = $_SESSION['Sdbpassword']; $driver = $_SESSION['Sdriver']; ! $moodleserver = $_SESSION['SmoodleDBhost']; $moodleusername = $_SESSION['SmoodleDBuser']; --- 55,65 ---- { //attempt to load variables from the session ! //session_start(); ! $server = $_SESSION['Sdbserver']; $db = $_SESSION['Sdb']; $username = $_SESSION['Sdbusername']; $password = $_SESSION['Sdbpassword']; $driver = $_SESSION['Sdriver']; ! $moodleserver = $_SESSION['SmoodleDBhost']; $moodleusername = $_SESSION['SmoodleDBuser']; *************** *** 84,88 **** $password = addslashes($_POST['password']); $driver = addslashes($_POST['driver']); ! $moodleserver = addslashes($_POST['moodleserver']); $moodledb = addslashes($_POST['moodledb']); --- 84,88 ---- $password = addslashes($_POST['password']); $driver = addslashes($_POST['driver']); ! $moodleserver = addslashes($_POST['moodleserver']); $moodledb = addslashes($_POST['moodledb']); *************** *** 91,100 **** $moodleprefix = addslashes($_POST['moodleprefix']); $moodleDriver = addslashes($_POST['moodleDriver']); ! //check can access db with supplied details //@$link = mysql_connect($server, $username, $password); require_once('adodbinit.php'); $link = testConnection($server, $username, $password, $db, $driver); ! if (!$link) { --- 91,100 ---- $moodleprefix = addslashes($_POST['moodleprefix']); $moodleDriver = addslashes($_POST['moodleDriver']); ! //check can access db with supplied details //@$link = mysql_connect($server, $username, $password); require_once('adodbinit.php'); $link = testConnection($server, $username, $password, $db, $driver); ! if (!$link) { *************** *** 108,112 **** else { ! //add to session session_start(); --- 108,112 ---- else { ! //add to session session_start(); *************** *** 118,122 **** $result = buildTables($server, $username, $password, $db, $driver); ! if($result != true) { --- 118,122 ---- $result = buildTables($server, $username, $password, $db, $driver); ! if($result != true) { *************** *** 145,153 **** //try to connect to moodle database. //@$link = mysql_connect($moodleserver, $moodleusername, $moodlepassword); ! //@$selectedDB = mysql_select_db($moodledb, $link); ! $moodleConn = testConnection($moodleserver, $moodleusername, $moodlepassword, $moodledb, $moodleDriver); ! if ($moodleConn == false) { --- 145,153 ---- //try to connect to moodle database. //@$link = mysql_connect($moodleserver, $moodleusername, $moodlepassword); ! //@$selectedDB = mysql_select_db($moodledb, $link); ! $moodleConn = testConnection($moodleserver, $moodleusername, $moodlepassword, $moodledb, $moodleDriver); ! if ($moodleConn == false) { *************** *** 177,184 **** $_SESSION['SmoodleDriver'] = $moodleDriver; $_SESSION['SmoodleSetup'] = 'true'; ! header('Location: p3.php'); } ! } else --- 177,184 ---- $_SESSION['SmoodleDriver'] = $moodleDriver; $_SESSION['SmoodleSetup'] = 'true'; ! header('Location: p3.php'); } ! } else *************** *** 187,196 **** header('Location: p3.php'); } ! ! } } } ! } --- 187,196 ---- header('Location: p3.php'); } ! ! } } } ! } Index: installFunctions.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/installFunctions.php,v retrieving revision 1.35 retrieving revision 1.35.8.1 diff -C2 -d -r1.35 -r1.35.8.1 *** installFunctions.php 1 Sep 2009 08:45:50 -0000 1.35 --- installFunctions.php 9 Nov 2010 16:51:37 -0000 1.35.8.1 *************** *** 28,32 **** * @return bool true if write succeeded. */ ! session_start(); function createTmpDir($root, $tmp) --- 28,32 ---- * @return bool true if write succeeded. */ ! if(session_id() == '') session_start(); function createTmpDir($root, $tmp) *************** *** 146,150 **** $config .= ' ! $this->configArray["version"] = "STACK 2.0 beta"; $this->configArray["platform"] = '."'".$_SESSION['Splatform']."'".'; //server os / server mode $this->configArray["host"] = '."'".$_SESSION['Shost']."'".'; //server hostname --- 146,150 ---- $config .= ' ! $this->configArray["version"] = "STACK 2.2"; $this->configArray["platform"] = '."'".$_SESSION['Splatform']."'".'; //server os / server mode $this->configArray["host"] = '."'".$_SESSION['Shost']."'".'; //server hostname *************** *** 199,214 **** switch($this->casArray["version"]) { - case "5.11.0": - $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.11.0.bat"; - break; - - case "5.12.0": - $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.12.0.bat"; - break; - - case "5.13.0": - $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.13.0.bat"; - break; - case "5.15.0": $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.15.0.bat"; --- 199,202 ---- *************** *** 230,233 **** --- 218,233 ---- $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.19.2.bat"; break; + + case "5.20.1": + $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.20.1.bat"; + break; + + case "5.21.1": + $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.20.1.bat"; + break; + + case "5.21.2": + $this->casArray["command"] = $this->configArray["docroot"]."/maxima/stackmaxima_5.20.1.bat"; + break; } *************** *** 279,283 **** } } ! ?>'; $config = trim($config); return $config; --- 279,283 ---- } } ! '; // deliberately omitting PHP close tag to avoid trailing whitespace issues $config = trim($config); return $config; *************** *** 285,291 **** /** ! * Checks the config.php wrote to disk is valid. * - * Checks last characters are ?> * @return bool */ --- 285,290 ---- /** ! * Checks the config.php wrote to disk is valid and secure. * * @return bool */ *************** *** 295,309 **** if($conf == false){ return false; ! }else{ ! if(substr($conf, -2) != '?>'){ ! return false; ! } ! else{ ! return true; ! } } } /** * Called at end of installation process, writes out the a server specific WSDL file required for Opaque server to function * --- 294,322 ---- if($conf == false){ return false; ! } else { ! return true; } } /** + * Checks various potential security loopholes. + * + * @return bool + */ + function checkSecurity(){ + + $issues = ''; + + if(file_exists('../config.php~')) { + $issues .= '<li>Your configuration settings are public as <tt>config.php~</tt>. You should remove this file.'; + } + if(!empty($issues)) { + $issues = '<ul>'.$issues.'</ul>'; + } + + return $issues; + } + + /** * Called at end of installation process, writes out the a server specific WSDL file required for Opaque server to function * *************** *** 500,504 **** $send .= "Referer: $r\r\n"; }else{ ! if ($_SERVER['HTTP_REFERER']){ $send .= "Referer: {$_SERVER['HTTP_REFERER']}\r\n"; } --- 513,517 ---- $send .= "Referer: $r\r\n"; }else{ ! if (isset($_SERVER['HTTP_REFERER'])){ $send .= "Referer: {$_SERVER['HTTP_REFERER']}\r\n"; } *************** *** 529,534 **** } fputs($open, $send); while (!feof($open)) { ! $return .= fgets($open, 4096); } fclose($open); --- 542,548 ---- } fputs($open, $send); + $return = ''; while (!feof($open)) { ! $return .= fgets($open, 4096); } fclose($open); Index: answer_test_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/answer_test_testsuite.php,v retrieving revision 1.42.2.2 retrieving revision 1.42.2.2.2.1 diff -C2 -d -r1.42.2.2 -r1.42.2.2.2.1 *** answer_test_testsuite.php 3 Nov 2009 13:35:43 -0000 1.42.2.2 --- answer_test_testsuite.php 9 Nov 2010 16:51:37 -0000 1.42.2.2.2.1 *************** *** 45,49 **** // AlgEquiv Answer tests. ! $testsuite[] = stack_testsuite_construct('AlgEquiv','1/0','x^2-2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3)','true',1,'','Predicates'); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3.1)','true',0,'',''); --- 45,50 ---- // AlgEquiv Answer tests. ! $testsuite[] = stack_testsuite_construct('AlgEquiv','1/0','1',0,'',''); ! $testsuite[] = stack_testsuite_construct('AlgEquiv','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3)','true',1,'','Predicates'); $testsuite[] = stack_testsuite_construct('AlgEquiv','integerp(3.1)','true',0,'',''); *************** *** 62,65 **** --- 63,69 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','abs(x)','sqrt(x^2)',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','x-1','(x^2-1)/(x+1)',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','a^b*a^c','a^(b+c)',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','(4*sqrt(3)*%i+4)^(1/5)','6^(1/5)*cos(%pi/15)-6^(1/5)*%i*sin(%pi/15)',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','(x-1)^2','x^2-2*x+1',1,'','Polynomials and rational function'); $testsuite[] = stack_testsuite_construct('AlgEquiv','(x-1)*(x^2+x+1)','x^3-1',1,'',''); *************** *** 70,75 **** --- 74,81 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','2*cos(x)^2-1','cos(2*x)',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','exp(%i*%pi)','-1',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','2*cos(2*x)+x+1','-sin(x)^2+3*cos(x)^2+x',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','(2*sec(2*t)^2-2)/2','-(sin(4*t)^2-2*sin(4*t)+cos(4*t)^2-1)*(sin(4*t)^2+2*sin(4*t)+cos(4*t)^2-1)/(sin(4*t)^2+cos(4*t)^2+2*cos(4*t)+1)^2',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','log(a^2*b)','2*log(a)+log(b)',1,'','Logarithms'); + $testsuite[] = stack_testsuite_construct('AlgEquiv','lg(10^x)','x',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','x','[1,2,3]',0,'','Lists'); $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,2]','[1,2,3]',0,'',''); *************** *** 77,80 **** --- 83,87 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,x>2]','[1,2<x]',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','[1,2,[2-x<0,{1,2,2,2,1,3}]]','[1,2,[2-x<0,{1,2}]]',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x','{1,2,3}',0,'','Sets'); $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,2}','{1,2,3}',0,'',''); *************** *** 82,85 **** --- 89,93 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,2,4}','{1,2,3}',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','{1,x>4}','{4<x,1}',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2],[2,3])',1,'','Matrices'); $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2,3],[2,3,3])',0,'',''); *************** *** 127,134 **** --- 135,144 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','n/n!','1/(n-1)!',1,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','2/%i*ln(sqrt((1+z)/2)+%i*sqrt((1-z)/2))','-%i*ln(z+i*sqrt(1-z^2))',1,'','These currently fail'); + $testsuite[] = stack_testsuite_construct('AlgEquiv','-%i/sqrt(x)','sqrt(-1/x)',1,'',''); // SubstEquiv Answer tests. $testsuite[] = stack_testsuite_construct('SubstEquiv','1/0','x^2-2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('SubstEquiv','x^2+1','x^2+1',1,'',''); + $testsuite[] = stack_testsuite_construct('SubstEquiv','x^2+1','x^3+1',0,'',''); $testsuite[] = stack_testsuite_construct('SubstEquiv','X^2+1','x^2+1',1,'',''); $testsuite[] = stack_testsuite_construct('SubstEquiv','x^2+y','a^2+b',1,'',''); *************** *** 139,154 **** $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/0','0',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+2*x','x*2+1',1,'','Simple polynomials'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(x+y)+z','z+x+y',1,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1+2','2-1',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1*2+3*4','3*4-1*2',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-1*2)+3*4','3*4+(-1*2)',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2','3/6',0,'','Rational expressions'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/(1+2*x)','1/(2*x+1)',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','2/(4+2*x)','1/(x+2)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1/(1-x)','1/(x-1)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2*1/x','1/(2*x)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','y=x','x=y',0,'','Equality is not included as commutative....'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x+1','y=2*x+1',0,'','Equations'); --- 149,177 ---- $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/0','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','0','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+2*x','x*2+1',1,'','Simple polynomials'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1+x+x','2*x+1',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(x+y)+z','z+x+y',1,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x*x','x^2',0,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(1-x)^2','(x-1)^2',0,'',''); ! $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1+2','2-1',1,'','Unary minus'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1*2+3*4','3*4-1*2',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-1*2)+3*4','3*4+(-1*2)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x*(-y)','-x*y',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x*(-y)','-(x*y)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-x)*(-x)','x*x',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-x)*(-x)','x^2',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2','3/6',0,'','Rational expressions'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/(1+2*x)','1/(2*x+1)',1,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','2/(4+2*x)','1/(x+2)',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(a*b)/c','a*(b/c)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(-x)/y','-(x/y)',1,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x/(-y)','-(x/y)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','-1/(1-x)','1/(x-1)',0,'',''); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','1/2*1/x','1/(2*x)',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','%i','e^(pi/2)',0,'','Complex numbers'); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','(4*sqrt(3)*%i+4)^(1/5)','rectform((4*sqrt(3)*%i+4)^(1/5))',0,'',''); + $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','y=x','x=y',0,'','Equality is not included as commutative....'); $testsuite[] = stack_testsuite_construct('Equal_Com_Ass','x+1','y=2*x+1',0,'','Equations'); *************** *** 183,186 **** --- 206,211 ---- + $testsuite[] = stack_testsuite_construct('SameType','1/0','1',0,'',''); + $testsuite[] = stack_testsuite_construct('SameType','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('SameType','4^(-1/2)','1/2',1,'','Numbers'); $testsuite[] = stack_testsuite_construct('SameType','x','[1,2,3]',0,'','Lists'); *************** *** 207,215 **** $testsuite[] = stack_testsuite_construct('Expanded','2*(x-1)','0',0,'',''); $testsuite[] = stack_testsuite_construct('Expanded','(x-1)*(x+1)','0',0,'',''); $testsuite[] = stack_testsuite_construct('Expanded','cos(2*x)','0',1,'',''); // Factored form ! $testsuite[] = stack_testsuite_construct('FacForm','1/0','x^2-2*x+1',0,'',''); ! $testsuite[] = stack_testsuite_construct('FacForm','1/0','x^2-2*x+1',0,'x',''); $testsuite[] = stack_testsuite_construct('FacForm','2','2',1,'x','Trivial cases'); $testsuite[] = stack_testsuite_construct('FacForm','1/3','1/3',1,'x',''); --- 232,244 ---- $testsuite[] = stack_testsuite_construct('Expanded','2*(x-1)','0',0,'',''); $testsuite[] = stack_testsuite_construct('Expanded','(x-1)*(x+1)','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Expanded','(x-a)*(x-b)','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Expanded','x^2-(a+b)*x+a*b','0',0,'',''); + $testsuite[] = stack_testsuite_construct('Expanded','x^2-a*x-b*x+a*b','0',1,'',''); $testsuite[] = stack_testsuite_construct('Expanded','cos(2*x)','0',1,'',''); // Factored form ! $testsuite[] = stack_testsuite_construct('FacForm','1/0','0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('FacForm','0','1/0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('FacForm','0','0',0,'1/0',''); $testsuite[] = stack_testsuite_construct('FacForm','2','2',1,'x','Trivial cases'); $testsuite[] = stack_testsuite_construct('FacForm','1/3','1/3',1,'x',''); *************** *** 251,254 **** --- 280,287 ---- $testsuite[] = stack_testsuite_construct('FacForm','(x-1)*(x+(1+sqrt(3)*%i)/2)*(x+(1-sqrt(3)*%i)/2)','x^3-1',1,'x',''); + + $testsuite[] = stack_testsuite_construct('CompSquare','1/0','0',0,'',''); + $testsuite[] = stack_testsuite_construct('CompSquare','1/0','0',0,'x',''); + $testsuite[] = stack_testsuite_construct('CompSquare','0','1/0',0,'x',''); $testsuite[] = stack_testsuite_construct('CompSquare','sin(x-1)+a-1','(x-1)^2+1',0,'x',''); $testsuite[] = stack_testsuite_construct('CompSquare','x^2-1','(x-1)*(x+1)',1,'x','Trivial cases'); *************** *** 268,272 **** //Single Fraction Test ! //$testsuite[] = stack_testsuite_construct('SingleFrac','1/0','1/n',0,'','Basic tests'); $testsuite[] = stack_testsuite_construct('SingleFrac','x=3','2',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','3','3',1,'',''); --- 301,306 ---- //Single Fraction Test ! $testsuite[] = stack_testsuite_construct('SingleFrac','1/0','1/n',0,'',''); ! $testsuite[] = stack_testsuite_construct('SingleFrac','0','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','x=3','2',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','3','3',1,'',''); *************** *** 283,288 **** --- 317,327 ---- $testsuite[] = stack_testsuite_construct('SingleFrac','(x-1)/(x^2-1)','1/(x+1)',1,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','(1/2)/(3/4)','2/3',0,'','Fractions within fractions'); + $testsuite[] = stack_testsuite_construct('SingleFrac','(x-2)/4/(2/x^2)','(x-2)*x^2/8',0,'',''); $testsuite[] = stack_testsuite_construct('SingleFrac','1/(1-1/x)','x/(x-1)',0,'',''); + $testsuite[] = stack_testsuite_construct('PartFrac','1/0','3*x^2',0,'',''); + $testsuite[] = stack_testsuite_construct('PartFrac','1/0','3*x^2',0,'x',''); + $testsuite[] = stack_testsuite_construct('PartFrac','0','0',0,'1/0',''); + $testsuite[] = stack_testsuite_construct('PartFrac','0','1/0',0,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','1/m','1/n',0,'n','Basic tests'); $testsuite[] = stack_testsuite_construct('PartFrac','1/n','1/n',0,'n',''); *************** *** 300,303 **** --- 339,343 ---- $testsuite[] = stack_testsuite_construct('PartFrac','n/(2*n-1)-(n+1)/(2*n+1)','1/(4*n-2)-1/(4*n+2)',0,'n',''); $testsuite[] = stack_testsuite_construct('PartFrac','10/(x+3) - 2/(x+2) + x -2','(x^3 + 3*x^2 + 4*x +2)/((x+2)*(x+3))',1,'x','Correct Answer, Numerator > Denominator'); + $testsuite[] = stack_testsuite_construct('PartFrac','2*x+1/(x+1)+1/(x-1)','2*x^3/(x^2-1)',1,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','1/(n*(n-1))','1/(n*(n-1))',0,'n','Simple mistakes'); $testsuite[] = stack_testsuite_construct('PartFrac','1/(n-1)-1/n^2','1/((n+1)*n)',0,'n',''); *************** *** 317,327 **** $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'',''); $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','3*x^2','3*x^2',1,'x',''); $testsuite[] = stack_testsuite_construct('Diff','3*X^2','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+1','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','3*x^2',0,'x',''); - $testsuite[] = stack_testsuite_construct('Diff','','3*x^2',0,'','Additional tests'); - $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','y=x^4/4','x^4/4',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','y=x^4/4',0,'x',''); --- 357,368 ---- $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'',''); $testsuite[] = stack_testsuite_construct('Diff','1/0','3*x^2',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','0','1/0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','0','0',0,'1/0',''); ! $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Diff','3*x^2','3*x^2',1,'x','Basic tests'); $testsuite[] = stack_testsuite_construct('Diff','3*X^2','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+1','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4+c','3*x^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','y=x^4/4','x^4/4',0,'x',''); $testsuite[] = stack_testsuite_construct('Diff','x^4/4','y=x^4/4',0,'x',''); *************** *** 334,339 **** // Integration test ! $testsuite[] = stack_testsuite_construct('Int','1/0','x^2-2*x+1',0,'x','Variable mismatch tests'); ! $testsuite[] = stack_testsuite_construct('Int','x^3/3','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','x^3/3+1','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','x^3/3+c','x^3/3',1,'x',''); --- 375,383 ---- // Integration test ! $testsuite[] = stack_testsuite_construct('Int','1/0','1',0,'',''); ! $testsuite[] = stack_testsuite_construct('Int','1/0','1',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Int','1','1/0',0,'x',''); ! $testsuite[] = stack_testsuite_construct('Int','0','0',0,'1/0',''); ! $testsuite[] = stack_testsuite_construct('Int','x^3/3','x^3/3',0,'x','Basic tests'); $testsuite[] = stack_testsuite_construct('Int','x^3/3+1','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','x^3/3+c','x^3/3',1,'x',''); *************** *** 344,351 **** $testsuite[] = stack_testsuite_construct('Int','X^3/3+c','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','sin(2*x)','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','(t-1)^5/5+c','(t-1)^5/5',1,'t',''); $testsuite[] = stack_testsuite_construct('Int','2*x','x^3/3',0,'x','Student differentiates by mistake'); $testsuite[] = stack_testsuite_construct('Int','2*x+c','x^3/3',0,'x',''); - $testsuite[] = stack_testsuite_construct('Int','e^x+c','e^x',1,'x',''); $testsuite[] = stack_testsuite_construct('Int','ln(x)','ln(x)',0,'x','Sloppy logs (teacher ignores abs(x) )'); $testsuite[] = stack_testsuite_construct('Int','ln(x)+c','ln(x)+c',1,'x',''); --- 388,398 ---- $testsuite[] = stack_testsuite_construct('Int','X^3/3+c','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','sin(2*x)','x^3/3',0,'x',''); + $testsuite[] = stack_testsuite_construct('Int','x^2/2-2*x+2+c','(x-2)^2/2',1,'x',''); $testsuite[] = stack_testsuite_construct('Int','(t-1)^5/5+c','(t-1)^5/5',1,'t',''); + $testsuite[] = stack_testsuite_construct('Int','x^3/3+c','x^3/3+c',1,'x','The teacher adds a constant'); + $testsuite[] = stack_testsuite_construct('Int','x^2/2-2*x+2+c','(x-2)^2/2+k',1,'x',''); + $testsuite[] = stack_testsuite_construct('Int','exp(x)+c','exp(x)',1,'x','Special case'); $testsuite[] = stack_testsuite_construct('Int','2*x','x^3/3',0,'x','Student differentiates by mistake'); $testsuite[] = stack_testsuite_construct('Int','2*x+c','x^3/3',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','ln(x)','ln(x)',0,'x','Sloppy logs (teacher ignores abs(x) )'); $testsuite[] = stack_testsuite_construct('Int','ln(x)+c','ln(x)+c',1,'x',''); *************** *** 365,368 **** --- 412,417 ---- $testsuite[] = stack_testsuite_construct('Int','ln(k*abs(x))','ln(k*abs(x))',1,'x',''); $testsuite[] = stack_testsuite_construct('Int','ln(x)+ln(a)','ln(k*abs(x+a))',0,'x','Other logs'); + $testsuite[] = stack_testsuite_construct('Int','log(x)^2-2*log(c)*log(x)+k','ln(c/x)^2',0,'x',''); + $testsuite[] = stack_testsuite_construct('Int','log(x)^2-2*log(c)*log(x)+k','ln(abs(c/x))^2',0,'x',''); $testsuite[] = stack_testsuite_construct('Int','2*sin(x)*cos(x)','sin(2*x)+c',0,'x','Trig'); $testsuite[] = stack_testsuite_construct('Int','2*sin(x)*cos(x)+k','sin(2*x)+c',1,'x',''); *************** *** 375,379 **** $testsuite[] = stack_testsuite_construct('Int','tan(x)-x+c','tan(x)-x',1,'x',''); ! $testsuite[] = stack_testsuite_construct('GT','1','1',0,'',''); $testsuite[] = stack_testsuite_construct('GT','2','1',1,'',''); --- 424,429 ---- $testsuite[] = stack_testsuite_construct('Int','tan(x)-x+c','tan(x)-x',1,'x',''); ! $testsuite[] = stack_testsuite_construct('GT','1/0','1',0,'',''); ! $testsuite[] = stack_testsuite_construct('GT','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('GT','1','1',0,'',''); $testsuite[] = stack_testsuite_construct('GT','2','1',1,'',''); *************** *** 383,386 **** --- 433,438 ---- + $testsuite[] = stack_testsuite_construct('GTE','1/0','1',0,'',''); + $testsuite[] = stack_testsuite_construct('GTE','1','1/0',0,'',''); $testsuite[] = stack_testsuite_construct('GTE','1','1',1,'',''); $testsuite[] = stack_testsuite_construct('GTE','2','1',1,'',''); *************** *** 390,393 **** --- 442,448 ---- + $testsuite[] = stack_testsuite_construct('NumRelative','1/0','0',0,'','Basic tests'); + $testsuite[] = stack_testsuite_construct('NumRelative','0','1/0',0,'',''); + $testsuite[] = stack_testsuite_construct('NumRelative','0','0',0,'1/0',''); $testsuite[] = stack_testsuite_construct('NumRelative','1.1','1',0,'','No option, so 5%'); $testsuite[] = stack_testsuite_construct('NumRelative','1.05','1',1,'',''); *************** *** 404,411 **** $testsuite[] = stack_testsuite_construct('NumSigFigs','1/0','3',0,'0','Basic tests'); ! $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'pi',''); - $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[1,2,3]',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[3,x]',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1.234','4',0,'1','Option is a number'); $testsuite[] = stack_testsuite_construct('NumSigFigs','3.141','3.1415927',0,'3',''); --- 459,468 ---- $testsuite[] = stack_testsuite_construct('NumSigFigs','1/0','3',0,'0','Basic tests'); ! $testsuite[] = stack_testsuite_construct('NumSigFigs','0','1/0',0,'0',''); ! $testsuite[] = stack_testsuite_construct('NumSigFigs','0','0',0,'1/0',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'pi',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[3,x]',''); + $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'[1,2,3]',''); + $testsuite[] = stack_testsuite_construct('NumSigFigs','1','3',0,'',''); $testsuite[] = stack_testsuite_construct('NumSigFigs','1.234','4',0,'1','Option is a number'); $testsuite[] = stack_testsuite_construct('NumSigFigs','3.141','3.1415927',0,'3',''); *************** *** 439,464 **** $testsuite[] = stack_testsuite_construct('RegExp','cxcxcz','3.1415927',0,'[0-9]*\.[0-9]*',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/0','x^2-2*x+1',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','X','x',0,'','Case sensitivity'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.5','1/2',1,'','Mix of floats and rational numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.33','1/3',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/4','1/2',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-1/3','-1/3',1,'','Negative numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/-3','-1/3',1,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-2/4','-1/2',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/-4','-1/2',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+1/3','x+1/3',1,'','Polynomials'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+2/6','x+1/3',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','cos(x)','cos(-x)',1,'','Trig functions'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','[1,2]','[1,2,3]',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','[1,2,4]','[1,2,3]',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','{1,2}','{1,2,3}',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','{1,2,4}','{1,2,3}',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','matrix([1,2],[2,3])','matrix([1,2],[2,3])',1,'','Matrices'); - $testsuite[] = stack_testsuite_construct('LowestTerms','x=1','x=1',1,'',''); - $testsuite[] = stack_testsuite_construct('LowestTerms','1=x','x=1',1,'',''); - $testsuite[] = stack_testsuite_construct('LowestTerms','1','x>1',0,'','Inequalities'); - $testsuite[] = stack_testsuite_construct('LowestTerms','x>1','x>1',1,'',''); /* ********************************************************** */ --- 496,525 ---- $testsuite[] = stack_testsuite_construct('RegExp','cxcxcz','3.1415927',0,'[0-9]*\.[0-9]*',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/0','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.5','0',1,'','Mix of floats and rational numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','0.33','0',1,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/4','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-1/3','0',1,'','Negative numbers'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','1/-3','0',1,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','-2/4','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/-4','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+1/3','0',1,'','Polynomials'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','x+2/6','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2*x/4+2/6','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','2/4*x+2/6','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','cos(x)','0',1,'','Trig functions'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','cos(3/6*x)','0',0,'',''); ! $testsuite[] = stack_testsuite_construct('LowestTerms','matrix([1,2/4],[2,3])','0',0,'','Matrices'); ! ! $testsuite[] = stack_testsuite_construct('LowestTerms','x=1/2','0',1,'','Equations'); ! $testsuite[] = stack_testsuite_construct('LowestTerms','3/9=x','0',0,'',''); ! ! ! /* Create an array with all available tests on it */ ! foreach ($testsuite as $ts) { ! $AvailableTests[$ts['AnswerTest']]=true; ! } ! $AvailableTests = array_keys($AvailableTests); /* ********************************************************** */ *************** *** 468,471 **** --- 529,534 ---- + + // Now perform the tests, and display the results. *************** *** 475,478 **** --- 538,556 ---- } + if (array_key_exists('ALL',$_GET)) { + $AnsTest = 'ALL'; + } + + // Normally turned off on production servers. + if ('ALL'==$AnsTest) {die();} + //$AnsTest='ALL'; + + + /* Tests in Windows. + C: + cd \xampp\htdocs\stack-dev\install\ + \xampp\php\php.exe answer_test_testsuite.php > c:\tmp\test.html + */ + /* Output the text for a batch file test. */ /* *************** *** 494,533 **** echo ' </div>'; ! echo '<h2>'.get_string('stackInstall_testsuite_choose','stack','')."</h2>\n"; ! echo "<form name=\"ChooseAnsTest\" action=\"\" method=\"POST\">\n"; ! $prefs = new maximaPreferences(); ! $anst = new AnsTestController($AnsTest,0,0,$prefs); ! echo $anst->ansTestWidget("AnsTest",$AnsTest); ! echo '<input type="submit" value="Submit" />'; ! echo "</form>"; ! if ('' == $AnsTest OR 'default' == $AnsTest) { ! die(); } - $a = $AnsTest; - echo '<hr /><h1>'.get_string('stackInstall_testsuite_for','stack',$a)."</h2>\n"; ! echo $stackAnswerTest[$AnsTest]['doc']; ! $all_passed = TRUE; ! echo "<p><table border='1' cellpadding='2'>\n\n"; ! // (4) Sort out and display the output ! echo "<tr bgcolor='#DDDDDD'>\n <th> pass? </th> ! <th> SAns </th> ! <th> TAns </th> ! <th> Opt </th> ! <th> Errors </th> ! <th> RawMark </th> ! <th> Expected </th> ! <th> FeedBack </th> ! <th> AnswerNote </th>\n</tr>\n"; ! foreach ($testsuite as $ts) { // (0) Check this is the required AnswerTest. --- 572,627 ---- echo ' </div>'; ! if ('ALL'!==$AnsTest) { ! echo '<h2>'.get_string('stackInstall_testsuite_choose','stack','')."</h2>\n"; ! echo "<form name=\"ChooseAnsTest\" action=\"\" method=\"POST\">\n"; ! $prefs = new maximaPreferences(); ! $anst = new AnsTestController($AnsTest,0,0,$prefs); ! echo $anst->ansTestWidget("AnsTest",$AnsTest); ! echo '<input type="submit" value="Submit" />'; ! echo "</form>"; ! } ! if ('' == $AnsTest OR 'default' == $AnsTest) { ! die(); ! } ! // Decide how many answer tests to choose! ! if ('ALL'===$AnsTest) { ! $TestList = $AvailableTests; ! //$TestList = array('String','StringSloppy'); ! foreach($TestList as $AnsTest) { ! echo '<a href="#'.$AnsTest.'">'.$AnsTest.'</a><br />'; ! } ! echo '<hr />'; ! } else { ! $TestList = array($AnsTest); ! echo '<hr />'; } ! // Loop over the required tests ! foreach($TestList as $AnsTest) { ! $a = $AnsTest; ! echo '<h1><a name="'.$a.'">'.get_string('stackInstall_testsuite_for','stack',$a)."</a></h2>\n"; ! $all_passed = TRUE; ! ! echo "<p><table border='1' cellpadding='2' width='100%'>\n\n"; ! // (4) Sort out and display the output ! echo "<tr bgcolor='#DDDDDD'>\n <th> pass? </th> ! <th> SAns </th> ! <th> TAns </th> ! <th> Opt </th> ! <th> Err </th> ! <th> M </th> ! <th> Ex </th> ! <th> FeedBack </th> ! <th> AnswerNote </th>\n</tr>\n"; ! foreach ($testsuite as $ts) { // (0) Check this is the required AnswerTest. *************** *** 537,541 **** //$maxima_str .= 'AT'.$ts['AnswerTest'].'('.$ts['SAns'].',['.$ts['TAns'].','.$ts['AnsTestOpt']."]);\n"; - $err = ''; --- 631,634 ---- *************** *** 564,571 **** } - if ('false' === $valid) { - $errors .= ' <font color="red">[invalid]</font>'; - } - if (''===$rawmark) { $rawmark='<font color="red">[ ]</font>'; --- 657,660 ---- *************** *** 589,594 **** echo "<tr>\n"; echo " <td> $outcome </td>\n"; ! echo " <td nowrap=\"nowrap\">".htmlspecialchars($ts['SAns'])." </td>\n "; ! echo " <td nowrap=\"nowrap\">".htmlspecialchars($ts['TAns'])." </td>\n "; echo " <td> {$ts['AnsTestOpt']} </td>\n "; echo " <td> $errors </td>\n "; --- 678,683 ---- echo "<tr>\n"; echo " <td> $outcome </td>\n"; ! echo " <td>".htmlspecialchars($ts['SAns'])." </td>\n "; ! echo " <td>".htmlspecialchars($ts['TAns'])." </td>\n "; echo " <td> {$ts['AnsTestOpt']} </td>\n "; echo " <td> $errors </td>\n "; *************** *** 617,620 **** --- 706,711 ---- //echo "<pre>".$maxima_str."</pre>"; + } + ?> Index: p4.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/p4.php,v retrieving revision 1.7 retrieving revision 1.7.18.1 diff -C2 -d -r1.7 -r1.7.18.1 *** p4.php 12 Dec 2007 14:37:41 -0000 1.7 --- p4.php 9 Nov 2010 16:51:37 -0000 1.7.18.1 *************** *** 37,45 **** } ! if(isset($_POST['sent'])) { - //check all complete - $errorMessage = ''; - if ($_POST['adminname'] == '') { --- 37,43 ---- } ! $errorMessage = ''; ! if(isset($_POST['sent'])) //check all complete { if ($_POST['adminname'] == '') { *************** *** 110,117 **** <form action="p4.php" method="POST"> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_firstName','stack'); ?></span><span class="formw"><input type="text" name="adminname" size="40" value="<?php echo $_SESSION['Sadminname']; ?>" /></span> </div> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_surname','stack'); ?></span><span class="formw"><input type="text" name="adminsurname" size="40" value="<?php echo $_SESSION['Sadminsurname']; ?>" /></span> </div> <br /> --- 108,115 ---- <form action="p4.php" method="POST"> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_firstName','stack'); ?></span><span class="formw"><input type="text" name="adminname" size="40" value="<?php echo isset($_SESSION['Sadminname'])? $_SESSION['Sadminname']:''; ?>" /></span> </div> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_surname','stack'); ?></span><span class="formw"><input type="text" name="adminsurname" size="40" value="<?php echo isset($_SESSION['Sadminsurname'])?$_SESSION['Sadminsurname']:''; ?>" /></span> </div> <br /> *************** *** 122,132 **** <span class="label"><?php echo get_string('stackInstall_password2','stack'); ?></span><span class="formw"><input type="password" name="pword2" size="40" /></span> </div> ! ! <?php if($_SESSION['SmoodleSetup'] == 'true') { echo '<br /> <div class="row"> ! <span class="label">Your Moodle Username</span><span class="formw">'; $result = moodleUsers($_SESSION['SmoodleDBhost'],$_SESSION['SmoodleDBuser'],$_SESSION['SmoodleDBpassword'],$_SESSION['SmoodleDB'],$_SESSION['SmoodleDriver'], $_SESSION['SmoodlePrefix']); echo $result; --- 120,130 ---- <span class="label"><?php echo get_string('stackInstall_password2','stack'); ?></span><span class="formw"><input type="password" name="pword2" size="40" /></span> </div> ! ! <?php if($_SESSION['SmoodleSetup'] == 'true') { echo '<br /> <div class="row"> ! <span class="label">'.get_string('stackInstall_yourMoodleUsername','stack').'</span><span class="formw">'; $result = moodleUsers($_SESSION['SmoodleDBhost'],$_SESSION['SmoodleDBuser'],$_SESSION['SmoodleDBpassword'],$_SESSION['SmoodleDB'],$_SESSION['SmoodleDriver'], $_SESSION['SmoodlePrefix']); echo $result; *************** *** 139,150 **** } ?> ! <br /> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_email','stack'); ?></span><span class="formw"><input type="text" name="adminemail" size="40" value="<?php echo $_SESSION['Sadminemail']; ?>" /></span> </div> <div class="row"> <span class="label"><?php echo get_string('stackInstall_smtp','stack'); ?></span><span class="formw"><input type="text" name="smtp" size="40" value="<?php ! if ($_SESSION['Ssmtp'] != '') { echo $_SESSION['Ssmtp']; } else { --- 137,148 ---- } ?> ! <br /> <div class="row"> ! <span class="label"><?php echo get_string('stackInstall_email','stack'); ?></span><span class="formw"><input type="text" name="adminemail" size="40" value="<?php echo isset($_SESSION['Sadminemail'])?$_SESSION['Sadminemail']:''; ?>" /></span> </div> <div class="row"> <span class="label"><?php echo get_string('stackInstall_smtp','stack'); ?></span><span class="formw"><input type="text" name="smtp" size="40" value="<?php ! if (isset($_SESSION['Ssmtp'])) { echo $_SESSION['Ssmtp']; } else { *************** *** 162,166 **** <div class="row"> <input type="hidden" name="sent" value="sent" /> ! <span class="label"></span><span class="formw"><input type="submit" value="Submit" /></span> </div> </form> --- 160,164 ---- <div class="row"> <input type="hidden" name="sent" value="sent" /> ! <span class="label"><input type="submit" value="Submit" /></span> </div> </form> Index: healthcheck.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/healthcheck.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 *** healthcheck.php 7 Dec 2009 14:41:23 -0000 1.11.6.1.2.1 --- healthcheck.php 9 Nov 2010 16:51:37 -0000 1.11.6.1.2.2 *************** *** 63,67 **** $maximaOptions = new maximaPreferences(); ! $seed = mktime(); --- 63,67 ---- $maximaOptions = new maximaPreferences(); ! $seed = time(); // encouraged over calling mktime() *************** *** 98,102 **** $display = 'LaTeX'; ! $displayTestString = '\[ \sum_{n=1}^\infty \left( \frac{1}{n^2}\right) = \frac{\pi^2}{6}. \]'; require_once $root.'/lib/ui/frontend.php'; --- 98,102 ---- $display = 'LaTeX'; ! $displayTestString = '\[ \sum_{n=1}^\infty \left( \frac{1}{n^2}\right) = \frac{\pi^2}{6}. \]'; require_once $root.'/lib/ui/frontend.php'; *************** *** 150,159 **** <?php // Check the configuration of JSMath if it has been set - $jsmathroot = trim($config->get('jsmath')); - if ('' != $jsmathroot) { echo '<div class="box"><h3>'.get_string('stackInstall_jsmathcheck','stack','').'</h3>'; ! $f = 1; $c = 1;//1 for header, 2 for body, 3 for both $r = NULL; --- 150,166 ---- <?php // Check the configuration of JSMath if it has been set + // incremental checks to avoid confusing contradictory failures + + $jsmathroot = trim($config->get('jsmath')); + + if ('' != $jsmathroot) { echo '<div class="box"><h3>'.get_string('stackInstall_jsmathcheck','stack','').'</h3>'; + // firstly, is it on the same server? + if(false !== strpos($jsmathroot, $_SERVER['HTTP_HOST'])) { + echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathsamehost', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; ! // secondly, can load file be found? ! $f = 1; $c = 1;//1 for header, 2 for body, 3 for both $r = NULL; *************** *** 169,182 **** } else { echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathok', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; - } ! // is it on the same server? ! if(false !== strpos($jsmathroot, $_SERVER['HTTP_HOST'])) { ! echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathsamehost', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; ! } else { ! echo '<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathdifferenthost', 'stack','').$_SERVER['HTTP_HOST'].' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; ! }; ! ! // is jsMath loaded? echo '<script type="text/javascript">' . 'if (!window.jsMath) document.write(\'<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathnotfound', 'stack','').' <tt>'.$jsmathroot.'</tt> <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>\');' . --- 176,181 ---- } else { echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackInstall_jsmathok', 'stack','').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; ! // finally, try to load and render with jsMath? echo '<script type="text/javascript">' . 'if (!window.jsMath) document.write(\'<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathnotfound', 'stack','').' <tt>'.$jsmathroot.'</tt> <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>\');' . *************** *** 187,190 **** --- 186,196 ---- '</script>'; + + } + + } else { // not same server + echo '<p><span class="failed">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_jsmathdifferenthost', 'stack','').$jsmathroot.' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; + }; + echo '</div>'; } *************** *** 448,452 **** else { ! echo '<p><span class="error">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_confEndSpaces','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; $problems = true; } --- 454,458 ---- else { ! echo '<p><span class="error">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackInstall_failopenconfig','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" /></p>'; $problems = true; } *************** *** 457,460 **** --- 463,482 ---- </div> + <div class="box"> + <h3><?php echo get_string('stackInstall_securityHeader','stack'); ?></h3> + + <?php + $securityIssues = checkSecurity(); + if('' == $securityIssues){ + echo '<p><span class="valid">'.get_string('stackInstall_success', 'stack','').'</span> '.get_string('stackHealth_securityPass','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_success','stack').'" width="16" height="16" alt="'.get_string('stackIcon_success_alt','stack').'" /></p>'; + } + else + { + echo '<p><span class="error">'.get_string('stackInstall_failed', 'stack','').'</span> '.get_string('stackHealth_securityFail','stack').' <img src="'.$wroot.'/pix/'.get_string('stackIcon_fail','stack').'" width="16" height="16" alt="'.get_string('stackIcon_fail_alt','stack').'" />'.$securityIssues.'</p>'; + $problems = true; + } + ?> + </div> + Index: adodbinit.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/adodbinit.php,v retrieving revision 1.8 retrieving revision 1.8.8.1 diff -C2 -d -r1.8 -r1.8.8.1 *** adodbinit.php 24 Aug 2009 10:20:49 -0000 1.8 --- adodbinit.php 9 Nov 2010 16:51:37 -0000 1.8.8.1 *************** *** 31,36 **** require_once("../other/adodb5/adodb.inc.php"); ! define("NUM_TABLES", 10); ! define("EXPECTED_TABLE_NAMES", "'attempt_meta_PRT', 'attempt_meta_answer', 'display_cache', 'display_cache_sequence', 'keywords', 'opaque_sessions', 'question_keyword', 'question_attempts', 'response_trees', 'stackquestion'");; /** --- 31,36 ---- re... [truncated message content] |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:16
|
Update of /cvsroot/stack/stack-dev/maxima In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/maxima Modified Files: Tag: item_state_separation stacktex.lisp initMaxima.php unittests.mac maximafun.php complexi.lisp stackmaxima.mac complexj.lisp noun_arith.mac Added Files: Tag: item_state_separation stackmaxima_5.20.1.bat Removed Files: Tag: item_state_separation stackmaxima_5.15.0.bat stackmaxima_5.11.0.bat stackmaxima_5.13.0.bat stackmaxima_5.12.0.bat Log Message: Brought back up to date with big HEAD merge. --- NEW FILE: stackmaxima_5.20.1.bat --- @echo off set arg0=%0 set arg1=%1 set arg2=%2 set arg3=%3 set arg4=%4 set arg5=%5 set arg6=%6 set arg7=%7 set arg8=%8 set arg9=%9 rem Uncomment the line below and set required value to MAXIMA_LANG_SUBDIR rem to get localized describe in command line Maxima rem set MAXIMA_LANG_SUBDIR=es set lisp=gcl set version=5.20.1 set prefix=C:/maxima set maxima_prefix=C:\PROGRA~1\MAXIMA~1.1 set package=maxima set verbose=false set mingw_gccver=3.3.1 set path=%maxima_prefix%\bin;%maxima_prefix%\lib\gcc-lib\mingw32\3.3.1;%path% if "%USERPROFILE%" == "" goto win9x if "%MAXIMA_USERDIR%" == "" set MAXIMA_USERDIR=%USERPROFILE%\maxima if "%MAXIMA_TEMPDIR%" == "" set MAXIMA_TEMPDIR=%USERPROFILE% goto startparseargs :win9x if "%MAXIMA_USERDIR%" == "" set MAXIMA_USERDIR=%maxima_prefix%\user if "%MAXIMA_TEMPDIR%" == "" set MAXIMA_TEMPDIR=%maxima_prefix% :startparseargs if x%1 == x-l goto foundlisp if x%1 == x--lisp goto foundlisp if x%1 == x-u goto foundversion if x%1 == x--use-version goto foundversion if x%1 == x-v goto foundverbose if x%1 == x--verbose goto foundverbose :continueparseargs shift if not x%1 == x goto startparseargs goto endparseargs :foundlisp set lisp=%2 shift goto continueparseargs :foundversion set version=%2 shift goto continueparseargs :foundverbose set verbose=true goto continueparseargs :endparseargs if "%MAXIMA_LAYOUT_AUTOTOOLS%" == "" goto defaultlayout set layout_autotools=true goto endlayout :defaultlayout set layout_autotools=true :endlayout if "%MAXIMA_PREFIX%" == "" goto defaultvars if "%layout_autotools%" == "true" goto maxim_autotools set maxima_imagesdir=%MAXIMA_PREFIX%\src goto endsetupvars :maxim_autotools set maxima_imagesdir=%MAXIMA_PREFIX%\lib\%package%\%version% goto endsetupvars :defaultvars if "%layout_autotools%" == "true" goto defmaxim_autotools set maxima_imagesdir=%prefix%\src goto endsetupvars :defmaxim_autotools set maxima_imagesdir=%prefix%\lib\%package%\%version% goto endsetupvars :endsetupvars set maxima_image_base=%maxima_imagesdir%\binary-%lisp%\maxima if "%verbose%" == "true" @echo on if "%lisp%" == "gcl" goto dogcl if "%lisp%" == "clisp" goto doclisp if "%lisp%" == "ecl" goto doecl @echo Maxima error: lisp %lisp% not known. goto end :dogcl %maxima_imagesdir%\binary-gcl\maxima.exe -eval "(cl-user::run)" -f -- %arg1% %arg2% %arg3% %arg4% %arg5% %arg6% %arg7% %arg8% %arg9% goto end :doclisp if "%layout_autotools%" == "true" goto clisp_autotools clisp -q -M %maxima_image_base%.mem "" -- %arg1% %arg2% %arg3% %arg4% %arg5% %arg6% %arg7% %arg8% %arg9% goto end :clisp_autotools %maxima_imagesdir%\binary-clisp\lisp.exe -q -M %maxima_image_base%.mem "" -- %arg1% %arg2% %arg3% %arg4% %arg5% %arg6% %arg7% %arg8% %arg9% goto end :doecl ecl -load %maxima_image_base%.fas -eval "(user::run)" -- "%arg1%" "%arg2%" "%arg3%" "%arg4%" "%arg5%" "%arg6%" "%arg7%" "%arg8%" "%arg9%" goto end :end --- stackmaxima_5.11.0.bat DELETED --- Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stackmaxima.mac,v retrieving revision 1.66.4.4 retrieving revision 1.66.4.4.2.1 diff -C2 -d -r1.66.4.4 -r1.66.4.4.2.1 *** stackmaxima.mac 3 Nov 2009 13:36:24 -0000 1.66.4.4 --- stackmaxima.mac 9 Nov 2010 16:51:37 -0000 1.66.4.4.2.1 *************** *** 25,31 **** pi:%pi,Pi:%pi,PI:%pi, pi():=%pi, /* Why does Excel do this?! */ - i:%i, - %j:%i, - j:%i, /* Sets up randomization, using Maxima's internal random command */ stack_randseed(10000), --- 25,28 ---- *************** *** 47,56 **** [...1685 lines suppressed...] - else if is(test="FF") then - rt:FacFormfun(cl,ll,opt) - else if is(test="AE") then - rt:ATAlgEquivfun(cl,ll) - else /* Something invalid passed */ - rt:[false,0,concat("ATE_unknowntest_",test),""], /* val,rawmk,ansnote,fb */ - return(rt) - )$ - /* Description : forme echelonne par lignes d'une matrice rectangulaire --- 1871,1878 ---- /* If ok, we perform the test */ if cont then ret:ATEquationfun(SA,SB,var,AT), ! ret:StackReturnOb(string(ret[2]),ret[3],ret[4]), return(ret) )$ /* Description : forme echelonne par lignes d'une matrice rectangulaire --- stackmaxima_5.15.0.bat DELETED --- Index: maximafun.php =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/maximafun.php,v retrieving revision 1.6 retrieving revision 1.6.18.1 diff -C2 -d -r1.6 -r1.6.18.1 *** maximafun.php 3 Oct 2007 12:24:17 -0000 1.6 --- maximafun.php 9 Nov 2010 16:51:37 -0000 1.6.18.1 *************** *** 19,22 **** --- 19,25 ---- $maxima_cmd['%enumer']['use'] = 't'; + $maxima_cmd['%f']['urls'][] = 'maxima_16.html#IDX636'; + $maxima_cmd['%f']['use'] = 't'; + $maxima_cmd['%gamma']['urls'][] = 'maxima_31.html#IDX1065'; $maxima_cmd['%gamma']['use'] = 's'; *************** *** 46,49 **** [...13412 lines suppressed...] ! $maxima_cmd['zlabel']['urls'][] = 'maxima_48.html#IDX1868'; ! $maxima_cmd['zlabel']['use'] = ''; ! ! $maxima_cmd['zlange']['urls'][] = 'maxima_58.html#IDX2297'; ! $maxima_cmd['zlange']['use'] = ''; ! ! $maxima_cmd['zrange']['urls'][] = 'maxima_48.html#IDX1855'; $maxima_cmd['zrange']['use'] = ''; ! $maxima_cmd['ztics']['urls'][] = 'maxima_48.html#IDX1873'; $maxima_cmd['ztics']['use'] = ''; + $maxima_cmd['ztics_axis']['urls'][] = 'maxima_48.html#IDX1884'; + $maxima_cmd['ztics_axis']['use'] = ''; + + $maxima_cmd['ztics_rotate']['urls'][] = 'maxima_48.html#IDX1879'; + $maxima_cmd['ztics_rotate']['use'] = ''; ?> \ No newline at end of file Index: complexj.lisp =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/complexj.lisp,v retrieving revision 1.1 retrieving revision 1.1.18.1 diff -C2 -d -r1.1 -r1.1.18.1 *** complexj.lisp 23 Mar 2007 10:51:43 -0000 1.1 --- complexj.lisp 9 Nov 2010 16:51:37 -0000 1.1.18.1 *************** *** 6,10 **** ;; \Maxima-5.9.0\share\maxima\5.9.0\src\mactex.lisp ! (defprop $%i "j" texword) (defprop $%i "<mi>j</mi> " mathmlword) --- 6,10 ---- ;; \Maxima-5.9.0\share\maxima\5.9.0\src\mactex.lisp ! (defprop $%i "\\mathrm{j}" texword) (defprop $%i "<mi>j</mi> " mathmlword) Index: complexi.lisp =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/complexi.lisp,v retrieving revision 1.2 retrieving revision 1.2.10.1 diff -C2 -d -r1.2 -r1.2.10.1 *** complexi.lisp 23 Jun 2009 14:39:36 -0000 1.2 --- complexi.lisp 9 Nov 2010 16:51:37 -0000 1.2.10.1 *************** *** 6,10 **** ;; \Maxima-5.9.0\share\maxima\5.9.0\src\mactex.lisp ! (defprop $%i "i" texword) (defprop $%i "<mi>i</mi> " mathmlword) --- 6,10 ---- ;; \Maxima-5.9.0\share\maxima\5.9.0\src\mactex.lisp ! (defprop $%i "\\mathrm{i}" texword) (defprop $%i "<mi>i</mi> " mathmlword) Index: noun_arith.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/noun_arith.mac,v retrieving revision 1.3 retrieving revision 1.3.16.1 diff -C2 -d -r1.3 -r1.3.16.1 *** noun_arith.mac 19 Nov 2008 15:37:03 -0000 1.3 --- noun_arith.mac 9 Nov 2010 16:51:37 -0000 1.3.16.1 *************** *** 8,11 **** --- 8,12 ---- Chris Sangwin 21 Oct 2005. + Chris Sangwin 7 Nov 2009, with help from JHD. */ *************** *** 37,40 **** --- 38,42 ---- infix("noun/",122,123); infix("noun^",140,139); + prefix("UNARY_RECIP",100); /* (2) */ *************** *** 65,69 **** ex:subst(STACK_DIV_OP,"noun/",ex), ex:subst("^","noun^",ex), ! ev(ex))$ --- 67,73 ---- ex:subst(STACK_DIV_OP,"noun/",ex), ex:subst("^","noun^",ex), ! define(UNARY_RECIP a, a^(-1)), ! ex:ev(ex,UNARY_MINUS=-1), ! remfunction("noun+","noun*","noun/","noun^","noun-"),ex)$ *************** *** 78,82 **** define(a noun/ b, a/b), define(a noun^ b, a^b), ! define(n- a, -1*a), ex:ev(ex,nouns), remfunction("noun+","noun*","noun/","noun^","noun-"),ex)$ --- 82,86 ---- define(a noun/ b, a/b), define(a noun^ b, a^b), ! define(noun- a, -1*a), ex:ev(ex,nouns), remfunction("noun+","noun*","noun/","noun^","noun-"),ex)$ *************** *** 87,92 **** ex:subst("noun+","+",ex), ex:subst("noun*","*",ex), ! ex:subst("noun-","-",ex), ! ex:subst("noun/",STACK_DIV_OP,ex), ex:subst("noun^","^",ex), ev(ex))$ --- 91,96 ---- ex:subst("noun+","+",ex), ex:subst("noun*","*",ex), ! ex:subst(lambda([ex],UNARY_MINUS noun* ex),"-",ex), /* Unary minus really communtes with multipication*/ ! ex:subst(lambda([ex1,ex2], ex1 noun* (UNARY_RECIP ex2)),STACK_DIV_OP,ex), /* Turn 1/x into x^(-1), in a special form */ ex:subst("noun^","^",ex), ev(ex))$ *************** *** 119,131 **** /* An answer test in the context of commutative+associative addition and multiplication.*/ ATEqual_com_ass(sa,sb) := ! block([RawMark,FeedBack,AnswerNote,ret], RawMark:0, FeedBack:"", AnswerNote:"", /* We need to check things are of the same type */ ret:ATSameTypefun(sa,sb), if ret[2]=0 then ! (ret[3]:concat("ATEqual_com_ass:",ret[3]), return(StackReturnOb(string(false),string(ret[2]),ret[3],ret[4])) ), ret:block([simp:true,ret],ATAlgEquivfun(sa,sb)), if ret[2]=0 then ! (ret[3]:concat("ATEqual_com_ass: (not AlgEquiv) ",ret[3]), return(StackReturnOb(string(ret[1]),string(ret[2]),ret[3],"")) ), /* Now actually apply this test */ if equals_commute_associate(sa,sb) then --- 123,139 ---- /* An answer test in the context of commutative+associative addition and multiplication.*/ ATEqual_com_ass(sa,sb) := ! block([RawMark,FeedBack,AnswerNote,ret,SAA,SBB], RawMark:0, FeedBack:"", AnswerNote:"", + SAA:errcatch(ev(sa,simp,fullratsimp,nouns)), + if (is(SAA=[STACKERROR]) or is(SAA=[])) then return(StackReturnOb("0","ATEqual_com_ass_STACKERROR_SAns","")), + SBB:errcatch(ev(sb,simp,fullratsimp,nouns)), + if (is(SBB=[STACKERROR]) or is(SBB=[])) then return(StackReturnOb("0","ATEqual_com_ass_STACKERROR_TAns","")), /* We need to check things are of the same type */ ret:ATSameTypefun(sa,sb), if ret[2]=0 then ! (ret[3]:concat("ATEqual_com_ass:",ret[3]), return(StackReturnOb(string(ret[2]),ret[3],ret[4])) ), ret:block([simp:true,ret],ATAlgEquivfun(sa,sb)), if ret[2]=0 then ! (ret[3]:concat("ATEqual_com_ass: (not AlgEquiv) ",ret[3]), return(StackReturnOb(string(ret[2]),ret[3],"")) ), /* Now actually apply this test */ if equals_commute_associate(sa,sb) then *************** *** 133,137 **** else (RawMark:0, AnswerNote:"AlgEquiv, but not equal"), ! return(StackReturnOb("true",string(RawMark),AnswerNote,FeedBack)) )$ --- 141,145 ---- else (RawMark:0, AnswerNote:"AlgEquiv, but not equal"), ! return(StackReturnOb(string(RawMark),AnswerNote,FeedBack)) )$ *************** *** 161,162 **** --- 169,179 ---- + /* Things to consider: 7/11/9 + + (1) What about pushing -1 thorugh /, + eg x*(-y) vs -(x*y) + + (2) What about even powers? + e.g. (1-x)^2 vs (x-1)^2 + + */ Index: initMaxima.php =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/initMaxima.php,v retrieving revision 1.5 retrieving revision 1.5.10.1 diff -C2 -d -r1.5 -r1.5.10.1 *** initMaxima.php 23 Jun 2009 14:39:36 -0000 1.5 --- initMaxima.php 9 Nov 2010 16:51:37 -0000 1.5.10.1 *************** *** 172,175 **** --- 172,182 ---- // Exceptions: Maxima variable names which are allowed to be variable names as part of STACK. + // Enable students to use any Greek letters as part of an answer. + + $greek = array(alpha,nu,beta,xi,gamma,omicron,delta,pi,epsilon,rho,zeta,sigma,eta,tau,theta,upsilon,iota,phi,kappa,chi,lambda,psi,mu,omega); + foreach ($greek as $gl) { + $gl = strtoupper($gl); + $sA .= ", '$gl' "; + } --- stackmaxima_5.12.0.bat DELETED --- Index: stacktex.lisp =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/stacktex.lisp,v retrieving revision 1.5 retrieving revision 1.5.6.1 diff -C2 -d -r1.5 -r1.5.6.1 *** stacktex.lisp 28 Oct 2009 14:03:07 -0000 1.5 --- stacktex.lisp 9 Nov 2010 16:51:37 -0000 1.5.6.1 *************** *** 1,13 **** ;; Customize Maxima's TEX() function. To give better control to the output. ! ;; Chris Sangwin 21 Jan 2009. ! ;; Useful files: ! ;; \Maxima-5.9.0\share\maxima\5.9.0\share\utils\mactex-utilities.lisp ! ;; \Maxima-5.9.0\share\maxima\5.9.0\src\mactex.lisp ;; Additional mactex utilities taken from the distributed file ;; mactex-utilities.lisp ! ;; Based on code by Richard J. Fateman, copyright 1987. ! ;; Fateman's code was ported to Common Lisp by William ! ;; Schelter. ;; If you want LaTeX style quotients, first load mactex and second --- 1,13 ---- ;; Customize Maxima's TEX() function. To give better control to the output. ! ;; Chris Sangwin 27 Sept 2010. ! ;; Useful files: ! ;; \Maxima-5.21.1\share\maxima\5.21.1\share\utils\mactex-utilities.lisp ! ;; \Maxima-5.21.1\share\maxima\5.21.1\src\mactex.lisp ;; Additional mactex utilities taken from the distributed file ;; mactex-utilities.lisp ! ;; Based on code by Richard J. Fateman, copyright 1987. ! ;; Fateman's code was ported to Common Lisp by William ! ;; Schelter. ;; If you want LaTeX style quotients, first load mactex and second *************** *** 39,46 **** (defun tex-matrix (x l r) ;; matrix looks like ((mmatrix)((mlist) a b) ...) ! (append l `("\\left[\\begin{array}{") (tex-matrix-col-count x "c") ; Replace every column with a "c" `("} ") ! ; Below is the bit we need - forms the array (mapcan #'(lambda(y) (tex-list (cdr y) nil (list " \\\\ ") " & ")) (cdr x)) '("\\end{array}\\right]") r) --- 39,46 ---- (defun tex-matrix (x l r) ;; matrix looks like ((mmatrix)((mlist) a b) ...) ! (append l `("\\left[\\begin{array}{") (tex-matrix-col-count x "c") ; Replace every column with a "c" `("} ") ! ; Below is the bit we need - forms the array (mapcan #'(lambda(y) (tex-list (cdr y) nil (list " \\\\ ") " & ")) (cdr x)) '("\\end{array}\\right]") r) *************** *** 62,68 **** (defun tex-prefix-unaryminus (x l r) ! (tex (cadr x) (append l (texsym (caar x))) r 'mparen 'mparen)) ! (defprop &? ("?") texsym) --- 62,70 ---- (defun tex-prefix-unaryminus (x l r) ! (tex (cadr x) (append l (texsym (caar x))) r (caar x) rop)) ! ! ! ;; Display question marks correctly (defprop &? ("?") texsym) *************** *** 141,142 **** --- 143,153 ---- ((eql (elt x 0) #\\) x) (t (concatenate 'string "\\mbox{" x "}")))) + + + ;; Sort out display on inequalitis + ;; Chris Sangwin, 21/9/2010 + + (defprop mlessp (" < ") texsym) + (defprop mgreaterp (" > ") texsym) + + --- stackmaxima_5.13.0.bat DELETED --- Index: unittests.mac =================================================================== RCS file: /cvsroot/stack/stack-dev/maxima/unittests.mac,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** unittests.mac 25 Sep 2009 17:22:37 -0000 1.11 --- unittests.mac 9 Nov 2010 16:51:37 -0000 1.11.8.1 *************** *** 18,21 **** --- 18,23 ---- )$ + UT('all_listp(real_numberp,[1,e^(%i*%pi),1+sqrt(2),sin(1)]),true)$ + UT('any_listp(real_numberp,[%i,1+%i,x+3,1+sqrt(-3)]),false)$ UT('expandp( (x-1)*(x+1)),false)$ *************** *** 23,26 **** --- 25,31 ---- UT('expandp( 2*x-1),true)$ UT('expandp( x-1),true)$ + UT('expandp( (p-1)*(p+1)),false)$ + UT('expandp( 2*(p-1)),false)$ + UT('expandp( 6*p+3*y),true)$ UT('factorp( x),true)$ *************** *** 158,160 **** --- 163,203 ---- UT('subst_equiv(x^2+y+v+u+w,a^2+b+y+v+w),[u=b,x=a]); + UT('exdowncase(X^2+X+1),x^2+x+1); + UT('exdowncase(X-x),0); /* Watch out for this case when using in anger! */ + UT('exdowncase(%pi),%pi); + + UT('stack_assignmentp(x=1),true); + UT('stack_assignmentp(x=sqrt(2)),true); + UT('stack_assignmentp(3=1),false); + UT('stack_assignmentp(d=v*t),false); + UT('stack_assignmentp(1=x),false); + + UT('stack_op(1),""); + UT('stack_op(x),""); + UT('stack_op(%pi),""); + UT('stack_op(3+z),"+"); + UT('stack_op(3*z),"*"); + UT('stack_op(3^z),"^"); + UT('stack_op(3/z),STACK_DIV_OP); + UT('stack_op(sin(3*z)),"sin"); + UT('stack_op((-1)/(x^2+1)),"/"); + UT('stack_op(1-x),"+"); + UT('stack_op(x-1),"+"); + UT('stack_op("-"(x-1)),"+"); + UT('stack_op("-"(1/(x^2+1))),STACK_DIV_OP); + UT('stack_op("-"(2*x)),"*"); + + UT('StackDISP(a/b,""),"\\frac{a}{b}"); + UT('StackDISP(-27,""),"-27"); + UT('StackDISP(-(x-1),""),"-\\left(x-1\\right)"); + UT('StackDISP(-sin(x^2),""),"-\\sin \\left( x^2 \\right)"); + UT('StackDISP(asin(x),""),"\\sin^{-1} \\left( x \\right)"); + UT('StackDISP(log(x),""),"\\ln \\left( x \\right)"); + + UT('strip_int_const(x+k,x),x); + UT('strip_int_const(x+1+k,x),x+1); + UT('strip_int_const((x-1)^2+k^2,x),(x-1)^2); + UT('strip_int_const((t-1)^4/4+c,x),(t-1)^4/4); + + |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:16
|
Update of /cvsroot/stack/stack-dev In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193 Modified Files: Tag: item_state_separation Readme.txt testsuite.php styles.css index.php Log Message: Brought back up to date with big HEAD merge. Index: styles.css =================================================================== RCS file: /cvsroot/stack/stack-dev/styles.css,v retrieving revision 1.38.8.1 retrieving revision 1.38.8.2 diff -C2 -d -r1.38.8.1 -r1.38.8.2 *** styles.css 2 Dec 2009 20:13:03 -0000 1.38.8.1 --- styles.css 9 Nov 2010 16:51:37 -0000 1.38.8.2 *************** *** 19,22 **** --- 19,23 ---- span.incorrect{ color: red; + background-color: transparent; } *************** *** 26,34 **** } ! /** Generic classes -------------------------------- */ img{ border:0; --- 27,50 ---- } ! .moreTags { ! display:none; ! } /** Generic classes -------------------------------- */ + body, table, td, th, li { + font-family:Arial,Verdana,Helvetica,sans-serif; + padding: 5px; + } + + a { + text-decoration: none; + } + + a:hover { + text-decoration: underline; + } + img{ border:0; *************** *** 221,225 **** padding: 0.4em; margin-bottom: 0.5em; ! margin-left: 140px; } h3.section{ --- 237,241 ---- padding: 0.4em; margin-bottom: 0.5em; ! margin-left: 180px; } h3.section{ *************** *** 257,272 **** } div.PRTTrue{ border: 1px solid #DDFFBA; padding: 0.25em; - margin-top: 1em; background-color: #efe; } div.PRTFalse{ border: 1px dotted #FFA19E; - padding: 0.25em; - margin-top: 1em; background-color: #fee; } --- 273,293 ---- } + div.PRTTrue, div.PRTFalse { + width: 48%; + padding: 0.25em; + margin-top: 1em; + } + div.PRTTrue{ border: 1px solid #DDFFBA; padding: 0.25em; background-color: #efe; + float:left; } div.PRTFalse{ border: 1px dotted #FFA19E; background-color: #fee; + float:right; } *************** *** 276,280 **** text-align: left; width: 95%; ! background-color: #fff; } --- 297,312 ---- text-align: left; width: 95%; ! border: 0; ! } ! ! .interactionElementsTable td, .interactionElementsTable th { ! border-color: #000000; ! border-width: 0 0 0 1px; ! padding: 3px; ! } ! ! .IElabel { ! border:0 none; ! text-align: right; } *************** *** 319,322 **** --- 351,369 ---- } + div.authorMath { + background-color:#FFFFFF; + border:1px dashed; + clear:left; + float:none; + padding:0.2em; + width:505px; + display: none; + } + + div#authoringVersionID { + float:right; + font-size:small; + } + div#authoringControls { background-color:#EEEEEE; *************** *** 324,335 **** padding:5px; position:fixed; ! width:120px; } div#authoringControls input { ! width: 110px; margin: 1px 5px; } /* Tables --------------------------------------------------------------*/ --- 371,386 ---- padding:5px; position:fixed; ! width:160px; } div#authoringControls input { ! width: 100px; margin: 1px 5px; } + div#authoringControls ul { + + } + /* Tables --------------------------------------------------------------*/ *************** *** 348,351 **** --- 399,411 ---- } + #questionListTable { + border-collapse: collapse; + border-spacing: 0; + } + + #questionListTable th { + background-image: url('pix/gradient.jpg') + } + .reportTable{ text-align: left; *************** *** 374,377 **** --- 434,441 ---- } + td { + vertical-align: top; + } + /* Lists ------------------------------------------------------------------*/ Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-dev/index.php,v retrieving revision 1.38 retrieving revision 1.38.8.1 diff -C2 -d -r1.38 -r1.38.8.1 *** index.php 20 Oct 2009 15:12:45 -0000 1.38 --- index.php 9 Nov 2010 16:51:37 -0000 1.38.8.1 *************** *** 57,169 **** } } ! ! switch($_POST['Submit']) ! { ! case get_string('stackQuestionList_delete','stack'): //delete ! if(!empty($selected)) ! { ! $msg .= '<h3 class="section">'.get_string('FE_confirmDelete','stack').'</h3>'; ! $msg .= '<p>'.get_string('FE_deleteMsg','stack',count($selected)).'</p>'; ! $msg .= '<p><form action="index.php" method="POST"> ! <input type="Submit" name="Submit" value="'.get_string('FE_yesDelete','stack').'" /> ! <input type="Submit" name="Submit" value="'.get_string('FE_noCancel','stack').'" />'; ! foreach($selected as $qid) ! { ! $msg .= '<input type="hidden" name="'.$qid.'" value="selected" />'; ! } ! $msg .= '</form></p>'; ! } ! break; ! case get_string('FE_yesDelete','stack'): ! foreach($selected as $name) ! { ! $db->removeItem($name); ! } ! $msg = '<p>'.get_string('FE_qDeleted','stack').'</p>'; ! break; ! case get_string('stackQuestionList_export','stack'): //export ! if(!empty($selected)) ! { ! foreach($selected as $name) ! { ! $export[] = $name; ! } ! $batch = new ExportStackTwoBatch($export); ! $result = $batch->exportItems(); ! } ! break; ! case get_string('stackQuestionList_validate','stack'): //validate ! if(!empty($selected)) ! { ! $execTime = ini_get('max_execution_time'); ! $start = time(); ! $toValidate = count($selected); ! $validated = 0; ! $failedValidation = 0; ! $i = 0; ! while((time() - $start) < ($execTime - 10) && ($i < $toValidate)) // leaving 10 seconds to spare to display list of questions ! { ! $item = new Item(NULL, $selected[$i]); ! if($item->valid == false) ! { ! $item->validateQuestion(); ! $item->store(); ! if($item->valid == false) ! { ! $failedValidation++; ! } ! //$validated++; ! } ! $validated++; ! $i++; ! } ! //echo 'Elapsed: '.(time() - $start).'<br />'; ! //echo $validated.' of '.$toValidate.' questions validated.<br />'; ! } ! break; ! case get_string('stackQuestionList_updateStatus','stack'): //update status ! if(!empty($selected)) ! { ! foreach($selected as $id) ! { ! //the question status is stored in the item object and a db field - so we can't just update the db. ! $item = new Item(NULL, $id); ! $item->published->setSelection($_POST['publishedStatus']); ! $item->store(); ! } ! } ! break; ! case get_string('stackQuestionList_Deploy','stack'): //Deploy each of the selected. ! if(!empty($selected)) ! { ! foreach($selected as $id) ! { ! $deployment = new Deployment($id); ! if ($deployment->isSingleton()) { ! if($deployment->autoDeployed) { // single version, not deployed ! $msg .= get_string('FE_deployQuestion_auto', 'stack').' '.$id.'<br />'; ! } else { ! $msg .= $id.': '.get_string('FE_deployQuestion_norand', 'stack').'<br />'; ! } ! } else { ! $post = array('add'=>$_POST['nodeploy']); ! $deployment->processOperations($post); ! $msg .= $id.': '. get_string('FE_deployQuestion_adding', 'stack', $_POST['nodeploy']).'<br />'; ! } ! } ! } ! break; } } --- 57,170 ---- } } ! if(isset($_POST['Submit'])) { ! switch($_POST['Submit']) ! { ! case get_string('stackQuestionList_delete','stack'): //delete ! if(!empty($selected)) ! { ! $msg .= '<h3 class="section">'.get_string('FE_confirmDelete','stack').'</h3>'; ! $msg .= '<p>'.get_string('FE_deleteMsg','stack',count($selected)).'</p>'; ! $msg .= '<p><form action="index.php" method="POST"> ! <input type="Submit" name="Submit" value="'.get_string('FE_yesDelete','stack').'" /> ! <input type="Submit" name="Submit" value="'.get_string('FE_noCancel','stack').'" />'; ! foreach($selected as $qid) ! { ! $msg .= '<input type="hidden" name="'.$qid.'" value="selected" />'; ! } ! $msg .= '</form></p>'; ! } ! break; ! case get_string('FE_yesDelete','stack'): ! foreach($selected as $name) ! { ! $db->removeLineContainingItem($name); ! } ! $msg = '<p>'.get_string('FE_qDeleted','stack').'</p>'; ! break; ! case get_string('stackQuestionList_export','stack'): //export ! if(!empty($selected)) ! { ! foreach($selected as $name) ! { ! $export[] = $name; ! } ! $batch = new ExportStackTwoBatch($export); ! $result = $batch->exportItems(); ! } ! break; ! case get_string('stackQuestionList_validate','stack'): //validate ! if(!empty($selected)) ! { ! $execTime = ini_get('max_execution_time'); ! $start = time(); ! $toValidate = count($selected); ! $validated = 0; ! $failedValidation = 0; ! $i = 0; ! while((time() - $start) < ($execTime - 10) && ($i < $toValidate)) // leaving 10 seconds to spare to display list of questions ! { ! $item = new Item(NULL, $selected[$i]); ! if($item->valid == false) ! { ! $item->validateQuestion(); ! $item->store(); ! if($item->valid == false) ! { ! $failedValidation++; ! } ! //$validated++; ! } ! $validated++; ! $i++; ! } ! //echo 'Elapsed: '.(time() - $start).'<br />'; ! //echo $validated.' of '.$toValidate.' questions validated.<br />'; ! } ! break; ! case get_string('stackQuestionList_updateStatus','stack'): //update status ! if(!empty($selected)) ! { ! foreach($selected as $id) ! { ! //the question status is stored in the item object and a db field - so we can't just update the db. ! $item = new Item(NULL, $id); ! $item->published->setSelection($_POST['publishedStatus']); ! $item->store(); ! } ! } ! break; ! case get_string('stackQuestionList_Deploy','stack'): //Deploy each of the selected. ! if(!empty($selected)) ! { ! foreach($selected as $id) ! { ! $deployment = new Deployment($id); ! if ($deployment->isSingleton()) { ! if($deployment->autoDeployed) { // single version, not deployed ! $msg .= get_string('FE_deployQuestion_auto', 'stack').' '.$id.'<br />'; ! } else { ! $msg .= $id.': '.get_string('FE_deployQuestion_norand', 'stack').'<br />'; ! } ! } else { ! $post = array('add'=>$_POST['nodeploy']); ! $deployment->processOperations($post); ! $msg .= $id.': '. get_string('FE_deployQuestion_adding', 'stack', $_POST['nodeploy']).'<br />'; ! } ! } ! } ! break; ! } } } *************** *** 180,198 **** <body> ! <div class="section80"> ! <h3 class="section">Administrate STACK</h3> ! <ul class="horizontal"> ! <li><a href="lib/ui/authorTest.php"><?php echo get_string('FE_index_New','stack','') ?></a></li> ! <li><a href="lib/ui/questionImporter.php"><?php echo get_string('FE_index_Import','stack','') ?></a></li> ! <li><a href="chat.php"><?php echo get_string('FE_index_Chat','stack','') ?></a></li> ! <li><a href="lib/ui/search.php"><?php echo get_string('FE_index_search','stack','') ?></a></li> ! <li><a href="lib/ui/report.php"><?php echo get_string('FE_index_Reports','stack','') ?></a></li> ! <li><a href="lib/ui/OptionsEdit.php"><?php echo get_string('FE_index_Options','stack','') ?></a></li> ! <li><a href="http://stack.bham.ac.uk/wiki/"><?php echo get_string('FE_index_Docs','stack','') ?></a></li> ! <li><a href="testsuite.php"><?php echo get_string('FE_index_Test','stack','') ?></a></li> ! <li><a href="<?php echo $hintroot;?>"><?php echo get_string('FE_index_Hints','stack','') ?></a></li> ! <li><a href="index.php?action=logout"><?php echo get_string('FE_index_Logout','stack','') ?></a></li> ! </ul> ! </div> <?php --- 181,194 ---- <body> ! <a href="lib/ui/authorTest.php"><?php echo get_string('FE_index_New','stack','') ?></a> | ! <a href="lib/ui/questionImporter.php"><?php echo get_string('FE_index_Import','stack','') ?></a> | ! <a href="chat.php"><?php echo get_string('FE_index_Chat','stack','') ?></a> | ! <a href="lib/ui/search.php"><?php echo get_string('FE_index_search','stack','') ?></a> | ! <a href="lib/ui/report.php"><?php echo get_string('FE_index_Reports','stack','') ?></a> | ! <a href="lib/ui/OptionsEdit.php"><?php echo get_string('FE_index_Options','stack','') ?></a> | ! <a href="http://stack.bham.ac.uk/wiki/"><?php echo get_string('FE_index_Docs','stack','') ?></a> | ! <a href="testsuite.php"><?php echo get_string('FE_index_Test','stack','') ?></a> | ! <a href="<?php echo $hintroot;?>"><?php echo get_string('FE_index_Hints','stack','') ?></a> | ! <a href="index.php?action=logout"><?php echo get_string('FE_index_Logout','stack','') ?></a> <?php *************** *** 209,213 **** $question_bank_filter = stack_questionbank_filter_get(); ! if($result != NULL) { if($result == false) --- 205,209 ---- $question_bank_filter = stack_questionbank_filter_get(); ! if(isset($result)) { if($result == false) *************** *** 242,263 **** <?php echo '<h3>'.get_string('stackQuestion_filterQuestions','stack','').'</h3>'; ! echo '<p>'.get_string('stackQuestion_filterSearch','stack','').'</p>'; $db = new StackDBItem(); $db->connect(); ! $filter=array('order1'=>'','order2'=>'','order2'=>''); ! if (array_key_exists('bank_filter',$_POST)) { ! $filter['order1']=$_POST['bank_filter']['order1']; ! $filter['order2']=$_POST['bank_filter']['order2']; ! $filter['order3']=$_POST['bank_filter']['order3']; ! } ! $questions = $db->getListOfQuestions(NULL,true,$filter); ! $no_question = 0; if(!empty($questions)) { ! echo "\n<form name='questionsform' action='index.php' method='POST'>\n"; /************************************************************************************/ --- 238,266 ---- <?php echo '<h3>'.get_string('stackQuestion_filterQuestions','stack','').'</h3>'; ! //echo '<p>'.get_string('stackQuestion_filterSearch','stack','').'</p>'; $db = new StackDBItem(); $db->connect(); + // get question list ! $filter=array('order1'=>'','order2'=>'','order2'=>''); ! if (array_key_exists('bank_filter',$_POST)) { ! $filter['order1']=$_POST['bank_filter']['order1']; ! $filter['order2']=$_POST['bank_filter']['order2']; ! $filter['order3']=$_POST['bank_filter']['order3']; ! } ! ! $questions = $db->getListOfQuestions(NULL,true,$filter); ! ! // link all keywords ! $kwdb = new StackDBKeywords(); ! $kwdb->connect(); ! // need to sort alphnumerically whilst still respecting case (for now) ! $all_keywords = $kwdb->getAllKeywords(true); if(!empty($questions)) { ! /************************************************************************************/ *************** *** 269,323 **** /************************************************************************************/ ! echo '<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="0">'; stack_questionBank_filter_tablehead($question_bank_filter); ! echo '<tr><td></td>'; ! $fields = array('ID','Name','Description','Valid', 'Status', 'Published','DateLastEdited','NoDeployed'); foreach($fields as $key) { $val = get_string('stackQuestion_question'.$key,'stack',''); echo "<th scope='column'>$val</th>"; } ! echo '<td> </td><td> </td><td> </td></tr>'; for($i=0; $i < count($questions); $i++) { ! if (stack_questionBank_filter_display_question($question_bank_filter,$questions[$i])) { ! echo '<tr> ! <td><input type="checkbox" name="'.$questions[$i]['id'].'" value="selected" /></td> ! <td>'.$questions[$i]['id'].'</td> ! <td>'.$questions[$i]['questionName'].'</td> ! <td>'.$questions[$i]['questionDescription'].'</td> ! <td>'.$questions[$i]['valid'].'</td> ! <td>'.$questions[$i]['status'].'</td> ! <td>'.get_string('stackMetaData_published'.$questions[$i]['published'], 'stack').'</td> ! <td>'.$questions[$i]['questionDateLastEdited'].'</td> <td>'.$questions[$i]['nodeployed'].'</td>'; if($questions[$i]['valid'] == 1) { ! echo '<td><a href="lib/ui/questionTest.php?id='.$questions[$i]['id'].'">'.get_string('stackQuestion_filterLinkTry','stack').'</a></td>'; } else { ! echo '<td>'.get_string('stackQuestion_filterLinkTry', 'stack').'</td>'; } - echo '<td><a href="lib/ui/authorTest.php?id='.$questions[$i]['id'].'">'.get_string('stackQuestion_filterLinkEdit','stack').'</a></td>'; - echo '<td><a href="lib/ui/questionDeploy.php?id='.$questions[$i]['id'].'">'.get_string('stackQuestion_filterLinkDeploy','stack').'</a></td>'; - - echo '<td><a href="lib/ui/questionExporter.php?id='.$questions[$i]['id'].'">'.get_string('stackQuestion_filterLinkXML','stack').'</a></td>'; ! echo '</tr>'; ! $no_questions +=1; } } echo "\n</table>\n\n"; ! echo '(# = '.$no_questions.') <input type="radio" name="selectall" onclick="selectAll(this.form,0);" />'.get_string('stackSelectAll','stack').'<input type="radio" name="selectall" onclick="selectAll(this.form,1);" />'.get_string('stackInvertSelection','stack'); echo '<h4>'.get_string('stackQuestion_filterWithSelected','stack','').'</h4>'; $trans_sub = get_string('stackQuestion_filterExportToXML','stack'); --- 272,372 ---- /************************************************************************************/ ! echo "\n<form name='questionsform' action='index.php' method='POST'>\n"; + echo '<table>'; stack_questionBank_filter_tablehead($question_bank_filter); + echo '</table>'; ! echo '<table id="questionListTable">'; ! echo '<tr><th></th>'; ! $fields = array('Header','Valid', 'Status', 'Published','DateLastEdited','NoDeployed'); foreach($fields as $key) { $val = get_string('stackQuestion_question'.$key,'stack',''); echo "<th scope='column'>$val</th>"; } + echo '<th nowrap>'.get_string('stackQuestion_questionActions','stack','').'</th>'; + echo '<td></td></tr>'; ! $kwdb = new StackDBKeywords(); ! $kwdb->connect(); + $no_displayed=0; for($i=0; $i < count($questions); $i++) { ! $keywords = $kwdb->getQuestionsKeywords($questions[$i]['id']); ! if (stack_questionBank_filter_display_question($question_bank_filter,$questions[$i],$keywords)) { ! $no_displayed++; ! ! if($i % 2 == 0) echo '<tr class="even">'; ! else echo '<tr class="odd">'; ! echo '<td><input type="checkbox" name="'.$questions[$i]['id'].'" value="selected" /></td> ! <td><b>'.$questions[$i]['questionName'].'</b> (v.'.$questions[$i]['id'].'): </b>'.$questions[$i]['questionDescription']; ! ! if(!empty($keywords)) { ! echo '<br /><small>'; ! asort($keywords); ! $firstKeyword = true; ! foreach($keywords as $keyword) { ! if(!$firstKeyword) { ! echo ', '; ! } else $firstKeyword = false; ! $kwLink = "<a href='?tagged=$keyword'>".$keyword."</a>"; ! echo $kwLink; ! } ! echo '</small>'; ! } ! echo '</td><td style="text-align: center">'; ! if($questions[$i]['valid'] == 1) ! { ! echo '<img alt="1" src="pix/correct.png" />'; ! } ! else ! { ! echo '<img alt="0" src="pix/incorrect.png" />'; ! } ! echo '</td><td>'.$questions[$i]['status'].'</td>'; ! ! $val = $questions[$i]['published']; ! $aval = get_string('stackMetaData_published'.$questions[$i]['published'], 'stack'); ! echo '<td><img src="'.$config->get('webroot').'/pix/'.$val.'.png" alt="'.$aval.'" /></td>'; ! ! echo '<td>'.$questions[$i]['questionDateLastEdited'].'</td> <td>'.$questions[$i]['nodeployed'].'</td>'; + echo '<td nowrap>'; + echo '<a href="lib/ui/authorTest.php?id='.$questions[$i]['id'].'"><img src="'.$config->get('webroot').'/pix/pencil.png" title="'.get_string('stackIcon_edit','stack').'" alt="'.get_string('stackIcon_edit','stack').'" />'; if($questions[$i]['valid'] == 1) { ! echo '<a href="lib/ui/questionTest.php?id='.$questions[$i]['id'].'"><img src="'.$config->get('webroot').'/pix/eye.png" title="'.get_string('stackIcon_try','stack').'" alt="'.get_string('stackIcon_try','stack').'" /></a> '; } else { ! echo '<a href="lib/ui/questionTest.php?id='.$questions[$i]['id'].'"><img src="'.$config->get('webroot').'/pix/eye.png" title="'.get_string('stackIcon_try','stack').'" alt="'.get_string('stackIcon_try','stack').'" /></a> '; ! //echo get_string('stackQuestion_filterLinkTry', 'stack'); ! } ! if($questions[$i]['valid'] == 1) ! { ! echo ' <a href="lib/ui/questionDeploy.php?id='.$questions[$i]['id'].'"><img src="'.$config->get('webroot').'/pix/arrow_out.png" title="'.get_string('stackIcon_deploy','stack').'" alt="'.get_string('stackIcon_deploy','stack').'" /></a>'; ! } ! else ! { ! echo ' <img src="'.$config->get('webroot').'/pix/transparent16x16.gif" />'; ! //echo get_string('stackQuestion_filterLinkDeploy','stack'); } ! echo ' <a href="lib/ui/questionExporter.php?id='.$questions[$i]['id'].'"><img src="'.$config->get('webroot').'/pix/disk.png" title="'.get_string('stackIcon_xml','stack').'" alt="'.get_string('stackIcon_xml','stack').'" /></a>'; ! echo '</td></tr>'; } } echo "\n</table>\n\n"; ! ! echo '<br />'.$no_displayed.' ('.count($questions).') '.get_string('FE_index_question(s)', 'stack').'. '; ! ! echo ' <input type="radio" name="selectall" onclick="selectAll(this.form,0);" />'.get_string('stackSelectAll','stack').'<input type="radio" name="selectall" onclick="selectAll(this.form,1);" />'.get_string('stackInvertSelection','stack'); echo '<h4>'.get_string('stackQuestion_filterWithSelected','stack','').'</h4>'; $trans_sub = get_string('stackQuestion_filterExportToXML','stack'); *************** *** 334,337 **** --- 383,394 ---- echo '<input type="submit" name="Submit" value="'.get_string('stackQuestionList_Deploy','stack').'" class="stackbutton" /></span>'; echo "\n</form>\n"; + + echo '<table>'; + echo '<tr><th></th><th>'.get_string('stackQuestion_questionActions','stack','').'</th><th width="20"></th><th></th><th>'.get_string('stackQuestion_questionPublished','stack','').'</th></tr>'; + echo '<tr><td><img src="'.$config->get('webroot').'/pix/pencil.png" alt="'.get_string('stackQuestion_filterLinkEdit','stack').'" /></td> <td>'.get_string('stackQuestion_filterLinkEdit', 'stack').'</td><td></td><td><img src="'.$config->get('webroot').'/pix/Unpublished.png" alt="'.get_string('stackMetaData_publishedUnpublished', 'stack').'" /></td> <td>'.get_string('stackMetaData_publishedUnpublished', 'stack').'</td></tr>'; + echo '<tr><td><img src="'.$config->get('webroot').'/pix/eye.png" alt="'.get_string('stackIcon_try','stack').'" /></td> <td>'.get_string('stackQuestion_filterLinkTry', 'stack').'</td><td></td><td><img src="'.$config->get('webroot').'/pix/Published.png" alt="'.get_string('stackMetaData_publishedPublished', 'stack').'" /></td> <td>'.get_string('stackMetaData_publishedPublished', 'stack').'</td></tr>'; + echo '<tr><td><img src="'.$config->get('webroot').'/pix/arrow_out.png" alt="'.get_string('stackQuestion_filterLinkDeploy','stack').'" /></td> <td>'.get_string('stackQuestion_filterLinkDeploy', 'stack').'</td><td></td><td><img src="'.$config->get('webroot').'/pix/Private.png" alt="'.get_string('stackMetaData_publishedPrivate', 'stack').'" /></td> <td>'.get_string('stackMetaData_publishedPrivate', 'stack').'</td></tr>'; + echo '<tr><td><img src="'.$config->get('webroot').'/pix/disk.png" alt="'.get_string('stackQuestion_filterLinkXML','stack').'" /></td> <td>'.get_string('stackQuestion_filterLinkXML', 'stack').'</td></tr>'; + echo '</table>'; } else Index: Readme.txt =================================================================== RCS file: /cvsroot/stack/stack-dev/Readme.txt,v retrieving revision 1.4 retrieving revision 1.4.16.1 diff -C2 -d -r1.4 -r1.4.16.1 *** Readme.txt 3 Nov 2008 16:34:45 -0000 1.4 --- Readme.txt 9 Nov 2010 16:51:37 -0000 1.4.16.1 *************** *** 77,79 **** ------------- ! 2.0: 3rd October 2007, initial Alpha release. --- 77,79 ---- ------------- ! 2.0: 3rd October 2007, initial Alpha release. \ No newline at end of file Index: testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-dev/testsuite.php,v retrieving revision 1.5 retrieving revision 1.5.10.1 diff -C2 -d -r1.5 -r1.5.10.1 *** testsuite.php 20 Jul 2009 10:23:37 -0000 1.5 --- testsuite.php 9 Nov 2010 16:51:37 -0000 1.5.10.1 *************** *** 39,43 **** <div class="section80"> ! <p><?php echo get_string('stackTestsuite_installedVersion','stack').$config->get("version"); ?></p> <h3 class="section80"><?php echo get_string('stackTestsuite_subtitle','stack'); ?></h3> --- 39,45 ---- <div class="section80"> ! <p><?php ! ! echo get_string('stackTestsuite_installedVersion','stack').$config->get("version").' (Maxima '.$config->getCas('version').', '.$config->get('platform').')'; ?></p> <h3 class="section80"><?php echo get_string('stackTestsuite_subtitle','stack'); ?></h3> |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:15
|
Update of /cvsroot/stack/stack-dev/opaque/moodleModule/stack In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/opaque/moodleModule/stack Modified Files: Tag: item_state_separation block_stack.php Log Message: Brought back up to date with big HEAD merge. Index: block_stack.php =================================================================== RCS file: /cvsroot/stack/stack-dev/opaque/moodleModule/stack/block_stack.php,v retrieving revision 1.8 retrieving revision 1.8.10.1 diff -C2 -d -r1.8 -r1.8.10.1 *** block_stack.php 23 Jun 2009 16:18:28 -0000 1.8 --- block_stack.php 9 Nov 2010 16:51:37 -0000 1.8.10.1 *************** *** 67,70 **** --- 67,76 ---- $this->content->icons[] = '<img src="'.$root.'/pix/i/switch.gif" class="icon" alt="Edit Question Options" />'; } + /* + if (has_capability('moodle/question:viewmine', $context)) { + $this->content->items[] = '<a href="'.$root.'/question/type/opaque/stack/soapPage.php?page=diagnostic">'.get_string('diagnostic', 'block_stack').'</a>'; + $this->content->icons[] = '<img src="'.$root.'/pix/i/outcomes.gif" class="icon" alt="Diagnostic Report" />'; + } + */ } else *************** *** 86,88 **** } ! ?> --- 92,94 ---- } ! ?> \ No newline at end of file |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:15
|
Update of /cvsroot/stack/stack-dev/lib/database In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/database Modified Files: Tag: item_state_separation devCache.php StackDBItem.php StackDBAttemptPRTMeta.php StackDBBackup.php StackDBUser.php StackDB.php StackDBADOdb.php MoodleDB.php StackDBMySQL.php StackDBKeywords.php StackDBReporting.php StackDBCache.php Log Message: Brought back up to date with big HEAD merge. Index: MoodleDB.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/MoodleDB.php,v retrieving revision 1.14 retrieving revision 1.14.8.1 diff -C2 -d -r1.14 -r1.14.8.1 *** MoodleDB.php 27 Aug 2009 16:23:00 -0000 1.14 --- MoodleDB.php 9 Nov 2010 16:51:35 -0000 1.14.8.1 *************** *** 70,78 **** public function batchAdd($questions, $userID, $engineID, $category='1') { if(!empty($questions)) { foreach($questions as $question) { ! $result = $this->addQuestion($question, $userID, $engineID, $category); if($result == false) --- 70,79 ---- public function batchAdd($questions, $userID, $engineID, $category='1') { + $this->logger->debug("busy: $questions, $userID, $engineID, $category"); if(!empty($questions)) { foreach($questions as $question) { ! $result = $this->addQuestion($question, NULL, $userID, $engineID, $category); // line is unchanged if($result == false) *************** *** 106,118 **** * @return bool $return true if successful */ ! public function addQuestion($stackID, $userID, $engineID, $category='1') { global $config; $moodleEnabled = $config->getMoodle('enabled'); if(($moodleEnabled == 'true') && ($engineID != NULL)) //if moodle config is setup { //load up the question from the stack db & grab its name, grade & guid. ! $item = new Item(NULL, $stackID); $itemName = $item->questionName->getSelection(); --- 107,120 ---- * @return bool $return true if successful */ ! public function addQuestion($id, $line, $userID, $engineID, $category='1') { global $config; $moodleEnabled = $config->getMoodle('enabled'); + $this->logger->debug("mycat:".$category." and userid:".$userID); if(($moodleEnabled == 'true') && ($engineID != NULL)) //if moodle config is setup { //load up the question from the stack db & grab its name, grade & guid. ! $item = new Item(NULL, $id); $itemName = $item->questionName->getSelection(); *************** *** 134,144 **** //check whether the question is already in the moodle question bank. ! $inQBank = $this->inMoodleQuestionBank($stackID, $engineID); if($inQBank === false) { //add the question ! return $this->newQuestion($engineID, $userID, $category, $itemID, $itemName, $itemMaxMark, $itemGUID); } else { //update the question(s) return $this->updateQuestion($inQBank, $engineID, $userID, $category, $itemID, $itemName, $itemMaxMark, $itemGUID); } --- 136,148 ---- //check whether the question is already in the moodle question bank. ! $inQBank = $this->inMoodleQuestionBank($id, $engineID); if($inQBank === false) { + $this->logger->debug("New question"); //add the question ! return $this->newQuestion($engineID, $userID, $category, $itemID, $line, $itemName, $itemMaxMark, $itemGUID); } else { //update the question(s) + $this->logger->debug("Updating question in $inQBank"); return $this->updateQuestion($inQBank, $engineID, $userID, $category, $itemID, $itemName, $itemMaxMark, $itemGUID); } *************** *** 152,156 **** /** ! * Updates a question already in the moodle question bank * * @param int $qID moodle's question id --- 156,160 ---- /** ! * Updates a question already in the moodle question bank. * * @param int $qID moodle's question id *************** *** 163,167 **** protected function updateQuestion($qID, $engineID, $userID, $category, $stackID, $qName, $qMaxMark, $qGUID) { ! $this->logger->finer("Updating item $stackID to Moodles database"); global $config; $prefix = $config->getMoodle('prefix'); --- 167,172 ---- protected function updateQuestion($qID, $engineID, $userID, $category, $stackID, $qName, $qMaxMark, $qGUID) { ! $this->logger->debug("Updating item $stackID to Moodles database"); ! global $config; $prefix = $config->getMoodle('prefix'); *************** *** 188,191 **** --- 193,208 ---- $result = false; } + + $sql = "UPDATE {$prefix}question_opaque SET + remoteid = ".$this->dbSafeString('q'.$stackID).", + WHERE questionid = $id"; + + $result = $this->query($sql); + if(!$result){ + $this->logger->error("Failed to add the question to the opaque_questions table"); + } + else{ + $this->logger->finer("Added to opaque_questions table"); + } } return true; *************** *** 203,210 **** * @return bool */ ! protected function newQuestion($engineID, $userID, $category, $stackID, $qName, $qMaxMark, $qGUID) { ! $this->logger->finer("Adding item $stackID to Moodles database"); ! $stackID = 'q'.$stackID; global $config; $prefix = $config->getMoodle('prefix'); --- 220,231 ---- * @return bool */ ! protected function newQuestion($engineID, $userID, $category, $versionID, $lineID, $qName, $qMaxMark, $qGUID) { ! if($lineID == NULL) $lineID = 12345; ! ! $this->logger->debug("Adding item $versionID (line $lineID) to Moodles database by user: $userID"); ! ! ! global $config; $prefix = $config->getMoodle('prefix'); *************** *** 235,239 **** $category, 0, ".$this->dbSafeString($qName)." , ".$this->dbSafeString('').", 0, ".$this->dbSafeString('').", ".$this->dbSafeString('').", $qMaxMark, 0,".$this->dbSafeString(QTYPE).", 1, ".$this->dbSafeString($qGUID).", ".$this->dbSafeString($timestamp).", 0, $timestamp, $timestamp, $userID );"; ! $this->connectMoodleDB(); $added = $this->query($sql); --- 256,260 ---- $category, 0, ".$this->dbSafeString($qName)." , ".$this->dbSafeString('').", 0, ".$this->dbSafeString('').", ".$this->dbSafeString('').", $qMaxMark, 0,".$this->dbSafeString(QTYPE).", 1, ".$this->dbSafeString($qGUID).", ".$this->dbSafeString($timestamp).", 0, $timestamp, $timestamp, $userID );"; ! $this->logger->finer("trying adding to moodle question bank with sql: $sql"); $this->connectMoodleDB(); $added = $this->query($sql); *************** *** 253,257 **** remoteversion ) ! VALUES ( $qid, $engineID, ".$this->dbSafeString($stackID).", ".$this->dbSafeString('1.0').");"; $result = $this->query($sql); --- 274,278 ---- remoteversion ) ! VALUES ( $qid, $engineID, ".$this->dbSafeString('q'.$versionID).", ".$this->dbSafeString($lineID.'.'.$versionID).");"; // some redundancy for now until versioning get more sophisticated, e.g. with milestones $result = $this->query($sql); *************** *** 312,315 **** --- 333,372 ---- } + /** + * Attempts to remove a stack question from moodle's question bank. Return success status. + * + * @param int $engineID Opaque engine id + * @param int $stackID The id of the question on stack. + * @access public + * @return bool + */ + public function hideQuestion($stackID, $engineID) + { + $this->logger->debug("attempting to hide stack question $stackID on engine $engineID"); + // find moodle question id + $moodleQuestions = $this->inMoodleQuestionBank($stackID, $engineID); // an array + + if(empty($moodleQuestions)) { + $this->logger->debug("STACK question $stackID does not appear to be in Moodle question bank"); + return false; + } + + // remove, i.e. set hidden flag to 1 + if(count($moodleQuestions) > 1) { + $where = "id IN (".implode($moodleQuestions).")"; //multiple questions + } + else { + $where = "id = ".$moodleQuestions[0]; // single question + } + + $sql = "UPDATE {$prefix}question SET hidden=1 WHERE ".$where; + + $this->connect(); + $result = $this->query($sql); + + $this->logger->debug("Query ".$sql."\n\n Returned".print_r($result,true)); + //$no = $this->noRows(); + } + /** * Recursively checks for child question categories, returning an array of sub categories. *************** *** 466,470 **** if($categories[$i]['id'] == $selected) { ! $xhtml .= '<option value="'.$categories[$i]['id'].'" selected>'.$categories[$i]['name'].'</option>'; } else --- 523,527 ---- if($categories[$i]['id'] == $selected) { ! $xhtml .= '<option value="'.$categories[$i]['id'].'" selected="">'.$categories[$i]['name'].'</option>'; } else *************** *** 594,597 **** --- 651,765 ---- } } + + /** + * PROBABLY NOT NEEDED + * Return an mapping from the quizzes the student has taken to the attempts made. + * @access public + * @param int $student + * @return array $attempts + */ + public function getQuizAttempts($student, $course = NULL) { + global $config; + $prefix = $config->getMoodle('prefix'); + if(NULL == $course) { // irrespective of course + $sql = "SELECT quiz, {$prefix}quiz_attempts.id FROM {$prefix}quiz_attempts WHERE userid = ".$this->dbSafeString($student); + } else { // course specific + $sql = "SELECT quiz, {$prefix}quiz_attempts.id FROM {$prefix}quiz_attempts, {$prefix}quiz " . + "WHERE userid = ".$this->dbSafeString($student). + " AND course =".$this->dbSafeString($course). + " AND {$prefix}quiz.id = quiz"; + } + //$this->logger->debug($sql); + $result = $this->query($sql); + $attempts = NULL; + if($result) { + for($i = 0; $i < $this->noRows(); $i++) { + $attempts[$this->result($i, 'quiz')][] = $this->result($i, 'id'); // NOT result($i, 'attempt')! + } + } + return $attempts; + } + + /** + * Return an mapping from the questions the student has attempted to the attempt. + * @access public + * @param int $student + * @return array $attempts + */ + public function getQuestionAttempts($student, $course = NULL) { + global $config; + $prefix = $config->getMoodle('prefix'); + if(NULL == $course) { // irrespective of course + $sql = "SELECT quiz, {$prefix}quiz_attempts.id FROM {$prefix}quiz_attempts WHERE userid = ".$this->dbSafeString($student); + } else { // course specific + $sql = "SELECT quiz, {$prefix}quiz_attempts.id FROM {$prefix}quiz_attempts, {$prefix}quiz " . + "WHERE userid = ".$this->dbSafeString($student). + " AND course =".$this->dbSafeString($course). + " AND {$prefix}quiz.id = quiz"; + } + //$this->logger->debug($sql); + $result = $this->query($sql); + $attempts = NULL; + if($result) { + for($i = 0; $i < $this->noRows(); $i++) { + $attempts[$this->result($i, 'quiz')][] = $this->result($i, 'id'); // NOT result($i, 'attempt')! + } + } + return $attempts; + } + + /** + * Return all the responses from the student for the given attempt, in order, as well as (Moodle) question id + * @access public + * @param int $attempt + * @return array $responses + */ + public function getQuestionAttemptResponses($attempt) { + global $config; + $prefix = $config->getMoodle('prefix'); + + $sql = "SELECT seq_number, answer, event, question, remoteid" . + " FROM {$prefix}question_states, {$prefix}question_opaque" . + " WHERE attempt = ".$this->dbSafeString($attempt). + " AND {$prefix}question_opaque.questionid = {$prefix}question_states.question". + " ORDER BY seq_number"; + + $result = $this->query($sql); + // $responses = NULL; + if($result) { + for($i = 0; $i < $this->noRows(); $i++) { + $q = $this->result($i, 'question'); + $s = $this->result($i, 'seq_number'); + $return[$q]['version'] = substr($this->result($i, 'remoteid'), 1); // strip off 'q' + $return[$q][$s]['answer'] = $this->result($i, 'answer'); + $return[$q][$s]['event'] = $this->result($i, 'event'); + } + } + return $return; + } + + /** + * Returns the number of attempts on an STACK question + * @access public + * @param int $id + * @return int + */ + public function attemptsOnQuestion($id) { + global $config; + $prefix = $config->getMoodle('prefix'); + + $id = 'q'.$id; + $sql = "SELECT * FROM {$prefix}question_states, {$prefix}question_opaque " . + "WHERE question = questionid " . + "AND remoteid = ".$this->dbSafeString($id); + + $sql = "SELECT * FROM {$prefix}question_states";// test + $result = $this->query($sql); + $n = $this->noRows(); + //return $n; + //return $this->noRows(); + if($this->noRows() === false) return "noRows() === false for $sql"; + else return "$this->noRows() attempt states for this question"; + } } Index: StackDBAttemptPRTMeta.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBAttemptPRTMeta.php,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** StackDBAttemptPRTMeta.php 16 Sep 2009 12:04:22 -0000 1.7 --- StackDBAttemptPRTMeta.php 9 Nov 2010 16:51:35 -0000 1.7.8.1 *************** *** 69,73 **** VALUES ($CacheID, ".$this->dbSafeString($name).", $rawmark , $modmark , $ansnote , $error);"; ! $this->logger->critical($sql); $this->query($sql); --- 69,73 ---- VALUES ($CacheID, ".$this->dbSafeString($name).", $rawmark , $modmark , $ansnote , $error);"; ! $this->logger->finest($sql); $this->query($sql); *************** *** 114,120 **** } } - - - } --- 114,117 ---- Index: StackDB.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDB.php,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** StackDB.php 27 Aug 2009 16:23:00 -0000 1.5 --- StackDB.php 9 Nov 2010 16:51:35 -0000 1.5.8.1 *************** *** 78,81 **** --- 78,83 ---- public function allResults($field = NULL); + + //public function last_insert_id(); } Index: StackDBADOdb.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBADOdb.php,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** StackDBADOdb.php 27 Aug 2009 16:23:00 -0000 1.7 --- StackDBADOdb.php 9 Nov 2010 16:51:35 -0000 1.7.8.1 *************** *** 81,85 **** $driver = $this->config->getDB('dbType'); ! $this->conn = &NewADOConnection($driver); //$this->conn->debug=true; $this->conn->PConnect($server, $username, $password, $database); --- 81,85 ---- $driver = $this->config->getDB('dbType'); ! $this->conn = NewADOConnection($driver); //$this->conn->debug=true; $this->conn->PConnect($server, $username, $password, $database); *************** *** 163,166 **** --- 163,190 ---- /** + * Performs a query using adoDB SelectLimit + * + * @param string $sql + * @return Array|bool + * @access public + */ + public function selectLimit($sql, $rows, $start) + { + $this->logger->finest("Performing Query with selectLimit: ".$sql); + $rs=NULL; + try { + $rs=$this->conn->SelectLimit($sql, $rows, $start); + //$this->logger->finest("Result of Query: ".$rs); + } catch (exception $e) { + $this->errorLog->addError('Invalid query '.$this->conn->ErrorMsg()); + $this->logger->critical('Invalid query '.$this->conn->ErrorMsg()); + return false; + } + + $this->lastResult = $rs; + return $rs; + } + + /** * Returns the number of rows from the last query. * *************** *** 325,330 **** } ! public function insert_id() { ! return Insert_ID(); // PO_Insert_ID() is a more portable but untested alternative. } --- 349,354 ---- } ! public function last_insert_id() { ! return $this->conn->Insert_ID(); // PO_Insert_ID() is a more portable but untested alternative. } Index: StackDBUser.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBUser.php,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** StackDBUser.php 27 Aug 2009 16:23:00 -0000 1.7 --- StackDBUser.php 9 Nov 2010 16:51:35 -0000 1.7.8.1 *************** *** 157,160 **** --- 157,179 ---- /** + * Returns a count of moodle users + * @param int $userid + * @return int $number + */ + public function countUsers() + { + global $config; + $prefix = $config->getMoodle('prefix'); + $sql = 'SELECT COUNT(id) as count + FROM '.$prefix.'user'; + + $this->connect(); + $this->query($sql); + $this->disconnect(); + + return $this->result(0, 'count'); + } + + /** * Returns a list of a user's moodle capabilities. (NOTE: Does not take context into account). * *************** *** 231,235 **** } } - } --- 250,253 ---- Index: StackDBCache.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBCache.php,v retrieving revision 1.12.6.2.2.1 retrieving revision 1.12.6.2.2.2 diff -C2 -d -r1.12.6.2.2.1 -r1.12.6.2.2.2 *** StackDBCache.php 4 Dec 2009 10:11:14 -0000 1.12.6.2.2.1 --- StackDBCache.php 9 Nov 2010 16:51:35 -0000 1.12.6.2.2.2 *************** *** 18,21 **** --- 18,22 ---- require_once 'StackDBADOdb.php'; + require_once $config->get('docroot').'/other/adodb5/adodb-pager.inc.php'; /** *************** *** 49,56 **** // add a transition using the new state id ! $transition = $this->addTransition($lastNode, $stateID, $post, $event); ! // add attempt_meta information ! if($userEvent) $this->addMeta($stateID, $state); } --- 50,59 ---- // add a transition using the new state id ! if($stateID !== NULL) { // state added successfully: go ahead and reference it! ! $transition = $this->addTransition($lastNode, $stateID, $post, $event); ! // add attempt_meta information ! if($userEvent) $this->addMeta($stateID, $state); ! } } *************** *** 58,62 **** $this->query("UNLOCK TABLES"); ! return $transition; // either the new or recent prior one } --- 61,65 ---- $this->query("UNLOCK TABLES"); ! return $transition; // either the new or recent prior one (or NULL on failure) } *************** *** 77,87 **** ", NOW())"; ! $this->query($sql); ! // NOTE: if this fails it will mess the transition table because of 'last index' method below. ! $this->logger->debug("SQL debug: ".$sql); ! // would be nice to be able to obtain the index for the last insert (like mysql_insert_id) without this extra call but would require extending the StackDB interface ! $this->query("SELECT id FROM display_cache ORDER BY id DESC LIMIT 1"); // safe for multi-threading? if($this->noRows()<=0) { // no rows in display_cache? --- 80,92 ---- ", NOW())"; ! //$this->logger->debug("SQL:".$sql); ! $result = $this->query($sql); ! if(empty($result)) { // insert failed! ! $this->logger->critical("Failed to store a question state!"); ! return NULL; // don't add a transition! ! } // would be nice to be able to obtain the index for the last insert (like mysql_insert_id) without this extra call but would require extending the StackDB interface ! $this->query("SELECT id FROM display_cache ORDER BY id DESC LIMIT 1"); // safe for multi-threading if higher-level lock maintained if($this->noRows()<=0) { // no rows in display_cache? *************** *** 155,163 **** // discard if this duplicates an existing instance (defined by question note) ! $sql = "SELECT * FROM display_cache WHERE qID = ".$instance->getQuestionID(). ! " AND questionNote = ".$db->dbSafeString(StackDBCache::hackSlashes($instance->getQuestionNote())); ! // TODO: check is a *live* initial state $db->query($sql); ! if($db->noRows() > 0) { continue; } // create a cache state --- 160,168 ---- // discard if this duplicates an existing instance (defined by question note) ! $sql = "SELECT * FROM display_cache, display_cache_sequence WHERE qID = ".$instance->getQuestionID(). ! " AND questionNote = ".$db->dbSafeString(StackDBCache::hackSlashes($instance->getQuestionNote())). ! " AND display_cache_sequence.currentNode=0 AND display_cache_sequence.nextNode=display_cache.id"; $db->query($sql); ! if($db->noRows() > 0) { continue; } // discard and go round again // create a cache state *************** *** 226,230 **** */ public function nextNode($transition) { - // takes current node and posted answers // returns next node id (used for obtaining cache state) $sql = "SELECT nextNode FROM display_cache_sequence " . --- 231,234 ---- *************** *** 326,329 **** --- 330,353 ---- } + /* + * Determines whether a question can be changed without fear. + * i.e. even if it has available initial states, these have not been processed. + */ + public function hasActiveStates($qID) { + // initial states have a transition from a state id of 0 + + // get all starting configs for given question + $sql = "SELECT display_cache.id, display_cache.state FROM display_cache_sequence, display_cache " . + "LEFT JOIN display_cache_sequence AS successor " . + "ON successor.currentNode = $qID ". + "WHERE display_cache.qID = $qID " . + "AND display_cache_sequence.currentNode = 0 " . + "AND display_cache_sequence.nextNode = display_cache.id"; + $this->query($sql); + + // return 0 if question not deployed + return ($this->noRows() === 0); + } + /** * Empties the entire cache *************** *** 383,387 **** $this->query($sql); - //echo "<pre>";print_r($this); echo"</pre>"; $xhtml = '<table id="transitionstable" border=1>'; --- 407,410 ---- *************** *** 396,401 **** //$xhtml .= '<tr><td>'. $this->result($i,'id').'</td>'; $post = $this->base64_unserialize($this->result($i, 'post')); ! $xhtml .= '<td>'. $this->result($i,'currentNode').'</td>'; ! $xhtml .= '<td>'. $this->result($i,'nextNode').'</td>'; $showpost = $this->pretty_post($post); $xhtml .= '<td>'. $showpost.'</td>'; --- 419,426 ---- //$xhtml .= '<tr><td>'. $this->result($i,'id').'</td>'; $post = $this->base64_unserialize($this->result($i, 'post')); ! $xhtml .= '<td><a href="?sid='. $this->result($i,'currentNode').'">'. ! $this->result($i,'currentNode') .'</td>'; ! $xhtml .= '<td><a href="?sid='. $this->result($i,'nextNode').'">'. ! $this->result($i,'nextNode') .'</td>'; $showpost = $this->pretty_post($post); $xhtml .= '<td>'. $showpost.'</td>'; *************** *** 408,412 **** } ! public function dumpCacheState($qid = NULL) { if(!empty($qid)) { $sql .= "SELECT * FROM display_cache WHERE qID=".$qid." ORDER BY id"; --- 433,437 ---- } ! public function dumpCacheState($qid = NULL, $rows = 3, $startrow = 0) { if(!empty($qid)) { $sql .= "SELECT * FROM display_cache WHERE qID=".$qid." ORDER BY id"; *************** *** 414,418 **** else $sql = "SELECT * FROM display_cache ORDER BY id"; ! $this->query($sql); //echo "<pre>";print_r($this); echo"</pre>"; --- 439,444 ---- else $sql = "SELECT * FROM display_cache ORDER BY id"; ! //$this->query($sql); ! $this->selectLimit($sql, $rows, $startrow); //echo "<pre>";print_r($this); echo"</pre>"; *************** *** 435,441 **** --- 461,587 ---- $xhtml .= '</table>'; + $xhtml .= "next "; + $xhtml .= "<a href='?qid=$GET[qid]&startrow=".($startrow+$rows)."&rowcount=10'>10</a> | "; + $xhtml .= "<a href='?qid=$GET[qid]&startrow=".($startrow+$rows)."&rowcount=100'>100</a>"; return $xhtml; } + public function showInitialStates($qid) { + $sql = "SELECT display_cache.* FROM display_cache_sequence, display_cache " . + "WHERE display_cache.qID = $qid " . + "AND currentNode = 0 " . + "AND nextNode = display_cache.id"; + + $this->query($sql); + //echo $this->noRows(); + + // store these initial states since we'll need to use the connection for finding successive states + for ($i=0; $i<$this->noRows(); $i++) { + $id = $this->result($i,'id'); + $initials[$id]['id'] = $id; + $initials[$id]['post'] = $this->base64_unserialize($this->result($i, 'post')); + $initials[$id]['state'] = $this->base64_unserialize($this->result($i, 'state')); + $initials[$id]['answers'] = $this->pretty_post($this->base64_unserialize($this->result($i, 'answers')), true); + $initials[$id]['currentTotalMark'] = $this->result($i, 'currentTotalMark'); + $initials[$id]['totalPossibleMarks'] = $this->result($i, 'totalPossibleMarks'); + $initials[$id]['expired'] = $this->result($i, 'expired'); + $initials[$id]['questionNote'] = $this->result($i, 'questionNote'); + $initials[$id]['xhtml'] = $this->result($i,'xhtml'); + } + + //echo "<pre>";print_r($this); echo"</pre>"; + + $xhtml .= '<table id="statestable" border=1>'; + $xhtml .= '<tr><th>id</th><th>answers</th><th>current / total mark</th><th>exp.</th><th>questionNote</th><th>xhtml</th><th>transitions</th></tr>'; + + foreach($initials as $i) { + $xhtml .= '<td>'.$i['id'].'</td>'; + $xhtml .= '<td>'.$i['answers'].'</td>'; + $xhtml .= '<td>'.$i['currentTotalMark'].' / '.$i['totalPossibleMarks'].'</td>'; + $xhtml .= '<td>'.$i['expired'].'</td>'; + $xhtml .= '<td>'.$i['questionNote'].'</td>'; + $xhtml .= '<td>'.$i['xhtml'].'</td>'; + + $xhtml .= '<td>'.$this->innerTransitionsTable($i['id']).'</td></tr>'; + } + $xhtml .= '</table>'; + return $xhtml; + } + + private function innerTransitionsTable($id) { + $transitions = $this->stateTransitions($id); + $xhtml = ''; + if($transitions) { + $xhtml .= '<table>'; // start inner table + foreach($transitions as $t) { + if($t['previous'] !== null) { + if($t['previous'] > 0) $xhtml .= '<tr><td><a href="?sid='.$t['previous'].'">« back to '.$t[previous].'</a></td></tr>'; + } + else if($t['nextNode'] != $id) $xhtml .= + '<tr><td><a href="?sid='.$t['nextNode'].'">» '.$this->pretty_post($this->base64_unserialize($t['post'])).'</a> ('.$t['event'].')</td></tr>'; + else $xhtml .= '(loopback) '.$this->pretty_post($this->base64_unserialize($t['post'])); + } + $xhtml .= '</table>'; // end inner table + } + return $xhtml; + } + + public function showCacheState($id) { + $sql .= "SELECT * FROM display_cache WHERE id=".$id; + + $this->query($sql); + + //echo "<pre>";print_r($this); echo"</pre>"; + $xhtml .= '<table id="statestable" border=1>'; + $xhtml .= '<tr><th>id</th><th>answers</th><th>current / total mark</th><th>exp.</th><th>questionNote</th><th>xhtml</th><th>transitions</th></tr>'; + for ($i=0; $i<$this->noRows(); $i++) { + $post = $this->base64_unserialize($this->result($i, 'post')); + $state = $this->base64_unserialize($this->result($i, 'state')); + $xhtml .= '<tr><td>'. $this->result($i,'id').'</td>'; + //$xhtml .= '<td>'.$this->elementsToHTML($state).'</td>'; + $xhtml .= '<td>'. $this->pretty_post($this->base64_unserialize($this->result($i, 'answers')), true) .'</td>'; + $xhtml .= '<td>'. $this->result($i, 'currentTotalMark') .' / '. $this->result($i, 'totalPossibleMarks') .'</td>'; + $xhtml .= '<td>'. $this->result($i, 'expired') .'</td>'; + $xhtml .= '<td>'. $this->result($i, 'questionNote') .'</td>'; + $xhtml .= '<td>'. $this->result($i,'xhtml').'</td>'; + $xhtml .= '<td>'; + $xhtml .= $this->innerTransitionsTable($this->result($i,'id')); + $xhtml .= '</td></tr>'; + } + return $xhtml; + } + + private function stateTransitions($id) + { + $sql = "SELECT * FROM display_cache_sequence WHERE currentNode=$id OR nextNode=$id"; + $this->query($sql); + for ($i=0; $i<$this->noRows(); $i++) { + $tid = $this->result($i,'id'); + if($this->result($i, 'currentNode') == $id) { // transition FROM this node + $transitions[$tid]['nextNode'] = $this->result($i, 'nextNode'); + $transitions[$tid]['post'] = $this->result($i, 'post'); + $transitions[$tid]['event'] = $this->result($i, 'event'); + } else { // transition TO this node + $transitions[$tid]['previous'] = $this->result($i, 'currentNode'); + } + } + + //print_r($transitions); + return $transitions; + } + + public function cacheStatePager($qid = NULL) { + if(!empty($qid)) { + //$sql .= "SELECT * FROM display_cache WHERE qID=".$qid." ORDER BY id"; + $sql .= "SELECT id,qID,answers,questionNote,currentTotalMark,totalPossibleMarks,xhtml,expired,lastActive FROM display_cache WHERE qID=".$qid." ORDER BY id"; + } + //else $sql = "SELECT * FROM display_cache ORDER BY id"; + else $sql = "SELECT id,qID,answers,questionNote,currentTotalMark,totalPossibleMarks,xhtml,expired,lastActive FROM display_cache ORDER BY id"; + + $pager = new ADODB_Pager($this->conn,$sql,'adodb', true); + $pager->Render(); + //return $xhtml; + } + public function elementsToHTML($a) { foreach($a as $key => $value) { *************** *** 448,455 **** public function getInstances($qID) { ! $sql= "SELECT display_cache.id, xhtml, questionNote FROM display_cache, display_cache_sequence " . "WHERE currentNode = 0 " . "AND nextNode = display_cache.id " . ! "AND qID=$qID"; $this->query($sql); --- 594,604 ---- public function getInstances($qID) { ! $sql= "SELECT display_cache.state, display_cache.id, xhtml, questionNote " . ! "FROM display_cache, display_cache_sequence " . "WHERE currentNode = 0 " . "AND nextNode = display_cache.id " . ! "AND qID=$qID " . ! "ORDER BY questionNote"; ! $this->query($sql); *************** *** 461,466 **** $array[$f] = $this->result($i, $f); } $result[$i] = $array; ! } return $result; } --- 610,620 ---- $array[$f] = $this->result($i, $f); } + // potentially costly item deserialisation but can we justify an extra field for reversion? + //$item = $this->base64_unserialize($this->result($i, 'state')); + + //$array['version'] = $item->getVersion(); + $result[$i] = $array; ! } return $result; } *************** *** 477,480 **** --- 631,649 ---- } + // Array mapping all deployed versions to their instance frequency + public function countAllInstances() { + $sql = "SELECT qID, COUNT(qID) as freq FROM display_cache, display_cache_sequence " . + "WHERE currentNode = 0 " . + "AND nextNode = display_cache.id ". + "GROUP BY qID"; + $this->query($sql); + $count = array(); + for($i=0; $i<$this->noRows(); $i++) { + $this->result($i, 'freq'); + $count[$this->result($i, 'qID')] = $this->result($i, 'freq'); + } + return $count; + } + // returns deployed instances of the specified question public function dumpInstances($qID) { *************** *** 482,486 **** "WHERE currentNode = 0 " . "AND nextNode = display_cache.id " . ! "AND qID=$qID"; $this->query($sql); --- 651,655 ---- "WHERE currentNode = 0 " . "AND nextNode = display_cache.id " . ! "AND qID=$qID "; $this->query($sql); *************** *** 497,510 **** } ! // Returns array of question IDs in cache. // To help identify errors, not restricted to states that follow an initial state. ! public function getQuestionIDs() { ! $sql = "SELECT qID, count(*) AS freq FROM display_cache GROUP BY qID ORDER BY freq DESC"; $this->query($sql); for($i=0; $i<$this->noRows(); $i++) { ! $qid[] = $this->result($i, 'qID'); ! // adoDB no like aliases: $qid[$this->result($i, 'qID')] = $qid[$this->result($i, 'freq')]; } ! return $qid; } --- 666,680 ---- } ! // Returns array of frequencies of the question states in cache. // To help identify errors, not restricted to states that follow an initial state. ! public function getQuestionFreqs() { ! $sql = "SELECT qID, count(qID) as freq FROM display_cache GROUP BY qID"; $this->query($sql); for($i=0; $i<$this->noRows(); $i++) { ! $qid = $this->result($i, 'qID'); ! $freq = $this->result($i, 'freq'); ! $freqMap[$qid] = $freq; } ! return $freqMap; } *************** *** 529,532 **** --- 699,719 ---- } + /** + * Effectively 'undeploys' a version instance without removing it (and it's sucessors) from + * the cache as dropState() does. + */ + public function deinitialiseState($id) { + $this->query("DELETE FROM display_cache_sequence WHERE currentNode=0 AND nextNode=$id"); + } + + // checks whether a version is deployed, i.e. has instances which are initial states + // return number of insances deployed + public function instancesDeployed($id) { + $this->query("SELECT * FROM display_cache, display_cache_sequence " . + "WHERE display_cache.qID=$id AND currentNode=0 AND nextNode=display_cache.id"); + return $this->noRows(); + } + + // returns the serialised ItemState for given id. // This will supersede getDisplayItem Index: devCache.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/devCache.php,v retrieving revision 1.11.6.1 retrieving revision 1.11.6.1.2.1 diff -C2 -d -r1.11.6.1 -r1.11.6.1.2.1 *** devCache.php 3 Nov 2009 16:03:28 -0000 1.11.6.1 --- devCache.php 9 Nov 2010 16:51:35 -0000 1.11.6.1.2.1 *************** *** 20,29 **** require_once $root.'/lib/ui/DisplayItem.php'; require_once $root.'/lib/ui/frontend.php'; ! //echo html_head('dev cache','../../',"@import \"../../styles.css\";\n"); $cache = new StackDBCache(); $cache->connect(); ! $qidfilter = $_GET['qid']; // process button presses --- 20,30 ---- require_once $root.'/lib/ui/DisplayItem.php'; require_once $root.'/lib/ui/frontend.php'; ! //require_once $root.'/other/jquery.js'; ! echo html_head('dev cache','../../',"@import \"../../styles.css\";\n", 'LaTeX', 1); $cache = new StackDBCache(); $cache->connect(); ! $qid = $_GET['qid']; // process button presses *************** *** 39,43 **** ?> <head> ! <title>Direct Cache Access</title> <style> .box { --- 40,44 ---- ?> <head> ! <title>CAS Cache Admin</title> <style> .box { *************** *** 46,78 **** } </style> </head> ! <div class="box"> ! <?php echo $cache->dumpCacheSequence($qidfilter) ?> ! </div> ! <div class="box"> <?php ! $allQs = $cache->getQuestionIDs(); if(NULL !== $allQs) { ! echo "Show question: "; ! if(empty($qidfilter)) echo "All "; ! else echo "<a href='devCache.php'>All</a> "; ! foreach($allQs as $qid) { ! if($qid == $qidfilter) echo $qid." "; ! else echo "<a href='?qid=".$qid."'>$qid</a> "; } } else echo "Cache is completely empty."; - ?> - <form method="POST" action="devCache.php"> - <input type="submit" value="Refresh"> - <input type="submit" name="op" value="clear successive states"> - <input type="submit" name="op" onClick="return confirm('Are you sure you want to clear the ENTIRE cache?')" value="clear ENTIRE cache"> - </form> - </div> - <br clear="left" /> <?php ! echo $cache->dumpCacheState($qidfilter); ! ?> \ No newline at end of file --- 47,113 ---- } + .hidden { + display: none; + } + + table { + border: 1; + } + + tr, td, th { + border: 0; + } + + .freq { + color: #ccc; + font-size: small; + } + </style> </head> ! <body> ! <form method="POST" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> ! <input type="submit" name="op" value="clear non-initial states"> ! <input type="submit" name="op" onClick="return confirm('Are you sure you want to clear the ENTIRE cache?')" value="clear ENTIRE cache"> ! <b>Note:</b> Initial states represent deployed questions. ! </form> ! ! ! <h2>Questions with cached states</h2> <?php ! $allQs = $cache->getQuestionFreqs(); if(NULL !== $allQs) { ! echo "Questions: "; ! foreach($allQs as $id => $freq) { ! if($id == $qid) echo $id."<span class='freq'>×$freq</span> "; ! else echo "<a href='?qid=".$id."'>$id</a><span class='freq'>×$freq</span> "; } } else echo "Cache is completely empty."; ?> <?php ! //var_dump($qid); ! if(isset($_GET['sid'])) { ! echo "<h2>State #$_GET[sid]</h2>"; ! echo $cache->showCacheState($_GET['sid']); ! } ! if(!empty($qid)) { ! echo "<h2>Initial states for question #$qid</h2>"; ! echo $cache->showInitialStates($qid); ! } ! ! //echo $cache->dumpCacheSequence($qid); ! ?> ! <script> ! $(document).ready(function() { ! /* $('table#statestable td:last-child') ! .wrapInner('<div class="hidden">') ! .mouseover(function(x) {$(this).children('.hidden').slideDown('fast').next().remove()}) ! .append('<p>hover over to view</p>');*/ ! ! $('tr:odd').css('background-color', '#e6e6e6'); ! $('tr:even').css('background-color', '#ffffff'); ! }); ! </script> ! </body> \ No newline at end of file Index: StackDBReporting.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBReporting.php,v retrieving revision 1.27 retrieving revision 1.27.8.1 diff -C2 -d -r1.27 -r1.27.8.1 *** StackDBReporting.php 16 Sep 2009 12:04:22 -0000 1.27 --- StackDBReporting.php 9 Nov 2010 16:51:35 -0000 1.27.8.1 *************** *** 26,30 **** * Provides the database functions for reporting students answers. * - * */ class StackDBReporting extends StackDBADOdb { --- 26,29 ---- *************** *** 43,593 **** } [...1354 lines suppressed...] + // { + // $attemptId = $this->result($i, 'AttemptID'); + // $questionId = $this->result($i, 'QuestionID'); + // $userId = $this->result($i, 'UserID'); + // $PRTName = $this->result($i, 'PRTName'); + // $RawMark = $this->result($i, 'RawMark'); + // $ModMark = $this->result($i, 'ModMark'); + // + // if(!array_key_exists($questionId, $resultsArray) || !array_key_exists($userId, $resultsArray[$questionId])) + // { + // $resultsArray[$questionId][$userId] = new MarksAttempt($userId, $questionId); + // } + // $resultsArray[$questionId][$userId]->addAttempt($attemptId, $PRTName, $RawMark, $ModMark); + // } + // + // return $resultsArray; + // } + // } Index: StackDBBackup.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBBackup.php,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** StackDBBackup.php 27 Aug 2009 16:23:00 -0000 1.5 --- StackDBBackup.php 9 Nov 2010 16:51:35 -0000 1.5.8.1 *************** *** 19,25 **** * Database backup functions */ ! require_once 'StackDBMySQL.php'; ! class StackDBBackup extends StackDBMySQL { // Attributes --- 19,25 ---- * Database backup functions */ ! require_once 'StackDBADOdb.php'; ! class StackDBBackup extends StackDBADOdb { // Attributes Index: StackDBItem.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBItem.php,v retrieving revision 1.32 retrieving revision 1.32.8.1 diff -C2 -d -r1.32 -r1.32.8.1 *** StackDBItem.php 19 Oct 2009 11:45:01 -0000 1.32 --- StackDBItem.php 9 Nov 2010 16:51:35 -0000 1.32.8.1 *************** *** 71,74 **** --- 71,75 ---- questionKeywords , questionUserLastEdited , + line , questionPublisher , questionFormat , *************** *** 90,96 **** ) VALUES ( ! $meta[questionGUID], $meta[questionName], $meta[questionDescription], $meta[questionKeywords], $meta[lastUserEditor], $meta[questionPublisher], $meta[questionFormat], $meta[language], $meta[questionRights], $meta[questionLearningContext], $meta[questionDifficulty], $meta[questionCompetency], $meta[questionCompentencyLevel], $meta[questionTimeAllocated], $meta[questionExerciseType], ".$this->conn->sysTimeStamp." , ".$this->dbSafeString($dbQuestionVariables).", ".$this->dbSafeString($dbItemOptions).", ".$this->dbSafeString($dbItemTests)." , ".$this->dbSafeString($valid==1?1:0)." , ".$this->dbSafeString($status)." , ".$this->dbSafeString($published).");"; ! $added = $this->query($sql); if($added) --- 91,97 ---- ) VALUES ( ! $meta[questionGUID], $meta[questionName], $meta[questionDescription], $meta[questionKeywords], $meta[lastUserEditor], $meta[line], $meta[questionPublisher], $meta[questionFormat], $meta[language], $meta[questionRights], $meta[questionLearningContext], $meta[questionDifficulty], $meta[questionCompetency], $meta[questionCompentencyLevel], $meta[questionTimeAllocated], $meta[questionExerciseType], ".$this->conn->sysTimeStamp." , ".$this->dbSafeString($dbQuestionVariables).", ".$this->dbSafeString($dbItemOptions).", ".$this->dbSafeString($dbItemTests)." , ".$this->dbSafeString($valid==1?1:0)." , ".$this->dbSafeString($status)." , ".$this->dbSafeString($published).");"; + $this->logger->debug($sql); $added = $this->query($sql); if($added) *************** *** 98,103 **** //get question id for newly added item & return. //$result = $this->query("SELECT `questionID` FROM `stackQuestion` WHERE `questionGUID` = '$meta[questionGUID]'"); ! $result = $this->query("SELECT max(questionId) FROM stackquestion"); ! $result = $this->result(0,0); //echo 'Last inserted: '.$result; } --- 99,104 ---- //get question id for newly added item & return. //$result = $this->query("SELECT `questionID` FROM `stackQuestion` WHERE `questionGUID` = '$meta[questionGUID]'"); ! $result = $this->query("SELECT questionID FROM stackquestion ORDER BY questionID desc limit 1"); ! $result = $this->result(0,'questionID'); //echo 'Last inserted: '.$result; } *************** *** 117,123 **** * @return int * @access public ! */ public function updateItem($id, $dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $valid, $status, $published) { //make meta db safe foreach($meta as $label => $val) --- 118,128 ---- * @return int * @access public ! **/ public function updateItem($id, $dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $valid, $status, $published) { + //return addNewItem($dbItemOptions, $dbItemTests, $dbQuestionVariables, $meta, $valid, $status, $published); + + //update line + //make meta db safe foreach($meta as $label => $val) *************** *** 142,146 **** //build query - $sql = "UPDATE stackquestion SET questionGUID = $meta[questionGUID], questionName = $meta[questionName], --- 147,150 ---- *************** *** 148,151 **** --- 152,156 ---- questionKeywords = $meta[questionKeywords], questionUserLastEdited = $meta[lastUserEditor], + line = $meta[line], questionPublisher = $meta[questionPublisher], questionFormat = $meta[questionFormat], *************** *** 167,185 **** WHERE questionID = $id;"; ! $updated = $this->query($sql); if($updated) { ! return $id; } else { ! $this->errorLog->addError('Could not update Item'); ! $this->logger->critical('Failed to save item id '.$id); ! return false; } } /** --- 172,224 ---- WHERE questionID = $id;"; ! $updated = $this->query($sql); if($updated) { ! $this->logger->fine('Item updated.'); ! $result = true; } else { ! $result = false; ! $this->errorLog->addError('Could not update item.'); ! $this->logger->critical('Failed to update item named '.$meta['questionDescription'].' to the database'); } + return $result; + }//*/ + + /** + + * @param + * @return bool + * @access public + */ + public function newLine() + { + $sql = "INSERT INTO question_lines() VALUES()"; + $this->logger->debug($sql); + $this->query($sql); + + $this->query("SELECT id FROM question_lines ORDER BY id DESC LIMIT 1"); + return $this->result(0,'id'); } + public function setLatestVersion($line, $version) { + $sql = "UPDATE question_lines SET latestVersion=$version WHERE id=$line"; + $this->logger->debug("trying to set latest version with sql:$sql"); + $this->query($sql); + } + + public function getLatestVersion($qid) { + $sql = "SELECT latestVersion FROM question_lines, stackquestion WHERE questionID=$qid AND line=question_lines.id"; + $this->logger->debug("trying to get latest version with sql:$sql"); + $this->query($sql); + return $this->result(0, 'latestVersion'); + } + public function nameExists($name) { + $this->query("SELECT * FROM stackquestion WHERE questionName='$name'"); + return $this->noRows() > 0; + } /** *************** *** 207,210 **** --- 246,283 ---- } + /** + * Removes a line of items, their PRTrees and keywords + * + * @param int $id + * @return bool + * @access public + */ + public function removeLineContainingItem($id) + { + // get line from item id + $sql = "SELECT line FROM stackquestion WHERE questionID = $id"; + $result = $this->query($sql); + $line = $this->result(0, 'line'); + $this->logger->finer('Removing line '.$line); + + // get all question IDs + $sql = "SELECT questionID from stackquestion WHERE line = $line"; + $result = $this->query($sql); + if($result !== false) { + foreach($result as $row) { + $toRemove[] = $row['questionID']; + } + } + + foreach($toRemove as $id) { + $this->removeItem($id); + } + + // finally, remove line record + $sql = "DELETE FROM question_lines WHERE id = $line"; + $result = $this->query($sql); + return $result; + } + /** * Removes an items PRTrees. *************** *** 417,420 **** --- 490,531 ---- } + /** + * Returns the line that contains this Item version + * + * @param int $id + * @return int version + **/ + public function getLine($id) { + $sql = "SELECT line FROM stackquestion WHERE questionID = $id"; + //echo $sql; + $result = $this->query($sql); + if(!$result) + { + $this->logger->critical('No line recorded for item with id '.$id); + return false; + } + else + { + $toReturn = $this->result(0,'line'); + return $toReturn; + } + + } + + // returned in descending order + public function getVersions($line) { + if(!is_numeric($line)) { + $this->logger->critical("line not defined!"); + } + $sql = "SELECT questionID, questionDateLastEdited from stackquestion WHERE line=$line ORDER BY questionID DESC"; + //echo $sql; + $result = $this->query($sql); + if($result !== false) { + foreach($result as $row) { + $history[$row['questionDateLastEdited']] = $row['questionID']; + } + } + return $history; + } /** *************** *** 429,437 **** { $this->logger->finest('getListOfQuestions, userID='.$userID); ! $dateFormat = stack_sqlDateFormat(true); //uses to date format in the config file to give a sql date format. ! $dateQuery = $this->conn->SQLDate($dateFormat,'questionDateLastEdited'); ! $OrderBy = ' ORDER BY questionID'; // First level if (NULL != $filter) { --- 540,551 ---- { $this->logger->finest('getListOfQuestions, userID='.$userID); + $this->logger->debug('getListOfQuestions, filter='.print_r($filter, 1)); ! $qList = NULL; ! //$dateFormat = stack_sqlDateFormat(true); //uses to date format in the config file to give a sql date format. ! //$dateQuery = $this->conn->SQLDate($dateFormat,'questionDateLastEdited'); ! ! $OrderBy = ' ORDER BY questionID DESC'; // First level if (NULL != $filter) { *************** *** 453,471 **** } ! if($userID === NULL) { ! $sql = "SELECT questionID, questionName, questionDescription, valid, published, status, $dateQuery AS dateEdited FROM stackquestion".$OrderBy; ! } else { if ($public) { ! $sql = "SELECT questionID, questionName, questionDescription, valid, published, status, $dateQuery AS dateEdited FROM stackquestion WHERE (questionUserLastEdited = $userID or published=".$this->dbSafeString('Published').")".$OrderBy; } else { ! $sql = "SELECT questionID, questionName, questionDescription, valid, published, status, $dateQuery AS dateEdited FROM stackquestion WHERE (questionUserLastEdited = $userID)".$OrderBy; } } - $this->logger->finest('getListOfQuestions, sql='.$sql); - $result = $this->query($sql); if($result === false) --- 567,691 ---- } + $sql = "SELECT questionID, line, questionName, questionDescription, valid, published, status, questionDateLastEdited AS dateEdited " . + "FROM stackquestion, question_lines"; + if(!empty($tags)) $sql .= ", question_keyword, keywords "; // tbc + if($userID !== NULL) { + if ($public) { + $sql .= " WHERE (questionUserLastEdited = $userID or published=".$this->dbSafeString('Published').")"; + } else { + $sql .= " WHERE (questionUserLastEdited = $userID)"; + } + } + + if($userID !== NULL) $sql .= " AND "; + else $sql .= " WHERE "; + $sql .= "question_lines.latestVersion = stackquestion.questionID"; + + // filter + //if($filter !== NULL) $sql .= " AND questionName LIKE '%$filter%' "; + $sql .= $OrderBy; ! $this->logger->debug('getListOfQuestions, sql='.$sql); ! $result = $this->query($sql); ! //print_r($sql); ! ! if($result === false) { ! $this->logger->error('getListOfQuestions: Failed to load question list'); ! return false; ! } ! else ! { ! global $config; ! ! // get a count of deployed instances of each version from cache ! $dbc = new StackDBCache(); ! $dbc->connect(); ! $deployCount = $dbc->countAllInstances(); ! $dbc->disconnect(); ! ! //print_r($deployCount); ! ! $i=0; ! if($this->noRows()>0) ! { ! ! foreach($result as $row) ! { ! $qList[$i]['id'] = $this->result($i,'questionID'); ! $qList[$i]['line'] = $this->result($i,'line'); ! $qList[$i]['questionName'] = $this->result($i,'questionName'); ! $qList[$i]['questionDescription'] = $this->result($i, 'questionDescription'); ! $qList[$i]['valid'] = $this->result($i,'valid'); ! $qList[$i]['questionDateLastEdited'] = $this->result($i,'dateEdited'); ! $qList[$i]['published'] = $this->result($i,'published'); ! $qList[$i]['status'] = $this->result($i,'status'); ! $qList[$i]['nodeployed'] = $deployCount[$qList[$i]['id']];//TOO MANY QUERIES --> $dbc->countInstances($qList[$i]['id']); ! if(!isset($qList[$i]['nodeployed'])) $qList[$i]['nodeployed'] = 0; ! $i++; ! } ! ! ! $moodleEnabled = $config->getMoodle('enabled'); ! if('true' === $moodleEnabled) ! { ! $mdb = new MoodleDB(); ! $mdb->connect(); ! foreach($qList as $key => $val){ ! $qList[$key]['moodleCategories'] = $mdb->getQuestionCategoryName($val['id']); ! } ! $mdb->disconnect(); ! } ! ! } ! return $qList; ! } ! } ! ! public function getLines($userID=NULL,$public=false,$filter=NULL,$tags=NULL) ! { ! $this->logger->finest('getLines, userID='.$userID); ! $this->logger->debug('getLines, filter='.print_r($filter, 1)); ! ! $qList = NULL; ! ! //$dateFormat = stack_sqlDateFormat(true); //uses to date format in the config file to give a sql date format. ! //$dateQuery = $this->conn->SQLDate($dateFormat,'questionDateLastEdited'); ! ! $OrderBy = ' ORDER BY questionID DESC'; ! ! $sql = "SELECT questionID, line, questionName, questionDescription, valid, published, status, questionDateLastEdited AS dateEdited " . ! "FROM stackquestion, question_lines "; ! if(!empty($tags)) $sql .= ", question_keyword, keywords "; ! if($userID !== NULL) { if ($public) { ! $where[] = "(questionUserLastEdited = $userID or published=".$this->dbSafeString('Published').")"; } else { ! $where[] = "(questionUserLastEdited = $userID)"; } } + if(!empty($tags)) { + // create multi-keyword conditions + foreach(explode(' ', $tags) as $tag) { + $or[] = "keywords.keyword = ".$this->dbSafeString($tag); + + } + $where[] = '('.implode($or, ' OR ').')'; + $where[] = "keywords.id = kwid AND qid = stackquestion.questionID"; + } + + $where[] = "question_lines.latestVersion = stackquestion.questionID"; + + // filter + if($filter !== NULL) $where[] = "(questionName LIKE '%$filter%' OR questionDescription LIKE '%$filter%')"; + + $sql .= ' WHERE '.implode($where, ' AND '); // stitch conditions together + + $sql .= $OrderBy; + + $this->logger->debug('getListOfQuestions, sql='.$sql); + $result = $this->query($sql); if($result === false) *************** *** 486,489 **** --- 706,710 ---- { $qList[$i]['id'] = $this->result($i,'questionID'); + $qList[$i]['line'] = $this->result($i,'line'); $qList[$i]['questionName'] = $this->result($i,'questionName'); $qList[$i]['questionDescription'] = $this->result($i, 'questionDescription'); *************** *** 492,495 **** --- 713,770 ---- $qList[$i]['published'] = $this->result($i,'published'); $qList[$i]['status'] = $this->result($i,'status'); + $qList[$i]['nodeployed'] = $dbc->countInstances($qList[$i]['id']); + + $i++; + } + $dbc->disconnect(); + + $moodleEnabled = $config->getMoodle('enabled'); + if('true' === $moodleEnabled) + { + $mdb = new MoodleDB(); + $mdb->connect(); + foreach($qList as $key => $val){ + $qList[$key]['moodleCategories'] = $mdb->getQuestionCategoryName($val['id']); + } + $mdb->disconnect(); + } + } + return $qList; + } + } + + + public function getQuestionsTagged($tagLine, $userID=NULL,$public=false) { + $tag = $tagLine; // to explode + $sql = "SELECT stackquestion.* from stackquestion, question_keyword, keywords, question_lines " . + "WHERE keywords.keyword = ".$this->dbSafeString($tag)." " . + "AND keywords.id = kwid " . + "AND qid = stackquestion.questionID " . + "AND qid = latestVersion"; + $result = $this->query($sql); + + if($result === false) + { + $this->logger->error('getListOfQuestions: Failed to load question list'); + return false; + } + else + { + global $config; + + $i=0; + if($this->noRows()>0) + { + $dbc = new StackDBCache(); + $dbc->connect(); + foreach($result as $row) + { + $qList[$i]['id'] = $this->result($i,'questionID'); + $qList[$i]['questionName'] = $this->result($i,'questionName'); + $qList[$i]['questionDescription'] = $this->result($i, 'questionDescription'); + $qList[$i]['valid'] = $this->result($i,'valid'); + $qList[$i]['questionDateLastEdited'] = $this->result($i,'questionDateLastEdited'); + $qList[$i]['published'] = $this->result($i,'published'); + $qList[$i]['status'] = $this->result($i,'status'); $qList[$i]['nodeployed'] = $dbc->countInstances($qList[$i]['id']); *************** *** 513,517 **** return $qList; } ! } /** --- 788,793 ---- return $qList; } ! ! } /** *************** *** 581,585 **** } } - } --- 857,860 ---- Index: StackDBKeywords.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/database/StackDBKeywords.php,v retrieving revision 1.10 retrieving revision 1.10.8.1 diff -C2 -d -r1.10 -r1.10.8.1 *** StackDBKeywords.php 27 Aug 2009 16:23:00 -0000 1.10 --- StackDBKeywords.php 9 Nov 2010 16:51:35 -0000 1.10.8.1 *************** *** 261,271 **** /** * Returns all the keywords currently in the database ! * * @access public * @return array */ ! public function getAllKeywords() { ! $sql = 'SELECT keyword FROM keywords'; $query = $this->query($sql); --- 261,277 ---- /** * Returns all the keywords currently in the database ! *... [truncated message content] |
Update of /cvsroot/stack/stack-dev/lib/answertests In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/answertests Modified Files: Tag: item_state_separation CasEqual.php SAExpanded.php PartFrac.php SubstEquiv.php Diff.php SameType.php EqualComAss.php EquationAT.php ATRegExp.php CompSquare.php LowestTerms.php NumSigFigs.php template_cas_answertest.php AlgEquiv.php Int.php FacForm.php GreaterThan.php GreaterThanEqual.php MultiEquiv.php SingleFrac.php Expanded.php Log Message: Brought back up to date with big HEAD merge. Index: FacForm.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/FacForm.php,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** FacForm.php 27 Aug 2009 16:23:00 -0000 1.11 --- FacForm.php 9 Nov 2010 16:51:37 -0000 1.11.8.1 *************** *** 60,66 **** if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing required variable in CAS Option field'); ! $this->ATError = 'Missing required variable in CAS Option field'; ! return NULL; } else --- 60,69 ---- if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing variable in CAS Option field'); ! $this->ATError = 'Missing variable in CAS Option field'; ! $this->ATFeedback = ' stack_trans("TEST_FAILED");'; ! $this->ATAnsNote = 'STACKERROR_OPTION'; ! $this->ATMark = 0; ! return NULL; } else *************** *** 85,89 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 88,91 ---- Index: NumSigFigs.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/NumSigFigs.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.1.2.1 diff -C2 -d -r1.2.2.1 -r1.2.2.1.2.1 *** NumSigFigs.php 2 Nov 2009 18:19:27 -0000 1.2.2.1 --- NumSigFigs.php 9 Nov 2010 16:51:37 -0000 1.2.2.1.2.1 *************** *** 69,73 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 69,72 ---- Index: CasEqual.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/CasEqual.php,v retrieving revision 1.10 retrieving revision 1.10.8.1 diff -C2 -d -r1.10 -r1.10.8.1 *** CasEqual.php 27 Aug 2009 16:23:00 -0000 1.10 --- CasEqual.php 9 Nov 2010 16:51:37 -0000 1.10.8.1 *************** *** 63,67 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 63,66 ---- Index: SameType.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/SameType.php,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** SameType.php 27 Aug 2009 16:23:00 -0000 1.9 --- SameType.php 9 Nov 2010 16:51:37 -0000 1.9.8.1 *************** *** 61,65 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 61,64 ---- Index: ATRegExp.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/ATRegExp.php,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** ATRegExp.php 27 Aug 2009 16:23:00 -0000 1.7 --- ATRegExp.php 9 Nov 2010 16:51:37 -0000 1.7.8.1 *************** *** 52,57 **** if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing regular expression in Cas Option field'); ! $this->ATError = 'Missing regular expression in Cas Option field'; return NULL; } --- 52,60 ---- if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing regular expression in CAS Option field'); ! $this->ATError = 'Missing regular expression in CAS Option field'; ! $this->ATFeedback = ' stack_trans("TEST_FAILED");'; ! $this->ATAnsNote = 'STACKERROR_OPTION_REGEX'; ! $this->ATMark = 0; return NULL; } Index: GreaterThan.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/GreaterThan.php,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** GreaterThan.php 27 Aug 2009 16:23:00 -0000 1.9 --- GreaterThan.php 9 Nov 2010 16:51:37 -0000 1.9.8.1 *************** *** 62,66 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 62,65 ---- Index: SingleFrac.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/SingleFrac.php,v retrieving revision 1.4.6.1 retrieving revision 1.4.6.1.2.1 diff -C2 -d -r1.4.6.1 -r1.4.6.1.2.1 *** SingleFrac.php 3 Nov 2009 13:36:01 -0000 1.4.6.1 --- SingleFrac.php 9 Nov 2010 16:51:37 -0000 1.4.6.1.2.1 *************** *** 67,71 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 67,70 ---- Index: Expanded.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/Expanded.php,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -C2 -d -r1.2 -r1.2.8.1 *** Expanded.php 27 Aug 2009 16:23:00 -0000 1.2 --- Expanded.php 9 Nov 2010 16:51:37 -0000 1.2.8.1 *************** *** 61,65 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 61,64 ---- Index: Int.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/Int.php,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** Int.php 27 Aug 2009 16:23:00 -0000 1.11 --- Int.php 9 Nov 2010 16:51:37 -0000 1.11.8.1 *************** *** 61,66 **** if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing required variable in Cas Option field'); ! $this->ATError = 'Missing required variable in Cas Option field'; return NULL; } --- 61,69 ---- if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing variable in CAS Option field'); ! $this->ATError = 'Missing variable in CAS Option field'; ! $this->ATFeedback = ' stack_trans("TEST_FAILED");'; ! $this->ATAnsNote = 'STACKERROR_OPTION'; ! $this->ATMark = 0; return NULL; } *************** *** 85,89 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 88,91 ---- Index: EqualComAss.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/EqualComAss.php,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** EqualComAss.php 27 Aug 2009 16:23:00 -0000 1.9 --- EqualComAss.php 9 Nov 2010 16:51:37 -0000 1.9.8.1 *************** *** 62,66 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 62,65 ---- Index: CompSquare.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/CompSquare.php,v retrieving revision 1.1 retrieving revision 1.1.8.1 diff -C2 -d -r1.1 -r1.1.8.1 *** CompSquare.php 11 Sep 2009 13:35:49 -0000 1.1 --- CompSquare.php 9 Nov 2010 16:51:37 -0000 1.1.8.1 *************** *** 60,65 **** if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing required variable in CAS Option field'); ! $this->ATError = 'Missing required variable in CAS Option field'; return NULL; } --- 60,68 ---- if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing variable in CAS Option field'); ! $this->ATError = 'Missing variable in CAS Option field'; ! $this->ATFeedback = ' stack_trans("TEST_FAILED");'; ! $this->ATAnsNote = 'STACKERROR_OPTION'; ! $this->ATMark = 0; return NULL; } *************** *** 85,89 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 88,91 ---- Index: LowestTerms.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/LowestTerms.php,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -C2 -d -r1.2 -r1.2.8.1 *** LowestTerms.php 27 Aug 2009 16:23:00 -0000 1.2 --- LowestTerms.php 9 Nov 2010 16:51:37 -0000 1.2.8.1 *************** *** 67,71 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 67,70 ---- Index: MultiEquiv.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/MultiEquiv.php,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** MultiEquiv.php 30 Oct 2009 11:47:14 -0000 1.3 --- MultiEquiv.php 9 Nov 2010 16:51:37 -0000 1.3.4.1 *************** *** 65,69 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 65,68 ---- Index: template_cas_answertest.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/template_cas_answertest.php,v retrieving revision 1.2 retrieving revision 1.2.20.1 diff -C2 -d -r1.2 -r1.2.20.1 *** template_cas_answertest.php 27 Sep 2007 10:40:04 -0000 1.2 --- template_cas_answertest.php 9 Nov 2010 16:51:37 -0000 1.2.20.1 *************** *** 26,32 **** * Description of the answertest.. * ! * @author ! * @version ! * @copyright */ class template_cas_answertest extends AnsTest { --- 26,32 ---- * Description of the answertest.. * ! * @author ! * @version ! * @copyright */ class template_cas_answertest extends AnsTest { *************** *** 34,38 **** // Associations // Operations ! /** * constant --- 34,38 ---- // Associations // Operations ! /** * constant *************** *** 41,60 **** const casFunction = 'ATTest'; /** ! * ! * ! * @param string $sAnsKey ! * @param string $tAnsKey ! * @param CasString $casOption * @access public */ public function __construct($sAnsKey, $tAnsKey, $maximaPreferencs, $casOption = NULL) { ! parent::__construct($sAnsKey, $tAnsKey, $maximaPreferencs, $casOption); } /** * The actual answertest code, for most answertests using the cas this will suffice ! * ! * @return bool * @access public */ --- 41,60 ---- const casFunction = 'ATTest'; /** ! * ! * ! * @param string $sAnsKey ! * @param string $tAnsKey ! * @param CasString $casOption * @access public */ public function __construct($sAnsKey, $tAnsKey, $maximaPreferencs, $casOption = NULL) { ! parent::__construct($sAnsKey, $tAnsKey, $maximaPreferencs, $casOption); } /** * The actual answertest code, for most answertests using the cas this will suffice ! * ! * @return bool * @access public */ *************** *** 63,73 **** $mconn = new maximaConnector($this->maximaPreferences); $result = $mconn->sendAnsTest($this->sAnsKey,$this->tAnsKey, self::casFunction); //the call to the cas ! $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; $this->ATError = $result['error']; ! if($this->ATMark == '1') { --- 63,72 ---- $mconn = new maximaConnector($this->maximaPreferences); $result = $mconn->sendAnsTest($this->sAnsKey,$this->tAnsKey, self::casFunction); //the call to the cas ! $this->ATMark = $result['rawmark']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; $this->ATError = $result['error']; ! if($this->ATMark == '1') { Index: Diff.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/Diff.php,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** Diff.php 27 Aug 2009 16:23:00 -0000 1.11 --- Diff.php 9 Nov 2010 16:51:37 -0000 1.11.8.1 *************** *** 59,64 **** if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing required variable in Cas Option field'); ! $this->ATError = 'Missing required variable in Cas Option field'; return NULL; } --- 59,67 ---- if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing variable in CAS Option field'); ! $this->ATError = 'Missing variable in CAS Option field'; ! $this->ATFeedback = ' stack_trans("TEST_FAILED");'; ! $this->ATAnsNote = 'STACKERROR_OPTION'; ! $this->ATMark = 0; return NULL; } *************** *** 83,87 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 86,89 ---- Index: AlgEquiv.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/AlgEquiv.php,v retrieving revision 1.12 retrieving revision 1.12.8.1 diff -C2 -d -r1.12 -r1.12.8.1 *** AlgEquiv.php 27 Aug 2009 16:23:00 -0000 1.12 --- AlgEquiv.php 9 Nov 2010 16:51:37 -0000 1.12.8.1 *************** *** 64,68 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 64,67 ---- Index: SAExpanded.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/SAExpanded.php,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** SAExpanded.php 27 Aug 2009 16:23:00 -0000 1.9 --- SAExpanded.php 9 Nov 2010 16:51:37 -0000 1.9.8.1 *************** *** 61,65 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 61,64 ---- Index: EquationAT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/EquationAT.php,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** EquationAT.php 30 Oct 2009 16:43:36 -0000 1.6 --- EquationAT.php 9 Nov 2010 16:51:37 -0000 1.6.4.1 *************** *** 61,66 **** if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing required variable in Cas Option field'); ! $this->ATError = 'Missing required variable in Cas Option field'; return NULL; } --- 61,69 ---- if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing variable in CAS Option field'); ! $this->ATError = 'Missing variable in CAS Option field'; ! $this->ATFeedback = ' stack_trans("TEST_FAILED");'; ! $this->ATAnsNote = 'STACKERROR_OPTION'; ! $this->ATMark = 0; return NULL; } *************** *** 85,89 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 88,91 ---- Index: PartFrac.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/PartFrac.php,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** PartFrac.php 27 Aug 2009 16:23:00 -0000 1.11 --- PartFrac.php 9 Nov 2010 16:51:37 -0000 1.11.8.1 *************** *** 60,65 **** if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing required variable in Cas Option field'); ! $this->ATError = 'Missing required variable in Cas Option field'; return NULL; } --- 60,68 ---- if($this->ATOption == NULL) { ! $this->errorLog->addError('Missing variable in CAS Option field'); ! $this->ATError = 'Missing variable in CAS Option field'; ! $this->ATFeedback = ' stack_trans("TEST_FAILED");'; ! $this->ATAnsNote = 'STACKERROR_OPTION'; ! $this->ATMark = 0; return NULL; } *************** *** 85,89 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 88,91 ---- Index: GreaterThanEqual.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/GreaterThanEqual.php,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** GreaterThanEqual.php 27 Aug 2009 16:23:00 -0000 1.9 --- GreaterThanEqual.php 9 Nov 2010 16:51:37 -0000 1.9.8.1 *************** *** 61,65 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 61,64 ---- Index: SubstEquiv.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/answertests/SubstEquiv.php,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -C2 -d -r1.2 -r1.2.8.1 *** SubstEquiv.php 27 Aug 2009 16:23:00 -0000 1.2 --- SubstEquiv.php 9 Nov 2010 16:51:37 -0000 1.2.8.1 *************** *** 64,68 **** $this->ATMark = $result['rawmark']; - $this->ATValid = $result['valid']; $this->ATAnsNote = $result['answernote']; $this->ATFeedback = $result['feedback']; --- 64,67 ---- |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:15
|
Update of /cvsroot/stack/stack-dev/lib/CAS In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/CAS Modified Files: Tag: item_state_separation casText.php displayCASText.php maximaCLIConnector.php maximaXMLConnector.php Log Message: Brought back up to date with big HEAD merge. Index: maximaXMLConnector.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/CAS/maximaXMLConnector.php,v retrieving revision 1.22 retrieving revision 1.22.8.1 diff -C2 -d -r1.22 -r1.22.8.1 *** maximaXMLConnector.php 27 Aug 2009 16:23:00 -0000 1.22 --- maximaXMLConnector.php 9 Nov 2010 16:51:37 -0000 1.22.8.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.6.1 retrieving revision 1.35.6.1.2.1 diff -C2 -d -r1.35.6.1 -r1.35.6.1.2.1 *** maximaCLIConnector.php 2 Nov 2009 11:30:17 -0000 1.35.6.1 --- maximaCLIConnector.php 9 Nov 2010 16:51:37 -0000 1.35.6.1.2.1 *************** *** 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.10.1 diff -C2 -d -r1.37 -r1.37.10.1 *** displayCASText.php 26 Jun 2009 18:08:36 -0000 1.37 --- displayCASText.php 9 Nov 2010 16:51:37 -0000 1.37.10.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.8.1 diff -C2 -d -r1.36 -r1.36.8.1 *** casText.php 27 Aug 2009 16:23:00 -0000 1.36 --- casText.php 9 Nov 2010 16:51:37 -0000 1.36.8.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: Simon H. <sim...@us...> - 2010-11-09 16:52:14
|
Update of /cvsroot/stack/stack-dev/lib/ui/inputTypes In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/lib/ui/inputTypes Modified Files: Tag: item_state_separation DropDownList.php CreatingNewInteractionElements.txt SingleCharIT.php StringIT.php TextArea.php AnswerInputType.php AlgebraIT.php InputTypeController.php ListIT.php TrueFalseIT.php Matrix.php Added Files: Tag: item_state_separation Slider.php Log Message: Brought back up to date with big HEAD merge. Index: SingleCharIT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/SingleCharIT.php,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** SingleCharIT.php 27 Aug 2009 16:23:00 -0000 1.5 --- SingleCharIT.php 9 Nov 2010 16:51:35 -0000 1.5.8.1 *************** *** 104,108 **** return $box; } ! } --- 104,110 ---- return $box; } ! public static function getOptionsUsed() { ! return array('teacherAns', 'forbid', 'sameType', 'studentVerify', 'hideFeedback'); ! } } Index: AnswerInputType.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/AnswerInputType.php,v retrieving revision 1.10.6.1 retrieving revision 1.10.6.1.2.1 diff -C2 -d -r1.10.6.1 -r1.10.6.1.2.1 *** AnswerInputType.php 3 Nov 2009 11:57:57 -0000 1.10.6.1 --- AnswerInputType.php 9 Nov 2010 16:51:35 -0000 1.10.6.1.2.1 *************** *** 160,163 **** --- 160,176 ---- } + /** + * Default is to assume all options used. Subclasses can overide with more restrictive sets. + */ + public static function getOptionsUsed() { + return array('teacherAns', 'boxSize','informalSyntax','insertStars', 'syntaxHint', 'forbid','allow','floats','lowest','sameType','studentVerify', 'hideFeedback'); + } + + /** + * Default is to specify no defaults. Subclasses can overide with some. + */ + public static function getOptionDefaults() { + return NULL; + } } Index: DropDownList.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/DropDownList.php,v retrieving revision 1.6.6.2 retrieving revision 1.6.6.2.2.1 diff -C2 -d -r1.6.6.2 -r1.6.6.2.2.1 *** DropDownList.php 4 Nov 2009 15:23:57 -0000 1.6.6.2 --- DropDownList.php 9 Nov 2010 16:51:35 -0000 1.6.6.2.2.1 *************** *** 157,161 **** } ! } ?> \ No newline at end of file --- 157,167 ---- } ! public static function getOptionsUsed() { ! return array('teacherAns', 'studentVerify', 'hideFeedback'); ! } + public static function getOptionDefaults() { + return array('studentVerify'=>'false', 'hideFeedback'=>'true'); + } + } ?> \ No newline at end of file Index: TextArea.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/TextArea.php,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -C2 -d -r1.2 -r1.2.8.1 *** TextArea.php 27 Aug 2009 16:23:00 -0000 1.2 --- TextArea.php 9 Nov 2010 16:51:35 -0000 1.2.8.1 *************** *** 113,117 **** $rows = $this->modinput_tokenizer(substr($this->default, 1, -1)); // array("[a,b]","[c,d]"); ! $norows = count($rows)+4; $dispval = ''; $cols = $this->boxWidth; --- 113,117 ---- $rows = $this->modinput_tokenizer(substr($this->default, 1, -1)); // array("[a,b]","[c,d]"); ! $norows = count($rows)+3; $dispval = ''; $cols = $this->boxWidth; *************** *** 126,130 **** /** ! * Converts the inputs passed in into a textares into a Maxima list * * @param string|array $in --- 126,130 ---- /** ! * Converts the inputs passed in into a textareas into a Maxima list * * @param string|array $in *************** *** 134,137 **** --- 134,141 ---- public function transform($in) { + if(''==trim($in)) { + return(''); + } + $vals = explode("\n",$in); $out = '['; *************** *** 231,235 **** --- 235,254 ---- } + /** + * Returns an array in the form of the $_POST data, used for the question tests. + * + * @param string $value + * @access public + * @return array + */ + public function getTestPostData($value) + { + $post_data=substr($value,1,strlen($value)-2); + return array($this->name=>$post_data); + } + public static function getOptionDefaults() { + return array('boxSize'=>25, 'studentVerify'=>'true', 'hideFeedback'=>'false'); + } } ?> \ No newline at end of file --- NEW FILE: Slider.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 Benjamin Holmes (ma...@be...) * * @package stackInputType */ global $config; require_once 'AnswerInputType.php'; // A jQuery UI slider, see http://jqueryui.com/demos/slider class Slider extends AnswerInputType { // Attributes //protected $min; //protected $max; //protected $step; public function __construct($name, $width = null, $default = null, $maxLength = null, $height = null, $param = null) { //if (!isset($width)) $width = '200'; $this->name = $name; $this->boxWidth = $width; if($param == NULL) { $this->parameters['slider_min'] = new Meta('required', '0'); $this->parameters['slider_max'] = new Meta('required', '100'); $this->parameters['slider_step'] = new Meta('required', '1'); } else $this->parameters = $param; // parent::__construct($name, $width); //$this->min = $param['min']; //$this->max = $param['max']; //$this->step = $param['step']; parent::__construct($name, $width, $default, $maxLength, $height, $param); } public function getXHTML() { $url = $GLOBALS['config']->get('weburl'); // include jQuery and jQuery UI scripts $slider = '<link rel="stylesheet" type="text/css" href="' . $url . '/other/jqueryCSS/jquery.ui.css" /> <script type="text/javascript" src="' . $url . '/other/jquery.js"></script> <script type="text/javascript" src="' . $url . '/other/jquery.ui.js"></script>'; $slider .= '<div id="' . $this->name . '_slider" style="width: ' . $this->boxWidth . 'px;"></div> <div id="' . $this->name . '_value">'.$this->default.'</div> <input id="' . $this->name . '" name="' . $this->name . '" type="hidden" value="'.$this->default.'" />'; $slider .= '<script type="text/javascript"> $(document).ready(function() { $("#' . $this->name . '_slider").slider({' . (is_numeric($this->default) ? "value: {$this->default}," : '') . (isset($this->parameters['slider_min']) ? "min: {$this->parameters['slider_min']}," : '') . (isset($this->parameters['slider_max']) ? "max: {$this->parameters['slider_max']}," : '') . (isset($this->parameters['slider_step']) ? "step: {$this->parameters['slider_step']}," : '') . ' slide: function(event, ui) { $("#' . $this->name . '").val(ui.value) $("#' . $this->name . '_value").text(ui.value); } }); }); </script>'; return $slider; } /** * Modifies the default parameters of this Input type based on the authors inputs * If authors input is null, returns the defaults. * * @access public * @param array $param * @return array */ public function getDefaultParam($param=NULL) { if(!empty($param['slider_min'])) { $this->parameters['slider_min']->setSelection($param['slider_min']); } if(!empty($param['slider_max'])) { $this->parameters['slider_max']->setSelection($param['slider_max']); } return $this->parameters; } public static function getOptionsUsed() { return array('teacherAns', 'boxSize', 'studentVerify', 'hideFeedback'); } public static function getOptionDefaults() { return array('boxSize'=>'200', 'studentVerify'=>'false', 'hideFeedback'=>'true'); } } ?> Index: Matrix.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/Matrix.php,v retrieving revision 1.6.6.2 retrieving revision 1.6.6.2.2.1 diff -C2 -d -r1.6.6.2 -r1.6.6.2.2.1 *** Matrix.php 5 Nov 2009 11:04:44 -0000 1.6.6.2 --- Matrix.php 9 Nov 2010 16:51:35 -0000 1.6.6.2.2.1 *************** *** 157,163 **** for($j=0; $j < $width; $j++) { ! $name = $this->name.'-'.$i.'-'.$j; $default = empty($this->defaults) ? '' : $this->defaults[$i][$j]; ! $xhtml .= '<td><input type="text" name="'.$name.'" value="'.$default.'" size="'.$this->boxWidth.'" onfocus="this.value=\'\'" ></td>'; } if($i == 0) --- 157,163 ---- for($j=0; $j < $width; $j++) { ! $name = $this->name.'|'.$i.'|'.$j; $default = empty($this->defaults) ? '' : $this->defaults[$i][$j]; ! $xhtml .= '<td><input type="text" name="'.$name.'" value="'.$default.'" size="'.$this->boxWidth.'" ></td>'; } if($i == 0) *************** *** 215,219 **** /*echo '<hr>Defaults:<pre>'; var_dump($this->defaults); ! echo '</pre>';*/ } } --- 215,220 ---- /*echo '<hr>Defaults:<pre>'; var_dump($this->defaults); ! echo '</pre>'; ! */ } } *************** *** 320,331 **** } - /** - * Supercedes OLDmodinput_tokenizer() below - */ - private function modinput_tokenizer($in) { - $list = new stringUtil($in); - return $list->listToArray(); - } - /** * Takes comma separated list of elements and returns them as an array --- 321,324 ---- *************** *** 347,352 **** * contains only the input string */ ! /* ! private function OLDmodinput_tokenizer($in) { $braceCount = 0; $parenthesisCount = 0; --- 340,344 ---- * contains only the input string */ ! private function modinput_tokenizer($in) { $braceCount = 0; $parenthesisCount = 0; *************** *** 403,407 **** return $out; } - */ /** --- 395,398 ---- *************** *** 414,446 **** public function getTestPostData($value) { - $post_data = array(); - - /* - $cs = 'matrix_size('.$this->parameters['teacherAns'].')'; - $matrixSize = new CasString($cs); ! $mct = new MultiCasText(array('size' => $matrixSize)); ! $mct->casValidate('t'); ! ! $size = $mct->getRawValues('size'); ! $dimensions = explode(',',$size[$cs]); ! $height = trim($dimensions[0], '[]'); ! $width = trim($dimensions[1], '[]'); ! for($i=0; $i < $height; $i++) { ! for($j=0; $j < $width; $j++) { ! $name = $this->name.'-'.$i.'-'.$j; ! $default = empty($this->defaults) ? '' : $this->defaults[$i][$j]; ! $post_data[$name] = $default; ! } } - */ ! return $post_data; } ! } ?> \ No newline at end of file --- 405,432 ---- public function getTestPostData($value) { ! $this -> setDefault($value); ! $post_data = array(); ! $height = count($this->defaults); ! if ($height>0) { ! $width = count($this->defaults[1]); ! for($i=0; $i < $height; $i++) { ! for($j=0; $j < $width; $j++) { ! $name = $this->name.'|'.$i.'|'.$j; ! $default = empty($this->defaults) ? '' : $this->defaults[$i][$j]; ! $post_data[$name] = $default; ! } ! } } ! return $post_data; } ! public static function getOptionsUsed() { ! return array('teacherAns', 'informalSyntax', 'insertStars', 'syntaxHint', 'forbid', 'allow', 'floats', 'lowest', 'sameType', 'studentVerify', 'hideFeedback'); ! } } ?> \ No newline at end of file Index: StringIT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/StringIT.php,v retrieving revision 1.6 retrieving revision 1.6.8.1 diff -C2 -d -r1.6 -r1.6.8.1 *** StringIT.php 27 Aug 2009 16:23:00 -0000 1.6 --- StringIT.php 9 Nov 2010 16:51:35 -0000 1.6.8.1 *************** *** 113,116 **** --- 113,123 ---- } + public static function getOptionsUsed() { + return array('teacherAns', 'forbid', 'allow', 'floats', 'lowest', 'sameType', 'studentVerify', 'hideFeedback'); + } + + public static function getOptionDefaults() { + return array('boxSize'=>20, 'studentVerify'=>'false', 'hideFeedback'=>'true'); + } } Index: AlgebraIT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/AlgebraIT.php,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -C2 -d -r1.7 -r1.7.8.1 *** AlgebraIT.php 27 Aug 2009 16:23:00 -0000 1.7 --- AlgebraIT.php 9 Nov 2010 16:51:35 -0000 1.7.8.1 *************** *** 117,120 **** --- 117,138 ---- return $box; } + + public static function getOptionsUsed() { + return parent::getOptionsUsed(); + } + + + /** + * Returns the default options. + * Only need to specify where they differ from QuestionPart defaults, so does not contain all used options (see setOptionsUsed()) + * String keys MUST match QuestionPart variable names. + * + * @param array $param + * @access public + * @return Array(String) + */ + public static function getOptionDefaults() { + return array('boxSize'=>'20'); + } } ?> \ No newline at end of file Index: InputTypeController.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/InputTypeController.php,v retrieving revision 1.12 retrieving revision 1.12.8.1 diff -C2 -d -r1.12 -r1.12.8.1 *** InputTypeController.php 27 Aug 2009 16:23:00 -0000 1.12 --- InputTypeController.php 9 Nov 2010 16:51:35 -0000 1.12.8.1 *************** *** 34,37 **** --- 34,38 ---- require_once $root.'/lib/ui/inputTypes/ListIT.php'; require_once $root.'/lib/ui/inputTypes/TextArea.php'; + require_once $root.'/lib/ui/inputTypes/Slider.php'; class InputTypeController *************** *** 44,48 **** * @access private */ ! private $avaliableTypes; /** --- 45,49 ---- * @access private */ ! private $availableTypes; /** *************** *** 110,125 **** $this->answerBox = new TextArea($name, $width, $default, $maxLength, $height, $param); break; } } //set list of avaliable input types, in a format that can be translated ! $this->avaliableTypes['Algebraic Input'] = get_string('stackInputType_Algebraic', 'stack', ''); ! $this->avaliableTypes['True/False'] = get_string('stackInputType_truefalse', 'stack', ''); ! $this->avaliableTypes['Single Character'] = get_string('stackInputType_singlechar', 'stack', ''); ! $this->avaliableTypes['DropDownList'] = get_string('stackInputType_dropdownlist', 'stack', ''); ! $this->avaliableTypes['Matrix'] = get_string('stackInputType_matrix', 'stack', ''); ! $this->avaliableTypes['List'] = get_string('stackInputType_list', 'stack', ''); ! $this->avaliableTypes['Textarea'] = get_string('stackInputType_Textarea', 'stack', ''); // We currently don't allow strings to be passed to the CAS, so remove this type. ! //$this->avaliableTypes['String'] = get_string('stackInputType_String', 'stack', ''); // Currently there are too many bugs with DragMath - so don't offer it! //$this->avaliableTypes['Dragmath with input box'] = get_string('stackInputType_dragmathInputBox', 'stack', ''); --- 111,131 ---- $this->answerBox = new TextArea($name, $width, $default, $maxLength, $height, $param); break; + + case 'Slider': + $this->answerBox = new Slider($name, $width, $default, $maxLength, $height, $param); + break; } } //set list of avaliable input types, in a format that can be translated ! $this->availableTypes['Algebraic Input'] = get_string('stackInputType_Algebraic', 'stack', ''); ! $this->availableTypes['True/False'] = get_string('stackInputType_truefalse', 'stack', ''); ! $this->availableTypes['Single Character'] = get_string('stackInputType_singlechar', 'stack', ''); ! $this->availableTypes['DropDownList'] = get_string('stackInputType_dropdownlist', 'stack', ''); ! $this->availableTypes['Matrix'] = get_string('stackInputType_matrix', 'stack', ''); ! $this->availableTypes['List'] = get_string('stackInputType_list', 'stack', ''); ! $this->availableTypes['Textarea'] = get_string('stackInputType_Textarea', 'stack', ''); ! $this->availableTypes['Slider'] = get_string('stackInputType_slider', 'stack', ''); // We currently don't allow strings to be passed to the CAS, so remove this type. ! //$this->availableTypes['String'] = get_string('stackInputType_String', 'stack', ''); // Currently there are too many bugs with DragMath - so don't offer it! //$this->avaliableTypes['Dragmath with input box'] = get_string('stackInputType_dragmathInputBox', 'stack', ''); *************** *** 166,170 **** //display a drop down list $widget = '<select name="'.$prefix.'">'; ! foreach($this->avaliableTypes as $key => $val) { //if indexed array of values, use val for both display and return --- 172,176 ---- //display a drop down list $widget = '<select name="'.$prefix.'">'; ! foreach($this->availableTypes as $key => $val) { //if indexed array of values, use val for both display and return *************** *** 222,226 **** return $this->answerBox->transform($in); } - } ?> \ No newline at end of file --- 228,280 ---- return $this->answerBox->transform($in); } + public function getTestPostData($in) + { + return $this->answerBox->getTestPostData($in); + } + + /** + * Return array of arrays for each IT to be used by authoring interface. + */ + public static function getOptionsUsed() + { + // HTML option values mapping to array of options to be shown + $used['Algebraic Input'] = AlgebraIT::getOptionsUsed(); + //$used['DragMathAppletOnly'] = DragMathAppletOnly::getOptionsUsed(); + //$used['DragMathInputBox'] = DragMathInputBox::getOptionsUsed(); + $used['Single Character'] = SingleCharIT::getOptionsUsed(); + //$used['StringIT'] = StringIT::getOptionsUsed(); + $used['True/False'] = TrueFalseIT::getOptionsUsed(); + $used['DropDownList'] = DropDownList::getOptionsUsed(); + $used['Matrix'] = Matrix::getOptionsUsed(); + $used['List'] = ListIT::getOptionsUsed(); + $used['Textarea'] = TextArea::getOptionsUsed(); + $used['Slider'] = Slider::getOptionsUsed(); + + foreach($used as $type => $value) { + $used[$type][] = 'inputType'; // obviously required for all + } + + return $used; + } + + /** + * Return array of arrays for each IT to be used by authoring interface. + */ + public static function getOptionDefaults() { + $defaults['Algebraic Input'] = AlgebraIT::getOptionDefaults(); + //$defaults['DragMathAppletOnly'] = DragMathAppletOnly::getOptionDefaults(); + //$defaults['DragMathInputBox'] = DragMathInputBox::getOptionDefaults(); + $defaults['Single Character'] = SingleCharIT::getOptionDefaults(); + //$defaults['StringIT'] = StringIT::getOptionDefaults(); + $defaults['True/False'] = TrueFalseIT::getOptionDefaults(); + $defaults['DropDownList'] = DropDownList::getOptionDefaults(); + $defaults['Matrix'] = Matrix::getOptionDefaults(); + $defaults['List'] = ListIT::getOptionDefaults(); + $defaults['Textarea'] = TextArea::getOptionDefaults(); + $defaults['Slider'] = Slider::getOptionDefaults(); + + return $defaults; + } + } ?> \ No newline at end of file Index: ListIT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/ListIT.php,v retrieving revision 1.4.6.3 retrieving revision 1.4.6.3.2.1 diff -C2 -d -r1.4.6.3 -r1.4.6.3.2.1 *** ListIT.php 24 Nov 2009 09:47:48 -0000 1.4.6.3 --- ListIT.php 9 Nov 2010 16:51:35 -0000 1.4.6.3.2.1 *************** *** 274,278 **** foreach($randomSet as $id) { ! $xhtml .= '<input type="radio" name="'.$this->name.'" value="'.$displayVals[$id]['list_label'].'" />'.$displayVals[$id]['list_display']."<br />\n"; } } else { --- 274,278 ---- foreach($randomSet as $id) { ! $xhtml .= '<input type="radio" name="'.$this->name.'" value="'.$displayVals[$id]['list_label'].'" />'.stripslashes($displayVals[$id]['list_display'])."<br />\n"; } } else { *************** *** 282,290 **** if($this->default == $displayVals[$id]['list_label']) { ! $xhtml .= '<input type="radio" name="'.$this->name.'" value="'.$displayVals[$id]['list_label'].'" checked />'.$displayVals[$id]['list_display']."<br />\n"; } else { ! $xhtml .= '<input type="radio" name="'.$this->name.'" value="'.$displayVals[$id]['list_label'].'" />'.$displayVals[$id]['list_display']."<br />\n"; } } --- 282,290 ---- if($this->default == $displayVals[$id]['list_label']) { ! $xhtml .= '<input type="radio" name="'.$this->name.'" value="'.$displayVals[$id]['list_label'].'" checked />'.stripslashes($displayVals[$id]['list_display'])."<br />\n"; } else { ! $xhtml .= '<input type="radio" name="'.$this->name.'" value="'.$displayVals[$id]['list_label'].'" />'.stripslashes($displayVals[$id]['list_display'])."<br />\n"; } } *************** *** 331,351 **** { // Don't need "not selected" in checkbox type. ! //$xhtml .= '<input type="checkbox" name="'.$this->name.'-'.$i++.'" value="" checked />'.$ns_s."<br />\n"; foreach($randomSet as $id) { ! $xhtml .= '<input type="checkbox" name="'.$this->name.'-'.$i++.'" value="'.$displayVals[$id]['list_label'].'" />'.$displayVals[$id]['list_display']."<br />\n"; } } else { // Don't need "not selected" in checkbox type. ! //$xhtml .= '<input type="checkbox" name="'.$this->name.'-'.$i++.'" value="" />'.$ns_s."<br />\n"; foreach($randomSet as $id) { if(in_array($displayVals[$id]['list_label'],$ans_array)) { ! $xhtml .= '<input type="checkbox" name="'.$this->name.'-'.$i++.'" value="'.$displayVals[$id]['list_label'].'" checked />'.$displayVals[$id]['list_display']."<br />\n"; } else { ! $xhtml .= '<input type="checkbox" name="'.$this->name.'-'.$i++.'" value="'.$displayVals[$id]['list_label'].'" />'.$displayVals[$id]['list_display']."<br />\n"; } } --- 331,351 ---- { // Don't need "not selected" in checkbox type. ! //$xhtml .= '<input type="checkbox" name="'.$this->name.'|'.$i++.'" value="" checked />'.$ns_s."<br />\n"; foreach($randomSet as $id) { ! $xhtml .= '<input type="checkbox" name="'.$this->name.'|'.$i++.'" value="'.$displayVals[$id]['list_label'].'" />'.$displayVals[$id]['list_display']."<br />\n"; } } else { // Don't need "not selected" in checkbox type. ! //$xhtml .= '<input type="checkbox" name="'.$this->name.'|'.$i++.'" value="" />'.$ns_s."<br />\n"; foreach($randomSet as $id) { if(in_array($displayVals[$id]['list_label'],$ans_array)) { ! $xhtml .= '<input type="checkbox" name="'.$this->name.'|'.$i++.'" value="'.$displayVals[$id]['list_label'].'" checked />'.$displayVals[$id]['list_display']."<br />\n"; } else { ! $xhtml .= '<input type="checkbox" name="'.$this->name.'|'.$i++.'" value="'.$displayVals[$id]['list_label'].'" />'.$displayVals[$id]['list_display']."<br />\n"; } } *************** *** 402,406 **** foreach ($ans_array as $key=>$val) { ! $post_data[] = array($this->name.'-'.$key=>$val); } } --- 402,406 ---- foreach ($ans_array as $key=>$val) { ! $post_data[$this->name.'-'.$key] = $val; } } *************** *** 447,450 **** --- 447,454 ---- } } + + public static function getOptionsUsed() { + return array('teacherAns', 'studentVerify', 'hideFeedback'); + } } ?> \ No newline at end of file Index: CreatingNewInteractionElements.txt =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/CreatingNewInteractionElements.txt,v retrieving revision 1.1 retrieving revision 1.1.10.1 diff -C2 -d -r1.1 -r1.1.10.1 *** CreatingNewInteractionElements.txt 2 Jul 2009 10:46:41 -0000 1.1 --- CreatingNewInteractionElements.txt 9 Nov 2010 16:51:35 -0000 1.1.10.1 *************** *** 8,9 **** --- 8,12 ---- If a new interaction element fails to work through Moodle, look here. + + Where an interaction element needs to create more than one form + element, look at the Matrix type. Index: TrueFalseIT.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/ui/inputTypes/TrueFalseIT.php,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -C2 -d -r1.9 -r1.9.8.1 *** TrueFalseIT.php 27 Aug 2009 16:23:00 -0000 1.9 --- TrueFalseIT.php 9 Nov 2010 16:51:35 -0000 1.9.8.1 *************** *** 124,127 **** --- 124,153 ---- } + + /** + * Returns an array of all options that are relevant to this type (overiding ALL options) + * Used to determine which options to show in authoring, for example. + * String keys MUST match QuestionPart variable names. + * + * @access public + * @return Array(String) + */ + public static function getOptionsUsed() + { + return array('teacherAns', 'studentVerify', 'hideFeedback'); + } + + /** + * Returns the default options. + * Only need to specify where they differ from QuestionPart defaults, so does not contain all used options (see setUsedoptions()) + * String keys MUST match QuestionPart variable names. + * + * @param array $param + * @access public + * @return Array(StackOption) + */ + public static function getOptionDefaults() { + return array('studentVerify'=>'false', 'hideFeedback'=>'true'); + } } |
From: Simon H. <sim...@us...> - 2010-11-09 16:52:13
|
Update of /cvsroot/stack/stack-dev/install/update In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/install/update Modified Files: Tag: item_state_separation Updater.php index.php Log Message: Brought back up to date with big HEAD merge. Index: Updater.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/update/Updater.php,v retrieving revision 1.6 retrieving revision 1.6.8.1 diff -C2 -d -r1.6 -r1.6.8.1 *** Updater.php 27 Aug 2009 16:22:48 -0000 1.6 --- Updater.php 9 Nov 2010 16:51:35 -0000 1.6.8.1 *************** *** 21,25 **** require_once($root.'/lib/database/StackDBBackup.php'); ! define(STACK_CURRENT, 'STACK 2.0 alpha 2'); //The latest version of STACK. class Updater{ --- 21,25 ---- require_once($root.'/lib/database/StackDBBackup.php'); ! define(STACK_CURRENT, 'STACK 2.2'); //The latest version of STACK. class Updater{ *************** *** 63,68 **** unset($update); ! case 'STACK 2.0 alpha 2': ! //nothing yet } --- 63,73 ---- unset($update); ! // bit of a jump!? ! ! case 'STACK 2.0 beta': ! require_once('updates/TwoPointTwo.php'); //load the code to update STACK to 2.2 ! $update = new TwoPointTwo($this->errorLog); ! $update->performUpdate(); ! unset($update); } Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-dev/install/update/index.php,v retrieving revision 1.4 retrieving revision 1.4.16.1 diff -C2 -d -r1.4 -r1.4.16.1 *** index.php 14 Nov 2008 19:05:59 -0000 1.4 --- index.php 9 Nov 2010 16:51:35 -0000 1.4.16.1 *************** *** 17,21 **** */ session_start(); ! define(STACK_CURRENT, 'STACK 2.0 beta'); //The latest version of STACK. $configFile = '../../config.php'; if(!file_exists($configFile)) --- 17,21 ---- */ session_start(); ! define(STACK_CURRENT, 'STACK 2.2'); //The latest version of STACK. $configFile = '../../config.php'; if(!file_exists($configFile)) |
From: Simon H. <sim...@us...> - 2010-11-09 16:51:55
|
Update of /cvsroot/stack/stack-dev/sample_questions In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25193/sample_questions Modified Files: Tag: item_state_separation test_7.xml interaction_element_test.xml Added Files: Tag: item_state_separation test_10.xml test-venn.xml Removed Files: Tag: item_state_separation demo_venn.xml Log Message: Brought back up to date with big HEAD merge. --- NEW FILE: test-venn.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><img src="http://chart.apis.google.com/chart?cht=v&chs=200x100&chd=t:@a@,@b@,0,@anb@,0,0&chdl=A|B"> <br/> The size of $A=@a@$, the size of $A \cup B=@aub@$ and the size of $A \cap B = @anb@$. <br/> What is the size of $B$? <br /> #ans# <IEfeedback>ans</IEfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>a = 30 + rand(20); b = 40 + rand(50); anb = 5 + rand(20); aub = a+b-anb</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>ans</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>5</boxsize><teachersAns type="CasString"><casString>b</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans</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/><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>test-venn</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Demonstrates embedding question variables inside img tags to access third-party graphics api.</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection>http://localhost/stack-dev</selection><default>http://stack.bham.ac.uk/new-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>2010-02-08 17:17:40</selection><default>2010-02-08 17:17:22</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, test, venn, sets, size</selection><default>demo, test, venn, sets, size</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>true</default><values><value>true</value><value>false</value></values><casKey>make_complexI</casKey><casType>fun</casType><selected>true</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/></assessmentItem> --- demo_venn.xml DELETED --- Index: test_7.xml =================================================================== RCS file: /cvsroot/stack/stack-dev/sample_questions/test_7.xml,v retrieving revision 1.2 retrieving revision 1.2.10.1 diff -C2 -d -r1.2 -r1.2.10.1 *** test_7.xml 23 Jun 2009 14:39:35 -0000 1.2 --- test_7.xml 9 Nov 2010 16:51:38 -0000 1.2.10.1 *************** *** 1,10 **** <?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>Find the general solution to ! \[ @q@ =0. \] ! $y(t)=$#ans1# <IEfeedback>ans1</IEfeedback> ! <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>l1 = 1+(-1)^rand(1)*rand(6); l2 = l1+(-1)^rand(1)*(1+rand(4)); c1 = -1*(l1+l2); c2 = l1*l2; q = 'diff(y(t),t,2)+c1*'diff(y(t),t)+c2*y(t); ta = A*e^(l1*t)+B*e^(l2*t)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>@ta@</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>ta</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>false</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>true</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 = ev(q,y(t)=ans1,nouns,fullratsimp); l = setify(listofvars(ans1)); l = setdifference(l,set(t)); l = listify(l); lv = length(l); b1 = ev(ans1,t=0,fullratsimp); b2 = ev(ans1,t=1,fullratsimp); m = if b2#0 then fullratsimp(b1/b2) else 0; m = float(m)</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></rawMark><feedback>Your answer should satisfy the differential equation, but in fact when we substitute your expression into the differential equation we get \[@p@\] which is not zero, so you must have done something wrong.</feedback><ansnote>Fails to satisfy DE</ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>2</teachersAns><studentAns>lv</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-1-T </ansnote><nextPR>2</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0.75</rawMark><feedback>You should have a general solution, which includes unknown constants. Your answer satisfies the differential equation, but does not have the correct number of unknown ! constants.</feedback><ansnote>Insufficient constants</ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>true</teachersAns><studentAns>numberp(m)</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback>Your general solution should be a sum of two linearly independent components, but is not.</feedback><ansnote>Not two lin ind parts</ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>1</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>test_7</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Second order linear ODE with constant coefficients, general</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection>http://www.stack.bham.ac.uk/</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>PrimaryEducation</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>VeryEasy</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>Think</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>Elementary</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-03-09 17:36:09</selection><default>2009-03-09 17:28:03</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, ODE, </selection><default>demo, ODE, </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='correctAns'>Correct answer, well done.</span></default><casKey></casKey><casType></casType><selected><span class='correctAns'>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>ta</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-F </value></col></test><test><col><key>IE_ans1</key><value>A*e^(l1*t)</value></col><col><key>PRT_PotResTree_Result</key><value>Insufficient constants</value></col></test></ItemTests></assessmentItem> --- 1,17 ---- <?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>Find the general solution to ! \[ @ode@ =0. \] ! <br /> $y(t)=$#ans1# <IEfeedback>ans1</IEfeedback> ! <PRTfeedback>Result</PRTfeedback></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>l1 = 1+(-1)^rand(1)*rand(6); l2 = l1+(-1)^rand(1)*(1+rand(4)); c1 = -1*(l1+l2); c2 = l1*l2; ode = 'diff(y(t),t,2)+c1*'diff(y(t),t)+c2*y(t); ta = A*e^(l1*t)+B*e^(l2*t)</rawKeyVals><forbidFloats>false</forbidFloats><simplify>true</simplify></questionVariables><workedSolution type="CasText"><castext></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></workedSolution><questionNote type="CasText"><castext>@ta@</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>ta</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>false</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>true</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>sa1 = subst(y(t)=ans1,ode); sa2 = ev(sa1,nouns); sa3 = fullratsimp(expand(sa2)); l = delete(t,listofvars(ans1)); lv = length(l); b1 = ev(ans1,t=0,fullratsimp); b2 = ev(ans1,t=1,fullratsimp); m = float(if b2#0 then fullratsimp(b1/b2) else 0)</feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>AlgEquiv</answerTest><teachersAns>0</teachersAns><studentAns>sa3</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></rawMark><feedback>Your answer should satisfy the differential equation. ! In fact, when we substitute your expression into the differential equation we get ! <br >\[ @sa1@ =0, \]<br > ! evaluating the derivatives we have ! <br >\[ @sa2@ =0 \]<br > ! This simplifies to ! <br >\[ @sa3@ = 0,\]<br > ! so you must have done something wrong.</feedback><ansnote>Fails to satisfy DE</ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR><PR id="1"><answerTest>AlgEquiv</answerTest><teachersAns>2</teachersAns><studentAns>lv</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>Result-1-T </ansnote><nextPR>2</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0.75</rawMark><feedback>You should have a general solution, which includes unknown constants. Your answer satisfies the differential equation, but does not have the correct number of unknown ! constants.</feedback><ansnote>Insufficient constants</ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR><PR id="2"><answerTest>AlgEquiv</answerTest><teachersAns>true</teachersAns><studentAns>numberp(m)</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback>Your general solution should be a sum of two linearly independent components, but is not.</feedback><ansnote>Not two lin ind parts</ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>1</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>test_7</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>Second order linear ODE with constant coefficients, general</selection><default></default><values/></dc:description><dc:publisher stackname="questionPublisher" type="Meta"><selection>http://www.stack.bham.ac.uk/</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>PrimaryEducation</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>VeryEasy</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>Think</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>Elementary</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-02-22 13:37:02</selection><default>2010-02-22 12:18:20</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, ODE</selection><default>demo, ODE</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='correctAns'>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>ta</value></col><col><key>PRT_PotResTree_Result</key><value>Result-2-F </value></col></test><test><col><key>IE_ans1</key><value>A*e^(l1*t)+A*e^(l2*t)</value></col><col><key>PRT_PotResTree_Result</key><value>Insufficient constants</value></col></test><test><col><key>IE_ans1</key><value>A*e^(l1*t)+B*e^((l2+1)*t)</value></col><col><key>PRT_PotResTree_Result</key><value>Fails to satisfy DE</value></col></test><test><col><key>IE_ans1</key><value>A*e^(l1*t)+B*e^(l1*t)</value></col><col><key>PRT_PotResTree_Result</key><value>Not two lin ind parts</value></col></test></ItemTests></assessmentItem> --- NEW FILE: test_10.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>What is $1+1$? #ans1# <IEfeedback>ans1</IEfeedback><PRTfeedback>1</PRTfeedback> <p>How confident are you? #con1# <IEfeedback>con1</IEfeedback></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>5</boxsize><teachersAns type="CasString"><casString>2</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><questionpart><name>con1</name><inputType type="Meta"><selection>Slider</selection><default>Algebraic Input</default><values/></inputType><boxsize>200</boxsize><teachersAns type="CasString"><casString>0</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>con1</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_1</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables></feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>Equal_Com_Ass</answerTest><teachersAns>2</teachersAns><studentAns>ans1</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>1-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback></feedback><ansnote>1-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>test_10</selection><default></default><values/></dc:title><dc:description stackname="questionDescription" type="Meta"><selection>A trivial question: $1+1=$? together with confidence based testing.</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>PrimaryEducation</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>VeryEasy</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>Think</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>Elementary</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-07-30 14:42:20</selection><default>2010-07-30 14:33:56</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></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><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>2</value></col><col><key>PRT_PotResTree_1</key><value>1-0-T </value></col><col><key>IE_con1</key><value></value></col></test><test><col><key>IE_ans1</key><value>3</value></col><col><key>PRT_PotResTree_1</key><value>1-0-F </value></col><col><key>IE_con1</key><value></value></col></test></ItemTests></assessmentItem> Index: interaction_element_test.xml =================================================================== RCS file: /cvsroot/stack/stack-dev/sample_questions/interaction_element_test.xml,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.1.2.1 diff -C2 -d -r1.6.6.1 -r1.6.6.1.2.1 *** interaction_element_test.xml 3 Nov 2009 11:58:08 -0000 1.6.6.1 --- interaction_element_test.xml 9 Nov 2010 16:51:38 -0000 1.6.6.1.2.1 *************** *** 1,25 **** <?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>Type in the algebraic expression \[ @ta@ \] #ans# <IEfeedback>ans</IEfeedback><PRTfeedback>1</PRTfeedback> ! <p>The algebraic input box is the default input option. It can be used for all other kinds, for example ! <ul> ! <li> Sets <tt>{1,2,3}</tt> </li> ! <li> List <tt>[1,2,3]</tt> </li> ! <li> Martices <tt>matrix([1,2],[3,4])</tt> </li> ! </ul> ! </p></castext><forbidFloats>false</forbidFloats><simplify>true</simplify></questionStem><questionVariables type="RawKeyVal"><rawKeyVals>ta = 1/(1+x^2)</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>ans</name><inputType type="Meta"><selection>Algebraic Input</selection><default>Algebraic Input</default><values/></inputType><boxsize>15</boxsize><teachersAns type="CasString"><casString>ta</casString><forbidFloats>false</forbidFloats><simplify>true</simplify></teachersAns><studentAnsKey>ans</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_1</prtname><questionValue>1</questionValue><autoSimplify>true</autoSimplify><feedbackVariables></feedbackVariables><description type="Meta"><selection></selection><default></default><values/></description><PotentialResponses><PR id="0"><answerTest>AlgEquiv</answerTest><teachersAns>ta</teachersAns><studentAns>ans</studentAns><testoptions></testoptions><quietAnsTest></quietAnsTest><true><rawModMark>=</rawModMark><rawMark>1</rawMark><feedback></feedback><ansnote>1-0-T </ansnote><nextPR>-1</nextPR></true><false><rawModMark>=</rawModMark><rawMark>0</rawMark><feedback></feedback><ansnote>1-0-F </ansnote><nextPR>-1</nextPR></false><teacherNote></teacherNote></PR></PotentialResponses></PotentialResponseTree></PotentialResponseTrees><MetaData><dc:Publisher stackname="lastUserEditor" type="Meta"><selection></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>interaction_element_test_alg</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 ... [truncated message content] |