You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(486) |
Jul
(201) |
Aug
(194) |
Sep
(87) |
Oct
(72) |
Nov
(72) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(41) |
Mar
(22) |
Apr
(4) |
May
(12) |
Jun
|
Jul
|
Aug
(42) |
Sep
(21) |
Oct
(14) |
Nov
(10) |
Dec
|
2007 |
Jan
(14) |
Feb
(34) |
Mar
(61) |
Apr
(54) |
May
(140) |
Jun
(184) |
Jul
(164) |
Aug
(130) |
Sep
(241) |
Oct
(175) |
Nov
(148) |
Dec
(96) |
2008 |
Jan
(5) |
Feb
(38) |
Mar
(30) |
Apr
(46) |
May
(25) |
Jun
(22) |
Jul
(5) |
Aug
(17) |
Sep
(2) |
Oct
(100) |
Nov
(83) |
Dec
(33) |
2009 |
Jan
(127) |
Feb
(43) |
Mar
(86) |
Apr
(34) |
May
(50) |
Jun
(168) |
Jul
(48) |
Aug
(66) |
Sep
(38) |
Oct
(75) |
Nov
(113) |
Dec
(72) |
2010 |
Jan
(123) |
Feb
(68) |
Mar
(26) |
Apr
(11) |
May
(39) |
Jun
(131) |
Jul
(56) |
Aug
(79) |
Sep
(69) |
Oct
(17) |
Nov
(166) |
Dec
(32) |
2011 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(8) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Chris S. <san...@us...> - 2005-09-05 13:41:04
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16737/scripts Modified Files: stackAuthor.php stackDatabase.php stackQuiz.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** stackQuiz.php 4 Sep 2005 21:26:18 -0000 1.12 --- stackQuiz.php 5 Sep 2005 13:40:56 -0000 1.13 *************** *** 207,210 **** --- 207,211 ---- echo "\n<table cellpadding='2'>\n"; echo "\n<tr><th>{$stackQuiz['quizName']['descript']}</th><th>{$stackQuiz['quizDescription']['descript']}</th><th>Last mark (%)</th><th>{$stackQuiz['quizDueDate']['descript']}</th></tr>"; + foreach ($quiz_store as $qs => $quiz) { $qname = $quiz['quizName']; *************** *** 222,234 **** } if ($review) { $uID = $user['id']; ! echo "<tr><td><a href=\"javascript:quizreview('$uID','$qID','$subjectID');\">{$qname}</a></td>\n"; } else { ! echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; } ! echo "<td>".$quiz['quizDescription']."</td><td align='center'>$mark</td>\n"; if ('' != $quiz['quizDueDate']) { ! echo "<td>".stack_time_display($quiz['quizDueDate'])."</td>"; } echo "</tr>\n"; --- 223,236 ---- } + echo "<tr>\n"; if ($review) { $uID = $user['id']; ! echo " <td><a href=\"javascript:quizreview('$uID','$qID','$subjectID');\">{$qname}</a></td>\n"; } else { ! echo " <td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; } ! echo ' <td>'.$quiz['quizDescription']."</td>\n <td align='center'>$mark</td>\n"; if ('' != $quiz['quizDueDate']) { ! echo ' <td>'.stack_time_display($quiz['quizDueDate'])."</td>\n"; } echo "</tr>\n"; Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** stackDatabase.php 5 Sep 2005 13:26:22 -0000 1.46 --- stackDatabase.php 5 Sep 2005 13:40:56 -0000 1.47 *************** *** 198,206 **** // Display each row of the table if ('edit_metadata' != $action) { ! if ($trcol) { ! echo "\n<tr bgcolor='#DDDDDD'>\n"; ! } else { ! echo "\n<tr bgcolor='#DDDDFF'>\n"; ! } echo(" <td><input type='checkbox' name='checked[{$row[0]}]' value='ticked' /></td>\n"); echo(' <td>' . $row[0] . "</td>\n"); --- 198,202 ---- // Display each row of the table if ('edit_metadata' != $action) { ! if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } echo(" <td><input type='checkbox' name='checked[{$row[0]}]' value='ticked' /></td>\n"); echo(' <td>' . $row[0] . "</td>\n"); *************** *** 221,229 **** // Descriptions on a new line. if ($filter['show_descript']) { ! if ($trcol) { ! echo "\n<tr bgcolor='#DDDDDD'>\n"; ! } else { ! echo "\n<tr bgcolor='#DDDDFF'>\n"; ! } echo "<td></td>\n"; echo " <td colspan='3'><font size='1'>".stripslashes($row[2])."</font></td>\n"; --- 217,221 ---- // Descriptions on a new line. if ($filter['show_descript']) { ! if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } echo "<td></td>\n"; echo " <td colspan='3'><font size='1'>".stripslashes($row[2])."</font></td>\n"; *************** *** 1650,1654 **** for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_row($result); ! $usages .= ' '.$row[0]; } } else { --- 1642,1647 ---- for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_row($result); ! $quiz = stack_db_quiz_get($row[0],FALSE); ! $usages .= '<br /> ('.$row[0].') '.$quiz['quizName']; } } else { Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** stackAuthor.php 5 Sep 2005 08:52:21 -0000 1.42 --- stackAuthor.php 5 Sep 2005 13:40:56 -0000 1.43 *************** *** 847,851 **** --- 847,853 ---- echo "\n<table>\n"; echo "<tr><th>Drop</th><th>Order</th><th>Question no.</th><th>Name</th> <th>Key words</th></tr>\n"; + $trcol = FALSE; foreach ($quiz['questions'] as $qn => $qu) { + $trcol = !$trcol; $qID = $qu['questionID']; $qo = nsf($qu,'order'); *************** *** 860,867 **** $qkw = ''; } ! echo "<tr><td><input type=\"checkbox\" name=\"quiz[questions][$qn][drop]\" value=\"ticked\" /></td>\n"; ! echo "<td><input type=\"text\" name=\"quiz[questions][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; ! echo "<td><input type=\"hidden\" name=\"quiz[questions][$qn][questionID]\" value=\"{$qID}\" />$qID</td>"; ! echo "<td>$qname</td><td>$qkw</td> </tr>\n"; } --- 862,870 ---- $qkw = ''; } ! if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } ! echo " <td><input type=\"checkbox\" name=\"quiz[questions][$qn][drop]\" value=\"ticked\" /></td>\n"; ! echo " <td><input type=\"text\" name=\"quiz[questions][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; ! echo " <td><input type=\"hidden\" name=\"quiz[questions][$qn][questionID]\" value=\"{$qID}\" />$qID</td>"; ! echo " <td>$qname</td><td>$qkw</td> </tr>\n"; } *************** *** 1264,1268 **** --- 1267,1273 ---- echo "\n<table>\n"; echo "<tr>\n <th>Drop</th>\n <th>Order</th>\n <th>Quiz no.</th><th>Name</th><th></th>\n</tr>\n"; + $trcol = FALSE; foreach ($subject['quizzes'] as $qn => $qu) { + $trcol = !$trcol; $qID = $qu['quizid']; $qo = nsf($qu,'order'); *************** *** 1277,1281 **** $qkw = ''; } ! echo "<tr>\n <td><input type=\"checkbox\" name=\"subject[quizzes][$qn][drop]\" value=\"ticked\" /></td>\n"; echo " <td><input type=\"text\" name=\"subject[quizzes][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; echo " <td><input type=\"hidden\" name=\"subject[quizzes][$qn][quizid]\" value=\"{$qID}\" />$qID</td>\n"; --- 1282,1287 ---- $qkw = ''; } ! if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } ! echo " <td><input type=\"checkbox\" name=\"subject[quizzes][$qn][drop]\" value=\"ticked\" /></td>\n"; echo " <td><input type=\"text\" name=\"subject[quizzes][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; echo " <td><input type=\"hidden\" name=\"subject[quizzes][$qn][quizid]\" value=\"{$qID}\" />$qID</td>\n"; *************** *** 1535,1539 **** global $stackSubject; ! echo "\n<table cellpadding='2' border='1'>\n"; echo "\n<tr>\n"; echo " <th>{$stackSubject['subjectOrder']['descript']}</th>\n <th>ID</th>\n"; --- 1541,1545 ---- global $stackSubject; ! echo "\n<table cellpadding='1'>\n"; echo "\n<tr>\n"; echo " <th>{$stackSubject['subjectOrder']['descript']}</th>\n <th>ID</th>\n"; *************** *** 1542,1546 **** --- 1548,1554 ---- echo " <th>{$stackSubject['subjectDescription']['descript']}</th>\n</tr>\n"; + $trcol = FALSE; foreach ($subject_store as $key => $subject) { + $trcol = !$trcol; $sID = $subject['subjectID']; $so = nsf($subject,'subjectOrder'); *************** *** 1553,1557 **** } ! echo "<tr>\n"; echo " <td><input type=\"text\" name=\"zone[subjectOrder][$key][order]\" size=\"3\" value=\"{$so}\" />\n"; echo " <input type=\"hidden\" name=\"zone[subjectOrder][$key][subjectID]\" size=\"3\" value=\"{$sID}\" /></td>\n"; --- 1561,1565 ---- } ! if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } echo " <td><input type=\"text\" name=\"zone[subjectOrder][$key][order]\" size=\"3\" value=\"{$so}\" />\n"; echo " <input type=\"hidden\" name=\"zone[subjectOrder][$key][subjectID]\" size=\"3\" value=\"{$sID}\" /></td>\n"; |
From: Chris S. <san...@us...> - 2005-09-05 13:26:30
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13315/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** stackDatabase.php 5 Sep 2005 09:40:32 -0000 1.45 --- stackDatabase.php 5 Sep 2005 13:26:22 -0000 1.46 *************** *** 180,184 **** --- 180,186 ---- echo '<tbody>'; + $trcol = FALSE; for ($i = 0; $i < mysql_num_rows($result); $i++) { + $trcol = !$trcol; $row = mysql_fetch_row($result); *************** *** 196,204 **** // Display each row of the table if ('edit_metadata' != $action) { ! echo "\n<tr>"; ! echo("<td><input type='checkbox' name='checked[{$row[0]}]' value='ticked' /></td>\n"); ! echo('<td>' . $row[0] . '</td>'); ! echo('<td>' . $qname . '</td>'); ! echo('<td>' . $qkeywords . '</td>'); echo "\n<td nowrap='nowrap'><a href=\"javascript:SelectQ('$row[0]','edit_from_db');\">edit</a> <a href=\"javascript:SelectQ('$row[0]','preview_from_db');\">try</a> --- 198,210 ---- // Display each row of the table if ('edit_metadata' != $action) { ! if ($trcol) { ! echo "\n<tr bgcolor='#DDDDDD'>\n"; ! } else { ! echo "\n<tr bgcolor='#DDDDFF'>\n"; ! } ! echo(" <td><input type='checkbox' name='checked[{$row[0]}]' value='ticked' /></td>\n"); ! echo(' <td>' . $row[0] . "</td>\n"); ! echo(' <td>' . $qname . "</td>\n"); ! echo(' <td>' . $qkeywords . "</td>\n"); echo "\n<td nowrap='nowrap'><a href=\"javascript:SelectQ('$row[0]','edit_from_db');\">edit</a> <a href=\"javascript:SelectQ('$row[0]','preview_from_db');\">try</a> *************** *** 215,220 **** // Descriptions on a new line. if ($filter['show_descript']) { ! echo "<tr><td></td>\n"; ! echo "<td colspan='4'><font size='1'>".stripslashes($row[2])."</font></td></tr>\n"; } --- 221,235 ---- // Descriptions on a new line. if ($filter['show_descript']) { ! if ($trcol) { ! echo "\n<tr bgcolor='#DDDDDD'>\n"; ! } else { ! echo "\n<tr bgcolor='#DDDDFF'>\n"; ! } ! echo "<td></td>\n"; ! echo " <td colspan='3'><font size='1'>".stripslashes($row[2])."</font></td>\n"; ! // Show which quizzes a question is used. ! $usage = stack_db_quiz_question_use_report($row[0]); ! echo " <td colspan='2'><font size='1'>$usage</font></td>\n"; ! echo "</tr>\n"; } *************** *** 1619,1622 **** --- 1634,1664 ---- /** + * Provides a string report on which quizzes a question is used in. + * Used in stackAuthor.php + * + * @param int $questionID The questionID of the question! + * @return string $usages + */ + function stack_db_quiz_question_use_report($questionID) { + + $query = "SELECT quizid FROM quiz_question WHERE questionID = '$questionID';"; + $result = stack_db_query($query); + + if(0 != mysql_num_rows($result)) { + + $usages = 'Quiz ID(s):'; + for ($i = 0; $i < mysql_num_rows($result); $i++) { + $row = mysql_fetch_row($result); + $usages .= ' '.$row[0]; + } + } else { + $usages = '[Unused]'; + } + + return $usages; + } + + + /** * Drop a questionID from a quiz * *************** *** 1691,1702 **** * Record the fact the student has seen the solutions. * ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. ! * @param int $seed The $seed used to generate the questions. * @return void */ ! function stack_db_quiz_quizattempt_seensol($quizid,$userID,$seed) { ! $query = "UPDATE quizAttempts SET SolRequest = '1' WHERE quizid='$quizid' AND userID='$userID' AND Seed='$seed';"; $result = stack_db_query($query); } --- 1733,1745 ---- * Record the fact the student has seen the solutions. * ! * @param int $subjectID The $quizid number. ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. ! * @param int $seed The $seed used to generate the questions. * @return void */ ! function stack_db_quiz_quizattempt_seensol($subjectID,$quizid,$userID,$seed) { ! $query = "UPDATE quizAttempts SET SolRequest = '1' WHERE subjectID = '$subjectID' AND quizid='$quizid' AND userID='$userID' AND Seed='$seed';"; $result = stack_db_query($query); } |
From: Chris S. <san...@us...> - 2005-09-05 13:26:30
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13315 Modified Files: quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** quiz.php 4 Sep 2005 21:26:18 -0000 1.33 --- quiz.php 5 Sep 2005 13:26:22 -0000 1.34 *************** *** 43,46 **** --- 43,47 ---- $subject = ''; + $subjectID = -1; if (array_key_exists('subject',$_SESSION)) { $subject = $_SESSION['subject']; *************** *** 454,458 **** // (2.9.1) record the fact we have asked for solutions if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_seensol($quiz['quizid'],$user['id'],$quiz['seed']); } $quizid = $quiz['quizid']; --- 455,459 ---- // (2.9.1) record the fact we have asked for solutions if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_seensol($subjectID,$quiz['quizid'],$user['id'],$quiz['seed']); } $quizid = $quiz['quizid']; |
From: Chris S. <san...@us...> - 2005-09-05 09:40:39
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27424/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** stackDatabase.php 5 Sep 2005 09:19:26 -0000 1.44 --- stackDatabase.php 5 Sep 2005 09:40:32 -0000 1.45 *************** *** 1229,1232 **** --- 1229,1233 ---- $stackUserKeys = array_keys($stackUser); + $query =''; foreach ($stackUserKeys as $val) { $query .= ' ,'.$val; |
From: Chris S. <san...@us...> - 2005-09-05 09:19:44
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23811 Modified Files: user.php Log Message: Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** user.php 4 Sep 2005 19:24:57 -0000 1.7 --- user.php 5 Sep 2005 09:19:26 -0000 1.8 *************** *** 82,87 **** break; case 'review': ! $quiz_store = stack_db_quiz_get(); ! stack_quiz_student_select($quiz_store, $user_stu,TRUE); break; case 'delete': --- 82,88 ---- break; case 'review': ! echo "Not yet implemented."; ! //$quiz_store = stack_db_quiz_get(); ! //stack_quiz_student_select($quiz_store, $user_stu,TRUE); break; case 'delete': |
From: Chris S. <san...@us...> - 2005-09-05 09:19:44
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23811/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** stackDatabase.php 5 Sep 2005 08:21:40 -0000 1.43 --- stackDatabase.php 5 Sep 2005 09:19:26 -0000 1.44 *************** *** 1497,1503 **** } - // sortout options; - - $quiz_list[] = $quiz; --- 1497,1500 ---- |
From: pkiddie <pk...@us...> - 2005-09-05 08:52:30
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18357/scripts/rqp Modified Files: RQPv1p0Server.php stackRQP.php Log Message: Additions to RQP code to enable editing of existing assessmentItems held on Moodle Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RQPv1p0Server.php 3 Sep 2005 21:47:07 -0000 1.6 --- RQPv1p0Server.php 5 Sep 2005 08:52:21 -0000 1.7 *************** *** 374,400 **** //Use existing source to fill in fields within authoring form //Import source XML and display question editing form ! if('adminOptions'==$source) { ! $options_headings = array(get_string('stackOptions_edit_out','stack'),''); ! $options_list = array('Display','Language'); ! ! $fieldname = 'quiz'.'[quizOptions]'; ! ! $output = array('title' => '', //initially question will have no title ! //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), ! 'stem' => '', ! 'feedback' => '', ! 'response' => '', ! 'answer' => '', ! 'solution' => ''); ! } ! ! else if ('teacherOptions'==$source) { ! } ! ! else if ('userOptions'==$source) { } ! } } --- 374,498 ---- //Use existing source to fill in fields within authoring form //Import source XML and display question editing form ! switch($source) { ! case('adminOptions'): { ! $options_headings = array(get_string('stackOptions_edit_out','stack'),''); ! $options_list = array('Display','Language'); ! ! $fieldname = 'quiz'.'[quizOptions]'; ! ! $output = array('title' => '', //initially question will have no title ! //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), ! 'stem' => '', ! 'feedback' => '', ! 'response' => '', ! 'answer' => '', ! 'solution' => ''); ! break; ! } ! ! case('teacherOptions'): { ! $options_headings = array(get_string('stackOptions_edit_out','stack'),''); ! $options_list = array('Display','Language'); ! ! $fieldname = 'quiz'.'[quizOptions]'; ! ! $output = array('title' => '', //initially question will have no title ! //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), ! 'stem' => '', ! 'feedback' => '', ! 'response' => '', ! 'answer' => '', ! 'solution' => ''); ! break; ! } ! ! case('userOptions'): { ! $options_headings = array(get_string('stackOptions_edit_out','stack'),''); ! $options_list = array('Display','Language'); ! ! $fieldname = 'quiz'.'[quizOptions]'; ! ! $output = array('title' => '', //initially question will have no title ! //remoteCaller = true ! 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), ! 'stem' => '', ! 'feedback' => '', ! 'response' => '', ! 'answer' => '', ! 'solution' => ''); ! break; ! } ! ! //run where the source contains something other than options directives. ! //This could only be STACK question source XML ! default: { ! if (empty($inputData)) { //On initial entry of editing an existing qu. ! $question = stack_rqp_parse_xml_string($source, &$errors); // Retrieve the question from source ! ! if (!$question) { //If for some reason, the source is invalid ! return new nbSOAPFault("invalidSource", "The clients source is invalid"); ! } ! ! stack_question_validate($question,$errors); // Validate question and add potential reponse fields ! } ! ! else { //On successive iterations of editing an existing qu. ! $question = stack_rqp_question_get($inputData); // parse input fields instead ! stack_question_validate($question,$errors); // validate question and add potential reponse fields ! ! //Where there are no errors in the users input and the user has requested to save the question ! if ($errors=='' && stack_rqp_input_field_get($inputData, 'save')) ! { ! $outcomeVars['completion'] = 'complete'; ! $outcomeVars['source'] = stack_rqp_source_write($question); ! } ! ! else ! { ! $outcomeVars['completion'] = 'unknown'; ! } ! } ! ! $output['title'] = $question['questionName']; ! $output['body'] = stack_question_edit_form_substance($question,$errors,$namePrefix, $remoteCaller = TRUE); ! break; ! } } ! ! } ! } ! ! //Currently empty directives means attempting a question ! else { ! $question = stack_rqp_parse_xml_string($source, &$errors); // Retrieve the question from source ! ! if (!$question) { //If for some reason, the source is invalid ! return new nbSOAPFault("invalidSource", "The clients source is invalid"); } + + stack_question_validate($question,$errors); // Validate question and add potential reponse fields + + $seed = stack_get_seed(); + $options = stack_options_set($question); + $questionInst = stack_question_inst($question,$seed,$options,$errors); + + $this_attempt = stack_question_inst_mark($questionInst,$options,$RawAns,$errors); + $this_attempt['Action'] = $action; + + stack_question_add_attempt($questionInst,$this_attempt,$errors); + $_SESSION['questionInst'] = $questionInst; + $_SESSION['question'] = $questionInst; + // CJS We should display the question as the student should see it. Hence not + //stack_display_qb_preview($questionInst); + // But instead + + stack_question_inst_try_test($questionInst,$this_attempt,$options,$errors); + stack_question_inst_try_formfrag($RawAns, $AnsFieldName); + + + + $output['body'] = "<b>Render here!</b>"; } Index: stackRQP.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/stackRQP.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackRQP.php 3 Sep 2005 21:47:07 -0000 1.2 --- stackRQP.php 5 Sep 2005 08:52:21 -0000 1.3 *************** *** 5,10 **** require_once('../stackXML.php'); ! /** This function retrieves a particular field from the RQP inputData key val array ! * Used in retrieving save field */ function stack_rqp_input_field_get($inputData, $keyName) { --- 5,17 ---- require_once('../stackXML.php'); ! /** ! * Retrieves a particular field from a key-val style array ! * ! * Used in this case to retrieve the value of a particular field from the ! * inputData RQP_Render param. ! * ! * @param array $inputData The key-val array ! * @param string $keyName The field we are searching for ! * @return mixed Value of field if successfully found, otherwise false */ function stack_rqp_input_field_get($inputData, $keyName) { *************** *** 19,24 **** } ! /** Converts a DOMIT_Document instance to an XML string, which may be returned to the RQP client as ! * the 'source' param */ function stack_rqp_source_write($question) --- 26,36 ---- } ! /** ! * Converts a STACK question $question instance to a string of XML ! * ! * Used to return $question as 'source' render response parameter ! * ! * @param array $question The question we wish to retrieve the XML for ! * @return string XML representation of question */ function stack_rqp_source_write($question) *************** *** 29,39 **** } ! /** Provides first line defense against 'source' which is either ! * 1. not xml ! * 2. not stack valid XML (i.e. no assessmentItem head element) ! * This will be a rarity as all STACK servers should author questions, and return XML, but just in case... ! * ! * Version number of XML is checked - if it doesnt exist then we assume the use of old parsing code ! * We do not allow the importing of a list of questions, i.e. mathQuiz */ function stack_rqp_parse_xml_string($xmlString, &$errors) --- 41,53 ---- } ! /** ! * Converts a string of XML to a STACK question instance ! * ! * Checks the XML string input is valid, that it contains an <assessmentItem> tag, and decides what version of parsing code ! * it should use. ! * ! * @param string $xmlString The XML we wish to create the $question instance for ! * @param string $errors Any errors whilst attempting to parse the XML ! * @return mixed $question instance where parsing is successful, otherwise false */ function stack_rqp_parse_xml_string($xmlString, &$errors) *************** *** 43,53 **** $xmlString = html_entity_decode($xmlString); ! //We need to cut the two <pres> from the beginning of the string, if they exist ! if (0===strpos($xmlString,'<pre>')) //we have identified these <pre> exist, now remove them { ! $length = strlen($xmlString); ! ! //Get substring, and remove any more HTML formatting ! $parsedXml = html_entity_decode(substr($xmlString,5,$length-11)); } --- 57,65 ---- $xmlString = html_entity_decode($xmlString); ! //Check to see if <pre> exists within the XML string. Added at an unknown point.. ! if (0===strpos($xmlString,'<pre>')) { ! $length = strlen($xmlString); //get length of XML string ! $parsedXml = html_entity_decode(substr($xmlString,5,$length-11)); //remove <pre>,</pre> tags and any more HTML encoding } *************** *** 111,115 **** /** ! * Gets the question instance that has been stored within the RQP inputData fields * @param array $inputData inputData key/val array * @return array $question The question --- 123,128 ---- /** ! * Creates a question instance whose fields have been stored within the RQP_Render inputData param ! * * @param array $inputData inputData key/val array * @return array $question The question *************** *** 121,129 **** foreach ($stackQuestion as $qfield => $attribs) { for ($i=0;$i<(count($inputData));$i++) ! { ! //show_array($inputData[$i]); ! //show_array($qfield); ! //show_array($inputData[$i]['key']); ! if ($qfield==$inputData[$i]['key']) { if ($qfield == 'questionOptions') { --- 134,138 ---- foreach ($stackQuestion as $qfield => $attribs) { for ($i=0;$i<(count($inputData));$i++) ! { if ($qfield==$inputData[$i]['key']) { if ($qfield == 'questionOptions') { *************** *** 147,165 **** } } ! ! show_array($question); ! ! /*foreach($stackQuestion as $qfield => $attribs) { ! if (array_key_exists($qfield,$_POST) ) { ! if ('questionOptions' == $qfield) { ! $question[$qfield] = $_POST[$qfield]; ! } else if ('questionPotResp' == $qfield ) { ! $question[$qfield] = $_POST[$qfield]; ! } else if ( '' !=trim($_POST[$qfield]) ) { ! // We need this: all fields on form will be present in $_POST. ! $question[$qfield] = $_POST[$qfield]; ! } ! } ! }*/ return $question; } --- 156,160 ---- } } ! return $question; } |
From: pkiddie <pk...@us...> - 2005-09-05 08:52:30
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18357/scripts Modified Files: stackAuthor.php Log Message: Additions to RQP code to enable editing of existing assessmentItems held on Moodle Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** stackAuthor.php 5 Sep 2005 08:21:40 -0000 1.41 --- stackAuthor.php 5 Sep 2005 08:52:21 -0000 1.42 *************** *** 880,884 **** $fieldname = 'quiz'.'[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$prefix); // Check if quiz has metadata set --- 880,884 ---- $fieldname = 'quiz'.'[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname); // Check if quiz has metadata set |
From: Chris S. <san...@us...> - 2005-09-05 08:21:48
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13534/scripts Modified Files: stackAuthor.php stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** stackDatabase.php 4 Sep 2005 21:26:18 -0000 1.42 --- stackDatabase.php 5 Sep 2005 08:21:40 -0000 1.43 *************** *** 1384,1391 **** $result = stack_db_query($query); ! $query = "DELETE FROM quizattempts WHERE userID = '$userID'"; $result = stack_db_query($query); ! $query = "DELETE FROM questionattempts WHERE userID = '$userID'"; $result = stack_db_query($query); --- 1384,1391 ---- $result = stack_db_query($query); ! $query = "DELETE FROM quizAttempts WHERE userID = '$userID'"; $result = stack_db_query($query); ! $query = "DELETE FROM questionAttempts WHERE userID = '$userID'"; $result = stack_db_query($query); Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** stackAuthor.php 4 Sep 2005 21:26:18 -0000 1.40 --- stackAuthor.php 5 Sep 2005 08:21:40 -0000 1.41 *************** *** 1272,1276 **** $quiz = stack_db_quiz_get($qID,TRUE); $qname = $quiz['quizName']; ! $qkw = $question['quizKeywords']; } else { $qname = "Quiz with ID is $qID missing from DB!"; --- 1272,1276 ---- $quiz = stack_db_quiz_get($qID,TRUE); $qname = $quiz['quizName']; ! $qkw = $quiz['quizKeywords']; } else { $qname = "Quiz with ID is $qID missing from DB!"; *************** *** 1297,1301 **** $fieldname = 'subject'.'[subjectOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$prefix); // Check if subject has metadata set --- 1297,1301 ---- $fieldname = 'subject'.'[subjectOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname); // Check if subject has metadata set |
From: Chris S. <san...@us...> - 2005-09-05 08:21:48
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13534 Modified Files: stackLib.php Log Message: Index: stackLib.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/stackLib.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stackLib.php 4 Sep 2005 19:24:57 -0000 1.3 --- stackLib.php 5 Sep 2005 08:21:40 -0000 1.4 *************** *** 31,35 **** require_once("{$stack_root}/scripts/stackQuestion.php"); require_once("{$stack_root}/scripts/stackQuiz.php"); ! require_once("{$stack_root}/scripts/stacksubject.php"); require_once("{$stack_root}/scripts/stackUser.php"); --- 31,35 ---- require_once("{$stack_root}/scripts/stackQuestion.php"); require_once("{$stack_root}/scripts/stackQuiz.php"); ! require_once("{$stack_root}/scripts/stackSubject.php"); require_once("{$stack_root}/scripts/stackUser.php"); |
From: Chris S. <san...@us...> - 2005-09-05 08:21:48
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13534/scripts/install Modified Files: stackUpdateDatabase.php Log Message: Index: stackUpdateDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackUpdateDatabase.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** stackUpdateDatabase.php 4 Sep 2005 19:24:57 -0000 1.8 --- stackUpdateDatabase.php 5 Sep 2005 08:21:40 -0000 1.9 *************** *** 61,65 **** // ! $query = 'ALTER TABLE quizattempts ADD COLUMN subjectID int(11) default NULL;'; --- 61,65 ---- // ! $query = 'ALTER TABLE quizAttempts ADD COLUMN subjectID int(11) default NULL;'; |
From: Chris S. <san...@us...> - 2005-09-04 21:26:27
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3193/scripts Modified Files: stackAuthor.php stackDatabase.php stackFrontend.php stackQuiz.php stackSubject.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stackQuiz.php 4 Sep 2005 19:24:58 -0000 1.11 --- stackQuiz.php 4 Sep 2005 21:26:18 -0000 1.12 *************** *** 179,187 **** /** * Displays the student quiz selection screen * @param array $quize_store The list of quizzes * @param $user * @return void */ ! function stack_quiz_student_select($quiz_store, $user,$review=FALSE) { global $stack_root; require_once("{$stack_root}/html/quizjava.html"); --- 179,188 ---- /** * Displays the student quiz selection screen + * @param int $subjectID * @param array $quize_store The list of quizzes * @param $user * @return void */ ! function stack_quiz_student_select($subjectID, $quiz_store, $user, $review=FALSE) { global $stack_root; require_once("{$stack_root}/html/quizjava.html"); *************** *** 192,198 **** if (is_array($quiz_store)) { echo "<script language=\"javascript\"> ! function quizreview(u,n) { ! document.forms.quizform.userid.value = u; ! document.forms.quizform.quizid.value = n; document.forms.quizform.submit(); } --- 193,200 ---- if (is_array($quiz_store)) { echo "<script language=\"javascript\"> ! function quizreview(u,n,m) { ! document.forms.quizform.userid.value = u; ! document.forms.quizform.quizid.value = n; ! document.forms.quizform.subjectID.value = m; document.forms.quizform.submit(); } *************** *** 201,204 **** --- 203,207 ---- <input type='hidden' name='userid' value='-1'> <input type='hidden' name='quizid' value='-1'> + <input type='hidden' name='subjectID' value='-1'> <input type='hidden' name='action' value='review'>"; echo "\n<table cellpadding='2'>\n"; *************** *** 210,214 **** if (is_array($user)) { if (array_key_exists('id',$user)) { ! $userinfo = stack_db_quiz_quizattempt_getlast($qID,$user['id']); if (is_array($userinfo)) { if (NULL != $userinfo['mark']) { --- 213,217 ---- if (is_array($user)) { if (array_key_exists('id',$user)) { ! $userinfo = stack_db_quiz_quizattempt_getlast($subjectID,$qID,$user['id']); if (is_array($userinfo)) { if (NULL != $userinfo['mark']) { *************** *** 221,225 **** if ($review) { $uID = $user['id']; ! echo "<tr><td><a href=\"javascript:quizreview('$uID','$qID');\">{$qname}</a></td>\n"; } else { echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; --- 224,228 ---- if ($review) { $uID = $user['id']; ! echo "<tr><td><a href=\"javascript:quizreview('$uID','$qID','$subjectID');\">{$qname}</a></td>\n"; } else { echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; *************** *** 243,247 **** * @return void */ ! function stack_quiz_report($quizid) { global $stack_web_url; --- 246,250 ---- * @return void */ ! function stack_quiz_report($quizid,$subjectID) { global $stack_web_url; *************** *** 298,303 **** $username = $this_user['name']; echo "<tr>\n"; ! echo " <td><a href=\"javascript:quizreview('$userid','$quizid');\">$username</a></td>\n"; ! $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$userid); if (is_array($userinfo)) { --- 301,306 ---- $username = $this_user['name']; echo "<tr>\n"; ! echo " <td><a href=\"javascript:quizreview('$userid','$quizid','$subjectID');\">$username</a></td>\n"; ! $userinfo = stack_db_quiz_quizattempt_getlast($subjectID,$quizid,$userid); if (is_array($userinfo)) { *************** *** 344,350 **** echo "<script language=\"javascript\"> ! function quizreview(u,n) { document.forms.quiztryform.userid.value = u; document.forms.quiztryform.quizid.value = n; document.forms.quiztryform.submit(); } --- 347,354 ---- echo "<script language=\"javascript\"> ! function quizreview(u,n,m) { document.forms.quiztryform.userid.value = u; document.forms.quiztryform.quizid.value = n; + document.forms.quiztryform.subjectID.value = m; document.forms.quiztryform.submit(); } *************** *** 352,355 **** --- 356,360 ---- <p>\n<form name='quiztryform' action='{$stack_web_url}quiz.php' method='POST'> <input type='hidden' name='quizid' value='-1' /> + <input type='hidden' name='subjectID' value='-1' /> <input type='hidden' name='userid' value='-1' /> <input type='hidden' name='action' value='review' /> Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** stackDatabase.php 4 Sep 2005 19:24:57 -0000 1.41 --- stackDatabase.php 4 Sep 2005 21:26:18 -0000 1.42 *************** *** 170,174 **** if(0 != mysql_num_rows($result)) { - echo "<h2>Question bank</h2>\n"; echo "<font size='-2'>Search the question bank using comma separated lists of search terms in the Name and Keywords fields. Choose to match either 'Any' or 'All' of these to display the questions. Leave both blank to display all questions in the question bank. White space is ignored.</font>"; echo "<form name='stackquestionsform' action='{$_PHP_SELF}' method='POST'>\n"; --- 170,173 ---- *************** *** 1537,1541 **** if ('' == $quizid) { $new_quiz = TRUE; ! } else if(!stack_db_confirm_quiz_exists($quizid)) { $new_quiz = TRUE; } --- 1536,1540 ---- if ('' == $quizid) { $new_quiz = TRUE; ! } else if(!stack_db_quiz_confirm_exists($quizid)) { $new_quiz = TRUE; } *************** *** 1669,1675 **** * @return void */ ! function stack_db_quiz_quizattempt_store($quizid,$userID,$seed) { ! $query = "INSERT INTO quizAttempts (quizid, userID, Seed ) VALUES ('$quizid','$userID','$seed')"; $result = stack_db_query($query); } --- 1668,1674 ---- * @return void */ ! function stack_db_quiz_quizattempt_store($subjectID,$quizid,$userID,$seed) { ! $query = "INSERT INTO quizAttempts (subjectID, quizid, userID, Seed ) VALUES ('$subjectID', '$quizid','$userID','$seed')"; $result = stack_db_query($query); } *************** *** 1708,1720 **** * Return the last attempt at a quiz. An array containing the seed and mark are returned. * ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. * @return array $userinfo */ ! function stack_db_quiz_quizattempt_getlast($quizid,$userID) { $userinfo = NULL; ! $query = "SELECT Seed, Mark, MaxMark, SolRequest FROM quizAttempts WHERE quizid = '$quizid' and userID = '$userID'"; $result = stack_db_query($query); --- 1707,1720 ---- * Return the last attempt at a quiz. An array containing the seed and mark are returned. * ! * @param int $subjectID The $subjectID number. ! * @param int $quizid The $quizid number. ! * @param int $userID The $userID number. * @return array $userinfo */ ! function stack_db_quiz_quizattempt_getlast($subjectID,$quizid,$userID) { $userinfo = NULL; ! $query = "SELECT Seed, Mark, MaxMark, SolRequest FROM quizAttempts WHERE subjectID = '$subjectID' and quizid = '$quizid' and userID = '$userID'"; $result = stack_db_query($query); *************** *** 1777,1780 **** --- 1777,1787 ---- $result = stack_db_query($query); + // (2) Delete all attempt records + $query = "DELETE FROM quiz_attempts WHERE subjectID = '$subjectID'"; + $result = stack_db_query($query); + + // (3) Delete all user registrations + $query = "DELETE FROM user_subject WHERE subjectID = '$subjectID'"; + $result = stack_db_query($query); } Index: stackSubject.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackSubject.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stackSubject.php 4 Sep 2005 19:24:58 -0000 1.1 --- stackSubject.php 4 Sep 2005 21:26:18 -0000 1.2 *************** *** 206,212 **** } </script> ! <p>\n<form name='subjectform' action='index.php' method='POST'> ! <input type='hidden' name='subjectID' value='-1'> ! <input type='hidden' name='action' value='choose_quiz'>"; echo "\n<table cellpadding='2'>\n"; echo "\n<tr>\n <th>{$stackSubject['subjectName']['descript']}</th>\n"; --- 206,213 ---- } </script> ! <form name='subjectform' action='index.php' method='POST'> ! <input type='hidden' name='subjectID' value='-1'> ! <input type='hidden' name='action' value='choose_quiz'>"; ! echo "\n<table cellpadding='2'>\n"; echo "\n<tr>\n <th>{$stackSubject['subjectName']['descript']}</th>\n"; Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** stackAuthor.php 4 Sep 2005 19:24:57 -0000 1.39 --- stackAuthor.php 4 Sep 2005 21:26:18 -0000 1.40 *************** *** 1207,1210 **** --- 1207,1211 ---- $t = time(); $dts = strftime('%c',$t); // Format the string. + $subjectID=$subject['subjectID']; //Does the subject have options set? *************** *** 1217,1220 **** --- 1218,1223 ---- $optval = stack_options_formvals_set($subject_options); + + // Timestamp this edit echo "<form name='stacksubjecteditform' action='$PostTo' method='POST'>\n"; *************** *** 1255,1259 **** stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,''); - echo "<p><b>Quizzes attached to this subject:</b><br />(An empty order field indicates they are attached but hidden)"; --- 1258,1261 ---- *************** *** 1261,1265 **** if (is_array($subject['quizzes'])) { echo "\n<table>\n"; ! echo "<tr><th>Drop</th><th>Order</th><th>Quiz no.</th><th>Name</th></tr>\n"; foreach ($subject['quizzes'] as $qn => $qu) { $qID = $qu['quizid']; --- 1263,1267 ---- if (is_array($subject['quizzes'])) { echo "\n<table>\n"; ! echo "<tr>\n <th>Drop</th>\n <th>Order</th>\n <th>Quiz no.</th><th>Name</th><th></th>\n</tr>\n"; foreach ($subject['quizzes'] as $qn => $qu) { $qID = $qu['quizid']; *************** *** 1275,1282 **** $qkw = ''; } ! echo "<tr><td><input type=\"checkbox\" name=\"subject[quizzes][$qn][drop]\" value=\"ticked\" /></td>\n"; ! echo "<td><input type=\"text\" name=\"subject[quizzes][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; ! echo "<td><input type=\"hidden\" name=\"subject[quizzes][$qn][quizid]\" value=\"{$qID}\" />$qID</td>"; ! echo "<td>$qname</td><td>$qkw</td> </tr>\n"; } --- 1277,1284 ---- $qkw = ''; } ! echo "<tr>\n <td><input type=\"checkbox\" name=\"subject[quizzes][$qn][drop]\" value=\"ticked\" /></td>\n"; ! echo " <td><input type=\"text\" name=\"subject[quizzes][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; ! echo " <td><input type=\"hidden\" name=\"subject[quizzes][$qn][quizid]\" value=\"{$qID}\" />$qID</td>\n"; ! echo " <td>$qname</td>\n <td>$qkw</td>\n <td><a href=\"javascript:quizreview($qID,$subjectID);\">Review</a></td>\n</tr>\n"; } Index: stackFrontend.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackFrontend.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackFrontend.php 4 Sep 2005 19:24:57 -0000 1.2 --- stackFrontend.php 4 Sep 2005 21:26:18 -0000 1.3 *************** *** 243,247 **** echo "<td><a href=\"javascript:takeaction('quiz_edit','$qID');\">edit</a></td>\n"; echo "<td><a href=\"javascript:quiztry('continue_quiz','$qID');\">try</a></td>\n"; - echo "<td><a href=\"javascript:takeaction('quiz_report','$qID');\">results</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_xml','$qID');\">xml</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_delete','$qID');\"><font color='red'>del</font></a></td></tr>\n"; --- 243,246 ---- |
From: Chris S. <san...@us...> - 2005-09-04 21:26:27
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3193 Modified Files: editquiz.php editsubject.php editzone.php import.php index.php question_bank.php quiz.php Log Message: Index: editzone.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editzone.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editzone.php 4 Sep 2005 19:24:57 -0000 1.1 --- editzone.php 4 Sep 2005 21:26:18 -0000 1.2 *************** *** 92,95 **** --- 92,96 ---- /////////////////////////////////////////////////////////////// + echo "<h1>Zone page</h1>"; // Print the form listing the subjects. Index: editsubject.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editsubject.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editsubject.php 4 Sep 2005 19:24:57 -0000 1.1 --- editsubject.php 4 Sep 2005 21:26:18 -0000 1.2 *************** *** 37,43 **** require_once("{$stack_root}/scripts/stackFrontend.php"); - require_once("{$stack_root}/html/trypopupform.html"); - require_once("{$stack_root}/html/helpform.php"); - require_once("{$stack_root}/html/subjectjava.html"); /////////////////////////////////////////////////////////////// --- 37,40 ---- *************** *** 53,56 **** --- 50,55 ---- include('html/pagehead.php'); stack_user_ensureadmin($user); + require_once("{$stack_root}/html/helpform.php"); + require_once("{$stack_root}/html/subjectjava.html"); //////////////////////////////////////////////// *************** *** 129,132 **** --- 128,132 ---- //////////////////////////////////////////////// + echo "<h1>Subject page</h1>"; // (3.1) Display any errors. Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/import.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** import.php 30 Aug 2005 14:39:21 -0000 1.9 --- import.php 4 Sep 2005 21:26:18 -0000 1.10 *************** *** 36,43 **** require_once("{$stack_root}/scripts/stackAuthor.php"); ! ! require_once("{$stack_root}/html/trypopupform.html"); ! require_once("{$stack_root}/html/helpform.php"); ! require_once("{$stack_root}/html/quizjava.html"); $default_action = 'import'; --- 36,40 ---- require_once("{$stack_root}/scripts/stackAuthor.php"); ! require_once("{$stack_root}/scripts/stackFrontend.php"); $default_action = 'import'; *************** *** 49,58 **** include('html/pagehead.php'); ! ! if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { //Only allow import where logged in user is admin ! stack_display_editquiz_error_not_admin($user); ! include('html/pagefoot.php'); ! die(); ! } $upload_successful = FALSE; --- 46,50 ---- include('html/pagehead.php'); ! stack_user_ensureadmin($user); $upload_successful = FALSE; *************** *** 281,285 **** //For each valid question we must also add the question to the database stack_db_quiz_add_question($quiz['quizid'],$qu['questionID'],$key); //For each question, add link from quiz to question ! //explicitly state question order } echo "</tr>\n"; --- 273,277 ---- //For each valid question we must also add the question to the database stack_db_quiz_add_question($quiz['quizid'],$qu['questionID'],$key); //For each question, add link from quiz to question ! //explicitly state question order } echo "</tr>\n"; Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** quiz.php 4 Sep 2005 19:24:57 -0000 1.32 --- quiz.php 4 Sep 2005 21:26:18 -0000 1.33 *************** *** 19,23 **** include($stack_root.'/frontend_general/process_input.php'); - ///////////////////////////////////////////////////////////// // (1) For a quiz, the admin user should behave like a guest. --- 19,22 ---- *************** *** 46,50 **** if (array_key_exists('subject',$_SESSION)) { $subject = $_SESSION['subject']; ! } // $focus means "one question at a time"; --- 45,53 ---- if (array_key_exists('subject',$_SESSION)) { $subject = $_SESSION['subject']; ! $subjectID = $subject['subjectID']; ! } else if (array_key_exists('subjectID',$_POST)) { ! $subjectID = $_POST['subjectID']; ! $subject = stack_db_subject_get($subjectID,FALSE); ! } // $focus means "one question at a time"; *************** *** 178,182 **** if ('continue_quiz' == $action or 'review' == $action) { ! $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$user['id']); if (is_array($userinfo)) { --- 181,185 ---- if ('continue_quiz' == $action or 'review' == $action) { ! $userinfo = stack_db_quiz_quizattempt_getlast($subjectID,$quizid,$user['id']); if (is_array($userinfo)) { *************** *** 223,227 **** // Record the information in the DB if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_store($quiz['quizid'],$user['id'],$seed); } --- 226,230 ---- // Record the information in the DB if ( '0' != $user['id']) { ! stack_db_quiz_quizattempt_store($subjectID,$quiz['quizid'],$user['id'],$seed); } Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** index.php 4 Sep 2005 19:24:57 -0000 1.28 --- index.php 4 Sep 2005 21:26:18 -0000 1.29 *************** *** 163,167 **** echo $subject['subjectHTMLHead']; $quiz_store = stack_db_subject_quiz_list_student($subjectID); ! stack_quiz_student_select($quiz_store, $user); echo $subject['subjectHTMLFoot']; } --- 163,167 ---- echo $subject['subjectHTMLHead']; $quiz_store = stack_db_subject_quiz_list_student($subjectID); ! stack_quiz_student_select($subjectID,$quiz_store, $user); echo $subject['subjectHTMLFoot']; } Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** question_bank.php 30 Aug 2005 12:20:29 -0000 1.14 --- question_bank.php 4 Sep 2005 21:26:18 -0000 1.15 *************** *** 183,186 **** --- 183,187 ---- include('html/pagehead.php'); + echo "<h1>Question page</h1>"; switch ($action) { Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** editquiz.php 4 Sep 2005 19:24:57 -0000 1.21 --- editquiz.php 4 Sep 2005 21:26:18 -0000 1.22 *************** *** 39,46 **** require_once("{$stack_root}/scripts/stackFrontend.php"); - require_once("{$stack_root}/html/trypopupform.html"); - require_once("{$stack_root}/html/helpform.php"); - require_once("{$stack_root}/html/quizjava.html"); - /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, $user and $username --- 39,42 ---- *************** *** 55,58 **** --- 51,57 ---- include('html/pagehead.php'); stack_user_ensureadmin($user); + require_once("{$stack_root}/html/trypopupform.html"); + require_once("{$stack_root}/html/helpform.php"); + require_once("{$stack_root}/html/quizjava.html"); // Work out the correct value for any filter to be applied to the question *************** *** 151,154 **** --- 150,154 ---- //////////////////////////////////////////////// + echo "<h1>Quiz page</h1>"; // (3.1) Display any errors. *************** *** 171,176 **** } case 'quiz_report': ! $quizid = nsf($_POST, 'quizid'); ! stack_quiz_report($quizid); break; case 'quiz_edit': --- 171,177 ---- } case 'quiz_report': ! $quizid = nsf($_POST, 'quizid'); ! $subjectID = nsf($_POST, 'subjectID'); ! stack_quiz_report($quizid,$subjectID); break; case 'quiz_edit': |
From: Chris S. <san...@us...> - 2005-09-04 21:26:27
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3193/html Modified Files: quizjava.html subjectjava.html Log Message: Index: subjectjava.html =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/subjectjava.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** subjectjava.html 4 Sep 2005 19:24:57 -0000 1.1 --- subjectjava.html 4 Sep 2005 21:26:18 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + <!-- subjectjava.html --> <script language="javascript"> function takeaction(c,n) { *************** *** 9,11 **** document.forms.stacksubjecteditform.submit(); } ! </script> --- 10,23 ---- document.forms.stacksubjecteditform.submit(); } ! function quizreview(n,m) { ! document.forms.quizreview.quizid.value = n; ! document.forms.quizreview.subjectID.value = m; ! document.forms.quizreview.submit(); ! } ! </script> ! <form name='quizreview' action='editquiz.php' method='POST'> ! <input type='hidden' name='quizid' value='-1'> ! <input type='hidden' name='subjectID' value='-1'> ! <input type='hidden' name='action' value='quiz_report'> ! </form> ! <!-- /subjectjava.html --> Index: quizjava.html =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/quizjava.html,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** quizjava.html 20 Jun 2005 15:42:53 -0000 1.8 --- quizjava.html 4 Sep 2005 21:26:18 -0000 1.9 *************** *** 14,16 **** document.forms.stackquizeditform.submit(); } ! </script> --- 14,16 ---- document.forms.stackquizeditform.submit(); } ! </script> \ No newline at end of file |
From: Chris S. <san...@us...> - 2005-09-04 19:25:08
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12073 Modified Files: editquiz.php index.php quiz.php stackLib.php user.php Added Files: editsubject.php editzone.php Log Message: **MAJOR** changes: added the Subject layer over the top, --- NEW FILE: editzone.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * 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 * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * @author Laura Naismith L.N...@bh... * * * This file contains the front end logic for the subject editting * TO DO: Some of the code in this file needs to be factored out into separate * algorithms- ideally we should have a function for each action on entry and * for display. * - Automatically generated subject metadata added * <TODO> 'Export XML' link when editing subject * @package frontend * @subpackage Stack */ /** * */ session_start(); require_once('stackConfig.php'); require_once('stackLib.php'); require_once("{$stack_root}/scripts/stackAuthor.php"); require_once("{$stack_root}/scripts/stackFrontend.php"); require_once("{$stack_root}/html/trypopupform.html"); require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/subjectjava.html"); /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, etc /////////////////////////////////////////////////////////////// $default_action = ''; include('frontend_general/process_input.php'); $PostTo = 'editzone.php'; include('html/pagehead.php'); stack_user_ensureadmin($user); //////////////////////////////////////////////// // (2) Take any actions required on entry to the page //////////////////////////////////////////////// if ('zone_edit' == $action) { $zone = $_POST['zone']; if (array_key_exists('subjectOrder',$zone)) { $subjectOrder = $zone['subjectOrder']; $reveal_subject = array(); foreach ($subjectOrder as $sub) { if ('' === $sub['order']) { stack_db_subject_reorder($sub['subjectID'],''); } else { $reveal_subject[] = $sub; } } if (!empty($reveal_subject)) { stack_reorder($reveal_subject); foreach($reveal_subject as $key => $val) { stack_db_subject_reorder($val['subjectID'],$key); } } } } /////////////////////////////////////////////////////////////// // (3) Generate the HTML page /////////////////////////////////////////////////////////////// // Print the form listing the subjects. $subject_store = stack_db_subject_get(); $reveal_subject = array(); $hidden_subject = array(); foreach ($subject_store as $sub) { if ('' === $sub['subjectOrder']) { $hidden_subject[] = $sub; } else { $subo = $sub; $subo['order'] = $subo['subjectOrder']; $reveal_subject[] = $subo; } } $subject_store = array_merge($reveal_subject,$hidden_subject); echo "<form name='stackzoneeditform' action='$PostTo' method='POST'>\n"; echo "<h2>Revealed/hide subjects</h2>"; echo "<p>Subjects without an order are hidden from students, and hence not usable. Add an order to reveal the subject.</p>"; stack_zone_subjects_list($subject_store); // The end of the form! echo '<input type="hidden" name="action" value="zone_edit" />'; echo "<br /><input type=\"submit\" value=\"Edit\" />\n"; echo "</form>\n"; include('html/pagefoot.php'); ?> --- NEW FILE: editsubject.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * <br> * This file is licensed under the GPL License. * <br> * 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 * <br> * Copyright (c) 2005, Christopher James Sangwin * * @author Chris Sangwin C.J...@bh... * @author Laura Naismith L.N...@bh... * * This file contains the front end logic for the subject editting * TO DO: Some of the code in this file needs to be factored out into separate * algorithms- ideally we should have a function for each action on entry and * for display. * - Automatically generated subject metadata added * <TODO> 'Export XML' link when editing subject * @package frontend * @subpackage Stack */ /** * */ session_start(); require_once('stackConfig.php'); require_once('stackLib.php'); require_once("{$stack_root}/scripts/stackAuthor.php"); require_once("{$stack_root}/scripts/stackFrontend.php"); require_once("{$stack_root}/html/trypopupform.html"); require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/subjectjava.html"); /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, etc /////////////////////////////////////////////////////////////// $default_action = 'subject_choose'; include('frontend_general/process_input.php'); $PostTo = 'editsubject.php'; $filter = ''; $subjectID = NULL; include('html/pagehead.php'); stack_user_ensureadmin($user); //////////////////////////////////////////////// // (2) Take any actions required on entry to the page //////////////////////////////////////////////// // Possible values of $action are // subject_edit Edit a subject // subject_choose Choose a subject // subject_new Create a new subject // subject_delete Delete a subject // subject_edit_add_quiz Choose which quiz to add to a subject. // This needs to sort out the $subject from the post if it exists. $subject = ''; $subjectID = ''; if ('subject_delete' == $action) { $subjectID = nsf($_POST, 'subjectID'); } else if ('subject_edit' == $action or 'subject_edit_add_quiz' == $action) { $subject = nsf($_POST, 'subject'); if ('' == $subject) { $subjectID = nsf($_POST, 'subjectID'); } else { $subjectID = nsf($subject,'subjectID'); } } else if ('subject_new' == $action) { $subjectID = stack_db_subject_update(array()); } if (('subject_edit' == $action or 'subject_edit_add_quiz' == $action) and '' == $subject) { $subject = stack_db_subject_get($subjectID); //show_array($subject); if (array_key_exists('quizzesToAdd',$_POST)) { if (is_array($_POST['quizzesToAdd'])) { $subject['quizzesToAdd'] = $_POST['quizzesToAdd']; } } } if ('subject_delete' == $action and $subjectID != '') { stack_db_subject_delete($subjectID); $action = 'subject_choose'; } if ('subject_edit' == $action) { // Do we need to add questions to the subject? if (array_key_exists('questionsToAdd',$_POST)) { $subject['quizzesToAdd'] = array_keys($_POST['quizzesToAdd']); } } if ('subject_edit' == $action or 'subject_edit_add_quiz' == $action) { stack_subject_validate($subject,$errors); stack_subject_edit($subject,$errors); } if ('subject_new' == $action) { $subject = stack_subject_new($subjectID); $action = 'subject_edit'; } // if ('subject_xml' == $action) { // // include_once("{$stack_root}/scripts/stackXML.php"); // // $subject = stack_db_subject_get($subjectID); // stack_xml_remove_subject_meta_defaults($subject); //Pass subject by reference and remove all default metadata // $name = stack_xml_write_subject($subject,"{$stack_root}/{$stack_tmpdir}/"); // } //////////////////////////////////////////////// // (3) Generate web page //////////////////////////////////////////////// // (3.1) Display any errors. if (is_array($errors)) { stack_errors_show($errors,'subject'); } // (3.2) Now take some action switch ($action) { case 'subject_xml': { echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; } case 'subject_choose': $subject_store = stack_db_subject_get(); stack_subject_selectform($subject_store, $PostTo); break; case 'import': { } case 'subject_report': $subjectID = nsf($_POST, 'subjectID'); stack_subject_report($subjectID); break; case 'subject_edit': stack_subject_edit_form($subject,$errors,$PostTo = ''); echo "<p>\n<form name='subjectform' action='$PostTo' method='POST'> <input type='hidden' name='subjectID' value='-1'> <input type='hidden' name='action' value='subject_choose'>"; break; case 'subject_edit_add_quiz': stack_db_list_quizzes_subject($subject['subjectID']); break; } include('html/pagefoot.php'); ?> Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** quiz.php 29 Aug 2005 18:41:03 -0000 1.31 --- quiz.php 4 Sep 2005 19:24:57 -0000 1.32 *************** *** 42,45 **** --- 42,50 ---- $quiz = ''; $quizInst = ''; + + $subject = ''; + if (array_key_exists('subject',$_SESSION)) { + $subject = $_SESSION['subject']; + } // $focus means "one question at a time"; *************** *** 142,148 **** $quiz_options = $quiz['quizOptions']; } $question = array(); ! $options = stack_options_set($question,$quiz_options); $quizmode = $options['QuizMode']; --- 147,158 ---- $quiz_options = $quiz['quizOptions']; } + + $subject_options = array(); + if (array_key_exists('subjectOptions',$subject)){ + $subject_options = $subject['subjectOptions']; + } $question = array(); ! $options = stack_options_set($question,$quiz_options,$subject_options); $quizmode = $options['QuizMode']; *************** *** 220,225 **** stack_question_validate($question,$errors["qu$key"]); ! $options = stack_options_set($question,$quiz_options); ! if ( '' == $errors["qu$key"] ) { // We add an offset to the quiz $seed here to make sure each question in the quiz --- 230,235 ---- stack_question_validate($question,$errors["qu$key"]); ! $options = stack_options_set($question,$quiz_options,$subject_options); ! if ( '' == $errors["qu$key"] ) { // We add an offset to the quiz $seed here to make sure each question in the quiz *************** *** 323,327 **** } ! $options = stack_options_set($qInst,$quiz_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); --- 333,337 ---- } ! $options = stack_options_set($qInst,$quiz_options,$subject_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); *************** *** 359,363 **** if ($implicit_validate) { ! $options = stack_options_set($qInst,$quiz_options); $this_attempt = stack_question_inst_mark($qInst,$options,$ra,$errors["qu$key"]); $this_attempt['Action'] = 'validate'; --- 369,373 ---- if ($implicit_validate) { ! $options = stack_options_set($qInst,$quiz_options,$subject_options); $this_attempt = stack_question_inst_mark($qInst,$options,$ra,$errors["qu$key"]); $this_attempt['Action'] = 'validate'; *************** *** 385,389 **** ) { ! $options = stack_options_set($qInst,$quiz_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); --- 395,399 ---- ) { ! $options = stack_options_set($qInst,$quiz_options,$subject_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); *************** *** 420,424 **** // Do treat this non-empty, different attempt as a validation ! $options = stack_options_set($qInst,$quiz_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); $this_attempt['Action'] = 'validate'; --- 430,434 ---- // Do treat this non-empty, different attempt as a validation ! $options = stack_options_set($qInst,$quiz_options,$subject_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); $this_attempt['Action'] = 'validate'; *************** *** 481,485 **** if ($mark_this) { ! $options = stack_options_set($qInst,$quiz_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); $this_attempt['Action']='mark'; --- 491,495 ---- if ($mark_this) { ! $options = stack_options_set($qInst,$quiz_options,$subject_options); $this_attempt = stack_question_inst_mark($qInst,$options,$RawAns[$key],$errors["qu$key"]); $this_attempt['Action']='mark'; *************** *** 565,569 **** // Set up the information about this question. ! $options = stack_options_set($qInst,$quiz_options); $mark[$key]['max'] = $options['QuVal']; $qn = $key+1; --- 575,579 ---- // Set up the information about this question. ! $options = stack_options_set($qInst,$quiz_options,$subject_options); $mark[$key]['max'] = $options['QuVal']; $qn = $key+1; Index: stackLib.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/stackLib.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackLib.php 29 Aug 2005 18:41:03 -0000 1.2 --- stackLib.php 4 Sep 2005 19:24:57 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- require_once("{$stack_root}/scripts/stackQuestion.php"); require_once("{$stack_root}/scripts/stackQuiz.php"); + require_once("{$stack_root}/scripts/stacksubject.php"); require_once("{$stack_root}/scripts/stackUser.php"); Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** index.php 29 Aug 2005 18:41:03 -0000 1.27 --- index.php 4 Sep 2005 19:24:57 -0000 1.28 *************** *** 35,38 **** --- 35,39 ---- } require_once('stackLib.php'); + require_once($stack_root.'/scripts/stackFrontend.php'); /////////////////////////////////////////////////////////////// *************** *** 40,45 **** /////////////////////////////////////////////////////////////// - require_once($stack_root.'/scripts/stackFrontend.php'); - $default_action = 'loginscreen'; include($stack_root.'/frontend_general/process_input.php'); --- 41,44 ---- *************** *** 49,53 **** /////////////////////////////////////////////////////////////// - // 2.1 Check that XML schemas are up to date include_once("{$stack_root}/scripts/stackXML.php"); --- 48,51 ---- *************** *** 56,61 **** } - // 2.2 Check whether database needs updating - need to be logged in to get credentials - include_once("{$stack_root}/scripts/stackDatabase.php"); if (!stack_db_database_update() && stack_is_logged_in($user) and !stack_user_is_guest($user)) { $action = 'update_db'; --- 54,57 ---- *************** *** 70,73 **** --- 66,71 ---- $user = NULL; session_unregister('user'); + session_unregister('subject'); + session_unregister('quiz'); unset($_SESSION['user']); $_GET['expand'] = 0; *************** *** 93,97 **** echo "<h1>Welcome</h1> <p>Welcome to STACK, {$user['firstname']} {$user['lastname']}.</p>"; if ('admin' != $user['username']) { ! $action = 'choose_quiz'; } } --- 91,95 ---- echo "<h1>Welcome</h1> <p>Welcome to STACK, {$user['firstname']} {$user['lastname']}.</p>"; if ('admin' != $user['username']) { ! $action = 'choose_subject'; } } *************** *** 103,106 **** --- 101,115 ---- } + if ('choose_quiz' == $action) { + if (array_key_exists('subjectID',$_POST)) { + $subjectID = $_POST['subjectID']; + $subject = stack_db_subject_get($subjectID,FALSE); + $_SESSION['subject'] = $subject; + } else if (array_key_exists('subject',$_SESSION)) { + $subject = $_SESSION['subject']; + $subjectID = $subject['subjectID']; + } + } + switch ($action) { case 'loginscreen': *************** *** 144,150 **** break; case 'choose_quiz': ! $quiz_store = stack_db_quiz_get(); ! stack_quiz_student_select($quiz_store, $user); break; case 'update_schema': --- 153,169 ---- break; + case 'choose_subject': + stack_subject_student_select($user['id']); + break; case 'choose_quiz': ! if ('' == $subjectID) { ! echo "Please choose a subject first."; ! } else { ! echo '<h1>'.$subject['subjectName'].'</h1>'; ! echo $subject['subjectHTMLHead']; ! $quiz_store = stack_db_subject_quiz_list_student($subjectID); ! stack_quiz_student_select($quiz_store, $user); ! echo $subject['subjectHTMLFoot']; ! } break; case 'update_schema': Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** user.php 29 Aug 2005 18:41:03 -0000 1.6 --- user.php 4 Sep 2005 19:24:57 -0000 1.7 *************** *** 27,42 **** require_once('stackLib.php'); $default_action = 'none'; include($stack_root.'/frontend_general/process_input.php'); /////////////////////////////////////////////////////////////// // (2) Take any actions required /////////////////////////////////////////////////////////////// - // Note that we need to unset the user before printing the header. - if ('admin' != $user['username'] and $user['loggedin']) { - echo "Only the admin user may access this page."; - die(); - } if ('userupdate' == $action) { --- 27,42 ---- require_once('stackLib.php'); + require_once("{$stack_root}/scripts/stackFrontend.php"); + + $default_action = 'none'; include($stack_root.'/frontend_general/process_input.php'); + stack_user_ensureadmin($user); + /////////////////////////////////////////////////////////////// // (2) Take any actions required /////////////////////////////////////////////////////////////// if ('userupdate' == $action) { *************** *** 46,50 **** // Do we need analysis of one user? $userID = ''; ! if ('userupdate_choose' == $action or 'review' == $action) { $userID = $_POST['userID']; $user_stu = stack_db_user_get_ID($userID); --- 46,50 ---- // Do we need analysis of one user? $userID = ''; ! if ('userupdate_choose' == $action or 'review' == $action or 'delete' == $action) { $userID = $_POST['userID']; $user_stu = stack_db_user_get_ID($userID); *************** *** 64,68 **** switch ($action) { case 'none': ! echo "<h1>User management</h1>\n"; echo "<form name='stackuserform' action='' method='POST'>\n"; echo "<table>"; --- 64,68 ---- switch ($action) { case 'none': ! echo "<h1>User management</h1>\n Note, there is no 'undo' option."; echo "<form name='stackuserform' action='' method='POST'>\n"; echo "<table>"; *************** *** 86,90 **** break; case 'delete': ! echo 'Not yet implemented.'; break;} --- 86,91 ---- break; case 'delete': ! stack_db_user_delete($user_stu); ! echo "User deleted permanently. There is no 'undo' option."; break;} Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** editquiz.php 30 Aug 2005 13:51:54 -0000 1.20 --- editquiz.php 4 Sep 2005 19:24:57 -0000 1.21 *************** *** 51,65 **** $PostTo = 'editquiz.php'; $filter = ''; ! $quizid = NULL; include('html/pagehead.php'); ! ! if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { ! echo "<h1>Not permitted!</h1>"; ! echo "<p>You need to be logged in as the admin to edit quizzes, but seem to be user {$user['username']}."; ! echo "<p>Please login <a href='index.php?action=login'>here</a></p>"; ! include('html/pagefoot.php'); ! die(); ! } // Work out the correct value for any filter to be applied to the question --- 51,58 ---- $PostTo = 'editquiz.php'; $filter = ''; ! $quizid = NULL; include('html/pagehead.php'); ! stack_user_ensureadmin($user); // Work out the correct value for any filter to be applied to the question *************** *** 82,112 **** // quiz_report Gain a report of student's progress with this quiz. ! ! $quiz = ''; $quizid_source = ''; ! if ('quiz_delete' == $action or 'filter' == $action) { $quizid_source = 'post'; } else if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { $quizid_source = 'quiz'; - } else if ('quiz_new' == $action) { - $quizid_source = 'database'; - } - - else if ('quiz_xml' == $action) { - $quizid_source = 'post'; - } - else if ('quiz_xml_db' == $action) { - $quizid_source = 'database'; - } - - if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { $quiz = nsf($_POST, 'quiz'); if ('' == $quiz) { $quizid_source = 'post'; } } // Establish the $quizid - $quizid = ''; if ('quiz' == $quizid_source) { $quizid = nsf($quiz,'quizid'); --- 75,95 ---- // quiz_report Gain a report of student's progress with this quiz. ! $quiz = ''; $quizid_source = ''; ! $quizid = ''; ! ! if ('quiz_delete' == $action or 'filter' == $action or 'quiz_xml' == $action) { $quizid_source = 'post'; } else if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { $quizid_source = 'quiz'; $quiz = nsf($_POST, 'quiz'); if ('' == $quiz) { $quizid_source = 'post'; } + } else if ('quiz_new' == $action or 'quiz_xml_db' == $action) { + $quizid_source = 'database'; } // Establish the $quizid if ('quiz' == $quizid_source) { $quizid = nsf($quiz,'quizid'); *************** *** 128,133 **** $filter_source = 'session'; } ! ! if ('quiz_delete' == $action and $quizid != '') { stack_db_quiz_delete($quizid); --- 111,115 ---- $filter_source = 'session'; } ! if ('quiz_delete' == $action and $quizid != '') { stack_db_quiz_delete($quizid); *************** *** 152,157 **** if ('quiz_new' == $action) { ! $quiz = stack_quiz_new($quizid); ! $action = 'quiz_edit'; } --- 134,138 ---- if ('quiz_new' == $action) { ! $quiz = stack_quiz_new($quizid); $action = 'quiz_edit'; } *************** *** 173,184 **** // (3.1) Display any errors. if (is_array($errors)) { ! echo "<font color=\"red\">Errors exist!</font><br/>"; ! if (array_key_exists('quiz',$errors)) { ! foreach($errors['quiz'] as $key => $val) { ! echo "The field $key, gave the following error."; ! echo $val; ! } ! } ! } --- 154,158 ---- // (3.1) Display any errors. if (is_array($errors)) { ! stack_errors_show($errors,'quiz'); } |
From: Chris S. <san...@us...> - 2005-09-04 19:25:06
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12073/lang/en Modified Files: stack.php Log Message: **MAJOR** changes: added the Subject layer over the top, Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/stack.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** stack.php 1 Sep 2005 08:13:57 -0000 1.25 --- stack.php 4 Sep 2005 19:24:57 -0000 1.26 *************** *** 49,52 **** --- 49,55 ---- $string['quiz_nonetochoose'] = 'You have no quizzes available.'; + $string['subject_choose'] = 'Please choose a subject'; + $string['subject_nonetochoose'] = 'You have no subjects available.'; + // Stack page footer. $string['ThisSTACKVer'] = 'This is STACK version'; *************** *** 120,124 **** $string['EmptyCASString'] = 'You have included a CAS string which is empty. This is not permitted.'; // This occurs when validating CASText For example, a user might type "Factor @ @." $string['ErrorCASString'] = 'The string <font color=\'orange\'><tt>@{$a[\'key\']}@</tt></font> generated the following error(s)'; ! $string['OddAmpCASString'] = 'You have an odd number of @s, which is not permitted.'; $string['IncorrectPassword'] = 'Incorrect password!'; --- 123,127 ---- $string['EmptyCASString'] = 'You have included a CAS string which is empty. This is not permitted.'; // This occurs when validating CASText For example, a user might type "Factor @ @." $string['ErrorCASString'] = 'The string <font color=\'orange\'><tt>@{$a[\'key\']}@</tt></font> generated the following error(s)'; ! $string['OddAmpCASString'] = 'You have an odd number of @s, which is not permitted.'; $string['IncorrectPassword'] = 'Incorrect password!'; *************** *** 158,162 **** $string['stackQuestion_questionSol'] = 'Worked solution'; $string['stackQuestion_questionOptions'] = 'Options'; ! $string['stackQuestion_questionMetadata'] = 'Metadata'; $string['stackQuestion_questionNote'] = 'Question note'; $string['stackQuestion_questionID'] = 'Unique question ID'; --- 161,165 ---- $string['stackQuestion_questionSol'] = 'Worked solution'; $string['stackQuestion_questionOptions'] = 'Options'; ! $string['stackQuestion_questionMetadata'] = 'Metadata'; $string['stackQuestion_questionNote'] = 'Question note'; $string['stackQuestion_questionID'] = 'Unique question ID'; *************** *** 170,184 **** // <PDK> $stackQuestion metadata added ! $string['stackQuestion_questionPublisher'] = 'Server published'; ! $string['stackQuestion_questionType'] = 'Nature of content'; ! $string['stackQuestion_questionFormat'] = 'Digital manifestation'; ! $string['stackQuestion_questionLanguage'] = 'Language of content'; ! $string['stackQuestion_questionLearningContext']= 'Targetted to'; ! $string['stackQuestion_questionDifficulty'] = 'Difficulty'; ! $string['stackQuestion_questionCompetency'] = 'Competencies trained'; ! $string['stackQuestion_questionCompetencyLevel']= 'Skills required'; ! $string['stackQuestion_questionTimeAllocated'] = 'Recommended time to take'; ! $string['stackQuestion_questionExcerciseType'] = 'Type of question'; ! $string['stackQuestion_questionRights'] = 'Rights statement'; // Used in the question bank order select form to indicate no selection. --- 173,187 ---- // <PDK> $stackQuestion metadata added ! $string['stackQuestion_questionPublisher'] = 'Server published'; ! $string['stackQuestion_questionType'] = 'Nature of content'; ! $string['stackQuestion_questionFormat'] = 'Digital manifestation'; ! $string['stackQuestion_questionLanguage'] = 'Language of content'; ! $string['stackQuestion_questionLearningContext'] = 'Targetted to'; ! $string['stackQuestion_questionDifficulty'] = 'Difficulty'; ! $string['stackQuestion_questionCompetency'] = 'Competencies trained'; ! $string['stackQuestion_questionCompetencyLevel'] = 'Skills required'; ! $string['stackQuestion_questionTimeAllocated'] = 'Recommended time to take'; ! $string['stackQuestion_questionExcerciseType'] = 'Type of question'; ! $string['stackQuestion_questionRights'] = 'Rights statement'; // Used in the question bank order select form to indicate no selection. *************** *** 228,231 **** --- 231,253 ---- //////////////////////////////////// + // Subject + //////////////////////////////////// + $string['stackSubject_subjectName'] = 'Subject name'; + + // <PDK> $stackQuestion metadata added + $string['stackSubject_subjectPublisher'] = 'Server published'; + $string['stackSubject_subjectType'] = 'Nature of content'; + $string['stackSubject_subjectFormat'] = 'Digital manifestation'; + $string['stackSubject_subjectLanguage'] = 'Language of content'; + $string['stackSubject_subjectLearningContext']= 'Targetted to'; + $string['stackSubject_subjectDifficulty'] = 'Difficulty'; + $string['stackSubject_subjectCompetency'] = 'Competencies trained'; + $string['stackSubject_subjectCompetencyLevel']= 'Skills required'; + $string['stackSubject_subjectTimeAllocated'] = 'Recommended time to take'; + $string['stackSubject_subjectExcerciseType'] = 'Type of subject'; + $string['stackSubject_subjectRights'] = 'Rights statement'; + + + //////////////////////////////////// // Options //////////////////////////////////// *************** *** 260,263 **** --- 282,286 ---- $string['stackOptions_FeedBackGenericPCorrect_def'] = "<font color='orange'>Your answer is partially correct.</font>"; $string['stackOptions_QuizMode'] = 'Quiz mode'; + $string['stackOptions_SubjectMode'] = 'Allow access to'; //////////////////////////////////// *************** *** 292,295 **** --- 315,319 ---- $string['menu_SelectQ'] = 'Select Quiz'; + $string['menu_SelectS'] = 'Select Subject'; $string['menu_Update'] = 'Update user info'; $string['menu_Logout'] = 'Logout'; *************** *** 307,310 **** --- 331,336 ---- $string['menu_Import'] = 'Import'; $string['menu_Quizzes'] = 'Quizzes'; + $string['menu_Subjects'] = 'Subjects'; + $string['menu_Zone'] = 'Zone'; $string['menu_Reporting'] = 'Reporting'; $string['menu_Qfields'] = 'Question fields'; *************** *** 314,323 **** //////////////////////////////////// - // Question bank. - //////////////////////////////////// - - $string['qp_notadmin'] = "<p><font color='red'>Warning!</font> You are not the admin user and any changes will not be stored in the database.</p>"; - - //////////////////////////////////// // Interactions with the CAS //////////////////////////////////// --- 340,343 ---- *************** *** 383,386 **** --- 403,416 ---- $string['ATDiff_int'] = 'It looks like you have integrated instead!'; + //////////////////////////////////// + // Front end. + //////////////////////////////////// + + $string['qp_notadmin'] = "<p><font color='red'>Warning!</font> You are not the admin user and any changes will not be stored in the database.</p>"; + + $string['FE_notadmin'] = 'Not permitted!'; + $string['FE_needadmin'] = 'You need to be logged in as the admin to edit quizzes, but seem to be user {$a}.'; + $string['FE_errors_exist'] = 'Errors exist!'; + $string['FE_errors_field'] = 'The field $a, gave the following error.'; $string[''] = ''; *************** *** 388,391 **** --- 418,422 ---- $string[''] = ''; + //get_string('ThisSTACKVer','stack','') ?> |
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12073/scripts Modified Files: stackAuthor.php stackDatabase.php stackFrontend.php stackQuestion.php stackQuiz.php stackUser.php Added Files: stackSubject.php Log Message: **MAJOR** changes: added the Subject layer over the top, Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** stackDatabase.php 1 Sep 2005 13:50:18 -0000 1.40 --- stackDatabase.php 4 Sep 2005 19:24:57 -0000 1.41 *************** *** 10,13 **** --- 10,49 ---- /** + * Run the database update script if needed. + * + */ + function stack_db_database_update() + { + global $stack_mysql; + extract($stack_mysql); + + // If the options exists we are in business. + $query = 'SELECT options FROM stackUser'; + + if (!$connection=mysql_connect($host,$user,$pswd)) { + $msg = mysql_error(); + echo "<b>Could not connet to MYSQL on host '$host', as user '$user'. The attempt to connect generated the MYSQL Error ".mysql_errno().": ".mysql_error()."</b>"; + die(); + } + + $db = mysql_select_db($stackdb,$connection); + + if (!$db) { + echo "<b>Could not connet to the MYSQL database '$stackdb' (on host '$host', as user '$user'). The attempt to connect generated the MYSQL Error ".mysql_errno().": ".mysql_error()."</b>"; + die(); + } + + $result = mysql_query($query); + + if (0 == $result) { + return false; + } + + return true; + } + + + + /** * Serialize doesn't work properly with ';' characters in the string * *************** *** 738,741 **** --- 774,779 ---- } + + /** * Returns an array of quizID's, indicating in which quizzes a question is used. *************** *** 1329,1332 **** --- 1367,1397 ---- } + + /** + * Takes the itemSource and returns a PHP array containing the item. + * + * @param array $user The array containing the user. + * @return number $id The ID of the new user in the DB. + */ + function stack_db_user_delete($user) { + global $stackUser; + + $userID = $user['id']; + + $query = "DELETE FROM stackUser WHERE id = '$userID'"; + $result = stack_db_query($query); + + $query = "DELETE FROM user_subject WHERE userID = '$userID'"; + $result = stack_db_query($query); + + $query = "DELETE FROM quizattempts WHERE userID = '$userID'"; + $result = stack_db_query($query); + + $query = "DELETE FROM questionattempts WHERE userID = '$userID'"; + $result = stack_db_query($query); + + } + + ////////////////////////////////////////////////////// // Quiz related functions // *************** *** 1339,1343 **** * @return boolean */ ! function stack_db_confirm_quiz_exists($quizid) { $exists = FALSE; --- 1404,1408 ---- * @return boolean */ ! function stack_db_quiz_confirm_exists($quizid) { $exists = FALSE; *************** *** 1668,1704 **** } /** ! * Run the database update script if needed. * */ ! function stack_db_database_update() ! { ! global $stack_mysql; ! extract($stack_mysql); ! // If the options exists we are in business. ! $query = 'SELECT options FROM stackUser'; ! if (!$connection=mysql_connect($host,$user,$pswd)) { ! $msg = mysql_error(); ! echo "<b>Could not connet to MYSQL on host '$host', as user '$user'. The attempt to connect generated the MYSQL Error ".mysql_errno().": ".mysql_error()."</b>"; ! die(); ! } ! $db = mysql_select_db($stackdb,$connection); ! if (!$db) { ! echo "<b>Could not connet to the MYSQL database '$stackdb' (on host '$host', as user '$user'). The attempt to connect generated the MYSQL Error ".mysql_errno().": ".mysql_error()."</b>"; ! die(); ! } ! $result = mysql_query($query); ! ! if (0 == $result) { ! return false; } ! ! return true; } ?> --- 1733,2146 ---- } + + ////////////////////////////////////////////////////// + // Subject related functions // + ////////////////////////////////////////////////////// + /** ! * Confirms a subject still exists in the database. * + * @param int $subjectID The subjectID of the subject. + * @return boolean */ ! function stack_db_subject_confirm_exists($subjectID) { ! ! $exists = FALSE; ! if ('' != $subjectID ) { ! $query = 'SELECT subjectName FROM stackSubject WHERE subjectID='.$subjectID; ! $result= stack_db_query($query); ! if(0 != mysql_num_rows($result)) { ! $exists = TRUE; ! } ! } ! return $exists; ! } ! /** ! * Deletes a subject from the database. ! * ! * @param int $subjectID The subjectID of the quuiz. ! * @return void ! */ ! function stack_db_subject_delete($subjectID) { ! if ('' != $subjectID ) { ! // (0) Delete the subject itself ! $query = "DELETE FROM stackSubject WHERE subjectID = '$subjectID'"; ! $result = stack_db_query($query); ! ! // (1) Delete all quiz links attached to the subject (although the quizzes are left) ! $query = "DELETE FROM subject_quiz WHERE subjectID = '$subjectID'"; ! $result = stack_db_query($query); ! ! } ! ! } ! ! /** ! * Get details of the subject from the database. If no $subjectID is supplied, then all subjects ! * are listed instead. ! * ! * @param int $subjectID The subjectID number of the subject needed. ! * @param boolean $allqs If set to TRUE, then all quizzes are returned, including hidden ones. ! * @return array $subject_list Full information about the subjectzes. ! */ ! function stack_db_subject_get($subjectID='',$allqs=TRUE) { ! global $stackSubject; ! ! $subject_list = NULL; ! $subject_fields = array_keys($stackSubject); ! $query = ''; ! ! foreach ($subject_fields as $val) { ! $query .= ' ,'.$val; ! } ! $query = substr($query,2,strlen($query)-2); ! ! if ('' == $subjectID) { ! $query = "SELECT $query FROM stackSubject ORDER BY subjectOrder"; ! } else { ! $query = "SELECT $query FROM stackSubject WHERE subjectID = '$subjectID'"; ! } ! $result = stack_db_query($query); ! if(0 != mysql_num_rows($result)) { ! ! for ($i = 0; $i < mysql_num_rows($result); $i++) { ! $row = mysql_fetch_row($result); ! ! $subject = array(); ! foreach ($subject_fields as $qf => $qv) { ! if ('subjectOptions' == $qv) { ! $subject[$qv] = base64_unserialize(stripslashes($row[$qf])); ! } else { ! $subject[$qv] = stripslashes($row[$qf]); ! } ! } ! ! // Obtain all quizzes in the subjects. ! if ($allqs) { ! $query = "SELECT quizid, qord FROM subject_quiz WHERE subjectID = {$subject['subjectID']} ORDER BY qord"; ! } else { ! $query = "SELECT quizid, qord FROM subject_quiz WHERE subjectID = {$subject['subjectID']} AND qord >= 0 ORDER BY qord"; ! } ! $questions_result = stack_db_query($query); ! ! if(0 != mysql_num_rows($questions_result)) { ! ! for ($j = 0; $j < mysql_num_rows($questions_result); $j++) { ! $row = mysql_fetch_row($questions_result); ! $subject['quizzes'][$j]['quizid'] = $row[0]; ! $subject['quizzes'][$j]['order'] = $row[1]; ! } ! } ! ! // sortout options; ! ! $subject_list[] = $subject; ! ! } ! ! } ! ! if ('' == $subjectID) { ! return $subject_list; ! } else { ! return $subject_list[0]; ! } ! } ! ! /** ! * Update details of the subject in the database. ! * If the subjectID is blank, or the $subjectID is not in the database a new ! * subject is created. ! * ! * @param array $subject The subject. ! * @return int $subjectID The subjectID of the subject in question. ! */ ! function stack_db_subject_update($subject) { ! global $stackSubject,$stackOptions; ! ! $subject_fields = array_keys($stackSubject); ! ! //show_array($subject); ! ! $subjectID = ''; ! if (array_key_exists('subjectID',$subject)) { ! $subjectID = trim($subject['subjectID']); ! } ! ! $new_subject = FALSE; ! if ('' == $subjectID) { ! $new_subject = TRUE; ! } else if(!stack_db_subject_confirm_exists($subjectID)) { ! $new_subject = TRUE; ! } ! ! // Let SQL add the "last edit", like the question ! if (array_key_exists('subjectDateLastEdited',$subject)) { ! unset($subject['subjectDateLastEdited']); ! } ! ! // Although SubjectMode is an option and will be stored and used from there, ! // we should add it to the list of fields so we can search by it. ! $subject['subjectMode'] = $stackOptions['SubjectMode']['default']; ! if (array_key_exists('subjectOptions',$subject)) { ! if (is_array($subject['subjectOptions'])) { ! if (array_key_exists('SubjectMode',$subject['subjectOptions'])) { ! $subject['subjectMode'] = $subject['subjectOptions']['SubjectMode']; ! } ! } ! } ! ! if ($new_subject) { ! ! $qu = ''; ! $quv = ''; ! foreach ($stackSubject as $key => $fields) { ! if (array_key_exists($key,$subject)) { ! if ('' != @trim($subject[$key])) { ! $qu .= ", $key"; ! if ('subjectOptions' == $key) { ! $quv .= ", '".addslashes(base64_serialize($subject[$key]))."' "; ! } else { ! $quv .= ", '".addslashes($subject[$key])."' "; ! } ! } ! } ! } ! $qu = substr($qu,1,strlen($qu)-1); ! $quv = substr($quv,1,strlen($quv)-1); ! ! $query = "INSERT INTO stackSubject ($qu) VALUES ($quv)"; ! $result = stack_db_query($query); ! ! //show_array($query); ! ! // GET the last subjectID ! $result= stack_db_query('SELECT LAST_INSERT_ID() FROM stackSubject'); ! $row = mysql_fetch_row($result); ! $subjectID = $row[0]; ! ! } else { ! ! $qu = ''; ! foreach ($stackSubject as $key => $fields) { ! if (array_key_exists($key,$subject)) { ! if ('' != @trim($subject[$key])) { ! if ('subjectOptions' == $key) { ! $qu .= ", $key = '".addslashes(base64_serialize($subject[$key]))."' "; ! } else { ! $qu .= ", $key = '".addslashes($subject[$key])."' "; ! } ! } else if ('html' == $fields['type']) { ! // To reset the page header and footer to an empty value. ! $qu .= ", $key = NULL "; ! } ! } ! } ! $qu = substr($qu,1,strlen($qu)-1); ! ! $query = "UPDATE stackSubject SET $qu WHERE subjectID = '$subjectID'"; ! $result = stack_db_query($query); ! ! } ! ! ! return $subjectID; ! } ! ! ! /** ! * Add a quizID to a subject ! * Used in stackAuthor.php ! * ! * @param int $subjectID The subjectID number of the subject needed. ! * @param int $quizis The quizid of the quiz ! * @param int $qord The order of the question in the subject, optional ! * @return void ! */ ! function stack_db_subject_add_quiz($subjectID,$quizid,$qord='NULL') { ! ! if ($qord==='NULL') { ! $query = "INSERT INTO subject_quiz (subjectID, quizid) VALUES ('$subjectID','$quizid')"; ! } else { ! $query = "INSERT INTO subject_quiz (subjectID, quizid, qord) VALUES ('$subjectID','$questionID','$qord')"; ! } ! ! $result = stack_db_query($query); ! } ! ! /** ! * Drop a quizid from a subject ! * ! * @param int $subjectID The subjectID number of the subject needed. ! * @param int $quizid The questionID of the question! ! * @return int $result The number of table rows dropped. ! */ ! function stack_db_subject_drop_quiz($subjectID,$quizid) { ! ! if ('' != $subjectID and '' != $quizid) { ! $query = "DELETE FROM subject_quiz WHERE subjectID = '$subjectID' and quizid= '$quizid'"; ! $result = stack_db_query($query); ! } ! ! return $result; ! } ! ! /** ! * Reorder a quizid within a subject ! * ! * @param int $subjectID The subjectID number of the subject needed. ! * @param int $quizid The quizid of the quiz ! * @param int $order ! * @return int $result The number of table rows dropped. ! */ ! function stack_db_subject_reorder_quizzes($subjectID,$quizid,$order='NULL') { ! ! if ('' != $subjectID and '' != $quizid) { ! if ('NULL' === $order) { ! $query = "UPDATE subject_quiz SET qord=NULL WHERE subjectID='$subjectID' AND quizid='$quizid'"; ! } else { ! $query = "UPDATE subject_quiz SET qord='$order' WHERE subjectID='$subjectID' AND quizid='$quizid'"; ! } ! $result = stack_db_query($query); ! } ! ! return $result; ! } ! ! /** ! * Reorder a subject in the zone ! * ! * @param int $subjectID The subjectID number of the subject needed. ! * @param int $order ! * @return int $result The number of table rows dropped. ! */ ! function stack_db_subject_reorder($subjectID,$order) { ! ! if ('' === $order) { ! $query = "UPDATE stackSubject SET subjectOrder=NULL WHERE subjectID='$subjectID'"; ! } else { ! $query = "UPDATE stackSubject SET subjectOrder=$order WHERE subjectID='$subjectID'"; } ! ! $result = stack_db_query($query); ! ! return $result; ! } ! ! ! /** ! * Gets details of the quizzes in a subject from the database. ! * ! * @param int $subjectID ! * @return array $quiz_list Full information about the quizzes, without questions. ! */ ! function stack_db_subject_quiz_list_student($subjectID) { ! global $stackQuiz; ! ! $query = "SELECT quizid FROM subject_quiz WHERE subjectID = {$subjectID} AND qord >= 0 ORDER BY qord"; ! ! $result = stack_db_query($query); ! ! if(0 != mysql_num_rows($result)) { ! ! for ($i = 0; $i < mysql_num_rows($result); $i++) { ! $row = mysql_fetch_row($result); ! ! $quiz_list[] = stack_db_quiz_get($row[0],FALSE); ! ! } ! } ! ! return $quiz_list; ! } ! ! /** ! * Gets details of the subjects onto which a user is enrolled. ! * ! * @param int $userID ! * @return array $subject_store Full information about the subject, without quizzes. ! */ ! function stack_subject_user_enrolled($user) { ! ! if (0 == $user['id']) { ! $query = "SELECT subjectID FROM stackSubject WHERE subjectOrder >= 0 and subjectMode = 'all, including guests' ORDER BY subjectOrder"; ! } else { ! $query = "SELECT subjectID FROM stackSubject WHERE subjectOrder >= 0 ORDER BY subjectOrder"; ! } ! ! // Need to see which of **THESE** the student is enrolled upon. ! // A subject may have subsequently been hidden..... ! ! $result = stack_db_query($query); ! ! $subject_list = NULL; ! if(0 != mysql_num_rows($result)) { ! ! for ($i = 0; $i < mysql_num_rows($result); $i++) { ! $row = mysql_fetch_row($result); ! ! $subject_list[] = stack_db_subject_get($row[0],FALSE); ! ! } ! } ! ! return $subject_list; } + + /** + * List all the quizzes in the database for possible inclusion in a subject. + * + * @param $filter string Which questions are to be shown? + * @return void + */ + function stack_db_list_quizzes_subject($subjectID) + { // List all the questions in the database + global $_PHP_SELF; + + $query = 'SELECT quizid, quizName, quizDescription FROM stackQuiz '; + $result = stack_db_query($query); + + if(0 != mysql_num_rows($result)) { + + echo "<h2>Add quizzes to a subject</h2>\n<p>\n<form name='subjectform' action='{$_PHP_SELF}' method='POST'> + <input type='hidden' name='subjectID' value='$subjectID'>"; + echo '<table>'; + echo "<tbody>\n"; + + for ($i = 0; $i < mysql_num_rows($result); $i++) { + $row = mysql_fetch_row($result); + + $qID = $row[0]; + $name = stripslashes($row[1]); + $descript = stripslashes($row[2]); + + echo "<tr>\n"; + echo " <td><input type='checkbox' name='quizzesToAdd[$qID]' />\n"; + echo " <td>$qID</td>\n <td>$name</td>\n <td>$descript</td>\n</tr>\n"; + } + + echo "</tbody></table>\n"; + + echo '<input type="hidden" name="action" value="subject_edit" />'; + echo '<input type="submit" value="Add" /></form>'; + + + } else { + echo "<p>You currently have no quizzes in your database.</p>"; + } + + } + + + ////////////////////////////////////////////////////// + // Zone related functions // + ////////////////////////////////////////////////////// + + ?> Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** stackAuthor.php 1 Sep 2005 13:50:18 -0000 1.38 --- stackAuthor.php 4 Sep 2005 19:24:57 -0000 1.39 *************** *** 95,100 **** if ($remoteCaller) ! ob_start(); ! echo "<table cellpadding='4'><tr> <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> --- 95,100 ---- if ($remoteCaller) ! ob_start(); ! echo "<table cellpadding='4'><tr> <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> *************** *** 128,134 **** if ($remoteCaller) { ! $html = ob_get_contents(); ! ob_end_flush(); ! return $html; } } --- 128,134 ---- if ($remoteCaller) { ! $html = ob_get_contents(); ! ob_end_flush(); ! return $html; } } *************** *** 212,216 **** //For use by RQP - buffer these echo's if($remoteCaller) ! ob_start(); // hidden metadata --- 212,216 ---- //For use by RQP - buffer these echo's if($remoteCaller) ! ob_start(); // hidden metadata *************** *** 413,419 **** if ($remoteCaller) { ! $html = ob_get_contents(); ! ob_end_clean(); ! return $html; } } // end of edit_form_table --- 413,419 ---- if ($remoteCaller) { ! $html = ob_get_contents(); ! ob_end_clean(); ! return $html; } } // end of edit_form_table *************** *** 1184,1186 **** --- 1184,1564 ---- } + //****************************************************** + //** Edit subject + //****************************************************** + + /** + * Build the form to edit a STACK question. + * + * @param array $subject The STACK subject + * @param array &$errors Repository for errors + * @param string $PostTo Where to send the form + * @return void + */ + function stack_subject_edit_form($subject,&$errors,$PostTo = '') { + + //show_array($subject); + global $_PHP_SELF,$stackSubject,$stackOptions, $stack_stand_alone; + + if (empty($PostTo)) { + $PostTo=$_PHP_SELF; + } + + $t = time(); + $dts = strftime('%c',$t); // Format the string. + + //Does the subject have options set? + $subject_options = array(); + if (array_key_exists('subjectOptions',$subject)) { + if (is_array($subject['subjectOptions'])) { + $subject_options = $subject['subjectOptions']; + } + } + $optval = stack_options_formvals_set($subject_options); + + // Timestamp this edit + echo "<form name='stacksubjecteditform' action='$PostTo' method='POST'>\n"; + + // Hidden metadata, + // Why are tags one more level deep than they should be + echo "<input type='hidden' name='subject[subjectDateLastEdited]' value='$t' />\n + + <input type='hidden' name='subject[subjectGUID]' value='".sf($subject,'subjectGUID')."' />\n + <input type='hidden' name='subject[subjectUserLastEdited]' value='".sf($subject,'subjectUserLastEdited')."' />\n + <input type='hidden' name='subject[subjectPublisher]' value='".sf($subject,'subjectPublisher')."' />\n + <input type='hidden' name='subject[type]' value='".sf($subject,'type')."' />\n + <input type='hidden' name='subject[subjectFormat]' value='".sf($subject,'subjectFormat')."' />\n"; + + // Some Metadata is set at the top of the subject form. + echo "\n<table>\n"; + + $display_fields = array('subjectID','subjectName','subjectDescription','subjectKeywords'); + foreach ($display_fields as $key) { + //Check that within current field there is no type tag, otherwise skip + $err = ''; + echo "<tr><td><b>{$stackSubject[$key]['descript']}</b></td>\n"; + if ('subjectID' == $key) { + echo "<td><input type=\"hidden\" name=\"subject[$key]\" value=\"{$subject[$key]}\" alt=\"$key\" />{$subject[$key]}</td><td>".$err.'</td></tr>'; + } else { + echo "<td><input type=\"text\" name=\"subject[$key]\" size=\"35\" value=\"".nsf($subject,$key)."\" alt=\"$key\" /></td><td>".$err.'</td></tr>'; + } + } + echo "\n</table>\n"; + + // We need to add some options here also. + + $options_headings = array('',''); + $options_list = array('SubjectMode','TeacherEmail'); + + // If there is a prefix sort it out *HERE!* + $fieldname = 'subject'.'[subjectOptions]'; + stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,''); + + + echo "<p><b>Quizzes attached to this subject:</b><br />(An empty order field indicates they are attached but hidden)"; + + if (array_key_exists('quizzes',$subject)) { + if (is_array($subject['quizzes'])) { + echo "\n<table>\n"; + echo "<tr><th>Drop</th><th>Order</th><th>Quiz no.</th><th>Name</th></tr>\n"; + foreach ($subject['quizzes'] as $qn => $qu) { + $qID = $qu['quizid']; + $qo = nsf($qu,'order'); + // Get the quiz with the body encoded. + $qID_exists_in_DB = stack_db_quiz_confirm_exists($qID); + if ($qID_exists_in_DB) { + $quiz = stack_db_quiz_get($qID,TRUE); + $qname = $quiz['quizName']; + $qkw = $question['quizKeywords']; + } else { + $qname = "Quiz with ID is $qID missing from DB!"; + $qkw = ''; + } + echo "<tr><td><input type=\"checkbox\" name=\"subject[quizzes][$qn][drop]\" value=\"ticked\" /></td>\n"; + echo "<td><input type=\"text\" name=\"subject[quizzes][$qn][order]\" size=\"3\" value=\"{$qo}\" /></td>\n"; + echo "<td><input type=\"hidden\" name=\"subject[quizzes][$qn][quizid]\" value=\"{$qID}\" />$qID</td>"; + echo "<td>$qname</td><td>$qkw</td> </tr>\n"; + + } + echo "\n</table></p>\n"; + } + } + + echo "<p><b><a href=\"javascript:addquiz();\">Choose quiz to add</a></b> \n"; + + echo '<input type="hidden" name="action" value="subject_edit" />'; + echo "<input type=\"submit\" value=\"Edit\" />\n"; + + + $options_headings = array('',get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','',get_string('stackOptions_edit_out','stack'),''); + $options_list = array('QuizMode','InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','Language'); + + $fieldname = 'subject'.'[subjectOptions]'; + stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$prefix); + + // Check if subject has metadata set + // $fieldname = 'subject' + $metadata_list = array('subjectLanguage','subjectLearningContext','subjectDifficulty','subjectCompetency', + 'subjectCompetencyLevel','subjectTimeAllocated','subjectExcerciseType','subjectRights'); + stack_subject_metadata_edit_form($subject, $metadata_list); + + echo "</p>"; + + $headrows = substr_count($subject['subjectHTMLHead'],"\n") + 5; + $htmlhead = $subject['subjectHTMLHead']; + echo "<p><b>Subject page header</b><br /><textarea name='subject[subjectHTMLHead]' cols='80' rows='$headrows'>{$htmlhead}</textarea>"; + + $footrows = substr_count($subject['subjectHTMLFoot'],"\n") + 5; + $htmlfoot = $subject['subjectHTMLFoot']; + echo "<p><b>Subject page footer</b><br /><textarea name='subject[subjectHTMLFoot]' cols='80' rows='$headrows'>{$htmlfoot}</textarea>"; + + // The end of the form! + echo "<br /><input type=\"submit\" value=\"Edit\" />\n"; + echo "</form>\n"; + + + return NULL; + } + + + /** + * Process the incoming $_POST['subject'] fields. + * + * @param array $subject The STACK subject + * @param array &$errors Repository for errors + * @param string $PostTo Where to send the form + * @return void + */ + function stack_subject_edit(&$subject,&$errors) { + // (0) Establish the subjectID + if (array_key_exists('subjectID',$subject)) { + $subjectID = $subject['subjectID']; + } else { + $errors['subject']['subjectID'] = '<br />Could not find a subjectID!'; + return NULL; + } + + // (1) Validate and clean up the options. + if (array_key_exists('subjectOptions',$subject)) { + stack_options_validate($subject['subjectOptions']); + } + + if (array_key_exists('quizzes',$subject)) { + // (2) Drop any questions no longer used. + + foreach($subject['quizzes'] as $key => $qu) { + $quID = $qu['quizid']; + if (array_key_exists('drop',$qu)) { + $nodropped = stack_db_subject_drop_quiz($subject['subjectID'],$quID); + unset($subject['quizzes'][$key]); + } + } + + // (3) Re-order + $unordered_quizzes = array(); + $ordered_quizzes = array(); + + // (3.1) Split questions into hidden, and unhidden questions + foreach($subject['quizzes'] as $key => $qu) { + $ordered = FALSE; + if (array_key_exists('order',$qu)) { + if ('' != trim($qu['order'])) { + $ordered = TRUE; + } + } + if ($ordered) { + $ordered_quizzes[] = $qu; + } else { + $unordered_quizzes[] = $qu; + } + } + + if (!empty($ordered_quizzes)) { + // (3.2) Reorder those that need it. + stack_reorder($ordered_quizzes); + + // (3.3) Give these a nominal order. + foreach($ordered_quizzes as $key => $val) { + $ordered_quizzes[$key]['order'] = $key; + } + } + + // (3.4) Put them back together. + $subject['quizzes'] = array_merge($ordered_quizzes,$unordered_quizzes); + + + // (3.5) Update the database of the new orders. + foreach($subject['quizzes'] as $key => $qu) { + $ordered = FALSE; + if (array_key_exists('order',$qu)) { + if ('' != trim($qu['order'])) { + $ordered = TRUE; + } + } + if ($ordered) { + stack_db_subject_reorder_quizzes($subjectID,$qu['quizid'],$qu['order']); + } else { + stack_db_subject_reorder_quizzes($subjectID,$qu['quizid']); + } + } + + } // End of if (array_key_exists('quizzes',$subject)) .... + + // (4) Add any new questions + if (array_key_exists('quizzesToAdd',$subject)) { + + if (is_array($subject['quizzesToAdd'])) { + $to_add = $subject['quizzesToAdd']; + + foreach($to_add as $quID => $key) { + // HACK need a regular expression to confirm $quID is a number only! + + if (stack_db_quiz_confirm_exists($quID)) { + stack_db_subject_add_quiz($subjectID,$quID); + $subject['quizzes'][] = array('quizid'=>$quID); + } else { + $errors['subject']['quizzes'] .= "<br />Could not add the quiz with quizid $quID: it does not appear to exit in the database."; + } + } + } + unset($subject['questionsToAdd']); + } + + // (\infty) Update the subject information itself + stack_db_subject_update($subject); + + return NULL; + } + + /** + * Generates a portion of HTML which allows the editing of a particular subject metadata field. + * + * Checks that specified field is of type 'meta' and whether an array of values is present. If so, draw a list + * box with all the fields. As these fields contain optional data - they default to 'unspecified'. + * If an array of values is not present, we default to text box entry. + * + * @param string $name The name of the field in the form + * @param string $opt The option key + * @param mixed $optval The currently set value + * @param int $sz The size of the answer boxes + * @return void + */ + function stack_subject_edit_metadata_field($name,$opt,$optval,$default,$sz=8) { + global $stackSubject; + + $fields = $stackSubject[$opt]; + //Must be of type meta + if ('meta'==$fields['type']) { + if (is_array( $fields['values'])) { //Check that there is an array (list type) in the values tag + echo "\n<select name=\"$name\">\n"; + if (empty($optval)){echo " <option value='$default' selected>$default</option>\n";} + + foreach ($fields['values'] as $vals) { + if ($vals==$optval) {echo " <option value='$vals' selected>$vals</option>\n";} + else {echo " <option value='$vals'>$vals</option>\n";} + } + + echo " </select>\n"; + } + + else { + if (empty($optval)){echo "<input type='text' name='$name' value ='".stack_s($default)."' size = '$sz' />";} + else{echo "<input type='text' name='$name' value ='".stack_s($optval)."' size = '$sz' />";} + } + } + } + + /** + * Constructs the metadata part of the subject edit form + * + * @param string $question The current subject being edited + * @param array $metadata_list The list of subject metadata to display + * @return void + */ + function stack_subject_metadata_edit_form($subject, $metadata_list) + { + global $stackSubject; + + //Create table to put subject metadata on + echo "<table cellpadding='4'><tr> + <td> <b>".get_string('stackQuestion_questionMetadata','stack')."</b> </td> + <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> + <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; + + //Iterate through each field given in $metadata_list + foreach( $metadata_list as $k => $metadata) { + $descript = stack_subject_edit_dispsubjectfield($metadata); //Display tag with help + $defval = $stackSubject[$metadata]['default']; //Retrieve the metadata's default value + $fieldname= 'subject'.'['.$metadata.']'; + + echo " <td> $descript </td>\n <td>"; + @stack_subject_edit_metadata_field($fieldname,$metadata,$subject[$metadata],$defval); //Display correct UI component for field + echo "</td>\n"; + + //$defval = $stackSubject[$metadata]['default']; //Retrieve the metadata's default value + + echo " <td> $defval </td>\n</tr>\n"; + } + + echo "\n</table>\n\n\n"; + } + + /** + * Display the name of a subjectField, in a link generating a popup window. + * + * @param string $field The field name + * @return string The link to the popup window + */ + function stack_subject_edit_dispsubjectfield($field) { + global $stackSubject; + + $fd='stackSubject_'.$field; + + $fd=get_string($fd,'stack',''); + $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackSubject');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; + return($strout); + } + + //****************************************************** + //** Edit zone + //****************************************************** + + /** + * Display a selection of subjects in the zone edit page. + * + * @param array $subject_store an array of $subject + * @return void + */ + function stack_zone_subjects_list($subject_store) { + global $stackSubject; + + echo "\n<table cellpadding='2' border='1'>\n"; + echo "\n<tr>\n"; + echo " <th>{$stackSubject['subjectOrder']['descript']}</th>\n <th>ID</th>\n"; + echo " <th>{$stackSubject['subjectName']['descript']}</th>\n"; + echo " <th>{$stackSubject['subjectMode']['descript']}</th>\n"; + echo " <th>{$stackSubject['subjectDescription']['descript']}</th>\n</tr>\n"; + + foreach ($subject_store as $key => $subject) { + $sID = $subject['subjectID']; + $so = nsf($subject,'subjectOrder'); + $sname = nsf($subject,'subjectName'); + $sdescript = nsf($subject,'subjectDescription'); + + $smode = nsf($subject,'subjectMode'); + if ('' == $smode) { + $smode = 'Default'; + } + + echo "<tr>\n"; + echo " <td><input type=\"text\" name=\"zone[subjectOrder][$key][order]\" size=\"3\" value=\"{$so}\" />\n"; + echo " <input type=\"hidden\" name=\"zone[subjectOrder][$key][subjectID]\" size=\"3\" value=\"{$sID}\" /></td>\n"; + echo " <td>$sID</td>\n <td>$sname</td>\n <td>$smode</td>\n <td>$sdescript</td> </tr>\n"; + + } + echo "\n</table></p>\n"; + + } + + ?> --- NEW FILE: stackSubject.php --- <?php /** * This file contains most functions which deal with quizzes. * * @package scripts * @subpackage Stack */ /* the stackSubject data structure */ // 'Unique quiz ID - local mySQL value' $stackSubject['subjectID']['descript'] = 'Subject ID number'; $stackSubject['subjectID']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; $stackSubject['subjectID']['type'] = 'meta'; // 'Subject name' $stackSubject['subjectName']['descript'] = 'Subject name'; $stackSubject['subjectName']['mysql'] = 'TINYTEXT'; $stackSubject['subjectName']['type'] = 'meta'; $stackSubject['subjectName']['metatag'] = 'title'; //dc:title $stackSubject['subjectName']['metatype'] = 'dublincore'; // 'Subject description' $stackSubject['subjectDescription']['descript'] = 'Description'; $stackSubject['subjectDescription']['mysql'] = 'TINYTEXT'; $stackSubject['subjectDescription']['type'] = 'meta'; $stackSubject['subjectDescription']['metatag'] = 'description'; //dc:description $stackSubject['subjectDescription']['metatype'] = 'dublincore'; // 'Subject options' $stackSubject['subjectOptions']['descript'] = 'Subject options'; $stackSubject['subjectOptions']['mysql'] = 'TEXT'; $stackSubject['subjectOptions']['type'] = 'other'; // 'Subject mode' $stackSubject['subjectMode']['descript'] = 'Mode'; $stackSubject['subjectMode']['mysql'] = 'TINYTEXT'; $stackSubject['subjectMode']['type'] = 'string'; // 'Subject mode' $stackSubject['subjectOrder']['descript'] = 'Order in Zone'; $stackSubject['subjectOrder']['mysql'] = 'INT(11)'; $stackSubject['subjectOrder']['type'] = 'int'; // Page header and footers $stackSubject['subjectHTMLHead']['descript'] = 'Subject page header'; $stackSubject['subjectHTMLHead']['mysql'] = 'TEXT'; $stackSubject['subjectHTMLHead']['type'] = 'html'; $stackSubject['subjectHTMLFoot']['descript'] = 'Subject page header'; $stackSubject['subjectHTMLFoot']['mysql'] = 'TEXT'; $stackSubject['subjectHTMLFoot']['type'] = 'html'; // Subject Metadata added - database updated // 'Globally unique subject ID'; $stackSubject['subjectGUID']['required'] = 'system'; $stackSubject['subjectGUID']['mysql'] = 'CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters $stackSubject['subjectGUID']['type'] = 'meta'; $stackSubject['subjectGUID']['metatag'] = 'identifier'; $stackSubject['subjectGUID']['metatype'] = 'dublincore'; // 'Keywords'; $stackSubject['subjectKeywords']['required'] = 'optional'; $stackSubject['subjectKeywords']['mysql'] = 'TINYTEXT'; $stackSubject['subjectKeywords']['type'] = 'meta'; $stackSubject['subjectKeywords']['metatag'] = 'keyword'; //lom:keyword $stackSubject['subjectKeywords']['metatype'] = 'lom'; $stackSubject['subjectKeywords']['descript'] = 'Keywords'; //<PDK>Need for display purposes // 'Last edited by'; $stackSubject['subjectUserLastEdited']['required'] = 'system'; $stackSubject['subjectUserLastEdited']['mysql'] = 'INT UNSIGNED'; $stackSubject['subjectUserLastEdited']['type'] = 'meta'; $stackSubject['subjectUserLastEdited']['metatag'] = 'creator'; //dc:creator $stackSubject['subjectUserLastEdited']['metatype'] = 'dublincore'; // 'Last edited on'; $stackSubject['subjectDateLastEdited']['required'] = 'system'; $stackSubject['subjectDateLastEdited']['mysql'] = 'TIMESTAMP'; $stackSubject['subjectDateLastEdited']['type'] = 'meta'; $stackSubject['subjectDateLastEdited']['metatag'] = 'date'; //dc:date $stackSubject['subjectDateLastEdited']['metatype'] = 'dublincore'; //Publisher $stackSubject['subjectPublisher']['required'] = 'system'; $stackSubject['subjectPublisher']['mysql'] = 'TINYTEXT'; $stackSubject['subjectPublisher']['type'] = 'meta'; $stackSubject['subjectPublisher']['metatag'] = 'publisher'; //dc:publisher $stackSubject['subjectPublisher']['metatype'] = 'dublincore'; //Type: Hidden from user $stackSubject['type']['values']=array('subject','subject'); //Default to 'type' enumeration in XSD file $stackSubject['type']['required']='optional'; $stackSubject['type']['mysql']='TINYTEXT'; $stackSubject['type']['type']='meta'; $stackSubject['type']['metatag']='type'; //dc:type $stackSubject['type']['metatype']='dublincore'; //Format: Hidden from user, selected by script $stackSubject['subjectFormat']['values']=array('application','audio','image', 'message','model','text','video', 'multipart'); $stackSubject['subjectFormat']['required']='optional'; $stackSubject['subjectFormat']['mysql']='TINYTEXT'; $stackSubject['subjectFormat']['type']='meta'; //dc:format $stackSubject['subjectFormat']['metatag']='format'; $stackSubject['subjectFormat']['metatype']='dublincore'; //Language: Defaulted to current system language, but user definable $stackSubject['subjectLanguage']['values']=array('en','fr','nl','es','unspecified'); $stackSubject['subjectLanguage']['required']='optional'; $stackSubject['subjectLanguage']['mysql']='TINYTEXT'; $stackSubject['subjectLanguage']['type']='meta'; $stackSubject['subjectLanguage']['metatag']='language'; //dc:language $stackSubject['subjectLanguage']['metatype']='dublincore'; $stackSubject['subjectLanguage']['default']=$stack_defaultlang; //take the default language; //Rights $stackSubject['subjectRights']['required']='optional'; $stackSubject['subjectRights']['mysql']='TEXT'; $stackSubject['subjectRights']['type']='meta'; $stackSubject['subjectRights']['metatag']='rights'; //dc:rights $stackSubject['subjectRights']['metatype']='dublincore'; $stackSubject['subjectRights']['default']='http://www.gnu.org/copyleft/gpl.html'; //Learning context: Defaulted to system context, but user definable $stackSubject['subjectLearningContext']['values']=array('Primary Education','Secondary Education','Higher Education', 'University First Cycle','University Second Cycle','University Post Grade', 'Technical School First Cycle','Technical School Second Cycle','Professional Formation', 'Continuous Formation','Vocational Training','unspecified'); $stackSubject['subjectLearningContext']['required']='optional'; $stackSubject['subjectLearningContext']['mysql']='TINYTEXT'; $stackSubject['subjectLearningContext']['type']='meta'; $stackSubject['subjectLearningContext']['metatag']='context'; //lom:context $stackSubject['subjectLearningContext']['metatype']='lom'; $stackSubject['subjectLearningContext']['default']='unspecified'; //Difficulty: Default to null - up to user to specify this $stackSubject['subjectDifficulty']['values']=array('Very Easy','Easy','Medium', 'Difficult','Very Difficult','unspecified'); $stackSubject['subjectDifficulty']['required']='optional'; $stackSubject['subjectDifficulty']['mysql']='TINYTEXT'; $stackSubject['subjectDifficulty']['type']='meta'; $stackSubject['subjectDifficulty']['metatag']='difficulty'; //lom:difficulty $stackSubject['subjectDifficulty']['metatype']='lom'; $stackSubject['subjectDifficulty']['default']='unspecified'; //Competency: Default to solve - then up to user $stackSubject['subjectCompetency']['values']=array('think','argue','solve', 'represent','language','communicate', 'tools','unspecified'); $stackSubject['subjectCompetency']['required']='optional'; $stackSubject['subjectCompetency']['mysql']='TINYTEXT'; $stackSubject['subjectCompetency']['type']='meta'; $stackSubject['subjectCompetency']['metatag']='competency'; $stackSubject['subjectCompetency']['metatype']='stack'; //competency $stackSubject['subjectCompetency']['default']='unspecified'; //CompetencyLevel: Default to null - then up to user $stackSubject['subjectCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', 'complex','unspecified'); $stackSubject['subjectCompetencyLevel']['required']='optional'; $stackSubject['subjectCompetencyLevel']['mysql']='TINYTEXT'; $stackSubject['subjectCompetencyLevel']['type']='meta'; $stackSubject['subjectCompetencyLevel']['metatag']='competencylevel'; //competencylevel $stackSubject['subjectCompetencyLevel']['metatype']='stack'; $stackSubject['subjectCompetencyLevel']['default']='unspecified'; //Time to allocate: Default to null - then up to user $stackSubject['subjectTimeAllocated']['required']='optional'; $stackSubject['subjectTimeAllocated']['mysql']='TIME'; $stackSubject['subjectTimeAllocated']['type']='meta'; $stackSubject['subjectTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime $stackSubject['subjectTimeAllocated']['metatype']='lom'; $stackSubject['subjectTimeAllocated']['default']="00:00:00"; //Type of subject: Default to algebraicExpression as that is only type of subject atm, but provides extensibility $stackSubject['subjectExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', 'fillInBlank','unspecified'); $stackSubject['subjectExcerciseType']['required']='optional'; $stackSubject['subjectExcerciseType']['mysql']='TINYTEXT'; $stackSubject['subjectExcerciseType']['type']='meta'; $stackSubject['subjectExcerciseType']['metatag']='excercisetype'; //excercisetype $stackSubject['subjectExcerciseType']['metatype']='stack'; $stackSubject['subjectExcerciseType']['default']='unspecified'; /** * Displays the student subject selection screen * @param array $userID * @return void */ function stack_subject_student_select($userID) { global $stack_root,$stackSubject;; require_once("{$stack_root}/html/subjectjava.html"); echo '<h1>'.get_string('subject_choose','stack').'</h1>'; $subject_store = stack_subject_user_enrolled($userID); if (is_array($subject_store)) { echo "<script language=\"javascript\"> function choosequiz(n) { document.forms.subjectform.subjectID.value = n; document.forms.subjectform.submit(); } </script> <p>\n<form name='subjectform' action='index.php' method='POST'> <input type='hidden' name='subjectID' value='-1'> <input type='hidden' name='action' value='choose_quiz'>"; echo "\n<table cellpadding='2'>\n"; echo "\n<tr>\n <th>{$stackSubject['subjectName']['descript']}</th>\n"; echo " <th>{$stackSubject['subjectDescription']['descript']}</th>\n</tr>\n"; foreach ($subject_store as $qs => $subject) { $sID = $subject['subjectID']; $sname = $subject['subjectName']; $sdescript = $subject['subjectDescription']; echo "<tr>\n <td><a href=\"javascript:choosequiz('$sID');\">{$sname}</a></td>\n"; echo " <td>".$sdescript."</td>\n"; echo "</tr>\n"; } echo "\n</table>\n</form>\n</p>"; } else { echo '<p>'.get_string('subject_nonetochoose','stack').'</p>'; } } //<TODO: to be implemented> /** * Validate a STACK subject * * 1. Check required fields at the subject level are there (name of subject?) * 2. Check all fields at the subject level are valid (valid format?) * * @param array &$subject The STACK subject to validate * @param array &$errors Repository for errors * @return void */ function stack_subject_validate(&$subject,&$errors) { global $stackSubject, $debug; if ('' == trim($subject['subjectName'])) { $errors['subject']['subjectName'] = get_string('QValidRequiredField','stack'); } if (is_array($subject)) { //Perform subject field level validation here if (array_key_exists('subjectOptions',$subject)) { stack_options_validate($subject['subjectOptions']); } } else { // $subject is not an array $errors['subject']=get_string('QValidquestionnotar','stack',''); } } /** * Creates a new subject with the mimimum fields. * * @param int $subjectID ID the subject is to be initialised with * @return array $subject Question with the mimimum fields */ function stack_subject_new($subjectID) { global $stack_web_url, $user; $subject['subjectID'] = $subjectID; //Automatically generated subject metadata added $subject['subjectGUID'] = stack_generate_guid($stack_web_url); $subject['subjectFormat'] = 'text/xml; charset="utf-8"'; $subject['subjectPublisher'] = $stack_web_url; $subject['type'] = 'subject'; $subject['subjectUserLastEdited'] = $user['firstname']." ".$user['lastname']; if ($user['email']!='') { $subject['questionUserLastEdited'].=' <'.$user['email'].'>'; } return $subject; } ?> Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** stackQuestion.php 30 Aug 2005 10:28:01 -0000 1.33 --- stackQuestion.php 4 Sep 2005 19:24:57 -0000 1.34 *************** *** 118,121 **** --- 118,126 ---- $stackOptions['QuizMode']['default'] = 'Practice'; + $stackOptions['SubjectMode']['type'] = 'list'; + $stackOptions['SubjectMode']['values'] = array('all, including guests','any system user','the class list only'); + $stackOptions['SubjectMode']['default'] = 'the class list only'; + + //<PDK> sqlToSchemaMapping array maps basic SQL data types used in STAKCK to their respective XML schema data types //Only place temporarily here pending a resolution! *************** *** 2169,2197 **** function stack_question_new($remoteUser='') { ! global $user, $stack_web_url; ! ! $question=''; ! ! $question['questionID'] = '0'; ! $question['questionAnsKey'] = 'ans1'; ! $question['questionGUID'] = stack_generate_guid($stack_web_url); ! $question['questionFormat'] = 'text/xml; charset="utf-8"'; ! $question['questionPublisher'] = $stack_web_url; ! $question['type'] = 'question'; ! ! if (empty($remoteUser)) { ! $question['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! ! if ($user['email']!='') { //<TODO: need to somehow retrieve the RQP user who is making new question ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; ! } ! } ! ! else ! { ! $question['questionUserLastEdited'] = $remoteUser; ! } ! ! return $question; } --- 2174,2202 ---- function stack_question_new($remoteUser='') { ! global $user, $stack_web_url; ! ! $question=''; ! ! $question['questionID'] = '0'; ! $question['questionAnsKey'] = 'ans1'; ! $question['questionGUID'] = stack_generate_guid($stack_web_url); ! $question['questionFormat'] = 'text/xml; charset="utf-8"'; ! $question['questionPublisher'] = $stack_web_url; ! $question['type'] = 'question'; ! ! if (empty($remoteUser)) { ! $question['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! ! if ($user['email']!='') { //<TODO: need to somehow retrieve the RQP user who is making new question ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; ! } ! } ! ! else ! { ! $question['questionUserLastEdited'] = $remoteUser; ! } ! ! return $question; } Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** stackQuiz.php 30 Aug 2005 13:51:55 -0000 1.10 --- stackQuiz.php 4 Sep 2005 19:24:58 -0000 1.11 *************** *** 18,24 **** $stackQuiz['quizName']['descript'] = 'Quiz name'; $stackQuiz['quizName']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizName']['type'] = 'meta'; ! $stackQuiz['quizName']['metatag'] = 'title'; //dc:title ! $stackQuiz['quizName']['metatype'] = 'dublincore'; // 'Quiz description' --- 18,24 ---- $stackQuiz['quizName']['descript'] = 'Quiz name'; $stackQuiz['quizName']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizName']['type'] = 'meta'; ! $stackQuiz['quizName']['metatag'] = 'title'; //dc:title ! $stackQuiz['quizName']['metatype'] = 'dublincore'; // 'Quiz description' *************** *** 187,191 **** require_once("{$stack_root}/html/quizjava.html"); ! echo '<h1>'.get_string('quiz_choose','stack').'</h1>'; global $stackQuiz; --- 187,191 ---- require_once("{$stack_root}/html/quizjava.html"); ! echo '<h2>'.get_string('quiz_choose','stack').'</h2>'; global $stackQuiz; *************** *** 437,440 **** --- 437,444 ---- global $stackQuiz, $debug; + if ('' == trim($quiz['quizName'])) { + $errors['quiz']['quizName'] = get_string('QValidRequiredField','stack'); + } + if (is_array($quiz)) { //Perform quiz field level validation here *************** *** 456,460 **** */ function stack_quiz_new($quizid) { ! global $stack_web_url, $user; --- 460,464 ---- */ function stack_quiz_new($quizid) { ! global $stack_web_url, $user; Index: stackFrontend.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackFrontend.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stackFrontend.php 29 Aug 2005 18:41:03 -0000 1.1 --- stackFrontend.php 4 Sep 2005 19:24:57 -0000 1.2 *************** *** 258,260 **** --- 258,348 ---- + /** + * Displays the list of quizzes for the admin to edit + * @param array $quizstore The store of quizzes + * @param string $PostTo The page that the info from the form should be posted to + * @return void + */ + function stack_subject_selectform($subject_store, $PostTo) { + global $stackSubject,$stack_web_url; + if (is_array($subject_store)) { + + echo "<p>\n<form name='subjectform' action='$PostTo' method='POST'> + <input type='hidden' name='subjectID' value='-1' /> + <input type='hidden' name='action' value='subject_choose' />"; + + echo "\n<table cellpadding='2'>\n"; + echo "\n<tr>\n"; + echo " <th>ID</th>\n <th>{$stackSubject['subjectOrder']['descript']}</th>\n"; + echo " <th>{$stackSubject['subjectName']['descript']}</th> + <th>{$stackSubject['subjectDescription']['descript']}</th><th></th></tr>"; + foreach ($subject_store as $qs => $subject) + { + $sname = $subject['subjectName']; + if ('' == trim($sname)) { + $sname = '[empty]'; + } + $sID = $subject['subjectID']; + $sord = $subject['subjectOrder']; + echo "<tr>\n <td>{$sID}</td>\n <td>{$sord}</td>\n"; + echo " <td>{$sname}</td><td>".$subject['subjectDescription']."</td>\n"; + echo "<td><a href=\"javascript:takeaction('subject_edit','$sID');\">edit</a></td>\n"; + //echo "<td><a href=\"javascript:takeaction('subject_xml','$sID');\">xml</a></td>\n"; + echo "<td><a href=\"javascript:takeaction('subject_delete','$sID');\"><font color='red'>del</font></a></td></tr>\n"; + } + echo "\n</table>\n\n</p></form>"; + + } else { + echo "<p>You have no subjects available to try.</p>"; + echo "<p>\n<form name='subjectform' action='$PostTo' method='POST'> + <input type='hidden' name='subjectid' value='-1' /> + <input type='hidden' name='action' value='subject_choose' />"; + } + } + + + /** + * Kills the current script if the user is not *logged in* as the *admin*. + * + * @param $user The current user + * @return void + */ + function stack_user_ensureadmin($user) { + + if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { + echo '<h1>'.get_string('FE_notadmin','stack').'</h1>'; + echo '<p>'.get_string('FE_needadmin','stack',$user['username']).'</p>'; + echo "<p>Please login <a href='index.php?action=login'>here</a></p>"; + include('html/pagefoot.php'); + die(); + } + + } + + /** + * Displays any errors + * + * @param $errors The current user + * @param $where The context of the errors - 'quiz', 'subject' etc. + * @return void + */ + function stack_errors_show($errors,$where) { + + echo '<font color="red">'.get_string('FE_errors_exist','stack','').'</font><br/>'; + if (array_key_exists($where,$errors)) { + foreach($errors[$where] as $key => $val) { + if ('quiz' == $where) { + $dispkey = 'stackQuiz_'.$key; + } else if ('subject' == $where) { + $dispkey = 'stackSubject_'.$key; + } + + $dispkey = '<font color="orange">'.get_string($dispkey,'stack').'</font>'; + echo '<br />'.get_string('FE_errors_field','stack',$dispkey); + echo '<br /><font color="red">'.$val.'</font>'; + } + } + + } + ?> Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** stackUser.php 29 Aug 2005 18:41:03 -0000 1.14 --- stackUser.php 4 Sep 2005 19:24:58 -0000 1.15 *************** *** 328,331 **** --- 328,333 ---- echo '<tr><td>'.get_string('USR_Institution','stack','').'</td><td><input type="text" name="user[institution]" size="35" value="'.sf($user,'institution').'" alt="Last name" /></td><td>'.nsf($err,'institution').'</td></tr>'; + // Enrolled subjects. + } |
From: Chris S. <san...@us...> - 2005-09-04 19:25:05
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12073/scripts/install Modified Files: stackInstall.php stackUpdateDatabase.php Log Message: **MAJOR** changes: added the Subject layer over the top, Index: stackUpdateDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackUpdateDatabase.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** stackUpdateDatabase.php 30 Aug 2005 14:29:25 -0000 1.7 --- stackUpdateDatabase.php 4 Sep 2005 19:24:57 -0000 1.8 *************** *** 53,60 **** ADD COLUMN options text NULL;'; ! stack_mysqlcmd($addQuestionColumnQuery,$stack_mysql['user'],$error); stack_mysqlcmd($addQuizColumnQuery,$stack_mysql['user'],$error); stack_mysqlcmd($addUserColumnQuery,$stack_mysql['user'],$error); --- 53,69 ---- ADD COLUMN options text NULL;'; ! // Below added by CJS, 04/9/2005 ! stack_mysqlcmd($addQuestionColumnQuery,$stack_mysql['user'],$error); stack_mysqlcmd($addQuizColumnQuery,$stack_mysql['user'],$error); stack_mysqlcmd($addUserColumnQuery,$stack_mysql['user'],$error); + + // + + $query = 'ALTER TABLE quizattempts + ADD COLUMN subjectID int(11) default NULL;'; + + stack_mysqlcmd($query,$stack_mysql['user'],$error); + Index: stackInstall.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackInstall.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** stackInstall.php 29 Aug 2005 18:41:03 -0000 1.17 --- stackInstall.php 4 Sep 2005 19:24:57 -0000 1.18 *************** *** 235,238 **** --- 235,239 ---- $qu = "CREATE TABLE IF NOT EXISTS quizAttempts ( attemptID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + subjectID int(11) default NULL, quizID int(11) default NULL, userID int(11) default NULL, *************** *** 244,247 **** --- 245,279 ---- stack_mysqlcmd($qu,$stack_mysql['user'],$err); + // (9) Create the subject table + + // Create field list + $qu = ''; + foreach ($stackSubject as $key => $val) { + $qu .= ", $key {$val['mysql']}"; + } + $qu = substr($qu,1,strlen($qu)-1); + $qu = "CREATE TABLE IF NOT EXISTS stackSubject ( {$qu} );"; + + stack_mysqlcmd($qu,$stack_mysql['user'],$err); + + // (10) Create the table to link quizzes to subjects + + $qu = "CREATE TABLE IF NOT EXISTS subject_quiz ( + ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + subjectID INT, + quizid INT, + qord INT ); "; + + stack_mysqlcmd($qu,$stack_mysql['user'],$err); + + // (11) Create the table to link users to subjects + + $qu = "CREATE TABLE IF NOT EXISTS user_subject ( + ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + userID INT, + subjectID INT); "; + + stack_mysqlcmd($qu,$stack_mysql['user'],$err); + // /************************************************/ // /* (500) RQP tables have been created. */ |
From: Chris S. <san...@us...> - 2005-09-04 19:25:05
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12073/html Modified Files: admin-menu.txt pagehead.php student-menu.txt Added Files: subjectjava.html Log Message: **MAJOR** changes: added the Subject layer over the top, Index: student-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/student-menu.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** student-menu.txt 22 Jun 2005 13:14:35 -0000 1.4 --- student-menu.txt 4 Sep 2005 19:24:57 -0000 1.5 *************** *** 2,5 **** --- 2,6 ---- // level // text // link // target // + .menu_SelectS|index.php?action=choose_subject .menu_SelectQ|index.php?action=choose_quiz .menu_Update|index.php?action=update_info Index: admin-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/admin-menu.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** admin-menu.txt 26 Aug 2005 08:44:56 -0000 1.15 --- admin-menu.txt 4 Sep 2005 19:24:57 -0000 1.16 *************** *** 8,11 **** --- 8,14 ---- ..menu_New|editquiz.php?action=quiz_new ..menu_Import|import.php?action=import + .menu_Subjects|editsubject.php?action=subject_choose + ..menu_New|editsubject.php?action=subject_new + .menu_Zone|editzone.php .menu_Reporting|analysis.php .menu_User|user.php --- NEW FILE: subjectjava.html --- <script language="javascript"> function takeaction(c,n) { document.forms.subjectform.action.value = c; document.forms.subjectform.subjectID.value = n; document.forms.subjectform.submit(); } function addquiz() { document.forms.stacksubjecteditform.action.value = "subject_edit_add_quiz"; document.forms.stacksubjecteditform.submit(); } </script> Index: pagehead.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/pagehead.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pagehead.php 25 Aug 2005 16:06:16 -0000 1.12 --- pagehead.php 4 Sep 2005 19:24:57 -0000 1.13 *************** *** 1,140 **** <?php - /** - * - * STACK standard page header. - * - * @package frontend - * @subpackage Stack - */ - - /** - * - */ - ?> - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> - <html> - <head> - <title>STACK - System for Teaching and Assessment using a Computer algebra Kernel</title> - <link rel="shortcut icon" href="pics/logo_sm.gif" /> - <style type="text/css"> - @import url(html/stack.css); - </style> - </head> - <body> - <table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr align="left" valign="top"> - <td colspan="2" id="header"> - <table width="95%" border="0" cellpadding="0" cellspacing="5"> - <tr align="left" valign="top"> - <td align="left"><h1>STACK</h1> - <font size='+2'>S</font><em>ystem for </em><font size='+2'>T</font><em>eaching and </em><font size='+2'>A</font><em>ssessment using a </em><font size='+2'>C</font><em>omputer algebra </em><font size='+2'>K</font><em>ernel</em></em></td> - <td align="right"> - <?php - echo '<br /><font size=-3>'; - if (isset($user['loggedin']) && ($user['loggedin'])) { - echo "<p>Logged in as<br />{$user['username']}.</p>"; - } else { - echo "<p>Not logged in.</p>"; - } - echo "</font>\n"; - ?> - </tr></table> - </td></tr> - <tr align="left" valign="top"> - <td nowrap width="10%" id="navigation"> - <?php - require_once("{$stack_root}/other/ListMenu.php"); - $username = @nsf($user,'username'); - if ('' !=$stack_basepath) { - $menupath = '/'.$stack_basepath.'/'; - } else { - $menupath = '/'; - } ! ! if (!empty($username)) ! { ! if ('admin' == $username) { ! ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/admin-menu.txt"); ! ! } else if ($user['loggedin']) { ! ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/student-menu.txt"); ! ! } else { ! ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/index-menu.txt"); ! ! } ! } ! ! else ! { ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/index-menu.txt"); ! } ! ! $menu->printMenu(); - - ?> - </td> - - <td width="90%" id="content"> - --- 1,80 ---- <?php /** * * STACK standard page header. * * @package frontend * @subpackage Stack */ /** * */ ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>STACK - System for Teaching and Assessment using a Computer algebra Kernel</title> <link rel="shortcut icon" href="pics/logo_sm.gif" /> <style type="text/css"> @import url(html/stack.css); </style> </head> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr align="left" valign="top"> <td colspan="2" id="header"> <table width="95%" border="0" cellpadding="0" cellspacing="5"> <tr align="left" valign="top"> <td align="left"><h1>STACK</h1> <font size='+2'>S</font><em>ystem for </em><font size='+2'>T</font><em>eaching and </em><font size='+2'>A</font><em>ssessment using a </em><font size='+2'>C</font><em>omputer algebra </em><font size='+2'>K</font><em>ernel</em></em></td> <td align="right"> <?php echo '<br /><font size=-3>'; if (isset($user['loggedin']) && ($user['loggedin'])) { echo "<p>Logged in as<br />{$user['username']}.</p>"; } else { echo "<p>Not logged in.</p>"; } echo "</font>\n"; ?> </tr></table> </td></tr> <tr align="left" valign="top"> <td nowrap width="10%" id="navigation"> <?php require_once("{$stack_root}/other/ListMenu.php"); $username = @nsf($user,'username'); if ('' !=$stack_basepath) { $menupath = '/'.$stack_basepath.'/'; } else { $menupath = '/'; } ! if (!empty($username)) ! { ! if ('admin' == $username) { ! ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/admin-menu.txt"); ! ! } else if ($user['loggedin']) { ! ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/student-menu.txt"); ! ! } else { ! ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/index-menu.txt"); ! ! } ! } ! ! else ! { ! $menu = new ListMenu('/'.$stack_basepath.'/',"html/index-menu.txt"); ! } $menu->printMenu(); ?> </td> <td width="90%" id="content"> |
From: pkiddie <pk...@us...> - 2005-09-03 21:47:17
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20997/scripts/rqp Modified Files: RQPv1p0Server.php stackRQP.php Log Message: Completion of new question authoring via RQP Item_Information RQP call implemented Some additional helper functions Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RQPv1p0Server.php 1 Sep 2005 13:50:18 -0000 1.5 --- RQPv1p0Server.php 3 Sep 2005 21:47:07 -0000 1.6 *************** *** 51,67 **** */ - //Temporary placeholder for global variables used in RQP - /* You need to tell STACK where it is, to create accurate URL's */ - $stack_host = 'localhost'; - $stack_basepath = 'stack-1-0-dev_rqp'; - /* The URL of the site, with trailing slash */ - /* (You should not need to edit below) */ - $stack_web_url = 'http://'.$stack_host.'/'.$stack_basepath.'/'; - - //$stack_ver['release'] = '1.0'; - //$stack_ver['cvsmodule'] = 'stack-1-0'; - - $stack_web_services_provide = TRUE; - // "Insert *s where needed"; $stackOptions['InsertStars']['type'] = 'list'; --- 51,54 ---- *************** *** 212,216 **** function RQP_ServerInformation() { - //include("../../stackstd.php"); //Reqd for version info for STACK global $stack_ver, $stack_web_url, $stack_web_services_provide; --- 199,202 ---- *************** *** 253,314 **** return new nbSOAPFault("notImplemented", "The RQP_ItemInformation service is not available on this server"); } - //First we check to see if the source intantiates a valid question, if so set isValid to true - - $item = sourceHandler($source); - ! ! //Check that fault has not been recieved in handling the source. If parses successfully then good, otherwise put ! ! //relevant errros and warnings in particular field in ItemInformation. ! ! ! ! ! // Ensure $errors is an array ! ! /*if (empty($errors)) { ! ! $errors = array(); ! ! }*/ ! ! ! ! // Fix return types where required ! ! // (works around a bug in early versions of PHP 5) ! ! $sourceErrors = soap_encode_array($errors, 'sourceErrors', 'error', RQP_URI_NAMESPACE); ! ! ! ! $itemProperties = array('valid' => $isValid , ! ! 'template' => TRUE , ! 'adaptive' => TRUE , - 'timeDependant' => FALSE , - 'canComputerScore' => TRUE , ! ! 'maxScore' => 0 //Get max score from source ! ); ! ! ! ! //$itemInfo['title'] =>; //Retreived from source ! ! //$itemInfo['itemProperties'] => $itemProperties; ! ! //$itemInfo['error'] =>;//Retrevied from source parser ! ! //$itemInfo['warning'] =>; // Retrieved from source parser ! return new nbSOAPFault("unimplemented", "The RQP_ItemInformationservice has not been implemented yet", ""); ! // Fill in web method fuctionality here. ! // return a ItemInformationDType } --- 239,285 ---- return new nbSOAPFault("notImplemented", "The RQP_ItemInformation service is not available on this server"); } ! //Initialise empty error string ! if (empty($errors)) { ! $errors = ''; ! } ! //Initialise empty warning string ! if (empty($warnings)) { ! $warnings = ''; ! } ! ! //Construct the itemProperties array ! $itemProperties = array('template' => TRUE , 'adaptive' => TRUE , 'timeDependant' => FALSE , 'canComputerScore' => TRUE , ! 'maxScore' => 0, ! 'valid' => FALSE ); ! ! //First we check to see if the source intantiates a valid question, if so set isValid to true ! //In STACK, source is XML. ! //1. Attempt to import the question ! $question = stack_rqp_parse_xml_string($source, &$errors); ! ! //Only $question will pass through here ! if ($question) ! { ! show_array($question); ! $quOptions = stack_options_set($question); ! ! //2. Fill in relevent fields where question instantiates ! $itemProperties['valid']=TRUE; ! $itemProperties['maxScore']=$quOptions['QuVal']; ! //This isnt being returned?? is it in latest spec?? ! $itemInfo['title'] = $question['questionName']; ! } ! ! $itemInfo['itemProperties'] = $itemProperties; ! $itemInfo['error'] = $errors; ! $itemInfo['warning'] = $warnings; ! ! return $itemInfo; } *************** *** 336,347 **** } - //require("../../stackstd.php"); //Reqd for version info for STACK - //require("../moodlelib.php"); require_once('../stackAuthor.php'); - //require_once('../stackQuestion.php'); //Response parameters $persistentData=''; - $outcomeVars=''; $onSubmit=''; $head=''; --- 307,314 ---- *************** *** 350,353 **** --- 317,338 ---- $files=''; + //Response parameter - outcomeVars array + $outcomeVars = array('score' => '0', + 'rawScore' => '0', + 'penalty' => '0', + 'valid' => TRUE, + 'source' => '', + 'options' => '', + 'completion' => 'unknown'); + + //Response parameter - output array + $output = array('title' => '', + 'body' => '', + 'stem' => '', + 'feedback' => '', + 'response' => '', + 'answer' => '', + 'solution' => ''); + //1. User wants to author a question if (in_array('edit',$directives)) //if this is set, disregard other directives *************** *** 355,359 **** $errors=''; //Used in authoring form ! //1.1 Is a new question to be authored, or an existing one if (empty($source)) { --- 340,344 ---- $errors=''; //Used in authoring form ! //1.1 Is a new question to be authored if (empty($source)) { *************** *** 363,406 **** } ! else { //parse these input fields ! $question = stack_rqp_question_get($inputData); } ! $persistentData = ''; ! $outcomeVars = array('completion' => 'unknown', ! 'score' => '0', ! 'rawScore' => '0', ! 'penalty' => '0', ! 'valid' => TRUE, ! 'source' => 'edited sourcce', ! 'options' => 'options string'); ! ! $onSubmit = "</script> ! function EditQ(action) { ! f = document.stackeditqform; ! f.action.value = action; ! f.target = '_self'; ! f.submit(); ! }; ! <script type=".'"'.'text/javascript">'; ! $head = '<script type="text/javascript"> ! window.focus(); ! function EditQ(action) { ! f = document.stackeditqform; ! f.action.value = action; ! f.target = "_self"; ! f.submit(); ! }; ! </script>'; ! $output = array('title' => '', //initially question will have no title ! //remoteCaller = true ! 'body' => stack_question_edit_form_substance($question,$errors, $namePrefix, TRUE), ! 'stem' => '', ! 'feedback' => '', ! 'response' => '', ! 'answer' => '', ! 'solution' => ''); } else if (!empty($source)) { --- 348,373 ---- } ! else { ! $question = stack_rqp_question_get($inputData); // parse input fields ! stack_question_validate($question,$errors); // validate question and add potential reponse fields ! ! //Where there are no errors in the users input and the user has requested to save the question ! if ($errors=='' && stack_rqp_input_field_get($inputData, 'save')) ! { ! $outcomeVars['completion'] = 'complete'; ! $outcomeVars['source'] = stack_rqp_source_write($question); ! } ! ! else ! { ! $outcomeVars['completion'] = 'unknown'; ! } } ! $output['title'] = $question['questionName']; ! $output['body'] = stack_question_edit_form_substance($question,$errors,$namePrefix, $remoteCaller = TRUE); } + //Existing question with existing XML source else if (!empty($source)) { Index: stackRQP.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/stackRQP.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stackRQP.php 1 Sep 2005 13:50:18 -0000 1.1 --- stackRQP.php 3 Sep 2005 21:47:07 -0000 1.2 *************** *** 2,6 **** --- 2,113 ---- require_once('../../stackLib.php'); + require_once('../../stackConfig.php'); + require_once('../stackXML.php'); + /** This function retrieves a particular field from the RQP inputData key val array + * Used in retrieving save field + */ + function stack_rqp_input_field_get($inputData, $keyName) { + for ($i=0;$i<(count($inputData));$i++) + { + if ($keyName==$inputData[$i]['key']) { + return $inputData[$i]['val']; + } + } + + return false; + } + + /** Converts a DOMIT_Document instance to an XML string, which may be returned to the RQP client as + * the 'source' param + */ + function stack_rqp_source_write($question) + { + $xmlDoc = &stack_xml_create_question($question); + + return $xmlDoc->toString(true); + } + + /** Provides first line defense against 'source' which is either + * 1. not xml + * 2. not stack valid XML (i.e. no assessmentItem head element) + * This will be a rarity as all STACK servers should author questions, and return XML, but just in case... + * + * Version number of XML is checked - if it doesnt exist then we assume the use of old parsing code + * We do not allow the importing of a list of questions, i.e. mathQuiz + */ + function stack_rqp_parse_xml_string($xmlString, &$errors) + { + global $stack_root; + + $xmlString = html_entity_decode($xmlString); + + //We need to cut the two <pres> from the beginning of the string, if they exist + if (0===strpos($xmlString,'<pre>')) //we have identified these <pre> exist, now remove them + { + $length = strlen($xmlString); + + //Get substring, and remove any more HTML formatting + $parsedXml = html_entity_decode(substr($xmlString,5,$length-11)); + + } + + $xmlDoc = &new DOMIT_Document(); + $xmlDoc->setNamespaceAwareness(true); + $success = $xmlDoc->parseXML($parsedXml); + + if ($success) { + $headElement = &$xmlDoc->documentElement; + + //Now retrieve the version number attached to the XML file being imported, and check for equality + $importXmlVersion = $headElement->getAttribute('version'); + + if ($importXmlVersion==null) { //Retain for compatibility - use old parsing code + $question = stack_xml_parse_question_string($xmlDoc->toString()); + return $question; + } + + $schemaVersion = stack_xml_check_schema_version(schemaBaseDir); //Check that XML matches version with schema + + if ($importXmlVersion<=$schemaVersion) { + switch ($headElement->nodeName) { + case('assessmentItem'): { + //A single question + $question = stack_xml_parse_question($xmlDoc); + return $question['assessmentItem']; + break; + } + + //In RQP we only want to parse question + /*case('mathQuiz'): + { + //A list of questions or a quiz? + $quiz = stack_xml_parse_quiz($xmlDoc); + return $quiz; + break; + }*/ + + default: { //Any other head node. Do not accept this + $errors='The XML file does not seem to correspond to a question'; + return false; + break; + } + } + } + + //Where version number of XML data is not the same as the schema + else { + //Throw error + $errors='The version of the quiz or question you are trying to upload is the wrong version number.'; + return false; + } + } + + else if (!$success) { //The XML file is not formatted correctly + $errors=$xmlDoc->getErrorString(); + return false; + } + } + /** * Gets the question instance that has been stored within the RQP inputData fields |
From: pkiddie <pk...@us...> - 2005-09-01 13:53:51
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16848/scripts Modified Files: stackAuthor.php stackDatabase.php Log Message: Latest iteration of HTTP 1.1 code to ensure IIS compatibility Echo'ing of authoring form to buffer if accessing function remotely new stackRQP library, parses form fields returned from RQP client Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** stackDatabase.php 30 Aug 2005 14:46:54 -0000 1.39 --- stackDatabase.php 1 Sep 2005 13:50:18 -0000 1.40 *************** *** 666,669 **** --- 666,670 ---- global $stackQuestion,$stack_mysql; + $query = ""; foreach ($stackQuestion as $qfield => $val) { if ('meta' == $val['type']) { *************** *** 1388,1392 **** $quiz_list = NULL; $quiz_fields = array_keys($stackQuiz); ! foreach ($quiz_fields as $val) { $query .= ' ,'.$val; --- 1389,1394 ---- $quiz_list = NULL; $quiz_fields = array_keys($stackQuiz); ! $query = ''; ! foreach ($quiz_fields as $val) { $query .= ' ,'.$val; Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** stackAuthor.php 30 Aug 2005 18:30:19 -0000 1.37 --- stackAuthor.php 1 Sep 2005 13:50:18 -0000 1.38 *************** *** 94,97 **** --- 94,100 ---- global $stackOptions; + if ($remoteCaller) + ob_start(); + echo "<table cellpadding='4'><tr> <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> *************** *** 123,126 **** --- 126,135 ---- echo "\n</table>\n\n\n"; + + if ($remoteCaller) { + $html = ob_get_contents(); + ob_end_flush(); + return $html; + } } *************** *** 202,206 **** //For use by RQP - buffer these echo's ! ob_start(); // hidden metadata --- 211,216 ---- //For use by RQP - buffer these echo's ! if($remoteCaller) ! ob_start(); // hidden metadata *************** *** 397,411 **** $html = ob_get_contents(); ! if (!$remoteCaller) { ob_end_flush(); ! } ! //Do not ask server to display options, waste of processor power ! else { ! ob_end_clean(); } - - return $html; - } // end of edit_form_table --- 407,420 ---- $html = ob_get_contents(); ! /*if (!$remoteCaller) { ob_end_flush(); ! }*/ ! if ($remoteCaller) ! { ! $html = ob_get_contents(); ! ob_end_clean(); ! return $html; } } // end of edit_form_table |
From: pkiddie <pk...@us...> - 2005-09-01 13:50:26
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16848/scripts/rqp Modified Files: RQPv1p0Server.php nb_soapfuncs.php stackDetails.php Added Files: stackRQP.php Log Message: Latest iteration of HTTP 1.1 code to ensure IIS compatibility Echo'ing of authoring form to buffer if accessing function remotely new stackRQP library, parses form fields returned from RQP client Index: stackDetails.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/stackDetails.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackDetails.php 25 Aug 2005 16:06:18 -0000 1.2 --- stackDetails.php 1 Sep 2005 13:50:18 -0000 1.3 *************** *** 10,14 **** * - version of STACK in use */ ! require('../../stackstd.php'); echo '<html> --- 10,15 ---- * - version of STACK in use */ ! require('../../stackConfig.php'); ! require('../../stackLib.php'); echo '<html> Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RQPv1p0Server.php 30 Aug 2005 16:34:57 -0000 1.4 --- RQPv1p0Server.php 1 Sep 2005 13:50:18 -0000 1.5 *************** *** 2,9 **** include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); - //include("../../stackstd.php"); //include("rqp_util.php"); //Stack/RQP utility function. include("../../stackConfig.php"); include("../../stackLib.php"); /********* Data structures used by this web service ********* --- 2,9 ---- include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); //include("rqp_util.php"); //Stack/RQP utility function. include("../../stackConfig.php"); include("../../stackLib.php"); + include("stackRQP.php"); /********* Data structures used by this web service ********* *************** *** 59,64 **** $stack_web_url = 'http://'.$stack_host.'/'.$stack_basepath.'/'; ! $stack_ver['release'] = '1.0'; ! $stack_ver['cvsmodule'] = 'stack-1-0'; $stack_web_services_provide = TRUE; --- 59,64 ---- $stack_web_url = 'http://'.$stack_host.'/'.$stack_basepath.'/'; ! //$stack_ver['release'] = '1.0'; ! //$stack_ver['cvsmodule'] = 'stack-1-0'; $stack_web_services_provide = TRUE; *************** *** 336,340 **** } ! require("../../stackstd.php"); //Reqd for version info for STACK //require("../moodlelib.php"); require_once('../stackAuthor.php'); --- 336,340 ---- } ! //require("../../stackstd.php"); //Reqd for version info for STACK //require("../moodlelib.php"); require_once('../stackAuthor.php'); *************** *** 358,364 **** if (empty($source)) { $question = stack_question_new('Paul Kiddie'); //Create question with mim fields. Todo, how do we get admin name from Moodle - show_array($question); $persistentData = ''; $outcomeVars = array('completion' => 'unknown', --- 358,370 ---- if (empty($source)) { + //Is this a new NEW question, or are we in an existing authoring session + if (empty($inputData)) { // if empty input array - we are starting afresh $question = stack_question_new('Paul Kiddie'); //Create question with mim fields. Todo, how do we get admin name from Moodle + } + + else { //parse these input fields + $question = stack_rqp_question_get($inputData); + } $persistentData = ''; $outcomeVars = array('completion' => 'unknown', *************** *** 394,401 **** 'response' => '', 'answer' => '', ! 'solution' => ''); ! ! $mimetype = 'text/html'; ! $files = array(); } --- 400,404 ---- 'response' => '', 'answer' => '', ! 'solution' => ''); } *************** *** 404,411 **** --- 407,439 ---- //Use existing source to fill in fields within authoring form //Import source XML and display question editing form + if('adminOptions'==$source) { + $options_headings = array(get_string('stackOptions_edit_out','stack'),''); + $options_list = array('Display','Language'); + + $fieldname = 'quiz'.'[quizOptions]'; + + $output = array('title' => '', //initially question will have no title + //remoteCaller = true + 'body' => stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$namePrefix, TRUE), + 'stem' => '', + 'feedback' => '', + 'response' => '', + 'answer' => '', + 'solution' => ''); + } + + else if ('teacherOptions'==$source) { + } + + else if ('userOptions'==$source) { + } } } + //Variables the same no matter what context render called in + $mimetype = 'text/html'; + $files = array(); + //Construct RenderType Index: nb_soapfuncs.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/nb_soapfuncs.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nb_soapfuncs.php 30 Aug 2005 16:34:57 -0000 1.4 --- nb_soapfuncs.php 1 Sep 2005 13:50:18 -0000 1.5 *************** *** 73,77 **** stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) --- 73,77 ---- stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) *************** *** 89,94 **** while ((!feof($sock))&&(!$pageComplete)) { - $cl = strlen($contents); $contents .= fread($sock, 8192); if(!$headersComplete) { --- 89,94 ---- while ((!feof($sock))&&(!$pageComplete)) { $contents .= fread($sock, 8192); + $cl = strlen($contents); if(!$headersComplete) { *************** *** 97,100 **** --- 97,101 ---- while(($headerEnd != false)&&(!$headersComplete)) { + //echo "<p><i><b>Hdrend</b><br/><pre>[" . htmlentities($contents) . "]</pre></i></p>"; $fle = strpos($contents,"\r\n"); // first line end $line = substr($contents, 0, $fle); *************** *** 109,116 **** { $headersComplete = true; $clp = strpos($contents,"Content-Length:"); ! $cle = strpos($contents,"\r\n",$clp); ! $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); ! $headerLength = $cle+4; } else --- 110,130 ---- { $headersComplete = true; + // check for chunked encoding + $clp = strpos($contents,"Transfer-Encoding:"); + + // check for content length $clp = strpos($contents,"Content-Length:"); ! if($clp != false) ! { ! $cle = strpos($contents,"\r\n",$clp); ! $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); ! $headerLength = $cle+4; ! } ! else // no content length ! { ! // should really check that it is either chunked or CloseConnection ! // and through an exception if not... ! $contentLength = -1; ! } } else *************** *** 124,128 **** if($headersComplete) // not an else because I want it done if headersComplete just set { ! if(strlen($contents)>=$contentLength+$headerLength) $pageComplete = true; } --- 138,142 ---- if($headersComplete) // not an else because I want it done if headersComplete just set { ! if(($contentLength!=-1)&&(strlen($contents)>=$contentLength+$headerLength)) $pageComplete = true; } *************** *** 139,143 **** fclose($sock); } ! echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } --- 153,157 ---- fclose($sock); } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } --- NEW FILE: stackRQP.php --- <?php require_once('../../stackLib.php'); /** * Gets the question instance that has been stored within the RQP inputData fields * @param array $inputData inputData key/val array * @return array $question The question */ function stack_rqp_question_get($inputData) { global $stackQuestion; $question = NULL; foreach ($stackQuestion as $qfield => $attribs) { for ($i=0;$i<(count($inputData));$i++) { //show_array($inputData[$i]); //show_array($qfield); //show_array($inputData[$i]['key']); if ($qfield==$inputData[$i]['key']) { if ($qfield == 'questionOptions') { //This is two step - first we decode, then deserialise $question[$qfield] = unserialize(html_entity_decode($inputData[$i]['val'])); break; } else if ($qfield == 'questionPotResp') { $question[$qfield] = unserialize(html_entity_decode($inputData[$i]['val'])); break; } else { //Need to work out what we do with options and potential responses - can't have arrays within val! $question[$qfield] = $inputData[$i]['val']; break; } } } } show_array($question); /*foreach($stackQuestion as $qfield => $attribs) { if (array_key_exists($qfield,$_POST) ) { if ('questionOptions' == $qfield) { $question[$qfield] = $_POST[$qfield]; } else if ('questionPotResp' == $qfield ) { $question[$qfield] = $_POST[$qfield]; } else if ( '' !=trim($_POST[$qfield]) ) { // We need this: all fields on form will be present in $_POST. $question[$qfield] = $_POST[$qfield]; } } }*/ return $question; } ?> |
From: Chris S. <san...@us...> - 2005-09-01 09:15:06
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8995/scripts/maxima Modified Files: stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** stackmaxima.mac 1 Sep 2005 08:13:57 -0000 1.30 --- stackmaxima.mac 1 Sep 2005 09:14:50 -0000 1.31 *************** *** 228,232 **** set terminal ",PLOT_TERMINAL," ",PLOT_TERM_OPT," set output ",afn), - set_plot_option([GNUPLOT_OUT_FILE,tfn]), set_plot_option([GNUPLOT_PREAMBLE, preamble]), --- 228,231 ---- |
From: Chris S. <san...@us...> - 2005-09-01 08:20:56
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31035/lang/en/doc Modified Files: author_testsuite.php student_input.php Log Message: Added "equation" and "inequality" input types to the AlgEquiv Answer test. Index: author_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_testsuite.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** author_testsuite.php 25 Aug 2005 16:06:17 -0000 1.9 --- author_testsuite.php 1 Sep 2005 08:13:57 -0000 1.10 *************** *** 66,69 **** --- 66,82 ---- $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2,3],[2,3,3])',0,'',''); $testsuite[] = stack_testsuite_construct('AlgEquiv','matrix([1,2],[2,3])','matrix([1,2],[2,5])',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','1','x=1',0,'','Equations'); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x=1','x=1',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','1=x','x=1',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x=2','x=1',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','1','x>1',0,'','Inequalities'); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x>1','x>1',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x>2','x>1',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x<1','x>1',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','1<x','x>1',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x>=1','x>=1',1,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','x>1','x>=1',0,'',''); + $testsuite[] = stack_testsuite_construct('AlgEquiv','2*x>=x^2','x^2<=2*x',1,'',''); + // AlgEquiv Answer tests. Index: student_input.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/student_input.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** student_input.php 26 Aug 2005 08:44:56 -0000 1.4 --- student_input.php 1 Sep 2005 08:13:57 -0000 1.5 *************** *** 206,209 **** --- 206,210 ---- written as <font color="BLUE">|x|</font> in traditional notation. This must be entered as <tt><font color="GREEN">abs(x)</font></tt>. + <br /><br /> </li> *************** *** 228,231 **** --- 229,249 ---- <br /><br /> </li> + + <li><b>Equations:</b> can be entered using the equals sign. + For example, to enter the equation <font color="BLUE">y=x^2-2*x+1</font> + type <tt><font color="GREEN">y=x^2-2*x+1</font></tt>. + <br /><br /> + </li> + + <li><b>Inequalities:</b> can be entered using the greater then and less than + signs on the keyboard. Notice that there are four possibilities for you to + choose from: + <tt><font color="GREEN"><</font></tt> or + <tt><font color="GREEN">></font></tt> or + <tt><font color="GREEN"><=</font></tt> or + <tt><font color="GREEN">>=</font></tt>. Note there is no space between these symbols, and the equality + <em>must</em> come second when it is used. + <br /><br /> + </li> <li><b>Matrices:</b> You may be given a grid of boxes to fill in. If not, the teacher may |
From: Chris S. <san...@us...> - 2005-09-01 08:20:56
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31035/lang/en Modified Files: stack.php Log Message: Added "equation" and "inequality" input types to the AlgEquiv Answer test. Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/stack.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** stack.php 29 Aug 2005 18:41:03 -0000 1.24 --- stack.php 1 Sep 2005 08:13:57 -0000 1.25 *************** *** 112,115 **** --- 112,116 ---- $string['MissingStars'] = 'You seem to be missing *\'s.<br /> Perhaps you meant to type '; $string['BadAmps'] = 'You should not have any @\'s. '; + $string['BadIneqs'] = 'Your (non-strict) inequalities are not correct. You either have space between your symbols, or the symbols in the wrong order, or both.'; $string['BadAbsFun'] = 'You should not have any |\'s. You may need to use the <tt>abs()</tt> CAS function instead.'; $string['UnknownFun'] = 'The string <tt><font color=\'orange\'>{$a[\'key\']}</font></tt> does not occur in the list of permitted functions. It could be that you have missed off some multiplication signs, or brackets. If you are in doubt about this, please contact the administrator.'; *************** *** 330,336 **** $string['AT_NOTIMPLEMENTED'] = 'This answer test has not been implemented.'; ! $string['ATAlgEquiv_SA_notmatrix'] = 'Your answer should be a matrix, but is not.'; ! $string['ATAlgEquiv_SA_notlist'] = 'Your answer should be a list, but is not. Note that the syntax to enter a list is to enclose the comma separated values with square brackets.'; ! $string['ATAlgEquiv_SA_notset'] = 'Your answer should be a set, but is not. Note that the syntax to enter a set is to enclose the comma separated values with curly brackets.'; $string['ATList_wronglen'] = 'Your list should have {$a[0]} elements, but it is actually has {$a[1]}. '; --- 331,339 ---- $string['AT_NOTIMPLEMENTED'] = 'This answer test has not been implemented.'; ! $string['ATAlgEquiv_SA_not_matrix'] = 'Your answer should be a matrix, but is not.'; ! $string['ATAlgEquiv_SA_not_list'] = 'Your answer should be a list, but is not. Note that the syntax to enter a list is to enclose the comma separated values with square brackets.'; ! $string['ATAlgEquiv_SA_not_set'] = 'Your answer should be a set, but is not. Note that the syntax to enter a set is to enclose the comma separated values with curly brackets.'; ! $string['ATAlgEquiv_SA_not_equation'] = 'Your answer should be an equation, but is not.'; ! $string['ATAlgEquiv_SA_not_inequality'] = 'Your answer should be an inequality, but is not.'; $string['ATList_wronglen'] = 'Your list should have {$a[0]} elements, but it is actually has {$a[1]}. '; |