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-08-26 14:56:08
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28139/scripts/install Added Files: stack_quiz_Syntax practice.xml Log Message: --- NEW FILE: stack_quiz_Syntax practice.xml --- <?xml version="1.0" encoding="utf-8"?> <mathQuiz xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/home/stack/stacklocal//schemas/stack_quiz.xsd" version="1.0"> <dc:title>Syntax practice</dc:title> <dc:description>How to enter your answers into STACK.</dc:description> <quizOptions /> <quizDueDate></quizDueDate> <quizMode></quizMode> <dc:identifier>MTEyNTA3MTQ4MzY1NDAxNz</dc:identifier> <lom:keyword></lom:keyword> <dc:creator>Admin User</dc:creator> <dc:date>2005-08-26 15:51:23</dc:date> <dc:publisher>http://eee595.bham.ac.uk/~stack/</dc:publisher> <dc:type>quiz</dc:type> <dc:format>text/xml; charset="utf-8"</dc:format> <assessmentItem order="0"> <questionStem>\subsection*{How do I navigate around the page?} {\em Do not use your browser's "Back" or "Reload" buttons during the test.} \par You may choose to view a test either in focused mode, or in unfocused mode. Focued mode gives you one question at a time, and unfocused mode shows the whole test on one long scrolling screen. It is possible to switch between the two modes during a test. \par Once you've given your answers, you can check there are no syntax errors by pressing the {\bf Validate} link. This is at the top and the bottom of each page. You can change your answer and press validate as often as you need to. When you are happy with your answer click the {\bf Mark} link to mark your work. Again, you will usually be able to change an answer and either validate or mark again. {\em After you have requested the solutions you will not be able to change your response.} \par Some questions are randomly generated, so different students will get different questions. This is to discourage cheating by copying the work of others! \subsection*{How do I enter my answers?} You should type in your answers using the same syntax used by the symbolic mathematics package {\em Maxima}. If you are not sure how to do this you can always press the help link on this page. This will not alter your current test. \par Try the following questions to familiarize yourself with the question types before using the system for real. {\bf This is not a test that "counts"}. \subsection*{Entering basic formulae} Entering numbers is simple: just type the value. Enter the number answer to the sum $2+2$. </questionStem> <questionAns>4</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <Forbid>+</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTQ4MzY3NTE3Nz</dc:identifier> <dc:title>SP.1</dc:title> <dc:description>Syntax practice 1</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:43:51</dc:type> <dc:format>2005-08-26 15:11:52</dc:format> <dc:language>2005-08-26 15:10:17</dc:language> <dc:rights>2005-08-26 15:03:47</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> <assessmentItem order="1"> <questionStem>To enter the number represented by the Greek letter \[ \pi \] type either <html><tt><font color="ORANGE">pi</font></tt></html> or <html><tt><font color="ORANGE">%pi</font></tt></html> </questionStem> <questionAns>%pi</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <AnsTest>AlgEquiv</AnsTest> <Forbid>+</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTQ4MzcwMjY3MT</dc:identifier> <dc:title>SP.2</dc:title> <dc:description>Syntax practice 2</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:45:34</dc:type> <dc:format>2005-08-26 15:12:52</dc:format> <dc:language>2005-08-26 15:11:52</dc:language> <dc:rights>2005-08-26 15:10:17</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> <assessmentItem order="2"> <questionStem>\subsection*{Entering algebra} \begin{itemize} \item Use a star for multiplication: for example, 3x should be entered as {\tt 3*x}. \item Use a `caret' for raising something to a power. You can get a caret by holding down the SHIFT key and pressing the 6 key on most keyboards. \end{itemize} \par You will often have to enter algebraic answers such as \[3x^2.\] <html>This entered as <tt><font color="ORANGE">3*x^2</font></tt><p><font color="red"> The most common source of errors is missing the multiplication symbol `*`.</font></p></html> \par Try both the correct and incorrect syntax and see how AIM responds when you press the {\bf Mark } link at the end of this page. </questionStem> <questionAns>3*x^2</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <AnsTest>AlgEquiv</AnsTest> <Penalty>0</Penalty> <InformalSyntax>FALSE</InformalSyntax> <Forbid>detault</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTQ4MzcyOTMzND</dc:identifier> <dc:title>SP.3</dc:title> <dc:description>Syntax practice 3</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:20:08</dc:type> <dc:format>2005-08-26 15:19:47</dc:format> <dc:language>2005-08-26 15:16:48</dc:language> <dc:rights>2005-08-26 15:15:43</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> <assessmentItem order="3"> <questionStem>\subsection*{Brackets} Brackets are important to group terms in an expression. This is particularly the case in STACK since we use a {\em one dimensional input} rather than traditional written mathematics. When in doubt, use brackets, and also the validate button to display your input in two dimensional form. For example to enter powers such as \[2^{x+1}\] <html>you need to type <tt><font color="ORANGE">2^(x+1)</font></tt><p><font color="red"> The next most common source of errors is missing brackets.</font></p></html> Try typing this in here.</questionStem> <questionAns>3*x^2</questionAns> <questionPotResp order="0"> <SAns>ans1</SAns> <TAns>2^(x+1)</TAns> <AnsTest>AlgEquiv</AnsTest> <true> <RawMarkMod>=</RawMarkMod> <RawMark>1</RawMark> <ApLat>-1</ApLat> </true> <false> <RawMarkMod>=</RawMarkMod> <RawMark>0</RawMark> <ApLat>1</ApLat> </false> </questionPotResp> <questionPotResp order="1"> <SAns>ans1</SAns> <TAns>2^x+1</TAns> <AnsTest>AlgEquiv</AnsTest> <true> <RawMarkMod>=</RawMarkMod> <RawMark>0</RawMark> <FeedBack>You have made the classic mistake of missing brackets here. You needed to type <html><font color="ORANGE">2^(x+1)</font></html>.</FeedBack> <ApLat>-1</ApLat> </true> <false> <RawMarkMod>=</RawMarkMod> <RawMark>0</RawMark> <ApLat>-1</ApLat> </false> </questionPotResp> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <Penalty>0</Penalty> <InformalSyntax>FALSE</InformalSyntax> <Forbid>detault</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTQ4Mzc3MzAxOT</dc:identifier> <dc:title>SP.4</dc:title> <dc:description>Syntax practice 4</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:25:12</dc:type> <dc:format>2005-08-26 15:23:28</dc:format> <dc:language>2005-08-26 15:22:38</dc:language> <dc:rights>2005-08-26 15:20:19</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> <assessmentItem order="4"> <questionStem>The following examples are taken from the online help. \par Remember that the following expressions are different: <html><ol><li><tt>(a+b)/(c+d)</tt>, </li><li><tt>a+b/(c+d)</tt>,</li><li><tt>(a+b)/c+d</tt>, </li><li><tt>a+b/c+d</tt>. </ol></html> Enter 3. here: </questionStem> <questionAns>(a+b)/c+d</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <AnsTest>AlgEquiv</AnsTest> <Penalty>0</Penalty> <InsertStars>FALSE</InsertStars> <InformalSyntax>FALSE</InformalSyntax> <Forbid>detault</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTQ4MzgwMTk5MT</dc:identifier> <dc:title>SP.5</dc:title> <dc:description>Syntax practice 5</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:28:40</dc:type> <dc:format>2005-08-26 15:26:20</dc:format> <dc:language>2005-08-26 15:25:12</dc:language> <dc:rights>2005-08-26 15:23:28</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> <assessmentItem order="5"> <questionStem>\subsection*{Trig, logarithms and exponentials} Trigonometrical functions, such as $sin(x)$ are entered just like that! The natural logarithm of $x$ is entered as <html><tt><font color="ORANGE">ln(x)</font></tt></html> \par The exponential, $e^x$ as <html><tt><font color="ORANGE">exp(x)</font></tt></html> \par {\em You must use the parentheses.} Enter $cos(2x)$. </questionStem> <questionAns>cos(2*x)</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <AnsTest>AlgEquiv</AnsTest> <Penalty>0</Penalty> <InsertStars>FALSE</InsertStars> <InformalSyntax>FALSE</InformalSyntax> <Forbid>detault</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTQ4MzgyOTY5Mz</dc:identifier> <dc:title>SP.6</dc:title> <dc:description>Syntax practice 6</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:34:01</dc:type> <dc:format>2005-08-26 15:33:07</dc:format> <dc:language>2005-08-26 15:32:08</dc:language> <dc:rights>2005-08-26 15:30:59</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> <assessmentItem order="6"> <questionStem>\subsection*{Maxima evaluates your answer!} Maxima works in the background and you will notice that STACK manipulates your answers algebraically before comparing them with the teacher's answers. This means STACK sometimes displays a different answer than the one you typed - even if both are correct. When you enter \[ cos(\pi)\sqrt{16} \] Maxima performs some evaluation for you. Try it here, using <html><tt><font color="ORANGE">cos(Pi)*sqrt(16)</font> </tt></html> </questionStem> <questionAns>cos(Pi)*sqrt(16)</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <AnsTest>AlgEquiv</AnsTest> <Penalty>0</Penalty> <InsertStars>FALSE</InsertStars> <InformalSyntax>FALSE</InformalSyntax> <Forbid>detault</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTczNzgxNTkzOD</dc:identifier> <dc:title>SP.7</dc:title> <dc:description>Syntax practice 7</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:57:50</dc:publisher> <dc:type>2005-08-26 15:57:16</dc:type> <dc:format>2005-08-26 15:55:37</dc:format> <dc:language>2005-08-26 15:51:23</dc:language> <dc:rights>en</dc:rights> <lom:context>en</lom:context> <lom:difficulty>Primary Education</lom:difficulty> <competency>Very Easy</competency> <competencylevel>think</competencylevel> <lom:typicallearningtime>elementary</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>algebraicExpression</dc:date> </assessmentItem> <assessmentItem order="7"> <questionStem>The very Maxima aware might try to answer the question, Differentiate $x^4 \sin(x)$ with respect to $x$, by using Maxima's inbuilt {\tt diff} function. That is trying to enter <html><tt><font color="ORANGE">diff(x^4*sin(x),x)</font></tt></html> \par Try it here. </questionStem> <questionAns>diff(x^4*sin(x),x)</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <AnsTest>AlgEquiv</AnsTest> <Penalty>0</Penalty> <InsertStars>FALSE</InsertStars> <InformalSyntax>FALSE</InformalSyntax> </questionOptions> <dc:identifier>MTEyNTA3MTQ4Mzg1ODQ0MD</dc:identifier> <dc:title>SP.8a</dc:title> <dc:description>Syntax practice 8a</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:38:29</dc:type> <dc:format>2005-08-26 15:37:49</dc:format> <dc:language>2005-08-26 15:35:57</dc:language> <dc:rights>2005-08-26 15:34:01</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> <assessmentItem order="8"> <questionStem>Of course, we know about this sort of cheating! Please try to enter <html><tt><font color="ORANGE">diff(x^4*sin(x),x)</font></tt></html> again here. </questionStem> <questionAns>diff(x^4*sin(x),x)</questionAns> <questionAnsKey>ans1</questionAnsKey> <questionOptions> <AnsTest>AlgEquiv</AnsTest> <Penalty>0</Penalty> <InsertStars>FALSE</InsertStars> <InformalSyntax>FALSE</InformalSyntax> <Forbid>diff</Forbid> </questionOptions> <dc:identifier>MTEyNTA3MTQ4Mzg4NzQ1Mz</dc:identifier> <dc:title>SP.8b</dc:title> <dc:description>Syntax practice 8b</dc:description> <lom:keyword>Syntax practice</lom:keyword> <dc:creator>Admin User</dc:creator> <dc:publisher>2005-08-26 15:51:23</dc:publisher> <dc:type>2005-08-26 15:40:15</dc:type> <dc:format>2005-08-26 15:39:32</dc:format> <dc:language>2005-08-26 15:38:29</dc:language> <dc:rights>2005-08-26 15:37:49</dc:rights> <lom:context>en</lom:context> <lom:difficulty>en</lom:difficulty> <competency>Primary Education</competency> <competencylevel>Very Easy</competencylevel> <lom:typicallearningtime>think</lom:typicallearningtime> <excercisetype>00:00:00</excercisetype> <dc:date>00:00:00</dc:date> </assessmentItem> </mathQuiz> |
From: Chris S. <san...@us...> - 2005-08-26 11:42:26
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16307 Modified Files: quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** quiz.php 26 Aug 2005 10:33:07 -0000 1.27 --- quiz.php 26 Aug 2005 11:42:16 -0000 1.28 *************** *** 141,145 **** } ! $quizmode = $quiz_options['QuizMode']; $duedate = ''; --- 141,146 ---- } ! $options = stack_options_set($question,$quiz_options); ! $quizmode = $options['QuizMode']; $duedate = ''; |
From: Chris S. <san...@us...> - 2005-08-26 10:33:16
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32719 Modified Files: quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** quiz.php 25 Aug 2005 16:06:16 -0000 1.26 --- quiz.php 26 Aug 2005 10:33:07 -0000 1.27 *************** *** 194,198 **** } } // end foreach ! } else { // We have not attempted the quiz $action='new_quiz_version'; } --- 194,201 ---- } } // end foreach ! } else if ('review' == $action) { // We have not attempted the quiz ! $action = 'quiz_error'; ! $error['quiz'] = 'There are no attempts at this quiz.'; ! } else { $action='new_quiz_version'; } *************** *** 234,238 **** // (4.7) Get the information about the quiz from the $_SESSION ! if ('new_quiz_version' != $action and 'continue_quiz' != $action and 'choose_quiz' != $action) { // (4.7.1) Get the quiz from the $_SESSION --- 237,244 ---- // (4.7) Get the information about the quiz from the $_SESSION ! if ('new_quiz_version' != $action and ! 'continue_quiz' != $action and ! 'choose_quiz' != $action and ! 'quiz_error' != $action) { // (4.7.1) Get the quiz from the $_SESSION *************** *** 285,288 **** --- 291,295 ---- and 'choose_quiz' != $action and 'quiz_error' != $action + and 'review' != $action and 'solutions' != $action) { // Solutions are too complicated to deal with here, when it comes to focus/unfocus. |
From: Chris S. <san...@us...> - 2005-08-26 10:33:15
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32719/scripts Modified Files: stackQuiz.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stackQuiz.php 25 Aug 2005 16:06:17 -0000 1.6 --- stackQuiz.php 26 Aug 2005 10:33:07 -0000 1.7 *************** *** 235,238 **** --- 235,239 ---- $quiz = stack_db_quiz_get($quizid,FALSE); $quiz_options = $quiz['quizOptions']; + $quiz_res = ''; echo "<h1>Quiz results: {$quiz['quizName']}</h1>"; *************** *** 297,301 **** // Now reconstruct the actual $quizInst $quiz_attempts = array(); ! $tot = 0; foreach ($quiz_questions as $key => $qID) { $options = stack_options_set($quiz_questions_source[$key],$quiz_options); --- 298,302 ---- // Now reconstruct the actual $quizInst $quiz_attempts = array(); ! $tot = 0; foreach ($quiz_questions as $key => $qID) { $options = stack_options_set($quiz_questions_source[$key],$quiz_options); *************** *** 402,405 **** --- 403,408 ---- + } else { + echo "<p>There are no attempts at any questions in this quiz.</p>"; } |
From: Chris S. <san...@us...> - 2005-08-26 08:57:52
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13193/scripts Modified Files: stackUnix.php stackWin.php Log Message: Index: stackUnix.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUnix.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** stackUnix.php 26 Aug 2005 08:55:04 -0000 1.17 --- stackUnix.php 26 Aug 2005 08:57:42 -0000 1.18 *************** *** 82,86 **** global $stack_root,$stack_logfiles,$stack_cas; ! $debug = TRUE; $ret = FALSE; $err = ''; --- 82,86 ---- global $stack_root,$stack_logfiles,$stack_cas; ! $debug = FALSE; $ret = FALSE; $err = ''; *************** *** 144,147 **** --- 144,148 ---- fclose($pipes[1]); if ($debug) { + $time_taken = $now-$start_time; echo "</pre>"; echo "Start: $start_time<br >End: $now<br >Taken = $time_taken"; *************** *** 149,154 **** } else { - // We timed out, and need to set some error messages. - $err ='SOCKET-TIMEOUT'; // Add sufficient closing ]'s to allow something to be un-parsed from the CAS. $ret .=' The CAS timed out. ] ] ] ]'; --- 150,153 ---- Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** stackWin.php 26 Aug 2005 08:55:04 -0000 1.10 --- stackWin.php 26 Aug 2005 08:57:42 -0000 1.11 *************** *** 130,135 **** fclose($pipes[0]); fclose($pipes[1]); - $time_taken = $now-$start_time; if ($debug) { echo "</pre>"; echo "Start: $start_time<br >End: $now<br >Taken = $time_taken"; --- 130,135 ---- fclose($pipes[0]); fclose($pipes[1]); if ($debug) { + $time_taken = $now-$start_time; echo "</pre>"; echo "Start: $start_time<br >End: $now<br >Taken = $time_taken"; *************** *** 141,146 **** } - //This is useful for debugging. Removing the comments below will echo exactly the CAS session. - //echo "<pre>".$ret."</pre>"; $ret = trim($ret); --- 141,144 ---- |
From: Chris S. <san...@us...> - 2005-08-26 08:55:13
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12406/scripts Modified Files: stackUnix.php stackWin.php Log Message: Index: stackUnix.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUnix.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** stackUnix.php 25 Aug 2005 16:06:17 -0000 1.16 --- stackUnix.php 26 Aug 2005 08:55:04 -0000 1.17 *************** *** 78,87 **** * @return string|boolean The converted HTML string or FALSE if there was an error. */ ! function stack_maxima_rawsend($strin,&$err) { // Sends the $st to maxima. global $stack_root,$stack_logfiles,$stack_cas; ! $ret = FALSE; ! $err = ''; $descriptors = array( --- 78,88 ---- * @return string|boolean The converted HTML string or FALSE if there was an error. */ ! function stack_maxima_rawsend($strin) { // Sends the $st to maxima. global $stack_root,$stack_logfiles,$stack_cas; ! $debug = TRUE; ! $ret = FALSE; ! $err = ''; $descriptors = array( *************** *** 112,115 **** --- 113,119 ---- } + if ($debug) { + echo "<b>Input</b> <pre>$strin</pre>"; + echo '<pre>'; }; while ($continue and !feof($pipes[1])) { *************** *** 130,133 **** --- 134,138 ---- } $ret .= $out; + if ($debug) { echo $out; } } *************** *** 138,141 **** --- 143,151 ---- fclose($pipes[0]); fclose($pipes[1]); + if ($debug) { + echo "</pre>"; + echo "Start: $start_time<br >End: $now<br >Taken = $time_taken"; + }; + } else { // We timed out, and need to set some error messages. Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** stackWin.php 25 Aug 2005 16:15:07 -0000 1.9 --- stackWin.php 26 Aug 2005 08:55:04 -0000 1.10 *************** *** 107,111 **** $start_time = stack_microtime_float(); $continue = TRUE; ! if ($debug) { echo '<pre>'; }; while (!feof($pipes[1]) and $continue) { $out = fgets($pipes[1], 1024); --- 107,113 ---- $start_time = stack_microtime_float(); $continue = TRUE; ! if ($debug) { ! echo "<b>Input</b> <pre>$strin</pre>"; ! echo '<pre>'; }; while (!feof($pipes[1]) and $continue) { $out = fgets($pipes[1], 1024); |
From: Chris S. <san...@us...> - 2005-08-26 08:45:06
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10292/lang/en/doc Modified Files: student_input.php Log Message: Index: student_input.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/student_input.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** student_input.php 25 Aug 2005 16:06:17 -0000 1.3 --- student_input.php 26 Aug 2005 08:44:56 -0000 1.4 *************** *** 1,480 **** <?php - /** - * - * 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... - * - * @package documentation ! ! * @subpackage Stack ! */ - - - - ?> - - <a name="entry"><h2>How do I enter my answers?</h2></a> - ! ! You should type in your answers using the same syntax used in the ! ! symbolic mathematics package, known as a computer algebra system ! ! (cas), underpinning your implementation. This could be ! ! either <i>Axiom</i> or <i>Maxima</i>. The syntax is broadly similar ! ! to the syntax used for mathematical formulae in general programming ! ! languages such as Java, C and Basic and in spreadsheet programs such ! ! as Excel, so you will find it useful to master it. If you are ! ! taking the Applied Mathematics Core course AMA101 then you will ! ! learn to use such a system there. If you are not, the advice below should ! ! be sufficient. Stack tries quite hard to give helpful information ! ! about syntax errors. You can also learn about the right syntax by ! ! doing tests in practice mode and asking for ! ! the solutions; as well as displaying the right answers in ordinary ! ! mathematical notation, Stack will tell you how they could be ! ! entered. (However, there are often several possible ways, and Stack ! ! will not always suggest the easiest one.) ! ! <br /><br /> ! ! When you have entered your answer, you can always click on the ! ! <b>Validate</b> button at the bottom of the page to see how the CAS will ! ! interpret it. If there are any syntax errors or the cas has ! ! misunderstood what you meant then you can fix the problem before ! ! asking Stack to mark your work. ! ! <ul> ! ! <li> Numbers like <font color="BLUE">1/4</font> should be entered as ! <tt><font color="GREEN">1/4</font></tt>, not as ! ! <tt><font color="GREEN">0.25</font></tt>, which can cause some ! ! subtle problems. ! </li> ! ! <li> Use a star for multiplication: for example, ! ! <font color="BLUE">3x</font> should be ! ! entered as <tt><font color="GREEN">3*x</font></tt>. Forgetting this ! ! is by far the most ! ! common source of syntax errors. Note that you do <b>not</b> need ! ! a semicolon at the end, unlike when you are using a CAS directly. ! ! <br /><br /></li> ! ! <li> Use a caret (^) for raising something to a power: for example, ! <font color="BLUE">x<sup>2</sup></font> should be entered as - <tt><font color="GREEN">x^2</font></tt>. You can get - a caret by holding down the SHIFT key and pressing the 6 key - on most keyboards. Negative or fractional powers need brackets: ! ! enter <font color="BLUE">x<sup>-2</sup></font> as ! ! <tt><font color="GREEN">x^(-2)</font></tt> ! ! and <font color="BLUE">x<sup>1/3</sup></font> as ! ! <tt><font color="GREEN">x^(1/3)</font></tt>. ! ! <br /><br /></li> ! ! <li> More generally, when in doubt, use brackets. For example, ! <font color="BLUE"> - <center><table border="0" align="center"><tbody><tr><td> - <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> - </td><td nowrap="nowrap" align="center"> - a + b<hr noshade="noshade"> - c + d <br /></td><td nowrap="nowrap" align="center"> - </td></tr></tbody></table> - </td></tr></tbody></table></center> - </font> - should be entered as - <tt><font color="GREEN">(a+b)/(c+d)</font></tt>. - Note that in this context you should always use ordinary round - bracket (like <tt><font color="GREEN">(a+b)</font></tt>), not - square or curly ones (like <tt><font color="GREEN">[a+b]</font></tt> - or <tt><font color="GREEN">{a+b}</font></tt>). - <br /> - If you type ! ! <tt><font color="GREEN">a+b/(c+d)</font></tt>, then Stack ! will think that you mean - <font color="BLUE"> - <center><table border="0" align="center"><tbody><tr><td> - <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> - a +</td><td nowrap="nowrap" align="center"> - b<hr noshade="noshade"> - c + d<br /></td><td nowrap="nowrap" align="center"> - </td></tr></tbody></table> - </td></tr></tbody></table></center> - </font> ! ! If you type <tt><font color="GREEN">(a+b)/c+d</font></tt>, then Stack ! will think that you mean - <font color="BLUE"> - <center><table border="0" align="center"><tbody><tr><td> - <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> - </td><td nowrap="nowrap" align="center"> - a + b<hr noshade="noshade"> - c<br /></td><td nowrap="nowrap" align="center"> - + d </td></tr></tbody></table> - </td></tr></tbody></table></center> - </font> ! ! If you type <tt><font color="GREEN">a+b/c+d</font></tt>, then Stack ! will think that you mean - <font color="BLUE"> - <center><table border="0" align="center"><tbody><tr><td> - <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> - a +</td><td nowrap="nowrap" align="center"> - b<hr noshade="noshade"> - c<br /></td><td nowrap="nowrap" align="center"> - + d </td></tr></tbody></table> - </td></tr></tbody></table></center> - </font> - <br /> - Some other examples: - <ul> - <li> - <font color="BLUE">2<sup>a+b</sup></font> should be entered as - <tt><font color="GREEN">2^(a+b)</font></tt> - </li> - <li> - <font color="BLUE">2 cos 3x</font> should be entered as - <tt><font color="GREEN">2*cos(3*x)</font></tt> - </li> - <li> - <font color="BLUE">e<sup>ax</sup>sin(bx)</font> should be entered as - <tt><font color="GREEN">exp(a*x)*sin(b*x)</font></tt> - </li> - <li> - <font color="BLUE">(a x<sup>2</sup> + b x + c)<sup>-1</sup></font> - should be entered as - <tt><font color="GREEN">(a*x^2 + b*x + c)^(-1)</font></tt>. - </li> - </ul> ! ! <br /><br /></li> ! ! <li>the CAS system is case-sensitive. Do not enter ! ! <tt><font color="GREEN">X</font></tt> instead of ! ! <tt><font color="GREEN">x</font></tt>, or ! ! <tt><font color="GREEN">a</font></tt> instead of ! ! <tt><font color="GREEN">A</font></tt>, or ! ! <tt><font color="GREEN">Log(Z)</font></tt> instead of ! ! <tt><font color="GREEN">log(z)</font></tt>. ! ! </li> ! ! <li>The absolute value of <font color="BLUE">x</font>, which is ! ! written as <font color="BLUE">|x|</font> in traditional notation, ! ! must be entered as <tt><font color="GREEN">abs(x)</font></tt>. ! ! </li> ! ! <li> ! ! Standard functions such as sin, cos, tan, exp, log and so on can ! be entered using their usual names. However, the argument must - <font color="RED">always</font> be enclosed in brackets: - <font color="BLUE">sin x</font> should be entered as - <tt><font color="GREEN">sin(x)</font></tt>, - <font color="BLUE">ln 3</font> should be entered as ! <tt><font color="GREEN">ln(3)</font></tt> and so on. You can use either <tt><font color="GREEN">log(x)</font></tt> or - <tt><font color="GREEN">ln(x)</font></tt> for - the natural logarithm of x (note that both of these start with a ! lower case l, not a capital I). The function ! ! <font color="BLUE">1/sin(x)</font> must be ! ! referred to as <tt><font color="GREEN">csc(x)</font></tt> rather ! ! than <tt><font color="GREEN">cosec(x)</font></tt> (or you can just call ! ! it <tt><font color="GREEN">1/sin(x)</font></tt> if you prefer). You ! ! should always write ! ! <tt><font color="GREEN">exp(x)</font></tt> for ! ! <font color="BLUE">e<sup>x</sup></font>. ! ! <br /><br /></li> ! ! <li> ! ! <font color="BLUE">sin<sup>2</sup>x</font> should be entered as ! ! <tt><font color="GREEN">sin(x)^2</font></tt> (which is ! ! what it really means, after all). Similarly for ! ! <font color="BLUE">tan<sup>2</sup>(x)</font>, ! ! <font color="BLUE">sinh<sup>2</sup>(x)</font> and so on. ! ! <br /><br /></li> ! ! <li> ! ! Recall that <font color="BLUE">sin<sup>-1</sup>(x)</font> ! ! traditionally means the number <font color="BLUE">t</font> such that ! ! <font color="BLUE">sin(t) = x</font>, which is of ! ! course completely different from the number ! ! <font color="BLUE">sin(x)<sup>-1</sup> = 1/sin(x)</font>. This ! ! traditional notation is really rather unfortunate and is not used ! ! by the CAS; instead, <font color="BLUE">sin<sup>-1</sup>(x)</font> ! ! should be entered as <tt><font color="GREEN">arcsin(x)</font></tt>. ! ! Similarly, <font color="BLUE">tan<sup>-1</sup>(x)</font> should be ! ! entered as <tt><font color="GREEN">arctan(x)</font></tt> and so on. ! ! <br /><br /></li> ! ! <li> ! ! Greek letters can be entered using their English names: for ! example, enter - <font face="SYMBOL" color="BLUE">a+b</font> - as <tt><font color="GREEN">alpha+beta</font></tt>, and - <font face="SYMBOL" color="BLUE">2p</font> - as <tt><font color="GREEN">2*pi</font></tt>. ! ! <br /><br /></li> ! ! <li> ! ! When you work directly with a CAS, the vector <font color="BLUE">(1,2,3)</font> must be entered as ! ! <tt><font color="GREEN">vector([1,2,3])</font></tt>. Many Stack ! ! questions are set up so that you can just enter <tt><font color="green">[1,2,3]</font></tt> instead. ! </li> ! ! <li> ! ! When you work directly with a CAS, the matrix ! <font color="BLUE"> - </font><center><table border="0" align="center"><tbody><tr><td> - <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> - </td><td align="left"><font face="symbol"> - é<br />ê<br /> - ë - </font></td><td align="center"> - </td><td nowrap="nowrap"><table border="0" align="left"><tbody><tr><td nowrap="nowrap" align="center"> - <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> - 1 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> - <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> - 2 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> - <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> - 3 </td></tr></tbody></table></td></tr><tr><td nowrap="nowrap" align="center" colspan="1"><table border="0"><tbody><tr><td nowrap="nowrap" align="center"> - 4 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> - <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> - 5 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> - <table><tbody><tr><td nowrap="nowrap" align="center" colspan="1">6</td></tr></tbody></table></td></tr></tbody></table> - </td><td nowrap="nowrap"></td><td align="left"><font face="symbol"> - ù<br />ú<br /> - û - </font></td><td align="center"> - </td></tr></tbody></table> - </td></tr></tbody></table></center> - - must be entered as - <tt><font color="GREEN">matrix([1,2,3],[4,5,6])</font></tt>. </li> ! </ul> --- 1,331 ---- <?php /** * * 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... * * @package documentation ! * @subpackage STACK */ ?> <a name="entry"><h2>How do I enter my answers?</h2></a> ! <p>In STACK you often need to enter an answer which is an ! <em>algebraic expression</em>. You should type in your ! answers using the same syntax as that used in the ! symbolic mathematics package <i>Maxima</i>. The syntax is broadly similar ! to the syntax used for mathematical formulae in graphical calculators, general programming ! languages such as Java, C and Basic and in spreadsheet programs, ! so you will find it useful to master it.</p> ! ! <p>STACK tries quite hard to give helpful information about any syntax errors. ! It might also forgive some errors you make. <ul> ! <li> <b>Numbers:</b> You should type in numbers without spaces, and use fractions rather ! than decimals where possible. For example, <font color="BLUE">1/4</font> should be entered as <tt><font color="GREEN">1/4</font></tt>, not as ! <tt><font color="GREEN">0.25</font></tt>. ! Also, ! <ul> ! <li> <font color="BLUE" face="symbol">p</font> is entered as either <tt><font color="GREEN">pi</font></tt> or <tt><font color="GREEN">%pi</font></tt>, </li> ! <li> <font color="BLUE">e</font>, the base of the natural logarithms, is entered as either <tt><font color="GREEN">e</font></tt> or <tt><font color="GREEN">%e</font></tt>, </li> ! <li> <font color="BLUE" face="symbol">Ö</font><font color="BLUE">-1</font> ! is entered as either <tt><font color="GREEN">i</font></tt> or <tt><font color="GREEN">%i</font></tt>, </li> ! <li> <font color="BLUE" face="symbol">Ö</font><font color="BLUE">-1</font> is also sometimes entered as <tt><font color="GREEN">j</font></tt> if you are an engineer. If in doubt ask your teacher. ! You could also use <tt><font color="GREEN">sqrt(-1)</font></tt>, or <tt><font color="GREEN">(-1)^(1/2)</font></tt>, being careful with the brackets.</tt> ! </li> ! </ul> ! (STACK modifies Maxima's normal input rules so that you don't get caught out with a variable <tt><font color="GREEN">i</font></tt> when you meant <tt><font color="GREEN">%i</font></tt>.) ! <br /><br /> </li> ! <li> <b>Multiplication:</b> Use a star for multiplication. Forgetting this ! is by far the most common source of syntax errors. For example, ! <ul> ! <li><font color="BLUE">3x</font> should be entered as <tt><font color="GREEN">3*x</font></tt>.</li> ! <li><font color="BLUE">x(ax+1)(x-1)</font> should be entered as <tt><font color="GREEN">x*(a*x+1)*(x-1)</font></tt>.</li> ! </ul> ! <br /><br /> ! </li> ! <li> <b>Powers:</b> Use a caret (^) for raising something to a power: for example, <font color="BLUE">x<sup>2</sup></font> should be entered as <tt><font color="GREEN">x^2</font></tt>. You can get a caret by holding down the SHIFT key and pressing the 6 key on most keyboards. Negative or fractional powers need brackets: ! <ul> ! <li><font color="BLUE">x<sup>-2</sup></font> should be entered as <tt><font color="GREEN">x^(-2)</font></tt>.</li> ! <li><font color="BLUE">x<sup>1/3</sup></font> should be entered as <tt><font color="GREEN">x^(1/3)</font></tt>.</li> ! </ul> ! <br /><br /> ! </li> ! <li> <b>Brackets:</b> Brackets are important to group terms in an expression. This is ! particularly the case in STACK since we use a <em>one dimensional input</em> rather than ! traditional written mathematics. When in doubt, use brackets, and also the <a href="#validate">validate</a> ! button to display your input in two dimensional form. For example, <font color="BLUE"> <center><table border="0" align="center"><tbody><tr><td> <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> </td><td nowrap="nowrap" align="center"> a + b<hr noshade="noshade"> c + d <br /></td><td nowrap="nowrap" align="center"> </td></tr></tbody></table> </td></tr></tbody></table></center> </font> should be entered as <tt><font color="GREEN">(a+b)/(c+d)</font></tt>. Note that in this context you should always use ordinary round bracket (like <tt><font color="GREEN">(a+b)</font></tt>), not square or curly ones (like <tt><font color="GREEN">[a+b]</font></tt> or <tt><font color="GREEN">{a+b}</font></tt>). <br /> If you type ! <tt><font color="GREEN">a+b/(c+d)</font></tt>, then STACK will think that you mean <font color="BLUE"> <center><table border="0" align="center"><tbody><tr><td> <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> a +</td><td nowrap="nowrap" align="center"> b<hr noshade="noshade"> c + d<br /></td><td nowrap="nowrap" align="center"> </td></tr></tbody></table> </td></tr></tbody></table></center> </font> ! If you type <tt><font color="GREEN">(a+b)/c+d</font></tt>, then STACK will think that you mean <font color="BLUE"> <center><table border="0" align="center"><tbody><tr><td> <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> </td><td nowrap="nowrap" align="center"> a + b<hr noshade="noshade"> c<br /></td><td nowrap="nowrap" align="center"> + d </td></tr></tbody></table> </td></tr></tbody></table></center> </font> ! If you type <tt><font color="GREEN">a+b/c+d</font></tt>, then STACK will think that you mean <font color="BLUE"> <center><table border="0" align="center"><tbody><tr><td> <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> a +</td><td nowrap="nowrap" align="center"> b<hr noshade="noshade"> c<br /></td><td nowrap="nowrap" align="center"> + d </td></tr></tbody></table> </td></tr></tbody></table></center> </font> <br /> Some other examples: <ul> <li> <font color="BLUE">2<sup>a+b</sup></font> should be entered as <tt><font color="GREEN">2^(a+b)</font></tt> </li> <li> <font color="BLUE">2 cos 3x</font> should be entered as <tt><font color="GREEN">2*cos(3*x)</font></tt> </li> <li> <font color="BLUE">e<sup>ax</sup>sin(bx)</font> should be entered as <tt><font color="GREEN">exp(a*x)*sin(b*x)</font></tt> </li> <li> <font color="BLUE">(a x<sup>2</sup> + b x + c)<sup>-1</sup></font> should be entered as <tt><font color="GREEN">(a*x^2 + b*x + c)^(-1)</font></tt>. </li> </ul> ! <br /><br /> ! </li> ! <li><b>Standard functions:</b> Functions, such as sin, cos, tan, exp, log and so on can be entered using their usual names. However, the argument must <font color="RED">always</font> be enclosed in brackets: <font color="BLUE">sin x</font> should be entered as <tt><font color="GREEN">sin(x)</font></tt>, <font color="BLUE">ln 3</font> should be entered as + <tt><font color="GREEN">ln(3)</font></tt> and so on. + <br /><br /> + </li> ! <li><b>Exponential function:</b> ! You should always write <tt><font color="GREEN">exp(x)</font></tt> for ! <font color="BLUE">e<sup>x</sup></font>. (Typing <tt><font color="GREEN">e^x</font></tt> ! should work in STACK, but gets you into bad habits when using a CAS later!) ! <br /><br /> ! </li> + <li><b>Logarithm:</b> You can use either <tt><font color="GREEN">log(x)</font></tt> or <tt><font color="GREEN">ln(x)</font></tt> for the natural logarithm of x (note that both of these start with a + lower case l, not a capital I). + <br /><br /> + </li> + + <li><b>Trigonometrical functions:</b> STACK uses radians for the angles <em>not</em> degrees! + <br />There are a number of important things to remember: + <ul> + <li> The function <font color="BLUE">1/sin(x)</font> must be + referred to as <tt><font color="GREEN">csc(x)</font></tt> rather + than <tt><font color="GREEN">cosec(x)</font></tt> (or you can just call + it <tt><font color="GREEN">1/sin(x)</font></tt> if you prefer).</li> + <li> + <font color="BLUE">sin<sup>2</sup>x</font> should be entered as + <tt><font color="GREEN">sin(x)^2</font></tt> (which is + what it really means, after all). Similarly for + <font color="BLUE">tan<sup>2</sup>(x)</font>, + <font color="BLUE">sinh<sup>2</sup>(x)</font> and so on. + </li> + <li> + Recall that <font color="BLUE">sin<sup>-1</sup>(x)</font> + traditionally means the number <font color="BLUE">t</font> such that + <font color="BLUE">sin(t) = x</font>, which is of + course completely different from the number + <font color="BLUE">sin(x)<sup>-1</sup> = 1/sin(x)</font>. This + traditional notation is really rather unfortunate and is not used + by the CAS; instead, <font color="BLUE">sin<sup>-1</sup>(x)</font> + should be entered as <tt><font color="GREEN">asin(x)</font></tt>. + Similarly, <font color="BLUE">tan<sup>-1</sup>(x)</font> should be + entered as <tt><font color="GREEN">atan(x)</font></tt> and so on. + </li> + </ul> + <br /><br /> + </li> + <li><b>Modulus function:</b> The modulus function, sometimes called the absolute value of <font color="BLUE">x</font>, is + written as <font color="BLUE">|x|</font> in traditional notation. + This must be entered as <tt><font color="GREEN">abs(x)</font></tt>. + </li> ! <li><b>Greek letters</b> can be entered using their English names. For example, enter <font face="SYMBOL" color="BLUE">a+b</font> as <tt><font color="GREEN">alpha+beta</font></tt>, and <font face="SYMBOL" color="BLUE">2p</font> as <tt><font color="GREEN">2*pi</font></tt>. ! <br /><br /> </li> ! ! <li><b>Sets:</b> To enter a set such as <font color="BLUE">{1,2,3}</font> ! in Maxima you are expected to use the function <tt><font color="GREEN">set(1,2,3)</font></tt>. ! STACK also allows you to use curly brackets and type <tt><font color="GREEN">{1,2,3}</font></tt>. ! <br /><br /> ! </li> ! ! <li><b>Lists:</b> can be entered using square brackets. ! For example, to enter the list <font color="BLUE">1,2,2,3</font> ! type <tt><font color="GREEN">[1,2,2,3]</font></tt>. ! <br /><br /> ! </li> ! ! <li><b>Matrices:</b> You may be given a grid of boxes to fill in. If not, the teacher may ! provide a hint as to the correct syntax. Otherwise you will need to use Maxima's notation ! for entering the matrix. <br /><br /> ! The matrix <font color="BLUE"> </font><center><table border="0" align="center"><tbody><tr><td> <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> </td><td align="left"><font face="symbol"> é<br />ê<br /> ë </font></td><td align="center"> </td><td nowrap="nowrap"><table border="0" align="left"><tbody><tr><td nowrap="nowrap" align="center"> <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> 1 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> 2 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> 3 </td></tr></tbody></table></td></tr><tr><td nowrap="nowrap" align="center" colspan="1"><table border="0"><tbody><tr><td nowrap="nowrap" align="center"> 4 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> 5 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> <table><tbody><tr><td nowrap="nowrap" align="center" colspan="1">6</td></tr></tbody></table></td></tr></tbody></table> </td><td nowrap="nowrap"></td><td align="left"><font face="symbol"> ù<br />ú<br /> û </font></td><td align="center"> </td></tr></tbody></table> </td></tr></tbody></table></center> must be entered as <tt><font color="GREEN">matrix([1,2,3],[4,5,6])</font></tt>. + <p>Each <em>row</em> is entered as a list, and these should be the same length. The + function <font color="GREEN">matrix</font></tt> is used to indicate this is a matrix + and not a "list of lists".</p> </li> ! <!-- <li>the CAS system is case-sensitive. Do not enter ! <tt><font color="GREEN">X</font></tt> instead of ! <tt><font color="GREEN">x</font></tt>, or ! <tt><font color="GREEN">a</font></tt> instead of ! <tt><font color="GREEN">A</font></tt>, or ! <tt><font color="GREEN">Log(Z)</font></tt> instead of ! <tt><font color="GREEN">log(z)</font></tt>. ! </li> --> </ul> + + + <p>Note that you do <b>not</b> need + a semicolon at the end, unlike when you are using a CAS directly.</p> + + You can also learn about the right syntax by + doing tests in practice mode and asking for + the solutions; as well as displaying the right answers in ordinary + mathematical notation, STACK will tell you how they could be + entered. (However, there are often several possible ways, and STACK + will not always suggest the easiest one.)</p> + + <a name="quiz"><h2>What do the various links do?</h2></a> + + <a name="validate"><h3>Validate</h3></a> + + <p>When you have entered your answer, you can always click on the + <b>Validate</b> link to see how STACK will interpret it. Your answer will + be checked for syntax errors and, assuming there are none, will be displayed + in a traditional two dimensional from. If there are any syntax errors or the CAS has + misunderstood what you meant then you can fix the problem before + asking STACK to mark your work. There are no marks and no cumulative penalties for + using validate, and you are advised strongly to validate before you mark. + </p> + + <p>Validate also stores your answers in the database. If you would like to return + to a quiz later, but do not want to mark your work yet, press validate to record your current answers. + You will be able to change them and mark your work later, up to any "due date" for a quiz + of course. At some point you must login and decide to mark your work, however. + If you are taking a long time to answer all the questions in a quiz then it is a good + idea to press validate every time you enter a new answer to safeguard against + a problem with a connection to the internet.</p> + + <h3>Mark or Mark this question</h3> + + <p>Pressing this link asks STACK to assess your answer, provide feedback and record a mark. + You will almost always be given more than one attempt, but this may alter the marks.</p> + + <h3>Focus</h3> + <p>This enables you to concentrate on just one question at a time.</p> + + <h3>Unfocus</h3> + + <p>This enables you to see all the questions on one page, which is useful when you start a + quiz or wish to print the page.</p> + + <h3>Solutions</h3> + + <p>Sometimes solutions will be available. If you opt to see the solutions you will not be then + able to change your answers!</p> + + <h3>New version</h3> + + <p>Sometimes you will be able to generate another similar quiz.</p> + |
From: Chris S. <san...@us...> - 2005-08-26 08:45:05
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10292/html Modified Files: admin-menu.txt help_popup.php Log Message: Index: admin-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/admin-menu.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** admin-menu.txt 25 Aug 2005 16:06:16 -0000 1.14 --- admin-menu.txt 26 Aug 2005 08:44:56 -0000 1.15 *************** *** 27,31 **** ..menu_Develop|documentation.php?action=about_develop ..menu_CAS_OL|chat.php ! ..menu_CAS_OLML|chat.php ..menu_Forum|http://mantis.york.ac.uk/moodle/course/view.php?id=21|_blank ..menu_Sourceforge|http://sourceforge.net/projects/stack|_blank --- 27,31 ---- ..menu_Develop|documentation.php?action=about_develop ..menu_CAS_OL|chat.php ! ..menu_CAS_OLML|chat_mathml.php ..menu_Forum|http://mantis.york.ac.uk/moodle/course/view.php?id=21|_blank ..menu_Sourceforge|http://sourceforge.net/projects/stack|_blank Index: help_popup.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/help_popup.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** help_popup.php 25 Aug 2005 16:06:16 -0000 1.4 --- help_popup.php 26 Aug 2005 08:44:56 -0000 1.5 *************** *** 1,224 **** <?php - /** - * Generates help files. - * This file is used in the help popup windows, for individual fields. - * - * This is used by both the student and teacher. - * - * @package documentation - * @subpackage Stack - */ - - ?> - <head> - <title>Stack help!</title> - <style type="text/css"> - @import url(stack.css); - </style> - <script type="text/javascript"> - window.focus(); - </script> - <?php - /** - * - */ - include('../stackstd.php'); - // HACK for now. - $options = stack_options_set(array()); - $filename = stack_lang_filename($options,'doc/en_doc.php'); - include($filename); - - include("{$stack_root}/html/htmlstyle.html"); - - // HACK! - $lang = 'en'; - $disp_opt = 'LaTeX'; - - ?> - </head> - <body> - - <?php - - $field = $_POST['field']; - $variable = $_POST['variable']; - - if (array_key_exists('field',$_GET)) { - $field = $_GET['field']; - } - - if (array_key_exists('variable',$_GET)) { - $variable = $_GET['variable']; - } - - //show_array($_POST); - //echo $variable; - - if ('student' == $field) { ! include('student_input.php'); ! } else if('fact' == $variable) { - - //<a href="javascript:HelpPopup('calc_product_rule','fact');">A fact!</a> - - // These allow the student to ask for help in the popup window. - $fn = $stack_root.'/lang/'.$lang.'/doc/student_factsformula.php'; - - include($fn); - - if (array_key_exists($field,$stackFact)) { - $name = $stackFact[$field]['name']; - $fact = $stackFact[$field]['fact']; - $strout = stack_latex_to_html($fact); - - echo "<h2><img src='$stack_web_url/pics/logo_sm.png' /> $name</h2><p>$strout</p>"; - } - - } else if('all' == $field) { - // Then we would like a lot of documentation. - // This needs to come after 'fact' - - $filename="{$stack_root}/lang/{$lang}/doc/$variable.php"; - include($filename); - - } else { - if ('stackQuestion' == $variable) { - $q_field = $stackQuestion[$field]; - $fn = 'stackQuestion_'.$field;} - else if ('stackOptions' == $variable) { - $q_field = $stackOptions[$field]; - $fn = 'stackOptions_'.$field; } - else if ('stackQuestionPotResp' == $variable) { - $q_field = $stackQuestionPotResp[$field]; - $fn = 'stackQuestion_PR_'.$field; } - else if ('stackQuiz' == $variable) { - $q_field = $stackQuiz[$field]; ! ! $fn = 'stackQuiz_'.$field; ! ! } ! - $fd = get_string($fn,'stack',''); - echo "<h3>$fd</h3>"; - echo $q_field['doc']; - echo "<p>"; - - echo "Name of field: <font color=orange><tt>$field</tt></font>. - Type of field: <font color=orange><tt>{$q_field['type']}</tt></font>."; - if (array_key_exists('required',$q_field)) { - echo " Required: <font color=orange><tt>{$q_field['required']}</tt></font>."; - } - } - - ?> - - </body></html> - --- 1,114 ---- <?php /** * Generates help files. * This file is used in the help popup windows, for individual fields. * * This is used by both the student and teacher. * * @package documentation * @subpackage Stack */ ?> <head> <title>Stack help!</title> <style type="text/css"> @import url(stack.css); </style> <script type="text/javascript"> window.focus(); </script> <?php /** * */ include('../stackstd.php'); // HACK for now. $options = stack_options_set(array()); $filename = stack_lang_filename($options,'doc/en_doc.php'); include($filename); include("{$stack_root}/html/htmlstyle.html"); // HACK! $lang = 'en'; $disp_opt = 'LaTeX'; ?> </head> <body> <?php $field = $_POST['field']; $variable = $_POST['variable']; if (array_key_exists('field',$_GET)) { $field = $_GET['field']; } if (array_key_exists('variable',$_GET)) { $variable = $_GET['variable']; } //show_array($_POST); //echo $variable; if ('student' == $field) { + $fn = $stack_root.'/lang/'.$lang.'/doc/student_input.php'; ! include($fn); } else if('fact' == $variable) { //<a href="javascript:HelpPopup('calc_product_rule','fact');">A fact!</a> // These allow the student to ask for help in the popup window. $fn = $stack_root.'/lang/'.$lang.'/doc/student_factsformula.php'; include($fn); if (array_key_exists($field,$stackFact)) { $name = $stackFact[$field]['name']; $fact = $stackFact[$field]['fact']; $strout = stack_latex_to_html($fact); echo "<h2><img src='$stack_web_url/pics/logo_sm.png' /> $name</h2><p>$strout</p>"; } } else if('all' == $field) { // Then we would like a lot of documentation. // This needs to come after 'fact' $filename="{$stack_root}/lang/{$lang}/doc/$variable.php"; include($filename); } else { if ('stackQuestion' == $variable) { $q_field = $stackQuestion[$field]; $fn = 'stackQuestion_'.$field;} else if ('stackOptions' == $variable) { $q_field = $stackOptions[$field]; $fn = 'stackOptions_'.$field; } else if ('stackQuestionPotResp' == $variable) { $q_field = $stackQuestionPotResp[$field]; $fn = 'stackQuestion_PR_'.$field; } else if ('stackQuiz' == $variable) { $q_field = $stackQuiz[$field]; ! $fn = 'stackQuiz_'.$field; ! } $fd = get_string($fn,'stack',''); echo "<h3>$fd</h3>"; echo $q_field['doc']; echo "<p>"; echo "Name of field: <font color=orange><tt>$field</tt></font>. Type of field: <font color=orange><tt>{$q_field['type']}</tt></font>."; if (array_key_exists('required',$q_field)) { echo " Required: <font color=orange><tt>{$q_field['required']}</tt></font>."; } } ?> </body></html> |
From: Chris S. <san...@us...> - 2005-08-26 08:45:04
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10292 Modified Files: chat_mathml.php question_bank.php Log Message: Index: chat_mathml.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/chat_mathml.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** chat_mathml.php 14 Jul 2005 17:59:11 -0000 1.6 --- chat_mathml.php 26 Aug 2005 08:44:56 -0000 1.7 *************** *** 38,41 **** --- 38,43 ---- $options = stack_options_set(NULL); + $options['Display'] = 'MathML'; + if (array_key_exists('Display',$_POST)) { $options['Display'] = $_POST['Display']; Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** question_bank.php 25 Aug 2005 16:06:16 -0000 1.9 --- question_bank.php 26 Aug 2005 08:44:56 -0000 1.10 *************** *** 69,72 **** --- 69,73 ---- // questionbank_screen Begin again. + $admin = FALSE; if ('admin' == $user['username']) { *************** *** 120,124 **** if ($get_question) { $question = stack_get_question($source); ! if (!$new_question) { stack_question_validate($question,$errors); } --- 121,125 ---- if ($get_question) { $question = stack_get_question($source); ! if (!$new_question) { stack_question_validate($question,$errors); } *************** *** 130,137 **** // bank. This is not needed by all actions, but it is harmless to set it. $question_bank_filter = stack_get_questionbank_filter(); ! if ('export_xml' == $action) { include_once("{$stack_root}/scripts/stackXML.php"); ! $name = stack_xml_write_question_new($question, "{$stack_root}/tmp/"); $questions_to_export = TRUE; } --- 131,139 ---- // bank. This is not needed by all actions, but it is harmless to set it. $question_bank_filter = stack_get_questionbank_filter(); ! if ('export_xml' == $action) { include_once("{$stack_root}/scripts/stackXML.php"); ! stack_question_validate($question,$errors); ! $name = stack_xml_write_question_file($question, "{$stack_root}/tmp/"); $questions_to_export = TRUE; } *************** *** 177,181 **** include('html/pagehead.php'); ! switch ($action) { case 'delete': --- 179,183 ---- include('html/pagehead.php'); ! switch ($action) { case 'delete': |
From: pkiddie <pk...@us...> - 2005-08-25 16:26:19
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24168/lang/en/doc Modified Files: en_doc.php Log Message: Resolve conflicts Index: en_doc.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/en_doc.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** en_doc.php 17 Aug 2005 11:35:35 -0000 1.7 --- en_doc.php 25 Aug 2005 16:25:41 -0000 1.8 *************** *** 1,415 **** ! <?php ! /** ! * Describes the data structure stackQuestion ! * ! * @package documentation ! * @subpackage Stack ! */ ! ! $stackQuestion['questionVarsRaw']['doc']="This field is a string which contains a list of assignments ! of the form <br /> [...1228 lines suppressed...] ! //CompetencyLevel ! ! $stackQuiz['quizCompetencyLevel']['doc']="Mathematical skills a resource requires/trains. User defined, list type"; ! ! ! ! //Time to allocate ! ! $stackQuiz['quizTimeAllocated']['doc']="An approximate time it takes to work with the resource. User defined, list type"; ! ! ! ! //Type of question ! ! $stackQuiz['quizExcerciseType']['doc']="Type of interactive elements used in the context of the excercise. User defined, list type"; ! ! ! ! ?> ! |
From: pkiddie <pk...@us...> - 2005-08-25 16:26:19
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24168/scripts Modified Files: stackXML.php Log Message: Resolve conflicts Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** stackXML.php 25 Aug 2005 16:06:17 -0000 1.14 --- stackXML.php 25 Aug 2005 16:25:41 -0000 1.15 *************** *** 1652,1655 **** --- 1652,1656 ---- foreach($stackOptions as $arrayKey=>$optionField) { + show_array($optionField); if (!empty($optionField['type'])) { |
From: pkiddie <pk...@us...> - 2005-08-25 16:26:18
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24168/scripts/install Modified Files: stackInstall.php stacktest.php Log Message: Resolve conflicts Index: stacktest.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stacktest.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stacktest.php 31 Jul 2005 07:42:28 -0000 1.6 --- stacktest.php 25 Aug 2005 16:25:41 -0000 1.7 *************** *** 1,132 **** ! <?php ! /** ! * Installs the various functions needed by STACK. ! * @package install ! * @subpackage Stack ! */ ! ! ?> ! <html> ! <head> ! </head> ! <hody> ! ! <h1>STACK setup - stage 2 of 2</h1> ! ! <p>This script does the following. ! <ol> ! <li>Creates files containing local settings to trasfer information from stackstd.php ! to Maxima</li> ! <li>Tests the basic connections of STACK with external components. ! It will help you establish your server is working.</li> ! </ol> ! ! <?php ! /** ! * Include the stack settings. ! */ ! require_once('../../stackstd.php'); ! ! /************************************************/ ! /* Create maximalocal.php and CASKeywords.php. */ ! /************************************************/ ! ! echo '<h2>1. Create maximalocal.php and CASKeywords.php.</h2>'; ! echo '<p>This attempts to write these files to the directory <tt>$stack_logfiles='.$stack_logfiles; ! echo ' </tt>If you have problems, please check the settings in stackstd.php, and the file permissions'; ! ! require("{$stack_root}/scripts/maxima/initmaxima.php"); ! echo "<p>Check here for errors.</p>"; ! ! /************************************************/ ! /* Test write to $maximalocal['IMAGE_DIR']. */ ! /************************************************/ ! ! echo "<h2>2. Test write to the directory for dynamically generated plots</h2>"; ! ! echo '<p>The directory <tt>$maximalocal[\'IMAGE_DIR\']='; ! echo $maximalocal['IMAGE_DIR']; ! echo " </tt>is needed by the webserver to store dynamically generated images. If this fails, either edit stackstd.php to point to a suitable directory, or create one with the necessary permissions."; ! ! $fname = "{$maximalocal['IMAGE_DIR']}test.txt"; ! ! if ('win' == $stack_os) { ! $sname = addslashes(str_replace( '/', '\\', $fname)); ! } ! ! $fh = fopen($fname,'w') or die('<font color="red">Cannot write a file to $maximalocal[IMAGE_DIR].</font>'); ! fwrite($fh,"Test write a success!"); ! fclose($fh); ! echo "<br /><font color='green'>Test write a success!</font>"; ! ! // /************************************************/ ! // /* Install sample questions in the DB */ ! // /************************************************/ ! // ! // echo "<h2>4. Install sample questions.</h2>"; ! // ! // if (!$add_sample_questions) { ! // echo "<p><font color='red'>You have opted not to install the sample questions!</font>"; ! // echo "<br .>If you wish to do so, edit stackInstall.php and re-run the script."; ! // die(); ! // } ! // ! ! /************************************************/ ! /* Test write to $maximalocal['IMAGE_DIR']. */ ! /************************************************/ ! ! echo "<h2>3. Test the LaTeX system</h2>"; ! ! $strin = "\[ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}. \]"; ! echo "<p>We will attempt to LaTeX the string <pre>$strin</pre>The result is:"; ! ! $strout = stack_latex_to_html($strin); ! ! if ('' != $strout) { ! echo $strout; ! echo "<br /><font color='green'>Output from the LaTeX to HTML conversion above.</font>"; ! } else { ! echo "<font color='red'>No output from the LaTeX to HTML conversion.</font>"; ! } ! ! /************************************************/ ! /* Test call to the CAS. */ ! /************************************************/ ! ! echo "<h2>4. Test the CAS system</h2>"; ! ! $strin = "The derivative of @ x^4/(1+x^4) @ is \[ @ diff(x^4/(1+x^4),x) @ \] ! We can plot them both @plot([x^4/(1+x^4),diff(x^4/(1+x^4),x)],[x,-3,3])@"; ! ! echo "<p>We will attempt to connect to the CAS to process the CAS-enabled text <pre>$strin</pre>The result is:"; ! ! $err =''; ! $locals = NULL; ! $options['Display']='LaTeX'; ! ! $strout = stack_castext_inst($strin,$locals,$options,$err); ! ! // $strout = stack_process_vars($locals,1321321,$options,$err); ! // $strout = stack_maxima_rawsend("diff(cos(x^2),x);\n quit();"); ! ! if ('' != $strout) { ! echo $strout; ! echo "<br /><font color='green'>Output from the CAS above.</font>"; ! } else { ! echo "<font color='red'>No output from the CAS conversion.</font>"; ! } ! ! ?> ! ! <h2>Next</h2> ! <p>If you have no errors, you are ready to go to your ! <?php ! /** ! * Echo URL. ! */ ! echo "<a href=\"$stack_web_url\">home page</a></p>"; ! ?> ! ! </body> ! </html> --- 1,322 ---- ! <?php ! ! /** ! ! * Installs the various functions needed by STACK. ! ! * @package install ! ! * @subpackage Stack ! ! */ ! ! ! ! ?> ! ! <html> ! ! <head> ! ! </head> ! ! <hody> ! ! ! ! <h1>STACK setup - stage 2 of 2</h1> ! ! ! ! <p>This script does the following. ! ! <ol> ! ! <li>Creates files containing local settings to trasfer information from stackstd.php ! ! to Maxima</li> ! ! <li>Tests the basic connections of STACK with external components. ! ! It will help you establish your server is working.</li> ! ! </ol> ! ! ! ! <?php ! ! /** ! ! * Include the stack settings. ! ! */ ! ! require_once('../../stackstd.php'); ! ! ! ! /************************************************/ ! ! /* Create maximalocal.php and CASKeywords.php. */ ! ! /************************************************/ ! ! ! ! echo '<h2>1. Create maximalocal.php and CASKeywords.php.</h2>'; ! ! echo '<p>This attempts to write these files to the directory <tt>$stack_logfiles='.$stack_logfiles; ! ! echo ' </tt>If you have problems, please check the settings in stackstd.php, and the file permissions'; ! ! ! ! require("{$stack_root}/scripts/maxima/initmaxima.php"); ! ! echo "<p>Check here for errors.</p>"; ! ! ! ! /************************************************/ ! ! /* Test write to $maximalocal['IMAGE_DIR']. */ ! ! /************************************************/ ! ! ! ! echo "<h2>2. Test write to the directory for dynamically generated plots</h2>"; ! ! ! ! echo '<p>The directory <tt>$maximalocal[\'IMAGE_DIR\']='; ! ! echo $maximalocal['IMAGE_DIR']; ! ! echo " </tt>is needed by the webserver to store dynamically generated images. If this fails, either edit stackstd.php to point to a suitable directory, or create one with the necessary permissions."; ! ! ! ! $fname = "{$maximalocal['IMAGE_DIR']}test.txt"; ! ! ! ! if ('win' == $stack_os) { ! ! $sname = addslashes(str_replace( '/', '\\', $fname)); ! ! } ! ! ! ! $fh = fopen($fname,'w') or die('<font color="red">Cannot write a file to $maximalocal[IMAGE_DIR].</font>'); ! ! fwrite($fh,"Test write a success!"); ! ! fclose($fh); ! ! echo "<br /><font color='green'>Test write a success!</font>"; ! ! ! ! // /************************************************/ ! ! // /* Install sample questions in the DB */ ! ! // /************************************************/ ! ! // ! ! // echo "<h2>4. Install sample questions.</h2>"; ! ! // ! ! // if (!$add_sample_questions) { ! ! // echo "<p><font color='red'>You have opted not to install the sample questions!</font>"; ! ! // echo "<br .>If you wish to do so, edit stackInstall.php and re-run the script."; ! ! // die(); ! ! // } ! ! // ! ! ! ! /************************************************/ ! ! /* Test write to $maximalocal['IMAGE_DIR']. */ ! ! /************************************************/ ! ! ! ! echo "<h2>3. Test the LaTeX system</h2>"; ! ! ! ! $strin = "\[ \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}. \]"; ! ! echo "<p>We will attempt to LaTeX the string <pre>$strin</pre>The result is:"; ! ! ! ! $strout = stack_latex_to_html($strin); ! ! ! ! if ('' != $strout) { ! ! echo $strout; ! ! echo "<br /><font color='green'>Output from the LaTeX to HTML conversion above.</font>"; ! ! } else { ! ! echo "<font color='red'>No output from the LaTeX to HTML conversion.</font>"; ! ! } ! ! ! ! /************************************************/ ! ! /* Test call to the CAS. */ ! ! /************************************************/ ! ! ! ! echo "<h2>4. Test the CAS system</h2>"; ! ! ! ! $strin = "The derivative of @ x^4/(1+x^4) @ is \[ @ diff(x^4/(1+x^4),x) @ \] ! ! We can plot them both @plot([x^4/(1+x^4),diff(x^4/(1+x^4),x)],[x,-3,3])@"; ! ! ! ! echo "<p>We will attempt to connect to the CAS to process the CAS-enabled text <pre>$strin</pre>The result is:"; ! ! ! ! $err =''; ! ! $locals = NULL; ! ! $options['Display']='LaTeX'; ! ! ! ! $strout = stack_castext_inst($strin,$locals,$options,$err); ! ! ! ! // $strout = stack_process_vars($locals,1321321,$options,$err); ! ! // $strout = stack_maxima_rawsend("diff(cos(x^2),x);\n quit();"); ! ! ! ! if ('' != $strout) { ! ! echo $strout; ! ! echo "<br /><font color='green'>Output from the CAS above.</font>"; ! ! } else { ! ! echo "<font color='red'>No output from the CAS conversion.</font>"; ! ! } ! ! ! ! /***********************************************/ ! ! /* Creation of schemas */ ! ! /***********************************************/ ! ! ! ! require("{$stack_root}/scripts/stackXML.php"); ! ! $strout=""; ! ! ! ! echo "<h2>5. Create all XML schemas required by STACK</h2>"; ! ! ! ! echo "<p>We will attempt to create XML schemas for questions, quizzes, and their respective metadata. The results are:"; ! ! echo "<br />5.1 Creation of question schema"; ! ! ! ! $success = stack_xml_create_question_schema(schemaBaseDir); ! ! ! ! if ($success) { ! ! echo "<br /><font color='green'>Question metadata written out successfully</font>"; ! ! } else { ! ! echo "<br /><font color='red'>Question metadata not written out - check you have permissions to the schemas directory</font>"; ! ! } ! ! ! ! echo "<br />5.2 Creation of quiz schema"; ! ! ! ! $strout = stack_xml_create_quiz_schema(schemaBaseDir); ! ! ! ! if ($success) { ! ! echo "<br /><font color='green'>Quiz metadata written out successfully</font>"; ! ! } else { ! ! echo "<br /><font color='red'>Quiz metadata not written out - check you have permissions to the schemas directory</font>"; ! ! } ! ! ?> ! ! ! ! <h2>Next</h2> ! ! <p>If you have no errors, you are ready to go to your ! ! <?php ! ! /** ! ! * Echo URL. ! ! */ ! ! echo "<a href=\"$stack_web_url\">home page</a></p>"; ! ! ?> ! ! ! ! </body> ! ! </html> ! Index: stackInstall.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackInstall.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** stackInstall.php 31 Jul 2005 07:42:28 -0000 1.14 --- stackInstall.php 25 Aug 2005 16:25:41 -0000 1.15 *************** *** 1,321 **** ! <?php ! /** ! * Installs the various functions needed by STACK. ! * @package install ! * @subpackage Stack ! */ ! ! // To install, add comments to this line. ! //die(); ! ! /** ! * Include the stack settings. ! */ ! require_once('../../stackstd.php'); ! ! /* Add the MySQL username and password here. Use NULL for the password to ! * be prompted to enter it (works only when run in CLI mode) ! */ ! ! $stack_mysqlroot['user'] = 'root'; ! $stack_mysqlroot['host'] = $stack_mysql['host']; ! ! if (array_key_exists('pswd',$_POST)) { ! ! $stack_mysqlroot['pswd'] = $_POST['pswd']; ! ! /* If you wish to add the sample questions to stack's database change this line. */ ! // Not yet implemented. ! // $add_sample_questions = FALSE; ! ! // The SQL privileges which stack requires on its database ! define('STACK_SQL_PRIVILEGES', 'ALTER,CREATE,CREATE TEMPORARY TABLES,DELETE,DROP,INDEX,INSERT,LOCK TABLES,SELECT,UPDATE'); ! ! /** ! * Used to connect to the MySQL stack database and execute a query. ! * ! * ! * @param string $qu The query to execute ! * @param string $who The MySQL user name ! * @param array &$err Array of errors passed by reference ! * @return void ! */ ! function stack_mysqlcmd($qu,$who,&$err) ! { ! global $stack_mysql; ! global $stack_mysqlroot; ! ! if ('root' == $who) { ! $host = $stack_mysqlroot['host']; ! $user = $stack_mysqlroot['user']; ! $password = $stack_mysqlroot['pswd']; ! $db = ''; ! } else { ! $host = $stack_mysql['host']; ! $user = $stack_mysql['user']; ! $password = $stack_mysql['pswd']; ! $db = $stack_mysql['stackdb']; ! } ! ! mysql_connect($host,$user,$password); ! ! // Root only connects to drop and create users! ! if ('root'!=$who) { ! mysql_select_db($db); ! } ! ! $result = mysql_query($qu); ! ! echo "User :<b>$who</b><br> ! Database Selected: <b>{$db}</b><br> ! Query: <b>$qu</b>\n<p><b>Results</b></p>\n\n"; ! ! if($result == 0) ! { ! echo "<b>Error ".mysql_errno().": ".mysql_error()."</b>"; ! $err=TRUE; ! } ! elseif (@mysql_num_rows($result) == 0) ! { ! echo("<b>Query completed. No results returned. </b><br />"); ! } ! else ! { ! echo "<p><table border=1><thead><tr>\n"; ! for($i = 0;$i < mysql_num_fields($result);$i++) ! { ! echo "<th>".mysql_field_name($result,$i). "</th>"; ! } ! echo " </tr></thead><tbody>\n"; ! for ($i = 0; $i < mysql_num_rows($result); $i++) ! { ! echo "<tr>"; ! $row = mysql_fetch_row($result); ! for($j = 0;$j<mysql_num_fields($result);$j++) ! { ! echo("<td>" . $row[$j] . "</td>"); ! } ! echo "</tr>\n"; ! } ! echo "</tbody></table></p>\n"; ! } //end else ! echo "<hr />\n\n\n"; ! } ! // ** MYSQL install! ! ! echo "<h1>STACK setup - stage 1 of 2</h1>"; ! echo "<p>This script sets up the database. When this is done, proceed to stage two of the set-up process.</p>"; ! echo "<h2>Set up the databases</h2>"; ! ! // (1) Create a database 'stack' ! //stack_mysqlcmd("DROP DATABASE {$stack_mysql['stackdb']}",'root',$err); ! stack_mysqlcmd("CREATE DATABASE IF NOT EXISTS {$stack_mysql['stackdb']}",'root',$err); ! ! // (2) Grant privileges to the user. ! ! $qu = "GRANT " . STACK_SQL_PRIVILEGES . " ON {$stack_mysql['stackdb']}.* ! TO '{$stack_mysql['user']}'@'localhost' ! IDENTIFIED BY '{$stack_mysql['pswd']}'"; ! stack_mysqlcmd($qu,'root',$err); ! ! $qu = "GRANT " . STACK_SQL_PRIVILEGES . " ON {$stack_mysql['stackdb']}.* ! TO '{$stack_mysql['user']}'@'{$stack_mysql['host']}' ! IDENTIFIED BY '{$stack_mysql['pswd']}'"; ! stack_mysqlcmd($qu,'root',$err); ! ! $qu = "FLUSH PRIVILEGES"; ! stack_mysqlcmd($qu,'root',$err); ! ! // (3) Create a question table ! // ! // Create a MySQL query from $stackQuestion. ! $qu = "CREATE TABLE IF NOT EXISTS stackQuestion ("; ! ! foreach ($stackQuestion as $key => $val) { ! if ('meta' == $val['type']) { ! $qu.="$key {$val['mysql']},"; ! } ! } ! ! $qu = substr($qu,0,strlen($qu)-1); ! $qu .= " );"; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! // (4) Create the attempts table ! // ! ! // Create table ! $qu = "CREATE TABLE IF NOT EXISTS questionAttempts ("; ! // Add primary key ! $qu .= "attemptID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, "; ! // Add questionID number ! $qu .= "questionID INT, "; ! // Add which seed is used ! $qu .= "questionSeedInst INT, "; ! // Who the attempt belongs to ! $qu .= "userID INT, "; ! // Add questionNote (to indicate the instance) ! $qu .= "questionNote TEXT, "; ! ! ! // Add other fields ! foreach ($stackQuestionAttempt as $key => $val) { ! if ('Ans' != $key) { ! $qu.="$key {$val['mysql']}, "; ! } ! } ! ! // The Ans variable is treated slightly differently. ! ! $qu .= "AnsValue VARCHAR(255)," ; ! $qu .= "AnsDisplay TEXT, "; ! $qu .= "AnsError TEXT, "; ! ! $qu .= " INDEX(attemptID) );"; ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! // (5) Create the users table ! // ! ! // Create table ! $qu = " CREATE TABLE IF NOT EXISTS `stackUser` ( ! `id` int(10) unsigned NOT NULL auto_increment, ! `username` varchar(100) NOT NULL default '', ! `password` varchar(32) NOT NULL default '', ! `idnumber` varchar(64) default NULL, ! `firstname` varchar(20) NOT NULL default '', ! `lastname` varchar(20) NOT NULL default '', ! `email` varchar(100) NOT NULL default '', ! `phone1` varchar(20) default NULL, ! `institution` varchar(40) default NULL, ! `department` varchar(30) default NULL, ! `address` varchar(70) default NULL, ! `options` text default NULL, ! `firstaccess` int(10) unsigned NOT NULL default '0', ! `lastaccess` int(10) unsigned NOT NULL default '0', ! PRIMARY KEY (`id`), ! UNIQUE KEY `id` (`id`), ! UNIQUE KEY `username` (`username`), ! KEY `user_firstname` (`firstname`), ! KEY `user_lastname` (`lastname`), ! KEY `user_lastaccess` (`lastaccess`), ! KEY `user_email` (`email`), ! KEY `idnumber` (`idnumber`) ! );"; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! // (6) Create the table to link questions to quizzes ! ! $qu = "CREATE TABLE IF NOT EXISTS quiz_question ( ! ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, ! quizID INT, ! questionID INT, ! qord INT ); "; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! // (7) Create the quiz table ! ! // Create field list ! $qu = ''; ! foreach ($stackQuiz as $key => $val) { ! $qu .= ", $key {$val['mysql']}"; ! } ! $qu = substr($qu,1,strlen($qu)-1); ! $qu = "CREATE TABLE IF NOT EXISTS stackQuiz ( {$qu} );"; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! // (8) Create the quiz attmpet table ! ! $qu = "CREATE TABLE IF NOT EXISTS quizAttempts ( ! attemptID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, ! quizID int(11) default NULL, ! userID int(11) default NULL, ! Seed int(11) default NULL, ! MaxMark float default NULL, ! Mark float default NULL, ! SolRequest bool );"; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! /************************************************/ ! /* (500) RQP tables have been created. */ ! /************************************************/ ! ! // (501) RQPcacheItem ! // ! // Caches item sources. ! $qu = "CREATE TABLE IF NOT EXISTS RQPcacheItem ("; ! // Add primary key ! $qu .= "cacheID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, "; ! $qu .= "lastEdited TIMESTAMP, "; ! ! $tabfields = array('questionGUID','questionBody'); ! foreach ($tabfields as $field) { ! $val = $stackQuestion[$field]; ! $qu .= "$field {$val['mysql']},"; ! } ! ! $qu = substr($qu,0,strlen($qu)-1); ! $qu .= " );"; ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! // (502) RQPcacheItemInst ! // ! // Caches item sources. ! $qu = "CREATE TABLE IF NOT EXISTS RQPcacheItemInst ("; ! // Add primary key ! $qu .= "cacheID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, "; ! // Add the seed info ! $qu .= "lastEdited TIMESTAMP, questionSeedInst INT, "; ! $qu .= "questionGUID CHAR(22), "; ! $tabfields = array('questionBody'); ! foreach ($tabfields as $field) { ! $val = $stackQuestion[$field]; ! $qu.="$field {$val['mysql']},"; ! } ! ! $qu = substr($qu,0,strlen($qu)-1); ! $qu .= " );"; ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! /************************************************/ ! /* (\infty) Check the tables have been created. */ ! /************************************************/ ! stack_mysqlcmd('SHOW TABLES',$stack_mysql['user'],$err); ! ! if ('' != $err) { ! echo "\n\n\n<br/ ><font color='red'>***** WARNING! ******</font><br />\n\n ERRORS OCCURRED DURING EXECUTION.<br />\n Please read the above carefully."; ! echo "<p>Please type in the MYSQL root password:</p>"; ! echo "<form name=\"install\" action=\"{$stack_web_url}scripts/install/stackInstall.php\" method=\"POST\"> ! <input type=\"password\" name=\"pswd\" value=\"\" /> ! <br /><input type=\"submit\" name=\"Submit\" value=\"Submit\" /> ! </form>"; ! // die(); ! } ! else { ! echo "\n\n Success with database setup!</br />\n\n"; ! echo "Please proceed to the <a href='stacktest.php'>next stage</a></br />\n\n"; ! } ! ! } else { ! ! $user = $stack_mysqlroot['user']; ! $host = $stack_mysqlroot['host']; ! ! echo "<h1>STACK setup - stage 1 of 2</h1>"; ! echo "<p>Please type in the MYSQL root password for <tt>$user@$host</tt>. </p>"; ! echo "<form name=\"install\" action=\"{$stack_web_url}scripts/install/stackInstall.php\" method=\"POST\"> ! <input type=\"password\" name=\"pswd\" value=\"\" /> ! <br /><input type=\"submit\" name=\"Submit\" value=\"Submit\" /> ! </form>"; ! ! } ! ! ?> --- 1,642 ---- ! <?php ! ! /** ! ! * Installs the various functions needed by STACK. ! ! * @package install ! ! * @subpackage Stack ! ! */ ! ! ! ! // To install, add comments to this line. ! ! //die(); ! ! ! ! /** ! ! * Include the stack settings. ! ! */ ! ! require('../../stackstd.php'); ! ! ! ! /* Add the MySQL username and password here. Use NULL for the password to ! ! * be prompted to enter it (works only when run in CLI mode) ! ! */ ! ! ! ! $stack_mysqlroot['user'] = 'root'; ! ! $stack_mysqlroot['host'] = $stack_mysql['host']; ! ! ! ! if (array_key_exists('pswd',$_POST)) { ! ! ! ! $stack_mysqlroot['pswd'] = $_POST['pswd']; ! ! ! ! /* If you wish to add the sample questions to stack's database change this line. */ ! ! // Not yet implemented. ! ! // $add_sample_questions = FALSE; ! ! ! ! // The SQL privileges which stack requires on its database ! ! define('STACK_SQL_PRIVILEGES', 'ALTER,CREATE,CREATE TEMPORARY TABLES,DELETE,DROP,INDEX,INSERT,LOCK TABLES,SELECT,UPDATE'); ! ! ! ! /** ! ! * Used to connect to the MySQL stack database and execute a query. ! ! * ! ! * ! ! * @param string $qu The query to execute ! ! * @param string $who The MySQL user name ! ! * @param array &$err Array of errors passed by reference ! ! * @return void ! ! */ ! ! function stack_mysqlcmd($qu,$who,&$err) ! ! { ! ! global $stack_mysql; ! ! global $stack_mysqlroot; ! ! ! ! if ('root' == $who) { ! ! $host = $stack_mysqlroot['host']; ! ! $user = $stack_mysqlroot['user']; ! ! $password = $stack_mysqlroot['pswd']; ! ! $db = ''; ! ! } else { ! ! $host = $stack_mysql['host']; ! ! $user = $stack_mysql['user']; ! ! $password = $stack_mysql['pswd']; ! ! $db = $stack_mysql['stackdb']; ! ! } ! ! ! ! mysql_connect($host,$user,$password); ! ! ! ! // Root only connects to drop and create users! ! ! if ('root'!=$who) { ! ! mysql_select_db($db); ! ! } ! ! ! ! $result = mysql_query($qu); ! ! ! ! echo "User :<b>$who</b><br> ! ! Database Selected: <b>{$db}</b><br> ! ! Query: <b>$qu</b>\n<p><b>Results</b></p>\n\n"; ! ! ! ! if($result == 0) ! ! { ! ! echo "<b>Error ".mysql_errno().": ".mysql_error()."</b>"; ! ! $err=TRUE; ! ! } ! ! elseif (@mysql_num_rows($result) == 0) ! ! { ! ! echo("<b>Query completed. No results returned. </b><br />"); ! ! } ! ! else ! ! { ! ! echo "<p><table border=1><thead><tr>\n"; ! ! for($i = 0;$i < mysql_num_fields($result);$i++) ! ! { ! ! echo "<th>".mysql_field_name($result,$i). "</th>"; ! ! } ! ! echo " </tr></thead><tbody>\n"; ! ! for ($i = 0; $i < mysql_num_rows($result); $i++) ! ! { ! ! echo "<tr>"; ! ! $row = mysql_fetch_row($result); ! ! for($j = 0;$j<mysql_num_fields($result);$j++) ! ! { ! ! echo("<td>" . $row[$j] . "</td>"); ! ! } ! ! echo "</tr>\n"; ! ! } ! ! echo "</tbody></table></p>\n"; ! ! } //end else ! ! echo "<hr />\n\n\n"; ! ! } ! ! // ** MYSQL install! ! ! ! ! echo "<h1>STACK setup - stage 1 of 2</h1>"; ! ! echo "<p>This script sets up the database. When this is done, proceed to stage two of the set-up process.</p>"; ! ! echo "<h2>Set up the databases</h2>"; ! ! ! ! // (1) Create a database 'stack' ! ! //stack_mysqlcmd("DROP DATABASE {$stack_mysql['stackdb']}",'root',$err); ! ! stack_mysqlcmd("CREATE DATABASE IF NOT EXISTS {$stack_mysql['stackdb']}",'root',$err); ! ! ! ! // (2) Grant privileges to the user. ! ! ! ! $qu = "GRANT " . STACK_SQL_PRIVILEGES . " ON {$stack_mysql['stackdb']}.* ! ! TO '{$stack_mysql['user']}'@'localhost' ! ! IDENTIFIED BY '{$stack_mysql['pswd']}'"; ! ! stack_mysqlcmd($qu,'root',$err); ! ! ! ! $qu = "GRANT " . STACK_SQL_PRIVILEGES . " ON {$stack_mysql['stackdb']}.* ! ! TO '{$stack_mysql['user']}'@'{$stack_mysql['host']}' ! ! IDENTIFIED BY '{$stack_mysql['pswd']}'"; ! ! stack_mysqlcmd($qu,'root',$err); ! ! ! ! $qu = "FLUSH PRIVILEGES"; ! ! stack_mysqlcmd($qu,'root',$err); ! ! ! ! // (3) Create a question table ! ! // ! ! // Create a MySQL query from $stackQuestion. ! ! $qu = "CREATE TABLE IF NOT EXISTS stackQuestion ("; ! ! ! ! foreach ($stackQuestion as $key => $val) { ! ! if ('meta' == $val['type']) { ! ! $qu.="$key {$val['mysql']},"; ! ! } ! ! } ! ! ! ! $qu = substr($qu,0,strlen($qu)-1); ! ! $qu .= " );"; ! ! ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! ! ! // (4) Create the attempts table ! ! // ! ! ! ! // Create table ! ! $qu = "CREATE TABLE IF NOT EXISTS questionAttempts ("; ! ! // Add primary key ! ! $qu .= "attemptID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, "; ! ! // Add questionID number ! ! $qu .= "questionID INT, "; ! ! // Add which seed is used ! ! $qu .= "questionSeedInst INT, "; ! ! // Who the attempt belongs to ! ! $qu .= "userID INT, "; ! ! // Add questionNote (to indicate the instance) ! ! $qu .= "questionNote TEXT, "; ! ! ! ! ! ! // Add other fields ! ! foreach ($stackQuestionAttempt as $key => $val) { ! ! if ('Ans' != $key) { ! ! $qu.="$key {$val['mysql']}, "; ! ! } ! ! } ! ! ! ! // The Ans variable is treated slightly differently. ! ! ! ! $qu .= "AnsValue VARCHAR(255)," ; ! ! $qu .= "AnsDisplay TEXT, "; ! ! $qu .= "AnsError TEXT, "; ! ! ! ! $qu .= " INDEX(attemptID) );"; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! ! ! // (5) Create the users table ! ! // ! ! ! ! // Create table ! ! $qu = " CREATE TABLE IF NOT EXISTS `stackUser` ( ! ! `id` int(10) unsigned NOT NULL auto_increment, ! ! `username` varchar(100) NOT NULL default '', ! ! `password` varchar(32) NOT NULL default '', ! ! `idnumber` varchar(64) default NULL, ! ! `firstname` varchar(20) NOT NULL default '', ! ! `lastname` varchar(20) NOT NULL default '', ! ! `email` varchar(100) NOT NULL default '', ! ! `phone1` varchar(20) default NULL, ! ! `institution` varchar(40) default NULL, ! ! `department` varchar(30) default NULL, ! ! `address` varchar(70) default NULL, ! ! `options` text default NULL, ! ! `firstaccess` int(10) unsigned NOT NULL default '0', ! ! `lastaccess` int(10) unsigned NOT NULL default '0', ! ! PRIMARY KEY (`id`), ! ! UNIQUE KEY `id` (`id`), ! ! UNIQUE KEY `username` (`username`), ! ! KEY `user_firstname` (`firstname`), ! ! KEY `user_lastname` (`lastname`), ! ! KEY `user_lastaccess` (`lastaccess`), ! ! KEY `user_email` (`email`), ! ! KEY `idnumber` (`idnumber`) ! ! );"; ! ! ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! // (6) Create the table to link questions to quizzes ! ! ! ! $qu = "CREATE TABLE IF NOT EXISTS quiz_question ( ! ! ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, ! ! quizID INT, ! ! questionID INT, ! ! qord INT ); "; ! ! ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! // (7) Create the quiz table ! ! ! ! // Create field list ! ! $qu = ''; ! ! foreach ($stackQuiz as $key => $val) { ! ! $qu .= ", $key {$val['mysql']}"; ! ! } ! ! $qu = substr($qu,1,strlen($qu)-1); ! ! $qu = "CREATE TABLE IF NOT EXISTS stackQuiz ( {$qu} );"; ! ! ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! // (8) Create the quiz attmpet table ! ! ! ! $qu = "CREATE TABLE IF NOT EXISTS quizAttempts ( ! ! attemptID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, ! ! quizID int(11) default NULL, ! ! userID int(11) default NULL, ! ! Seed int(11) default NULL, ! ! MaxMark float default NULL, ! ! Mark float default NULL, ! ! SolRequest bool );"; ! ! ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! /************************************************/ ! ! /* (500) RQP tables have been created. */ ! ! /************************************************/ ! ! ! ! // (501) RQPcacheItem ! ! // ! ! // Caches item sources. ! ! $qu = "CREATE TABLE IF NOT EXISTS RQPcacheItem ("; ! ! // Add primary key ! ! $qu .= "cacheID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, "; ! ! $qu .= "lastEdited TIMESTAMP, "; ! ! ! ! $tabfields = array('questionGUID','questionBody'); ! ! foreach ($tabfields as $field) { ! ! $val = $stackQuestion[$field]; ! ! $qu .= "$field {$val['mysql']},"; ! ! } ! ! ! ! $qu = substr($qu,0,strlen($qu)-1); ! ! $qu .= " );"; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! ! ! // (502) RQPcacheItemInst ! ! // ! ! // Caches item sources. ! ! $qu = "CREATE TABLE IF NOT EXISTS RQPcacheItemInst ("; ! ! // Add primary key ! ! $qu .= "cacheID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, "; ! ! // Add the seed info ! ! $qu .= "lastEdited TIMESTAMP, questionSeedInst INT, "; ! ! $qu .= "questionGUID CHAR(22), "; ! ! $tabfields = array('questionBody'); ! ! foreach ($tabfields as $field) { ! ! $val = $stackQuestion[$field]; ! ! $qu.="$field {$val['mysql']},"; ! ! } ! ! ! ! $qu = substr($qu,0,strlen($qu)-1); ! ! $qu .= " );"; ! ! stack_mysqlcmd($qu,$stack_mysql['user'],$err); ! ! ! ! /************************************************/ ! ! /* (\infty) Check the tables have been created. */ ! ! /************************************************/ ! ! stack_mysqlcmd('SHOW TABLES',$stack_mysql['user'],$err); ! ! ! ! if ('' != $err) { ! ! echo "\n\n\n<br/ ><font color='red'>***** WARNING! ******</font><br />\n\n ERRORS OCCURRED DURING EXECUTION.<br />\n Please read the above carefully."; ! ! echo "<p>Please type in the MYSQL root password:</p>"; ! ! echo "<form name=\"install\" action=\"{$stack_web_url}scripts/install/stackInstall.php\" method=\"POST\"> ! ! <input type=\"password\" name=\"pswd\" value=\"\" /> ! ! <br /><input type=\"submit\" name=\"Submit\" value=\"Submit\" /> ! ! </form>"; ! ! // die(); ! ! } ! ! else { ! ! echo "\n\n Success with database setup!</br />\n\n"; ! ! echo "Please proceed to the <a href='stacktest.php'>next stage</a></br />\n\n"; ! ! } ! ! ! ! } else { ! ! ! ! $user = $stack_mysqlroot['user']; ! ! $host = $stack_mysqlroot['host']; ! ! ! ! echo "<h1>STACK setup - stage 1 of 2</h1>"; ! ! echo "<p>Please type in the MYSQL root password for <tt>$user@$host</tt>. </p>"; ! ! echo "<form name=\"install\" action=\"{$stack_web_url}scripts/install/stackInstall.php\" method=\"POST\"> ! ! <input type=\"password\" name=\"pswd\" value=\"\" /> ! ! <br /><input type=\"submit\" name=\"Submit\" value=\"Submit\" /> ! ! </form>"; ! ! ! ! } ! ! ! ! ?> ! |
From: pkiddie <pk...@us...> - 2005-08-25 16:15:22
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21777/scripts Modified Files: stackDatabase.php stackQuestion.php stackWin.php Log Message: Resolved conflicts Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** stackDatabase.php 31 Jul 2005 07:42:28 -0000 1.35 --- stackDatabase.php 25 Aug 2005 16:15:07 -0000 1.36 *************** *** 1,1689 **** ! <?php ! ! /** ! * Functions to access the MySQL Database. This should allow other ! * databases to be used without too much pain. ! * ! * @package data ! * @subpackage Stack ! */ ! [...3347 lines suppressed...] ! 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; ! } ! ! ?> Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** stackWin.php 31 Jul 2005 07:42:28 -0000 1.8 --- stackWin.php 25 Aug 2005 16:15:07 -0000 1.9 *************** *** 81,84 **** --- 81,85 ---- global $stack_root,$stack_logfiles,$stack_cas; + $debug = FALSE; $ret = FALSE; *************** *** 88,94 **** 2 => array('file', $stack_logfiles."cas_errors.txt", 'a')); ! $TeXProcess = proc_open($stack_cas['command'],$descriptors, $pipes); - if(is_resource($TeXProcess)) { if (!fwrite($pipes[0], $stack_cas['initCommand'])) { echo "<br />Could not write to the CAS process!<br/ >\n"; --- 89,96 ---- 2 => array('file', $stack_logfiles."cas_errors.txt", 'a')); ! $CASProcess = proc_open($stack_cas['command'],$descriptors, $pipes); ! ! if(is_resource($CASProcess)) { if (!fwrite($pipes[0], $stack_cas['initCommand'])) { echo "<br />Could not write to the CAS process!<br/ >\n"; *************** *** 104,108 **** // read output from stdout $start_time = stack_microtime_float(); ! while (!feof($pipes[1])) { $out = fgets($pipes[1], 1024); if ('' == $out) { --- 106,112 ---- // read output from stdout $start_time = stack_microtime_float(); ! $continue = TRUE; ! if ($debug) { echo '<pre>'; }; ! while (!feof($pipes[1]) and $continue) { $out = fgets($pipes[1], 1024); if ('' == $out) { *************** *** 111,119 **** } $ret .= $out; ! //echo $out; $now = stack_microtime_float(); // if (($now-$start_time) > 0.3) { // // CTRL+C should be ASCII 3. // //fwrite($pipes[0], chr(3)); // fwrite($pipes[0], chr(27)."[13~"); // fflush($pipes[0]); --- 115,125 ---- } $ret .= $out; ! if ($debug) { echo $out; } $now = stack_microtime_float(); // if (($now-$start_time) > 0.3) { // // CTRL+C should be ASCII 3. // //fwrite($pipes[0], chr(3)); + // $continue = FALSE; + // echo "STOP!"; // fwrite($pipes[0], chr(27)."[13~"); // fflush($pipes[0]); *************** *** 122,128 **** fclose($pipes[0]); fclose($pipes[1]); ! //$time_taken = $now-$start_time; ! //echo "Start: $start_time<br >End: $now<br >Taken = $time_taken"; ! } else { --- 128,136 ---- fclose($pipes[0]); fclose($pipes[1]); ! $time_taken = $now-$start_time; ! if ($debug) { ! echo "</pre>"; ! echo "Start: $start_time<br >End: $now<br >Taken = $time_taken"; ! }; } else { *************** *** 138,336 **** } - - /** - * Instantiate a list of local variables through the CAS. - * - * This function performs the following tasks: - * 1. Checks each local for a PHP error - * 2. If no errors, sends them to the CAS - * 3. Checks for CAS errors - * - * @param array $locals List of local variables to instantiate. - * @param int $seed The random number seed to use - * @param array $options STACK options - * @param array &$err Repository for errors. - * @return array List of instantiated local variables. - */ function stack_process_vars($locals,$seed,$options,&$err) { - - // Make sure ?'s are replaced by qmchar's - if (is_array($locals)) { - foreach ($locals as $key=> $val) { - $locals[$key] = str_replace('?','qmchar',$val); - } - } - - if (isset($errors['ProcessVars'])) { - unset($errors['ProcessVars']); - } - - // generate a StackRequest and send it - $winRequest = new StackRequest('PROCESSVARS'); - $winRequest->crData = array('locals' => $locals, 'display' => $options['Display'], 'randseed' => $seed ); - - $locals_inst = CPProcessVars($winRequest); - - - return($locals_inst); - } - - - /** - * Instantiate a list of local variables. - * - * Possible errors: - * - VARS-UNPACK : request array was empty - * - VARS-CODEINST : error instantiating CAS-specific code - * - VARS-TIMESTAMP : output from CAS did not match with input - * - VARS-PARSE : output from CAS could not be parsed, any variables that could not be instantiated are restored to un-CASed value in $crReturn - * - * @param StackRequest $varRequest $crData contains the list of local variables - * @return StackResponse $varResponse $crReturn contains the instantiated values - */ - function CPProcessVars($varRequest) { - // create a StackResponse object - $varResponse = new StackResponse(); - $cpCAS = new Maxima(); - - // local variables to be processed will be stored in - // $varRequest->crData - // generate CAS command - - $locals = $varRequest->crData['locals']; - $display = $varRequest->crData['display']; - // CJS - $seed = $varRequest->crData['randseed']; - - if (!is_array($locals)) { - // no data in $varRequest! - $varResponse->crError['VARS-UNPACK'] = TRUE; - return $varResponse; - } - - $t = time(); - $varCommand = $cpCAS->CASCodeInstantiate($locals, $t, $seed, $display); - - if ($varCommand != '') { - // send to CAS - $varResponse = stack_maxima_rawsend($varCommand); - - // echo "<pre>".$varResponse."</pre>"; - - // Chop off the part up till the first input group. - $varResponse = strstr($varResponse,"[TimeStamp"); - - $parsed = $cpCAS->CASParseCASOutput($varResponse); - - //show_array($parsed); - - // Get the CAS's values of the locals into an array. - // Get the CAS's values of the locals into an array. - foreach ($locals as $lk => $locvar) { - if (array_key_exists($lk,$parsed['questionVarsInst'])) { - $locals_inst[$lk] = $locals[$lk]; - $locals_inst[$lk]['display'] = ''; - foreach ($parsed['questionVarsInst'][$lk] as $lkk => $lvv) { - $locals_inst[$lk][$lkk] = $lvv; - } - } else { - $locals_inst[$lk] = $locals[$lk]; - $locals_inst[$lk]['error'] = 'CAS-error (no output)'; - $locals_inst[$lk]['display'] = ''; - } - - // Maxima typesets strings with a & at the front. This breaks TeX, so we - // need to get rid of it..... - if (array_key_exists('display',$locals_inst[$lk])) { - if ( '&' == substr($locals_inst[$lk]['display'],0,1)) { - $locals_inst[$lk]['display'] = substr($locals_inst[$lk]['display'],1); - } - } - - if (isset($locals_inst[$lk]['error'])) { // There is a CAS error! - // Get the command that went in. - $val = $locvar['value']; - if ('' == $locals_inst[$lk]['display']) { - // This must be a genuine error, since nothing is displayed. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - $locals_inst[$lk]['display'] = $val; // Restore the un-CASed value - } else if (strstr($locals_inst[$lk]['error'],'Plot error')) { - // This must be a genuine error, since we created it! - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - } else if (FALSE != strstr($val,'plot')) { - // We asked for a plot, these always generate an error! (HACK) - unset($locals_inst[$lk]['error']); - $locals_inst[$lk]['display'] = $locals_inst[$lk]['value']; - } else { - // This must also be a genuine error, but keep the display, since we have it. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - } - } - } - } - - //show_array($locals_inst); - return $locals_inst; - - } - - - /** - * Directly perform an answer test - * - * @param string $exp1 A CAS expression, nominally the student's - * @param string $exp2 A CAS expression, nominally the teachers's - * @param string $test Which AnswerTest to apply. - * @param array $options The only option needed is the Display, but other answer tests may in the future require their own options. - * @return array $this_attempt An array structure, which is used to build the student's attempt. - */ - function CPProcessAnsTest($exp1,$exp2,$test,$disp,&$err) { - // create a StackResponse object - $varResponse = new StackResponse(); - $cpCAS = new Maxima(); - - $t = time(); - - $varCommand = $cpCAS->CASAnsTestCmd($exp1, $exp2, $t, $disp, $test); - - if ($varCommand != '') { - // send to CAS - $varResponse = stack_maxima_rawsend($varCommand); - - //echo "<pre>".$varResponse."</pre>"; - - // Chop off the part up till the first input group. - $varResponse = strstr($varResponse,"[TimeStamp"); - - $parsed = $cpCAS->CASAnsTestParse($varResponse); - - - // If we have errors, we need to add blank fields. - if (!array_key_exists('AnswerNote',$parsed)) { - $parsed['AnswerNote'] = ''; - } - - if (!array_key_exists('FeedBack',$parsed)) { - $parsed['FeedBack'] = ''; - } else { - // We translate the language. - - } - - if (!array_key_exists('Ans',$parsed)) { - $parsed['Ans']['value'] = $exp1; - $parsed['Ans']['display'] = $exp1; - $parsed['Ans']['error'] = get_string('CASError_ans','stack',''); - } else { - if (!array_key_exists('value',$parsed['Ans'])) { - $parsed['Ans']['value'] = $exp1; - } - if (!array_key_exists('display',$parsed['Ans'])) { - $parsed['Ans']['display'] = $exp1; - } - } - } - - return $parsed; - } - ?> --- 146,148 ---- Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** stackQuestion.php 17 Aug 2005 11:35:36 -0000 1.31 --- stackQuestion.php 25 Aug 2005 16:15:07 -0000 1.32 *************** *** 1,2140 **** ! <?php ! ! /** ! * This file contains most functions which deal with questions. These are the ! * everyday functions used by students, and it is rare indeed that this file is not ! * required. Functions for authoring questions (not used by students) are ! * kept in stackAuthor.php ! * ! * @package scripts ! * @subpackage Stack [...4274 lines suppressed...] ! ! /** ! * Returns the last seed of a $qID generated for $user ! * ! * @param int $qID The question ID ! * @param int $user The user ID ! * @return int $seed The seed ! */ ! function stack_question_getlastseed($qID,$user){ ! ! $seeds = stack_db_getseeds($qID,$user); ! if (is_array($seeds)) { ! $seed = end($seeds); ! } ! ! return($seed); ! ! } ! ! ?> |
Update of /cvsroot/stack/stack-1-0/other/domit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/other/domit Added Files: changelog.txt docs.html domit.html domitBanner.gif license.txt php_file_utilities.php php_http_client_generic.php php_http_client_include.php php_http_connector.php php_http_exceptions.php php_http_proxy.php testing_domit.css testing_domit.php timer.php tutorial.html xml_domit_cache.php xml_domit_doctor.php xml_domit_getelementsbypath.php xml_domit_include.php xml_domit_lite_include.php xml_domit_lite_parser.php xml_domit_nodemaps.php xml_domit_nodetools.php xml_domit_parseattributes.php xml_domit_parser.php xml_domit_shared.php xml_domit_utilities.php xml_domit_xpath.php xml_saxy_lite_parser.php xml_saxy_parser.php xml_saxy_shared.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch --- NEW FILE: xml_saxy_shared.php --- <?php /** * SAXY_Parser_Base is a base class for SAXY and SAXY Lite * @package saxy-xmlparser * @version 0.87 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/saxy/ SAXY Home Page * SAXY is Free Software **/ /** the initial characters of a cdata section */ define('SAXY_SEARCH_CDATA', '![CDATA['); /** the length of the initial characters of a cdata section */ define('SAXY_CDATA_LEN', 8); /** the initial characters of a notation */ define('SAXY_SEARCH_NOTATION', '!NOTATION'); /** the initial characters of a doctype */ define('SAXY_SEARCH_DOCTYPE', '!DOCTYPE'); /** saxy parse state, just before parsing an attribute */ define('SAXY_STATE_ATTR_NONE', 0); /** saxy parse state, parsing an attribute key */ define('SAXY_STATE_ATTR_KEY', 1); /** saxy parse state, parsing an attribute value */ define('SAXY_STATE_ATTR_VALUE', 2); /** * The base SAX Parser class * * @package saxy-xmlparser * @author John Heinstein <joh...@nb...> */ class SAXY_Parser_Base { /** @var int The current state of the parser */ var $state; /** @var int A temporary container for parsed characters */ var $charContainer; /** @var Object A reference to the start event handler */ var $startElementHandler; /** @var Object A reference to the end event handler */ var $endElementHandler; /** @var Object A reference to the data event handler */ var $characterDataHandler; /** @var Object A reference to the CDATA Section event handler */ var $cDataSectionHandler = null; /** @var boolean True if predefined entities are to be converted into characters */ var $convertEntities = true; /** @var Array Translation table for predefined entities */ var $predefinedEntities = array('&' => '&', '<' => '<', '>' => '>', '"' => '"', ''' => "'"); /** @var Array User defined translation table for entities */ var $definedEntities = array(); /** @var boolean True if whitespace is to be preserved during parsing. NOT YET IMPLEMENTED! */ var $preserveWhitespace = false; /** * Constructor for SAX parser */ function SAXY_Parser_Base() { $this->charContainer = ''; } //SAXY_Parser_Base /** * Sets a reference to the handler for the start element event * @param mixed A reference to the start element handler */ function xml_set_element_handler($startHandler, $endHandler) { $this->startElementHandler = $startHandler; $this->endElementHandler = $endHandler; } //xml_set_element_handler /** * Sets a reference to the handler for the data event * @param mixed A reference to the data handler */ function xml_set_character_data_handler($handler) { $this->characterDataHandler =& $handler; } //xml_set_character_data_handler /** * Sets a reference to the handler for the CDATA Section event * @param mixed A reference to the CDATA Section handler */ function xml_set_cdata_section_handler($handler) { $this->cDataSectionHandler =& $handler; } //xml_set_cdata_section_handler /** * Sets whether predefined entites should be replaced with their equivalent characters during parsing * @param boolean True if entity replacement is to occur */ function convertEntities($truthVal) { $this->convertEntities = $truthVal; } //convertEntities /** * Appends an array of entity mappings to the existing translation table * * Intended mainly to facilitate the conversion of non-ASCII entities into equivalent characters * * @param array A list of entity mappings in the format: array('&' => '&'); */ function appendEntityTranslationTable($table) { $this->definedEntities = $table; } //appendEntityTranslationTable /** * Gets the nth character from the end of the string * @param string The text to be queried * @param int The index from the end of the string * @return string The found character */ function getCharFromEnd($text, $index) { $len = strlen($text); $char = $text{($len - 1 - $index)}; return $char; } //getCharFromEnd /** * Parses the attributes string into an array of key / value pairs * @param string The attribute text * @return Array An array of key / value pairs */ function parseAttributes($attrText) { $attrText = trim($attrText); $attrArray = array(); $maybeEntity = false; $total = strlen($attrText); $keyDump = ''; $valueDump = ''; $currentState = SAXY_STATE_ATTR_NONE; $quoteType = ''; for ($i = 0; $i < $total; $i++) { $currentChar = $attrText{$i}; if ($currentState == SAXY_STATE_ATTR_NONE) { if (trim($currentChar != '')) { $currentState = SAXY_STATE_ATTR_KEY; } } switch ($currentChar) { case "\t": if ($currentState == SAXY_STATE_ATTR_VALUE) { $valueDump .= $currentChar; } else { $currentChar = ''; } break; case "\x0B": //vertical tab case "\n": case "\r": $currentChar = ''; break; case '=': if ($currentState == SAXY_STATE_ATTR_VALUE) { $valueDump .= $currentChar; } else { $currentState = SAXY_STATE_ATTR_VALUE; $quoteType = ''; $maybeEntity = false; } break; case '"': if ($currentState == SAXY_STATE_ATTR_VALUE) { if ($quoteType == '') { $quoteType = '"'; } else { if ($quoteType == $currentChar) { if ($this->convertEntities && $maybeEntity) { $valueDump = strtr($valueDump, $this->predefinedEntities); $valueDump = strtr($valueDump, $this->definedEntities); } $keyDump = trim($keyDump); $attrArray[$keyDump] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; } else { $valueDump .= $currentChar; } } } break; case "'": if ($currentState == SAXY_STATE_ATTR_VALUE) { if ($quoteType == '') { $quoteType = "'"; } else { if ($quoteType == $currentChar) { if ($this->convertEntities && $maybeEntity) { $valueDump = strtr($valueDump, $this->predefinedEntities); $valueDump = strtr($valueDump, $this->definedEntities); } $keyDump = trim($keyDump); $attrArray[$keyDump] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; } else { $valueDump .= $currentChar; } } } break; case '&': //might be an entity $maybeEntity = true; $valueDump .= $currentChar; break; default: if ($currentState == SAXY_STATE_ATTR_KEY) { $keyDump .= $currentChar; } else { $valueDump .= $currentChar; } } } return $attrArray; } //parseAttributes /** * Parses character data * @param string The character data */ function parseBetweenTags($betweenTagText) { if (trim($betweenTagText) != ''){ $this->fireCharacterDataEvent($betweenTagText); } } //parseBetweenTags /** * Fires a start element event * @param string The start element tag name * @param Array The start element attributes */ function fireStartElementEvent($tagName, $attributes) { call_user_func($this->startElementHandler, $this, $tagName, $attributes); } //fireStartElementEvent /** * Fires an end element event * @param string The end element tag name */ function fireEndElementEvent($tagName) { call_user_func($this->endElementHandler, $this, $tagName); } //fireEndElementEvent /** * Fires a character data event * @param string The character data */ function fireCharacterDataEvent($data) { if ($this->convertEntities && ((strpos($data, "&") != -1))) { $data = strtr($data, $this->predefinedEntities); $data = strtr($data, $this->definedEntities); } call_user_func($this->characterDataHandler, $this, $data); } //fireCharacterDataEvent /** * Fires a CDATA Section event * @param string The CDATA Section data */ function fireCDataSectionEvent($data) { call_user_func($this->cDataSectionHandler, $this, $data); } //fireCDataSectionEvent } //SAXY_Parser_Base ?> --- NEW FILE: xml_domit_shared.php --- <?php /** * @package domit-xmlparser * @version 0.98 * @copyright (C) 2004 John Heinstein. All rights reserved * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { /* Path to DOMIT! files */ define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } //Nodes /** DOM Element nodeType */ define('DOMIT_ELEMENT_NODE', 1); /** DOM Attr nodeType */ define('DOMIT_ATTRIBUTE_NODE', 2); /** DOM Text nodeType */ define('DOMIT_TEXT_NODE', 3); /** DOM CDATA Section nodeType */ define('DOMIT_CDATA_SECTION_NODE', 4); /** DOM Entity Reference nodeType */ define('DOMIT_ENTITY_REFERENCE_NODE', 5); /** DOM Entity nodeType */ define('DOMIT_ENTITY_NODE', 6); /** DOM Processing Instruction nodeType */ define('DOMIT_PROCESSING_INSTRUCTION_NODE', 7); /** DOM Comment nodeType */ define('DOMIT_COMMENT_NODE', 8); /** DOM Document nodeType */ define('DOMIT_DOCUMENT_NODE', 9); /** DOM DocType nodeType */ define('DOMIT_DOCUMENT_TYPE_NODE', 10); /** DOM Document Fragment nodeType */ define('DOMIT_DOCUMENT_FRAGMENT_NODE', 11); /** DOM Notation nodeType */ define('DOMIT_NOTATION_NODE', 12); //DOM Level 1 Exceptions /** DOM error: array index out of bounds */ define('DOMIT_INDEX_SIZE_ERR', 1); /** DOM error: text doesn't fit into a DOMString */ define('DOMIT_DOMSTRING_SIZE_ERR', 2); /** DOM error: node can't be inserted at this location */ define('DOMIT_HIERARCHY_REQUEST_ERR', 3); /** DOM error: node not a child of target document */ define('DOMIT_WRONG_DOCUMENT_ERR', 4); /** DOM error: invalid character specified */ define('DOMIT_INVALID_CHARACTER_ERR', 5); /** DOM error: data can't be added to current node */ define('DOMIT_NO_DATA_ALLOWED_ERR', 6); /** DOM error: node is read-only */ define('DOMIT_NO_MODIFICATION_ALLOWED_ERR', 7); /** DOM error: node can't be found in specified context */ define('DOMIT_NOT_FOUND_ERR', 8); /** DOM error: operation not supported by current implementation */ define('DOMIT_NOT_SUPPORTED_ERR', 9); /** DOM error: attribute currently in use elsewhere */ define('DOMIT_INUSE_ATTRIBUTE_ERR', 10); //DOM Level 2 Exceptions /** DOM error: attempt made to use an object that is no longer usable */ define('DOMIT_INVALID_STATE_ERR', 11); /** DOM error: invalid or illegal string specified */ define('DOMIT_SYNTAX_ERR', 12); /** DOM error: can't modify underlying type of node */ define('DOMIT_INVALID_MODIFICATION_ERR', 13); /** DOM error: attempt to change node in a way incompatible with namespaces */ define('DOMIT_NAMESPACE_ERR', 14); /** DOM error: operation unsupported by underlying object */ define('DOMIT_INVALID_ACCESS_ERR', 15); //DOMIT! Exceptions /** DOM error: attempt to instantiate abstract class */ define('DOMIT_ABSTRACT_CLASS_INSTANTIATION_ERR', 100); /** DOM error: attempt to call abstract method */ define('DOMIT_ABSTRACT_METHOD_INVOCATION_ERR', 101); /** DOM error: can't perform this action on or with Document Fragment */ define('DOMIT_DOCUMENT_FRAGMENT_ERR', 102); /** *@global Object Instance of the UIDGenerator class */ $GLOBALS['uidFactory'] = new UIDGenerator(); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_nodemaps.php'); /** * Generates unique ids for each node * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class UIDGenerator { /** @var int A seed value for generating uids */ var $seed; /** @var int A tally of the number of uids generated */ var $counter = 0; /** * UIDGenerator constructor */ function UIDGenerator() { $this->seed = 'node' . time(); } //UIDGenerator /** * Generates a unique id * @return uid */ function generateUID() { return ($this->seed . $this->counter++); } //generateUID } //UIDGenerator /** * @global object Reference to custom error handler for DOMException class * * Made global to simulate a static variable in PHP 4 */ $GLOBALS['DOMIT_DOMException_errorHandler'] = null; /** * A DOMIT! exception handling class * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_DOMException { /** * Raises the specified exception * @param int The error number * @param string A string explanation of the error */ function raiseException($errorNum, $errorString) { if ($GLOBALS['DOMIT_DOMException_errorHandler'] != null) { call_user_func($GLOBALS['DOMIT_DOMException_errorHandler'], $errorNum, $errorString); } else { $errorMessage = 'Error: ' . $errorNum . "\n " . $errorString; if ((!isset($GLOBALS['DOMIT_ERROR_FORMATTING_HTML'])) || ($GLOBALS['DOMIT_ERROR_FORMATTING_HTML'] == true)) { $errorMessage = "<p><pre>" . $errorMessage . "</pre></p>"; } die($errorMessage); } } //raiseException /** * custom handler for DOM errors * @param object A reference to the custom error handler */ function setErrorHandler($method) { $GLOBALS['DOMIT_DOMException_errorHandler'] =& $method; } //setErrorHandler } //DOMIT_DOMException /** * A class representing the DOM Implementation node * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_DOMImplementation { function hasFeature($feature, $version = null) { if (strtoupper($feature) == 'XML') { if (($version == '1.0') || ($version == '2.0') || ($version == null)) { return true; } } return false; } //hasFeature /** * Creates a new DOMIT_Document node and appends a documentElement with the specified info * @param string The namespaceURI of the documentElement * @param string The $qualifiedName of the documentElement * @param Object A document type node * @return Object The new document fragment node */ function &createDocument($namespaceURI, $qualifiedName, &$docType) { $xmldoc =& new DOMIT_Document(); $documentElement =& $xmldoc->createElementNS($namespaceURI, $qualifiedName); $xmldoc->setDocumentElement($documentElement); if ($docType != null) { $xmldoc->doctype =& $docType; } return $xmldoc; } //createDocument /** * Creates a new DOMIT_DocumentType node (not yet implemented!) * @param string The $qualifiedName * @param string The $publicID * @param string The $systemID * @return Object The new document type node */ function &createDocumentType($qualifiedName, $publicID, $systemID) { //not yet implemented DOMIT_DOMException::raiseException(DOMIT_NOT_SUPPORTED_ERROR, ('Method createDocumentType is not yet implemented.')); } //createDocumentType } //DOMIT_DOMImplementation ?> --- NEW FILE: xml_domit_doctor.php --- <?php /** * DOMIT! Doctor is a set of utilities for repairing malformed XML * @package domit-xmlparser * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ /** * A (static) class containing utilities for repairing malformed XML * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class domit_doctor { /** * Looks for illegal ampersands and converts them to entities * @param string The xml text to be repaired * @return string The repaired xml text */ function fixAmpersands($xmlText) { $xmlText = trim($xmlText); $startIndex = -1; $processing = true; $illegalChar = '&'; while ($processing) { $startIndex = strpos($xmlText, $illegalChar, ($startIndex + 1)); if ($startIndex !== false) { $xmlText = domit_doctor::evaluateCharacter($xmlText, $illegalChar, ($startIndex + 1)); } else { $processing = false; } } return $xmlText; } //fixAmpersands /** * Evaluates whether an ampersand should be converted to an entity, and performs the conversion * @param string The xml text * @param string The (ampersand) character * @param int The character index immediately following the ampersand in question * @return string The repaired xml text */ function evaluateCharacter($xmlText, $illegalChar, $startIndex) { $total = strlen($xmlText); $searchingForCDATASection = false; for ($i = $startIndex; $i < $total; $i++) { $currChar = substr($xmlText, $i, 1); if (!$searchingForCDATASection) { switch ($currChar) { case ' ': case "'": case '"': case "\n": case "\r": case "\t": case '&': case "]": $searchingForCDATASection = true; break; case ";": return $xmlText; break; } } else { switch ($currChar) { case '<': case '>': return (substr_replace($xmlText, '&', ($startIndex - 1) , 1)); break; case "]": return $xmlText; break; } } } return $xmlText; } //evaluateCharacter } //domit_doctor ?> --- NEW FILE: xml_domit_parser.php --- <?php /** * DOMIT! is a non-validating, but lightweight and fast DOM parser for PHP * @package domit-xmlparser * @subpackage domit-xmlparser-main * @version 1.0 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** current version of DOMIT! */ define ('DOMIT_VERSION', '1.0'); [...3626 lines suppressed...] //make uri lower case because Expat forces it to upper case for some reason $this->xmlDoc->namespaceURIMap[strtolower($uri)] = $prefix; //set up a switch so when the target element arrives, namespaces can be mapped to it $this->waitingForElementToDeclareNamespaces = true; $this->tempNamespaceURIMap[strtolower($uri)] = $prefix; } //startNamespaceDeclaration /** * Catches an end namespace declaration event * @param Object A reference to the current SAX parser * @param string The namespace prefix */ function endNamespaceDeclaration(&$parser, $prefix) { //do nothing; could remove from map, but would hardly be optimal } //endNamespaceDeclaration } //DOMIT_Parser ?> --- NEW FILE: php_file_utilities.php --- <?php if (!defined('PHP_TEXT_CACHE_INCLUDE_PATH')) { define('PHP_TEXT_CACHE_INCLUDE_PATH', (dirname(__FILE__) . "/")); } class php_file_utilities { /** * Retrieves binary or text data from the specified file * @param string The file path * @param string The attributes for the read operation ('r' or 'rb' or 'rt') * @return mixed he text or binary data contained in the file */ function &getDataFromFile($filename, $readAttributes, $readSize = 8192) { $fileContents = null; $fileHandle = @fopen($filename, $readAttributes); if($fileHandle){ do { $data = fread($fileHandle, $readSize); if (strlen($data) == 0) { break; } $fileContents .= $data; } while (true); fclose($fileHandle); } return $fileContents; } //getDataFromFile /** * Writes the specified binary or text data to a file * @param string The file path * @param mixed The data to be written * @param string The attributes for the write operation ('w' or 'wb') */ function putDataToFile($fileName, &$data, $writeAttributes) { $fileHandle = @fopen($fileName, $writeAttributes); if ($fileHandle) { fwrite($fileHandle, $data); fclose($fileHandle); } } //putDataToFile } //php_file_utilities ?> --- NEW FILE: xml_domit_nodemaps.php --- <?php /** * DOMIT node maps are structures for storing and accessing collections of DOMIT_Nodes. * @package domit-xmlparser * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ if (!defined('DOMIT_INCLUDE_PATH')) { define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** * A DOM NodeList implementation * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_NodeList { /** @var Array A container for the nodes in the list */ var $arNodeList = array(); /** * Return the node at the specified index * @param int The index of the requested node * @return Object A reference to the requested node, or null */ function &item($index) { if ($index < $this->getLength()) { return $this->arNodeList[$index]; } return null; } //item /** * Returns the number of nodes in the list * @return int The number of nodes in the list */ function getLength() { return count($this->arNodeList); } //getLength /** * Appends a node to the list * @return Object The appended node */ function &appendNode(&$node) { $this->arNodeList[] =& $node; return $node; } //appendNode /** * Removes the specified node from the list * @param Object A reference to the node to be removed * @return Object A reference to the removed node */ function &removeNode(&$node) { $total = $this->getLength(); $returnNode = null; $found = false; for ($i = 0; $i < $total; $i++) { if (!$found) { if ($node->uid == $this->arNodeList[$i]->uid) { $found = true; $returnNode=& $node; } } if ($found) { if ($i == ($total - 1)) { unset($this->arNodeList[$i]); } else { $this->arNodeList[$i] =& $this->arNodeList[($i + 1)]; } } } return $returnNode; } //$removeNode /** * Formats a string for presentation as HTML * @param string The string to be formatted * @param boolean True if the string is to be sent directly to output * @return string The HTML formatted string */ function forHTML($str, $doPrint = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); return DOMIT_Utilities::forHTML($str, $doPrint); } //forHTML /** * Generates an array representation of the node and its children * @return Array A representation of the node and its children */ function toArray() { return $this->arNodeList; } //toArray /** * Copies a node and/or its children * @param boolean True if all child nodes are also to be cloned * @return Object A copy of the node and/or its children */ function &createClone($deep = false) { $className = get_class($this); $clone =& new $className(); foreach ($this->arNodeList as $key => $value) { $currNode =& $this->arNodeList[$key]; $clone->arNodeList[$key] =& $currNode->cloneNode($deep); } return $clone; } //createClone /** * Generates a string representation of the node and its children * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeList as $key => $value) { $currNode =& $this->arNodeList[$key]; $result .= $currNode->toString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toString /** * Generates a normalized (formatted for readability) representation of the node collection * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toNormalizedString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeList as $key => $value) { $currNode =& $this->arNodeList[$key]; $result .= $currNode->toNormalizedString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toNormalizedString } //DOMIT_NodeList /** * A DOM NamedNodeMap implementation * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_NamedNodeMap { /** @var Array A container for the nodes in the map */ var $arNodeMap = array(); /** @var Array A numerical index to the keys of the mapped nodes */ var $indexedNodeMap = array(); /** @var boolean True if the list has been modified and $indexedNodeMap needs reindexing */ var $isDirty = true; /** * Gets a node with the specifed name * @param string The name of the node * @return mixed A reference to the requested node, or null */ function &getNamedItem($name) { if (isset($this->arNodeMap[$name])) { return $this->arNodeMap[$name]; } return null; } //getNamedItem /** * Reindexes the numerical index for the named node map */ function reindexNodeMap() { $this->indexedNodeMap = array(); foreach ($this->arNodeMap as $key => $value) { $this->indexedNodeMap[] = $key; } $this->isDirty = false; } //reindexNodeMap /** * Assigns a node to the list * @param Object A reference to the node to be assigned * @return Object A reference to the assigned node */ function &setNamedItem(&$arg) { $returnNode = null; if (isset($this->arNodeMap[$arg->nodeName])) { $returnNode =& $this->arNodeMap[$arg->nodeName]; } else { $this->isDirty = true; } $this->arNodeMap[$arg->nodeName] =& $arg; return $returnNode; } //setNamedItem /** * Removes a node from the list, by name * @param string The name of the node to be removed * @return mixed A reference to the removed node, or null */ function &removeNamedItem($name) { $returnNode = null; if (isset($this->arNodeMap[$name])) { $returnNode =& $this->arNodeMap[$name]; unset($this->arNodeMap[$name]); $this->isDirty = true; } return $returnNode; } //removeNamedItem /** * Gets a node with the specifed name, taking into account namespaces * @param string The namespaceURI of the node * @param string The localName of the node * @return mixed A reference to the requested node, or null */ function &getNamedItemNS($namespaceURI, $localName) { $key = $this->getKeyNS($namespaceURI, $localName); //check for explicit namespaces if (isset($this->arNodeMap[$key])) { return $this->arNodeMap[$key]; } //check for implicit namespaces too //URI will be on element, but not attribute if (isset($this->arNodeMap[$localName])) { //get element namespace $firstAttr =& $this->item(1); $ownerElem =& $firstAttr->ownerElement; if ($namespaceURI == $ownerElem->namespaceURI) { return $this->arNodeMap[$localName]; } } return null; } //getNamedItemNS /** * Assigns a node to the list, using its namespaceURI and localName * @param Object A reference to the node to be assigned * @return Object A reference to the assigned node */ function &setNamedItemNS(&$arg) { $returnNode = null; $key = $this->getKeyNS($arg->namespaceURI, $arg->localName); if (isset($this->arNodeMap[$key])) { $returnNode =& $this->arNodeMap[$key]; } else { $this->isDirty = true; } $this->arNodeMap[$key] =& $arg; return $returnNode; } //setNamedItemNS /** * Removes a node from the list, by name, by local name and namespace URI * @param string The namespaceURI of the node to be removed * @param string The localName of the node to be removed * @return mixed A reference to the removed node, or null */ function &removeNamedItemNS($namespaceURI, $localName) { $returnNode = null; $key = $this->getKeyNS($namespaceURI, $localName); if (isset($this->arNodeMap[$key])) { $returnNode =& $this->arNodeMap[$key]; unset($this->arNodeMap[$key]); $this->isDirty = true; } return $returnNode; } //removeNamedItemNS /** * Returns the key of the NamedNodeMap, given the namespaceURI and localName * @param string The namespaceURI of the node to be removed * @param string The localName of the node to be removed * @return string The key of the NamedNodeMap */ function getKeyNS($namespaceURI, $localName) { if ($namespaceURI != '') { return $namespaceURI . ":" . $localName; } return $localName; } //getKeyNS /** * Return the node at the specified index * @param int The index of the requested node * @return mixed A reference to the requested node, or null */ function &item($index) { if ($this->isDirty) $this->reindexNodeMap(); return $this->arNodeMap[$this->indexedNodeMap[$index]]; } //item /** * Returns the number of nodes in the map * @return int The number of nodes in the map */ function getLength() { return count($this->arNodeMap); } //getLength /** * Formats a string for presentation as HTML * @param string The string to be formatted * @param boolean True if the string is to be sent directly to output * @return string The HTML formatted string */ function forHTML($str, $doPrint = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); return DOMIT_Utilities::forHTML($str, $doPrint); } //forHTML /** * Generates an array representation of the node and its children * @return Array A representation of the node and its children */ function toArray() { return $this->arNodeMap; } //toArray /** * Copies a node and/or its children * @param boolean True if all child nodes are also to be cloned * @return Object A copy of the node and/or its children */ function &createClone($deep = false) { $className = get_class($this); $clone =& new $className(); foreach ($this->arNodeMap as $key => $value) { $currNode =& $this->arNodeMap[$key]; $clone->arNodeMap[$key] =& $currNode->cloneNode($deep); } return $clone; } //createClone /** * Generates a string representation of the node and its children * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeMap as $key => $value) { $currNode =& $this->arNodeMap[$key]; $result .= $currNode->toString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toString /** * Generates a normalized (formatted for readability) representation of the node collection * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toNormalizedString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeMap as $key => $value) { $currNode =& $this->arNodeMap[$key]; $result .= $currNode->toNormalizedString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toNormalizedString } //DOMIT_NamedNodeMap /** * A NamedNodeMap with specialized funtionality for Attribute nodes * * @package domit-xmlparser * @author John Heinstein <joh...@nb...> */ class DOMIT_NamedNodeMap_Attr extends DOMIT_NamedNodeMap { /** * Generates an array representation of the node and its children * @return Array A representation of the node and its children */ function toArray() { $arReturn = array(); foreach ($this->arNodeMap as $key => $value) { $arReturn[$key] = $this->arNodeMap[$key]->getValue(); } return $arReturn; } //toArray /** * Generates a string representation of the node and its children * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ function toString($htmlSafe = false, $subEntities=false) { $result = ''; foreach ($this->arNodeMap as $key => $value) { $currNode =& $this->arNodeMap[$key]; $result .= $currNode->toString(false, $subEntities); } if ($htmlSafe) $result = $this->forHTML($result); return $result; } //toString } //DOMIT_NamedNodeMap_Attr ?> --- NEW FILE: tutorial.html --- <html> <head> <title>DOMIT! Documentation</title> </head> <frameset cols="300,*" frameborder="0" border="0"> <frame src="documentation/menu.html" name="menu" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <frame src="documentation/DOMIT_tutorial_000.html" name="classes" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <noframes> <body> Your browser does not support frames. </body> </noframes> </frameset> </html> --- NEW FILE: testing_domit.css --- body { color: #000000; background-color: #FFFFFF; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; font-family: Arial, Verdana, sans-serif; font-size: 12px; } pre { font-family: Arial, Verdana, sans-serif; font-size: 12px; font-style: bold; } body a:link { color: darkgreen; font-family: Arial, Verdana, sans-serif; } body a:visited { color: darkgreen; font-family: Arial, Verdana, sans-serif; } img { text-align: center; border: 0; } h2 { color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 18px; font-style: bold; } .row0 { color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 12px; font-style: bold; } .row1 { color: #000000; font-family: Arial, Verdana, sans-serif; font-size: 18px; font-style: bold; } --- NEW FILE: xml_domit_lite_include.php --- <?php /** * @package domit-xmlparser * @subpackage domit-xmlparser-lite * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ /** The file system path to the domit library */ define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_lite_parser.php'); ?> --- NEW FILE: docs.html --- <html> <head> <title>DOMIT! Documentation</title> </head> <frameset cols="300,*" frameborder="0" border="0"> <frame src="documentation/menu.html" name="menu" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <frame src="documentation/DOMIT.html" name="classes" frameborder="0" noresize scrolling="yes" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" /> <noframes> <body> Your browser does not support frames. </body> </noframes> </frameset> </html> --- NEW FILE: xml_saxy_lite_parser.php --- <?php /** * SAXY Lite is a non-validating, but lightweight and fast SAX parser for PHP, modelled on the Expat parser * @package saxy-xmlparser * @subpackage saxy-xmlparser-lite * @version 0.17 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/saxy/ SAXY Home Page * SAXY is Free Software **/ if (!defined('SAXY_INCLUDE_PATH')) { define('SAXY_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** current version of SAXY Lite */ define ('SAXY_LITE_VERSION', '0.17'); /** initial saxy lite parse state, before anything is encountered */ define('SAXY_STATE_NONE', 0); /** saxy lite parse state, processing main document */ define('SAXY_STATE_PARSING', 1); require_once(SAXY_INCLUDE_PATH . 'xml_saxy_shared.php'); /** * The SAX Parser class * * @package saxy-xmlparser * @subpackage saxy-xmlparser-lite * @author John Heinstein <joh...@nb...> */ class SAXY_Lite_Parser extends SAXY_Parser_Base { /** * Constructor for SAX parser */ function SAXY_Lite_Parser() { $this->SAXY_Parser_Base(); $this->state = SAXY_STATE_NONE; } //SAXY_Lite_Parser /** * Returns the current version of SAXY Lite * @return Object The current version of SAXY Lite */ function getVersion() { return SAXY_LITE_VERSION; } //getVersion /** * Processes the xml prolog, doctype, and any other nodes that exist outside of the main xml document * @param string The xml text to be processed * @return string The preprocessed xml text */ function preprocessXML($xmlText) { //strip prolog $xmlText = trim($xmlText); $total = strlen($xmlText); for ($i = 0; $i < $total; $i++) { if ($xmlText{$i} == '<') { switch ($xmlText{($i + 1)}) { case '?': case '!': break; default: $this->state = SAXY_STATE_PARSING; return (substr($xmlText, $i)); } } } } //preprocessXML /** * The controlling method for the parsing process * @param string The xml text to be processed * @return boolean True if parsing is successful */ function parse ($xmlText) { $xmlText = $this->preprocessXML($xmlText); $total = strlen($xmlText); for ($i = 0; $i < $total; $i++) { $currentChar = $xmlText{$i}; switch ($this->state) { case SAXY_STATE_PARSING: switch ($currentChar) { case '<': if (substr($this->charContainer, 0, SAXY_CDATA_LEN) == SAXY_SEARCH_CDATA) { $this->charContainer .= $currentChar; } else { $this->parseBetweenTags($this->charContainer); $this->charContainer = ''; } break; case '>': if ((substr($this->charContainer, 0, SAXY_CDATA_LEN) == SAXY_SEARCH_CDATA) && !(($this->getCharFromEnd($this->charContainer, 0) == ']') && ($this->getCharFromEnd($this->charContainer, 1) == ']'))) { $this->charContainer .= $currentChar; } else { $this->parseTag($this->charContainer); $this->charContainer = ''; } break; default: $this->charContainer .= $currentChar; } break; } } return true; } //parse /** * Parses an element tag * @param string The interior text of the element tag */ function parseTag($tagText) { $tagText = trim($tagText); $firstChar = $tagText{0}; $myAttributes = array(); switch ($firstChar) { case '/': $tagName = substr($tagText, 1); $this->fireEndElementEvent($tagName); break; case '!': $upperCaseTagText = strtoupper($tagText); if (strpos($upperCaseTagText, SAXY_SEARCH_CDATA) !== false) { //CDATA Section $total = strlen($tagText); $openBraceCount = 0; $textNodeText = ''; for ($i = 0; $i < $total; $i++) { $currentChar = $tagText{$i}; if (($currentChar == ']') && ($tagText{($i + 1)} == ']')) { break; } else if ($openBraceCount > 1) { $textNodeText .= $currentChar; } else if ($currentChar == '[') { //this won't be reached after the first open brace is found $openBraceCount ++; } } if ($this->cDataSectionHandler == null) { $this->fireCharacterDataEvent($textNodeText); } else { $this->fireCDataSectionEvent($textNodeText); } } else if (strpos($upperCaseTagText, SAXY_SEARCH_NOTATION) !== false) { //NOTATION node, discard return; } else if (substr($tagText, 0, 2) == '!-') { //comment node, discard return; } break; case '?': //Processing Instruction node, discard return; default: if ((strpos($tagText, '"') !== false) || (strpos($tagText, "'") !== false)) { $total = strlen($tagText); $tagName = ''; for ($i = 0; $i < $total; $i++) { $currentChar = $tagText{$i}; if (($currentChar == ' ') || ($currentChar == "\t") || ($currentChar == "\n") || ($currentChar == "\r") || ($currentChar == "\x0B")) { $myAttributes = $this->parseAttributes(substr($tagText, $i)); break; } else { $tagName .= $currentChar; } } if (strrpos($tagText, '/') == (strlen($tagText) - 1)) { //check $tagText, but send $tagName $this->fireStartElementEvent($tagName, $myAttributes); $this->fireEndElementEvent($tagName); } else { $this->fireStartElementEvent($tagName, $myAttributes); } } else { if (strpos($tagText, '/') !== false) { $tagText = trim(substr($tagText, 0, (strrchr($tagText, '/') - 1))); $this->fireStartElementEvent($tagText, $myAttributes); $this->fireEndElementEvent($tagText); } else { $this->fireStartElementEvent($tagText, $myAttributes); } } } } //parseTag /** * Returns the current error code (non-functional for SAXY Lite) * @return int The current error code */ function xml_get_error_code() { return -1; } //xml_get_error_code /** * Returns a textual description of the error code (non-functional for SAXY Lite) * @param int The error code * @return string The error message */ function xml_error_string($code) { return ""; } //xml_error_string } //SAXY_Lite_Parser ?> --- NEW FILE: php_http_client_generic.php --- <?php /** * PHP HTTP Tools is a library for working with the http protocol * php_http_client_generic represents a basic http client * @package php-http-tools * @version 0.2-pre * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License * @author John Heinstein <joh...@nb...> * @link http://www.engageinteractive.com/php_http_tools/ PHP HTTP Tools Home Page * PHP HTTP Tools are Free Software **/ if (!defined('PHP_HTTP_TOOLS_INCLUDE_PATH')) { define('PHP_HTTP_TOOLS_INCLUDE_PATH', (dirname(__FILE__) . "/")); } /** end-of-line character sequence as defined in HTTP spec */ define ('CRLF', "\r\n"); /** carriage return character */ define ('CR', "\r"); /** line feed character */ define ('LF', "\n"); //http read states for client /** beginning read state */ define('HTTP_READ_STATE_BEGIN', 1); /** state when reading headers */ define('HTTP_READ_STATE_HEADERS', 2); /** state when reading body of message */ define('HTTP_READ_STATE_BODY', 3); require_once(PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_exceptions.php'); /** * An HTTP Request class * * @package php-http-tools * @author John Heinstein <joh...@nb...> */ class php_http_request { /** @var object A reference to the headers object */ var $headers = null; /** @var string The requested method, e.g. GET, POST, HEAD */ var $requestMethod = 'POST'; /** @var string The requested path */ var $requestPath = ''; /** @var string The requested protocol */ var $protocol = 'HTTP'; /** @var string The version of the requested protocol */ var $protocolVersion= '1.1'; /** * Returns the headers object * @return object The headers object */ function &getHeaders() { return $this->headers; } //getHeaders /** * Sets the header to the specified value * @param string The header name * @param string The header value * @param boolean True if multiple headers with the same name are allowed */ function setHeader($name, $value, $allowMultipleHeaders = false) { $this->headers->setHeader($name, $value, $allowMultipleHeaders); } //setHeader /** * Default method for setting headers; meant to be overridden in subclasses */ function setHeaders() { //you will want to override this method $this->setHeader('User-Agent', 'PHP-HTTP-Client(Generic)/0.1'); $this->setHeader('Connection', 'Close'); } //setHeaders /** * Sets the request method, e.g., GET * @param string The name of the request method * @return boolean True if the version number is valid */ function setRequestMethod($method) { $method = strtoupper($method); switch ($method) { case 'POST': case 'GET': case 'HEAD': case 'PUT': $this->requestMethod = $method; return true; break; } return false; } //setRequestMethod /** * Sets the request path, e.g., http://www.engageinteractive.com/domit/test.xml * @param string The request path */ function setRequestPath($path) { $this->requestPath = $path; } //setRequestPath /** * Sets the version number of the protocol * @param string The version number * @return boolean True if the version number is valid */ function setProtocolVersion($version) { if (($version == '1.0') || ($version == '1.1')) { $this->protocolVersion = $version; return true; } return false; } //setProtocolVersion /** * Specifies a user name and password for basic authentication * @param string The user name * @param string The password */ function setAuthorization($user, $password) { $encodedChallengeResponse = 'Basic ' . base64_encode($this->user . ':' . $this->password); $this->setHeader('Authorization', $encodedChallengeResponse); } //setAuthorization } //php_http_request class php_http_client_generic extends php_http_request { /** @var object A reference to the connection object */ var $connection; /** @var string True if response headers are to be generated as an object */ var $responseHeadersAsObject = false; /** @var object The http response */ var $response = null; /** @var string A list of event names that can be fired by the client */ var $events = array('onRequest' => null, 'onRead' => null, 'onResponse' => null, 'onResponseHeaders' => null, 'onResponseBody' => null); /** * HTTP Client constructor * @param string The client connection host name, with or without its protocol prefix * @param string The client connection path, not including the host name * @param int The port to establish the client connection on * @param int The timeout value for the client connection */ function php_http_client_generic($host = '', $path = '/', $port = 80, $timeout = 0) { $this->connection =& new php_http_connection($host, $path, $port, $timeout); $this->headers =& new php_http_headers(); $this->requestPath = $path; $this->response =& new php_http_response(); $this->setHeaders(); } //php_http_client_generic /** * Specifies that the response headers array should be generated * @param boolean True if the response headers array should be built */ function generateResponseHeadersAsObject($responseHeadersAsObject) { $this->responseHeadersAsObject = $responseHeadersAsObject; if ($responseHeadersAsObject) { $this->response->headers =& new php_http_headers(); } } //generateResponseHeadersAsObject /** * Fires an http event that has been registered * @param string The name of the event, e.g., onRead * @param string The data to be passed to the event */ function fireEvent($target, $data) { if ($this->events[$target] != null) { call_user_func($this->events[$target], $data); } } //fireEvent /** * Sets which http events are to be fired * @param string The http event option to be set * @param string True if the event is to be fired * @param object A reference to a custom handler for the http event data */ function setHTTPEvent($option, $truthVal, $customHandler = null) { if ($customHandler != null) { $handler =& $customHandler; } else { $handler = array(&$this, 'defaultHTTPEventHandler'); } switch($option) { case 'onRequest': case 'onRead': case 'onResponse': case 'onResponseHeaders': case 'onResponseBody': $truthVal ? ($this->events[$option] =& $handler) : ($this->events[$option] = null); break; } } //setHTTPEvent /** * Evaluates whether the specified http event option is active * @param string The http event option to evaluate * @return boolean True if the specified option is active */ function getHTTPEvent($option) { switch($option) { case 'onRequest': case 'onRead': case 'onResponse': case 'onResponseHeaders': case 'onResponseBody': return ($this->events[$option] != null); break; } } //getHTTPEvent /** * The default http event handler; fired if no custom handler has been registered * @param string The event data */ function defaultHTTPEventHandler($data) { $this->printHTML($data); } //defaultHTTPEventHandler /** * Prints the data to the browser as preformatted, htmlentified output * @param string The data to be printed */ function printHTML($html) { print('<pre>' . htmlentities($html) . '</pre>'); } //printHTML /** * Establishes a client connection */ function connect() { if (!$this->headers->headerExists('Host')) { $this->setHeader('Host', $this->connection->host); } return $this->connection->connect(); } //connect /** * Disconnects the current client connection if one exists */ function disconnect() { return $this->connection->disconnect(); } //disconnect /** * Evaluated whether the current client is connected * @return boolean True if a connection exists */ function isConnected() { return $this->connection->isOpen(); } //isConnected /** * Performs an HTTP GET * @param string The target url * @return object An HTTP response object */ function &get($url) { $this->setRequestMethod('GET'); $this->setRequestPath($url); $this->get_custom($url); $this->connect(); $result = $this->send(''); return $result; } //get /** * Handler for customizing the HTTP GET call * @param string The target url */ function get_custom($url) { //do nothing; meant to be overridden } //get_custom /** * Performs an HTTP POST * @param string The posted data * @return object An HTTP response object */ function &post($data) { $this->setRequestMethod('POST'); $this->setHeader('Content-Type', 'text/html'); $this->post_custom($data); $this->connect(); return $this->send($data); } //post /** * Handler for customizing the HTTP POST call * @param string The post data */ function post_custom($data) { //do nothing; meant to be overridden } //post_custom /** * Performs an HTTP HEAD * @param string The target url * @return object An HTTP response object */ function &head($url) { $this->setRequestMethod('HEAD'); $this->head_custom($url); $this->connect(); return $this->send(''); } //head /** * Handler for customizing the HTTP HEAD call * @param string The target url */ function head_custom($url) { //do nothing; meant to be overridden } //head_custom /** * Sends data through the client connection * @param string The message to be sent * @return string The http response */ function &send($message) { $conn =& $this->connection; if ($conn->isOpen()) { //build header info $request = $this->requestMethod . ' ' . $this->requestPath . ' ' . $this->protocol . '/' . $this->protocolVersion . CRLF; $request .= $this->headers->toString() . CRLF; $request .= $message; //init variables $response = $headers = $body = ''; $readState = HTTP_READ_STATE_BEGIN; $this->fireEvent('onRequest', $request); //send request $connResource =& $conn->connection; fputs ($connResource, $request); //read response while (!feof($connResource)) { $data = fgets($connResource, 4096); $this->fireEvent('onRead', $data); switch ($readState) { case HTTP_READ_STATE_BEGIN: $this->response->statusLine = $data; $readState = HTTP_READ_STATE_HEADERS; break; case HTTP_READ_STATE_HEADERS: if (trim($data) == '') { //end of headers is signalled by a blank line $readState = HTTP_READ_STATE_BODY; } else { if ($this->responseHeadersAsObject) { $this->response->setUnformattedHeader($data); } else { $this->response->headers .= $data; } } break; case HTTP_READ_STATE_BODY: $this->response->message .= $data; break; } } $this->normalizeResponseIfChunked(); $headerString = is_object($this->response->headers) ? $this->response->headers->toString() : $this->response->headers; $this->fireEvent('onResponseHeaders', $headerString); $this->fireEvent('onResponseBody', $this->response->message); $this->fireEvent('onResponse', $this->response->headers . $this->response->message); return $this->response; } else { HTTPExceptions::raiseException(HTTP_SOCKET_CONNECTION_ERR, ('HTTP Transport Error - Unable to establish connection to host ' . $conn->host)); } } //send /** * Determines if response data is transfer encoding chunked, then decodes */ function normalizeResponseIfChunked() { if (($this->protocolVersion = '1.1') && (!$this->response->isResponseChunkDecoded)) { if ($this->responseHeadersAsObject) { if ($this->response->headers->headerExists('Transfer-Encoding') && ($this->response->headers->getHeader('Transfer-Encoding') == 'chunked')) { $this->response->message = $this->decodeChunkedData($this->response->getResponse()); $this->response->isResponseChunkDecoded = true; } } else { if ((strpos($this->response->headers, 'Transfer-Encoding') !== false) && (strpos($this->response->headers, 'chunked') !== false)){ $this->response->message = $this->decodeChunkedData($this->response->getResponse()); $this->response->isResponseChunkDecoded = true; } } } } //normalizeResponseIfChunked /** * Decodes data if transfer encoding chunked * @param string The encoded data * @return string The decoded data */ function decodeChunkedData($data) { $chunkStart = $chunkEnd = strpos($data, CRLF) + 2; $chunkLengthInHex = substr($data, 0, $chunkEnd); $chunkLength = hexdec(trim($chunkLengthInHex)); $decodedData = ''; while ($chunkLength > 0) { $chunkEnd = strpos($data, CRLF, ($chunkStart + $chunkLength)); if (!$chunkEnd) { //if the trailing CRLF is missing, return all the remaining data $decodedData .= substr($data, $chunkStart); break; } $decodedData .= substr($data, $chunkStart, ($chunkEnd - $chunkStart)); $chunkStart = $chunkEnd + 2; $chunkEnd = strpos($data, CRLF, $chunkStart) + 2; if (!$chunkEnd) break; $chunkLengthInHex = substr($data, $chunkStart, ($chunkEnd - $chunkStart)); $chunkLength = hexdec(trim($chunkLengthInHex)); $chunkStart = $chunkEnd; } return $decodedData; } //decodeChunkedData } //php_http_client_generic /** * An HTTP Connection class * * @package php-http-tools * @author John Heinstein <joh...@nb...> */ class php_http_connection { /** @var object A reference to the current connection */ var $connection = null; /** @var string The host of the connection */ var $host; /** @var string The path of the connection */ var $path; /** @var int The port of the connection */ var $port; /** @var int The timeout value for the connection */ var $timeout; /** @var int The error number of the connection */ var $errorNumber = 0; /** @var string The error string of the connection */ var $errorString = ''; /** * HTTP Connection constructor * @param string The connection host name, with or without its protocol prefix * @param string The connection path, not including the host name * @param int The port to establish the client connection on * @param int The timeout value for the client connection */ function php_http_connection($host = '', $path = '/', $port = 80, $timeout = 0) { $this->host = $this->formatHost($host); $this->path = $this->formatPath($path); $this->port = $port; $this->timeout = $timeout; } //php_http_connection /** * Formats a host string by stripping off the http:// prefix * @param string The host name * @return string The formatted host name */ function formatHost($hostString) { $hasProtocol = (substr(strtoupper($hostString), 0, 7) == 'HTTP://'); if ($hasProtocol) { $hostString = substr($hostString, 7); } return $hostString; } //formatHost /** * Formats a path string * @param string The path * @return string The formatted path */ function formatPath($pathString) { if (($pathString == '') || ($pathString == null)) { $pathString = '/'; } return $pathString; } //formatPath /** * Establishes a socket connection * @return boolean True if the connection was successful */ function connect() { if ($this->timeout == 0) { $this->connection = @fsockopen($this->host, $this->port, $errorNumber, $errorString); } else { $this->connection = @fsockopen($this->host, $this->port, $errorNumber, $errorString, $this->timeout); } $this->errorNumber = $errorNumber; $this->errorString = $errorString; return is_resource($this->connection); } //connect /** * Determines whether the connection is still open * @return boolean True if the connection is still open */ function isOpen() { return (is_resource($this->connection) && (!feof($this->connection))); } //isOpen /** * Disconnects the current connection * @return boolean True if the connection has been disconnected */ function disconnect() { fclose($this->connection); $this->connection = null; return true; } //disconnect } //php_http_connection /** * An HTTP Headers class * * @package php-http-tools * @author John Heinstein <joh...@nb...> */ class php_http_headers { /** @var object An array of headers */ var $headers; /** * HTTP Headers constructor */ function php_http_headers() { $this->headers = array(); } //php_http_headers /** * Returns the specified header value * @param string The header name * @return mixed The header value, or an array of header values */ function &getHeader($name) { if ($this->headerExists($name)) { return $this->headers[$name]; } return false; } //getHeader /** * Sets the named header to the specified value * @param string The header name * @param string The header value * @param boolean True if multiple headers with the same name are allowed */ function setHeader($name, $value, $allowMultipleHeaders = false) { if ($allowMultipleHeaders) { if (isset($this->headers[$name])) { if (is_array($this->headers[$name])) { $this->headers[$name][count($this->headers)] = $value; } else { $tempVal = $this->headers[$name]; $this->headers[$name] = array($tempVal, $value); } } else { $this->headers[$name] = array(); $this->headers[$name][0] = $value; } } else { $this->headers[$name] = $value; } } //setHeader /** * Determines whether the specified header exists * @param string The header name * @return boolean True if the specified header exists */ function headerExists($name) { return isset($this->headers[$name]); } //headerExists /** * Removes the specified header * @param string The header name * @return boolean True if the specified header has been removed */ function removeHeader($name) { if ($this->headerExists($name)) { unset($this->headers[$name]); return true; } return false; } //removeHeader /** * Returns a reference to the headers array * @return array The headers array */ function getHeaders() { return $this->headers; } //getHeaders /** * Returns a list of existing headers names * @return array A list of existing header names */ function getHeaderList() { return array_keys($this->headers); } //getHeaderList /** * Returns a string representation of the headers array * @return string A string representation of the headers array */ function toString() { $retString = ''; foreach ($this->headers ... [truncated message content] |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:32
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/scripts/rqp Added Files: RQPv1p0Server.php admindocs-menu.txt index.php nb_easyxml_lite.php nb_soapfuncs.php rqp_util.php stackDetails.php stackDocs.php studentdocs-menu.txt teacherdocs-menu.txt Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch --- NEW FILE: studentdocs-menu.txt --- // DEMO MENU CONFIGURATION FILE // // level // text // link // target // .menu_QB|question_bank.php?action=questionbank_screen ..menu_New|question_bank.php?action=edit_new ..menu_Import|import.php?action=import .menu_Quizzes|editquiz.php?action=quiz_choose ..menu_New|editquiz.php?action=quiz_new ..menu_Import|import.php?action=import .menu_Reporting|analysis.php .menu_User|user.php .menu_Logout|index.php?action=logout .menu_Help|documentation.php ..menu_Author|documentation.php?action=author_gettingstarted ..menu_Syntax|documentation.php?action=author_commonsyntax ..menu_Qfields|documentation.php?action=author_questionfields ..menu_Options|documentation.php?action=author_options ..menu_AnswerT|documentation.php?action=author_answertest ..menu_TestSuite|documentation.php?action=author_testsuite ..menu_PR|documentation.php?action=author_potresp ..menu_FAF|documentation.php?action=author_factsformula ..menu_FAQ|documentation.php?action=author_faq ..menu_Maxima|documentation.php?action=author_maxima ..menu_CAS_Fn|documentation.php?action=functions .menu_About|documentation.php?action=about_general ..menu_Install|documentation.php?action=about_install ..menu_Develop|documentation.php?action=about_develop ..menu_CAS_OL|chat.php ..menu_CAS_OLML|chat.php ..menu_Forum|http://mantis.york.ac.uk/moodle/course/view.php?id=21|_blank ..menu_Sourceforge|http://sourceforge.net/projects/stack|_blank ..menu_Contact|mailto:ch...@sa... .menu_logo|documentation.php?action=logo --- NEW FILE: teacherdocs-menu.txt --- // DEMO MENU CONFIGURATION FILE // // level // text // link // target // .menu_QB|question_bank.php?action=questionbank_screen ..menu_New|question_bank.php?action=edit_new ..menu_Import|import.php?action=import .menu_Quizzes|editquiz.php?action=quiz_choose ..menu_New|editquiz.php?action=quiz_new ..menu_Import|import.php?action=import .menu_Reporting|analysis.php .menu_User|user.php .menu_Logout|index.php?action=logout .menu_Help|documentation.php ..menu_Author|documentation.php?action=author_gettingstarted ..menu_Syntax|documentation.php?action=author_commonsyntax ..menu_Qfields|documentation.php?action=author_questionfields ..menu_Options|documentation.php?action=author_options ..menu_AnswerT|documentation.php?action=author_answertest ..menu_TestSuite|documentation.php?action=author_testsuite ..menu_PR|documentation.php?action=author_potresp ..menu_FAF|documentation.php?action=author_factsformula ..menu_FAQ|documentation.php?action=author_faq ..menu_Maxima|documentation.php?action=author_maxima ..menu_CAS_Fn|documentation.php?action=functions .menu_About|documentation.php?action=about_general ..menu_Install|documentation.php?action=about_install ..menu_Develop|documentation.php?action=about_develop ..menu_CAS_OL|chat.php ..menu_CAS_OLML|chat.php ..menu_Forum|http://mantis.york.ac.uk/moodle/course/view.php?id=21|_blank ..menu_Sourceforge|http://sourceforge.net/projects/stack|_blank ..menu_Contact|mailto:ch...@sa... .menu_logo|documentation.php?action=logo --- NEW FILE: nb_soapfuncs.php --- <?php /***************************************************************************** The purpose of this library is to provide a very simple, interoperable SOAP implentation for PHP that is not dependent on any optional libraries and can function with both PHP version 4.3 and PHP version 5. This library is expected to be used with generated code from ws_gen and requires nb_easyxml.php. *****************************************************************************/ class nbSOAPFault { var $faultcode; var $faultstring; var $faultdetail; function nbSOAPFault($faultcode, $faultstring, $faultdetail) { $this->faultcode = $faultcode; $this->faultstring = $faultstring; $this->faultdetail = $faultdetail; $this->faultactor = $_SERVER['PHP_SELF']; } function soapify() { $out = "<soap:Fault>\n"; $out .= "<faultcode>".$this->faultcode."</faultcode>\n"; $out .= "<faultstring>".$this->faultstring."</faultstring>\n"; $out .= "<faultactor>".$this->faultactor."</faultactor>\n"; $out .= "<faultdetail>".$this->faultdetail."</faultdetail>\n"; $out .= "</soap:Fault>"; return $out; } } function desoap_nbSOAPFault($xmp, $cp) { return new nbSOAPFault("","",""); } class nbSOAP { //# this is just a placeholder for now, eventually it will // hold serialization methods for inbuilt types and // the SOAP request functions. } // HTTP 1.1 version; under development, still to get proxy support and error reporting. function nbSOAP_request11($URI, $SOAPAction, $data, $timeLimit = 20) { $contents = ""; $urldata = parse_url($URI); if(!array_key_exists('port', $urldata)) $urldata['port']=80; // $request = "GET " . $urldata['path'] . " HTTP/1.1\r\n"; $request = "POST " . $urldata['path'] . " HTTP/1.1\r\n"; $request .= "Host: ". $urldata['host'] ."\r\n"; $request .= "Accept: */*\r\n"; $request .= "User-Agent: PHP-script\r\n"; $request .= "Content-Type: text/xml; charset=utf-8\r\n"; $request .= "Content-length: " . strlen($data) . "\r\n"; $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; $request .= $data; $startTime = time(); $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); stream_set_timeout($sock, 2); stream_set_blocking($sock, false); echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) { return false; } else { fputs($sock, $request); //# this part needs to properly check the length of response, and //# time out neatly if there's too long a delay. $headersComplete = false; $pageComplete = false; $cl = -1; while ((!feof($sock))&&(!$pageComplete)) { $cl = strlen($contents); $contents .= fread($sock, 8192); /* if(!$headersComplete) { $headerEnd = strpos($contents,"\r\n\r\n"); if($headerEnd != false) { $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; } } if($headersComplete) // not an else because I want it done if headersComplete just set { if(strlen($contents)>=$contentLength+$headerLength) $pageComplete = true; } */ $callTime = time()-$startTime; if($callTime >= $timeLimit) $pageComplete = true; echo "<p><i><pre>[" . htmlentities($contents) . "]</pre></i></p>"; } fclose($sock); } echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } function nbSOAP_request10($URI, $SOAPAction, $data) { $contents = ""; $urldata = parse_url($URI); if(!array_key_exists('port', $urldata)) $urldata['port']=80; $request = "POST " . $urldata['path'] . " HTTP/1.0\r\n"; $request .= "Host: ". $urldata['host'] ."\r\n"; $request .= "Accept: */*\r\n"; $request .= "User-Agent: PHP-script\r\n"; $request .= "Content-Type: text/xml; charset=utf-8\r\n"; $request .= "Content-length: " . strlen($data) . "\r\n"; $request .= "SOAPAction: \"" . $SOAPAction . "\"\r\n\r\n"; $request .= $data; $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) { return false; } else { fputs($sock, $request); while (!feof($sock)) { $contents .= fread($sock, 8192); } fclose($sock); } echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } function nbSOAP_Envelope($body) { $body = trim($body); if(substr($body,0,10) != "<soap:Body") return false; $soapXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $soapXML .= "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; $soapXML .= "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"; $soapXML .= $body; $soapXML .= "\n</soap:Envelope>\n"; return $soapXML; } function encodeXMLSafeString($in) { // this is virtually the same as htmlspecialchars, however I've made my own version to // ensure it always matches the decodeXMLSafeString function. $plain = array("&", "<", ">", "\""); $code = array("&", "<", ">", """); return str_replace($plain, $code, strval($in)); } function decodeXMLSafeString($in) { $code = array("<", ">", """, "&"); $plain = array("<", ">", "\"", "&"); return str_replace($code, $plain, $in); } ?> --- NEW FILE: index.php --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><title>RQP 1.0 test</title></head> <body> <?php include("RQPv1p0Client.php"); $rqpserver = new RQPv1p0(); $rqpserver->Url = "http://localhost/RQPv1p0/RQPv1p0Server.php"; $serverInfo = $rqpserver->RQP_ServerInformation(); echo serialize($serverInfo); ?> </body> </html> --- NEW FILE: stackDetails.php --- <?php /** * This simple script returns some specific server information * * As per 'details' field in RQP ServerInformation call * - administrators name * - email address * - URL to STACK server * - version of STACK in use */ require('../../stackstd.php'); echo '<html> <head> <title>STACK - System for Teaching and Assessment using a Computer algebra Kernel</title> </head> <table> <tr><td><img src="'."{$stack_web_url}pics/logo.png".'" width="115" alt="STACK Logo" /></td> <td align="left"><h1>STACK</h1></td></tr> <tr><td></td><td><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></tr></table> <hr/>'; echo '<br><br><b>Properties of the current STACK server</b><br><br>'; echo '<table><tr><td>Current STACK version:</td>'; echo '<td>'.$stack_ver['release'].'</td></tr>'; echo '<tr><td>Administrator:</td>'; echo '<td>'.$stack_adminfirstname.' '.$stack_adminsurname.'</td></tr>'; echo '<tr><td>Administrators e-mail:</td>'; echo '<td><a href="mailto:'.$stack_mail['admin_email'].'">'.$stack_mail['admin_email'].'</a><br></td></tr>'; echo '<tr><td>STACK Web URL:</td>'; echo '<td><a href="'.$stack_web_url.'">'.$stack_web_url.'</a></td></tr></table>'; ?> --- NEW FILE: rqp_util.php --- <?php /** * Stack RQP utility functions * Not part of the RQP Server/Client combo but necessary to interact with RQP * * @package stackRQP * @subpackage Stack */ // Utility functions // /** * Converts an associative array of variables into an array of key-value * objects suitable for RQP * * Creates an array of {@link RQPVar} objects from an associative array * of variables. * @param array $vars Associative array of variables. * @return array Returns an array of objects with the key property set to * the key of the corresponding entry in the vars parameter and the values * property set to the corresponding value. */ function MakeRQPVars($vars) { if (!count($vars)) return array(); array_walk($vars, create_function('&$val, $key', '$obj->identifier = $key; $obj->values = (is_array($val) ? array_values($val) : array($val)); $val = $obj;')); return array_values($vars); } /** * Converts an array of name-value objects as used by RQP into an * associative array of variables. * * Creates an associative array of responses from an array of * {@link RQPInput} objects. * @param array $vars Array of {@link RQPInput} objects. * @return array Returns an associative array with the key of each element * set to the name property of the corresponding object and the value set to * the value property of the corresponding object. */ function FlattenRQPInputs($vars) { if (!is_array($vars)) return array(); $return = array(); foreach ($vars as $var) { $var = (object) $var; // sort out nuSOAP encoding weirdness if (!empty($var->name)) { $return[$var->name] = $var->value; } } return $return; } /** * Converts an array of key-value objects as used by RQP into an * associative array of variables. * * Creates an associative array of variables from an array of {@link RQPVar} * objects. * @param array $vars Array of {@link RQPVar} objects. * @return array Returns an associative array with the key of each element * set to the key property of the corresponding object and the value set to * the values property of the corresponding object. */ function FlattenRQPVars($vars) { if (!is_array($vars)) return array(); $return = array(); foreach ($vars as $var) { $var = (object) $var; // sort out nuSOAP encoding weirdness if (!empty($var->identifier)) { if (1 === count($var->values)) $return[$var->identifier] = $var->values[0]; else $return[$var->identifier] = array_values($var->values); } } return $return; } /** * Interprets source for the all operations which need it. * * @param string $source The item source. * @return array $item The item is returned. */ function source_handler($source, &$format, &$errors, $item_information=FALSE) { global $stack_web_url; $item = NULL; // No source supplied if ('' == trim($source)) { //return MakeRQPFault(MakeRQPError('emptySource', 'No item source supplied.'), 'No item source supplied.'); return 'No item source supplied' } // We need to use the source supplied, and had beter interpret the format. if ('' === $format) { // format not specified; we are asked to make our best guess if (stristr($source,'<assessmentItem>')) { $format = STACK_URI_FORMAT_XML; } else { $format = STACK_URI_FORMAT_FLAT; } } switch ($format) { case STACK_URI_FORMAT_XML: $itemTemp = stack_xml_parse_question_string($source); $item = $itemTemp['assessmentItem']; $questionBody = addslashes(base64_serialize($itemTemp)); break; case STACK_URI_FORMAT_FLAT: $questionBody = $source; $item = stack_db_decodebody($questionBody); break; default: // Invalid format return MakeRQPFault(MakeRQPError('unknownFormat', '`' . $format . '\' is not a format which STACK can use.'), 'Unknown source format.'); } // By this stage we should have an $item. // Validate item $errors = array(); stack_question_validate($item,$errors); // HACK: throwing a SOAP error here will break the itemInformation operation..... if (count($errors) > 0) { // $errstr should be generated on the client side // $errstr = stack_question_errstr($errors); if (!$item_information) return MakeRQPFault(MakeRQPError('invalidSource', 'The item is invalid.', $errors)); } // HACK: Items no longer need GUIDS so just generate one if it is not set if (empty($item['questionGUID'])) { $item['questionGUID'] = stack_generate_guid($stack_web_url); } $item['questionID'] = 0; // For test and RQP questions only return $item; } /** * Creates an RQP error object. * * An {@link RQPError} object is created to represent the error condition. * @param string $id The identifier for the error (this will be prefixed * with the error URI). * @param string $description Human readable description of the error * reprensented by the id. * @param mixed $detail Machine readable information about the error. * @return RQPError The error object created. */ function MakeRQPError($id, $description='', $detail='') { $error = new RQPError; $error->identifier = RQP_URI_ERROR . $id; $error->message = $description; $error->detail = $detail; return $error; } /** * Checks if a value is an RQP error object. * * The value is tested for being an object and if it is an object for being * of class {@link RQPError}. * @param mixed $value The value to be tested. * @return boolean Returns true if the value is an object of class * {@link RQPError}, false otherwise. */ if (floor(phpversion()) > 4) { function IsRQPError($value) { if (is_object($value)) { if ('RQPError' === get_class($value)) { return true; } } return false; } } else { // get_class returns the class name in lowercase under PHP 4 function IsRQPError($value) { if (is_object($value)) { if ('rqperror' === get_class($value)) { return true; } } return false; } } class /** * Creates an RQP style SOAP fault object. * * Creates a SOAP fault object with an RQP error object describing the * error using the SOAP detail field. * @param object $error The {@link RQPError} object describing the error. * @param string $description Human readable description of the error * reprensented by the id field of the error object. * @return SoapFault The SOAP fault object. */ function MakeRQPFault($error, $description='') { $errorID = substr($error->id, strlen(RQP_URI_ERROR)); switch ($errorID) { case 'emptySource': case 'unknownFormat': case 'invalidSource': case 'invalidTemplateVariables': $who = 'Client'; break; default: $who = 'Server'; break; } if (empty($description)) $description = $errorID; return make_soap_fault($who, 'RQP error: '.$description, '', $error); } ?> --- NEW FILE: nb_easyxml_lite.php --- <?PHP /*!< This set of classes and function is to provide a simple method of * dealing with XML that does not depend on optional libraries */ define("START_TAG",1); define("END_TAG",2); define("CLOSED_TAG",3); define("CONTENT",4); define("XML_ERROR",0); define("XML_DECLARATION",5); // <?xml define("XML_DOCTYPE",6); // <!DOCTYPE ... > define("XML_INSTRUCTION",7); // <? define("XML_CDATA",8); // <[CDATA[ ... ]]> define("XML_COMMENT",9); // <!-- ... --> /*! Base class from which tag and content classes are derived. Never used directly. */ class nb_xml_part{ var $type; //!< Indicates the type of entity - tag, content etc. var $depth; //!< Indicates how deep in the xml tree this entity is. //! A 'pure virtual' function. Derived classes impliment their own version. function dump() { return "<font color='red'>This should never be called!</font><br>"; } }; //! Class for tags in the list of the XML. class nb_xml_tag extends nb_xml_part{ var $tagname; //!< The name of the tag, no namespace prefix var $attribs; //!< An associative array containing attributes keyed by name var $cleansource; //!< the tidy source for the tag. // Next four lines added 28Jun05 NSFB var $nsURI; //!< The namespace URI of the tag if it exists var $nsPrefix; //!< The namespace prefix of the tag if it was used // this is only really meaningful in start elements, potentially used in closed though var $nsDetail; //!< an array of namespaces declared here ['!'] used as prefix for default; /*! Constructor takes a XML tag (without < >) sets $tagname, * $type (START_TAG|END_TAG|CLOSED_TAG), and $attribs, * an associative array of attributes. */ function nb_xml_tag($tagsource) { // initialise to default values $this->nsDetail = array(); $this->nsPrefix = ""; $this->nsURI = false; // "" would be empty, false is undefined // tidy up the ends and make sure the < and > are gone. $tagsource=trim($tagsource); if($tagsource[0]=="<") { $tagsource = substr($tagsource,1); } if($tagsource[strlen($tagsource)-1]==">") { $tagsource = substr($tagsource,0,strlen($tagsource)-1); } $tagsource=trim($tagsource); $this->cleansource=$tagsource; // now check what sort of tag it is... // echo $tagsource[0]; // debug switch($tagsource[0]) { case '?': if(substr($tagsource,0,4)=="?xml"){ $this->type = XML_DECLARATION;} else{ $this->type = XML_INSTRUCTION;} break; case '!': if(substr($tagsource,0,8)=="!DOCTYPE"){ $this->type = XML_DOCTYPE;} elseif(substr($tagsource,0,3)=="!--"){ $this->type = XML_COMMENT;} else{ $this->type = XML_ERROR;} break; case '[': if(substr($tagsource,0,7)=="[CDATA["){ $this->type = XML_CDATA;} else{ $this->type = XML_ERROR;} break; case '/': $this->type = END_TAG; $this->tagname = substr($tagsource,1); // split off namespace part if it exists, added 28Jun05 NSFB if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; break; default: //it's a normal tag! if($tagsource[strlen($tagsource)-1]=='/'){ $this->type = CLOSED_TAG; $tagsource = substr($tagsource,0,strlen($tagsource)-1); } else{ $this->type = START_TAG;} // need to extract name and attributes here. if(strpos($tagsource," ")==false) { $nm=$tagsource; $attrs=""; } else list($nm,$attrs)=explode(" ",$tagsource,2); $attrs = preg_replace("/\s+/"," ",$attrs); $attrs = str_replace("= \"","=\"",$attrs); $attrs = str_replace(" =\"","=\"",$attrs); $attrs=trim($attrs); while(strlen($attrs)>2) { if((strpos($attrs," ")!==false)&&((strpos($attrs," ")<strpos($attrs,"=")))) //== would indicate end of attribs, no val { list($attrname,$attrs)=explode(" ",$attrs,2); $attrval=true; } else { list($attrname,$attrs)=explode("=",$attrs,2); $echar=$attrs[0]; $attrs=trim($attrs); if(($echar=="\"")||($echar=="'")) { $attrs = substr($attrs,1); list($attrval,$attrs)=explode($echar,$attrs,2); } else list($attrval,$attrs)=explode(" ",$attrs,2); if($attrval=="") $attrval=true; } $this->attribs[trim($attrname)]=$attrval; $attrs=trim($attrs); // do the namespace collecting stuff, added 28Jun05, NSFB if(strpos($attrname,":")!==false) list($attrname, $prefix) = explode(":",$attrname,2); else $prefix = ""; // so there's a key use this instead of ""; if($attrname=="xmlns") { $this->nsDetail[$prefix] = trim($attrval); } // end of namespace collecting stuff } $this->tagname = $nm; if(strpos($this->tagname,":") !== FALSE) list($this->nsPrefix,$this->tagname) = explode(":",$this->tagname,2); else $this->nsPrefix = ""; // alocate namespace URI if possible , added 28Jun05, NSFB if(array_key_exists($this->nsPrefix,$this->nsDetail)) $this->nsURI = $this->nsDetail[$this->nsPrefix]; break; } } /*! Creates a tidy version of the tag for output. Start, end and closed tags are all correctly formated. Attributes will not nessesaraly be in the original order. \return A string containing the well formated tag. */ function dump() { switch($this->type) { case START_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } return $rstr.">"; break; case CLOSED_TAG: $rstr = "<".$this->tagname; if(is_array($this->attribs)) { while (list($akey, $aval)=each($this->attribs)) { if(strstr($aval,"\"")===false){ $rstr .= " ".$akey."=\"".$aval."\"";} else{ $rstr .= " ".$akey."='".$aval."'";} } } else { if(strlen($this->attribs)>0){$rstr .= " ".$this->attribs;} } return $rstr."/>"; break; case END_TAG: return "</".$this->tagname.">"; break; default: return "<".$this->cleansource.">"; break; } } }; /*! Class for content in the XML list - content is everything between tags, but does not include child tags, they become the next item in the list. */ class nb_xml_content extends nb_xml_part{ var $content; /*! constructor takes the content and sets the block type. \param $source is the content. */ function nb_xml_content($source) { $this->content = $source; $this->type = CONTENT; } //! returns the content. function dump() { return $this->content; } } /*! The main class of the XML library reads in XML and provides methods for manipulating it. The XML is held as a list of tags and content, each with a type and depth. */ class nb_easyxml { var $entities; var $source; // C++ private: equiv /*! Get a 'block' of xml from $this->source, either a tag or DATA/CDATA starting * from $point, update point to first char after the 'block' */ function getblock(&$point) { if($this->source[$point]=='<') { //print("<br>tag at $point<br>");//debug switch($this->source[$point+1]) { case '?': $estr = '?'.'>'; // split to be nice to PHP parser; break; case '!': if(substr($this->source,$point+1,3)=="!--"){ $estr = "-->";} elseif($this->source[$point+2]=="["){ $estr = "]]>";} else{ $estr = ">";} break; default: $estr = ">"; break; } $epoint = strpos($this->source,$estr,$point); if($epoint === false) { $point = strlen($this->source); return ""; } $epoint += strlen($estr); $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } else { $epoint = strpos($this->source,'<',$point); if($epoint === false) { $epoint = strlen($this->source); } $block = substr($this->source,$point,$epoint-$point); $point = $epoint; return $block; } } // C++ protected: equiv /*! Parses XML into the list and does a limited amount of checking. Not really intended to be used from outside the library. \param $source is the xml to be parsed. */ function parsein($source) { $this->entities=""; // this clears out old data. $this->source = $source; $prspt=0; // counter for where in the xml the parser has got to (PaRSe PoinT). $level=0; // how far down the xml tree I am! $nsInfo = array(); // namespace allocation array while($prspt < strlen($this->source)) { $block = $this->getblock($prspt); $printblk = htmlentities($block); // echo "<p><b>".$prspt."</b> ".strlen($block)."<br>".$printblk."</p>";//debug if($block[0] == '<') { $tagcls = new nb_xml_tag($block); $tagcls->depth = $level; if($tagcls->type== START_TAG) { $tagatlev[$level]=$tagcls->tagname; //printf("At level $level got tag '$tagcls->tagname'<br>"); // debug // store namespace info $nsInfo[$level] = $tagcls->nsDetail; $level++; $testlev = $level - 1; // no need to test this level as tag parser does it. while(($tagcls->nsURI === false)&&($testlev >= 0)) { if(array_key_exists($tagcls->nsPrefix, $nsInfo[$testlev])) $tagcls->nsURI = $nsInfo[$testlev][$tagcls->nsPrefix]; $testlev--; } //printf("At level $level got tag '$tagcls->tagname' in namespace {$tagcls->nsURI}<br>"); // debug } $this->entities[] = $tagcls; //$sz = sizeof($this->entities); //debug //echo $this->entities[$sz-1]->depth.": tag - ".$tagcls->tagname."<br>"; // debug if($tagcls->type== END_TAG) { $level--; if($tagatlev[$level]!=$tagcls->tagname) { die("XML error - unmatching start and end tags (/".$tagatlev[$level]." expected, found /".$tagcls->tagname.")"); } } } else { $tblock = trim($block); if($tblock != "") // eliminate all whitespace blocks. { $contcls = new nb_xml_content($block); $contcls->depth = $level; $this->entities[] = $contcls; //echo $contcls->depth.": some content<br>"; // debug } } } } /*! Finds the root tag of the xml. \return the index of the root tag. */ function root() { $index=0; while(($index<=sizeof($this->entities))&&($this->entities[$index]->type!=START_TAG)) { $index++; } if($index<=sizeof($this->entities)){ return $index;} else{ return false;} } /*! Finds the index of the first occurence of a tag after an index point. \param $tagnm is the tag name to search for \param $startpt is the point to start the search from (defaults to 0) \return the index of the first occurence of the tag or false */ function findElement($tagnm, $startpt=0, $namespace = false) { $n = $startpt; $found = false; while(($n < sizeof($this->entities))&&($found===false)) { if(($this->entities[$n]->type==START_TAG)&&($this->entities[$n]->tagname==$tagnm)) { if(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) $found=true; } if($found==false) $n++; } if($found===true){ return $n; } else{ return false;} } function getContent($idx) { if($this->entities[$idx]->type==CLOSED_TAG) return ""; elseif($this->entities[$idx]->type==START_TAG) { $n = $idx+1; $rstr = ""; while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$idx]->depth)) { if($this->entities[$n]->type==CONTENT) //# need to deal with CDATA too { $rstr .= $this->entities[$n]->dump(); } $n++; } return $rstr; } else return false; } /*! Finds either an immediate child or a peer (same depth) tag. If $tagnm is "" (default) the first child or peer tag is returned, otherwise only one with a matching name. This is the basic function for FindChildTag, FindNextPeerTag etc. This should be considered private, nicer functions exist that call this. \return index of the found tag or false. */ function findclosetag($parent, $tagnm="", $child=false, $namespace=false) { if($parent===false) die("false passed as parent in findclosetag"); $n = $parent+1; $seekdepth=$this->entities[$parent]->depth; //echo "$n parent [$parent], depth $seekdepth;<br>"; if($child) $seekdepth++; $found = false; while(($n < sizeof($this->entities))&&($found===false)&&($this->entities[$n]->depth>=$seekdepth)) { if((($this->entities[$n]->type==START_TAG)|| ($this->entities[$n]->type==CLOSED_TAG)) &&($this->entities[$n]->depth==$seekdepth) &&(($tagnm=="")||($this->entities[$n]->tagname==$tagnm)) &&(($namespace==false)||($namespace==$this->entities[$n]->nsURI)) ){ $found=true;} else{ $n++;} } if($found===true){ return $n; } else{ return false;} } /*! Finds imediate child tags of a particular tag (indicated by index). The tag index returned will either be the first child tag, or the first with a particular name. \param $parent is the index of the tag to find children of. \param $tagnm if provided is the tagname of child to search for. \return the index of the child tag or false */ function findChildElement($parent, $tagnm="", $namespace=false) { return $this->findclosetag($parent, $tagnm, true, $namespace); } /*! Finds the next peer tag of a particular tag (indicated by index) The tag index returned will either be the first peer tag, or the first with a particular name. \param $searchfrom is the index of the tag to search from. \param $tagnm is the tagname of peer to search for - if not given returns the first child index \return the index of the child tag or false */ function findNextPeer($searchfrom, $tagnm="", $namespace=false) { return $this->findclosetag($searchfrom, $tagnm, false, $namespace); } /*! Converts a block into a string of XML. The block goes from the start tag index provided to the matching end tag. \param $tagnum is the index of the start tag of the block to be dumped \return a string containing the block of XML */ function dumpblock($tagnum) { if($tagnum===false) return ""; $n = $tagnum+1; $rstr = $this->entities[$tagnum]->dump(); while(($n < sizeof($this->entities))&&($this->entities[$n]->depth > $this->entities[$tagnum]->depth)) { $rstr .= $this->entities[$n]->dump(); $n++; } return $rstr; } function getName($index) { return $this->entities[$index]->tagname; } function getNamespace($index) { return $this->entities[$index]->nsURI; } function getAttribute($index, $attribname) { if((is_array($this->entities[$index]->attribs))&&(array_key_exists($attribname,$this->entities[$index]->attribs))) return $this->entities[$index]->attribs[$attribname]; else return ""; } }; function nb_easyxmldoc($inp) { $dom = new nb_easyxml; $dom->parsein($inp); return $dom; } ?> --- NEW FILE: admindocs-menu.txt --- // DEMO MENU CONFIGURATION FILE // // level // text // link // target // .menu_QB|question_bank.php?action=questionbank_screen ..menu_New|question_bank.php?action=edit_new ..menu_Import|import.php?action=import .menu_Quizzes|editquiz.php?action=quiz_choose ..menu_New|editquiz.php?action=quiz_new ..menu_Import|import.php?action=import .menu_Reporting|analysis.php .menu_User|user.php .menu_Logout|index.php?action=logout .menu_Help|documentation.php ..menu_Author|documentation.php?action=author_gettingstarted ..menu_Syntax|documentation.php?action=author_commonsyntax ..menu_Qfields|documentation.php?action=author_questionfields ..menu_Options|documentation.php?action=author_options ..menu_AnswerT|documentation.php?action=author_answertest ..menu_TestSuite|documentation.php?action=author_testsuite ..menu_PR|documentation.php?action=author_potresp ..menu_FAF|documentation.php?action=author_factsformula ..menu_FAQ|documentation.php?action=author_faq ..menu_Maxima|documentation.php?action=author_maxima ..menu_CAS_Fn|documentation.php?action=functions .menu_About|documentation.php?action=about_general ..menu_Install|documentation.php?action=about_install ..menu_Develop|documentation.php?action=about_develop ..menu_CAS_OL|chat.php ..menu_CAS_OLML|chat.php ..menu_Forum|http://mantis.york.ac.uk/moodle/course/view.php?id=21|_blank ..menu_Sourceforge|http://sourceforge.net/projects/stack|_blank ..menu_Contact|mailto:ch...@sa... .menu_logo|documentation.php?action=logo --- NEW FILE: RQPv1p0Server.php --- <?php include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); //include("rqp_util.php"); //Stack/RQP utility functions include("../../stackstd.php"); //Reqd for version info for STACK /********* Data structures used by this web service ********* * * type ServerInformationDType{ * ['type']=>string * ['version']=>string * ['rqpVersion']=>string * ['details']=>anyURI * ['studentDocs']=>anyURI * ['teacherDocs']=>anyURI * ['adminDocs']=>anyURI * ['serverProperties']=>array({ * ['key']=>string [...1712 lines suppressed...] else $ret .= $this->soapify_anyURI($input, "anyURI") . "\n"; $ret .= "</$name>\n"; return $ret; } function desoap_anyURIArray($xml, $idx, $name) { $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { $ret[] = $this->desoap_anyURI($xml, $cidx, "anyURI"); $cidx = $xml->FindNextPeer($cidx); } return $ret; } } ?> --- NEW FILE: stackDocs.php --- <?php /** Script responsible for reproducing documentation for the student in how to answer questions * Depends on the stack server's language - check from stackstd.php */ require('../../stackstd.php'); require_once("{$stack_root}/other/ListMenu.php"); //Retrieve language from stackstd: $lang = $stack_defaultlang; $lang = 'en'; $action = $_GET['action']; switch ($action) { case('student'): //Retrieve the relevent docs //include("{$stack_root}/lang/$lang/doc/student_input.php"); $menu = new ListMenu('/'.$stack_basepath.'/scripts/rqp/studentdocs-menu.txt'); $menu->printMenu(); break; case('admin'): include("{$stack_root}/lang/$lang/doc/author_gettingstarted.php"); break; case('teacher'): echo("Teacher docs here"); break; default: echo("What to do when no action supplied?"); break; } //Generate HTML for a back button echo '<FORM> <INPUT type="button" value="Back to Moodle" onClick="javascript:history.back()"> </FORM>' ?> |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:32
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/scripts/maxima Modified Files: stackmaxima.mac Added Files: complexj.lisp Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** stackmaxima.mac 17 Aug 2005 11:35:36 -0000 1.26 --- stackmaxima.mac 25 Aug 2005 16:06:17 -0000 1.27 *************** *** 19,22 **** --- 19,24 ---- FPPREC:16; /* Work with 16 digits */ + ASSUME_POS:TRUE; + %E_TO_NUMLOG:TRUE; /* "r" some rational number, and "x" some expression, %E^(r*LOG(x)) => x^r .*/ *************** *** 78,81 **** --- 80,86 ---- load("stacktex.lisp"); /* Loads LaTeX adaptions and preferences */ + complexj:TRUE; + if complexj then (j:%i,load("complexj.lisp")) else i:%i; /* Makes a complex j if needed */ + /* ARRGH! */ /* texput("<<",[" {\\color{red} ", " } ", " " ],matchfix); */ *************** *** 205,209 **** plot(ex,[ra]) := /*stack_web_plot*/ ! BLOCK([tfn,afn,ufn,lvs,preamble,sysp,sysr,filename], lvs:listofvars(ex), if length(lvs)#1 then --- 210,215 ---- plot(ex,[ra]) := /*stack_web_plot*/ ! BLOCK([tfn,afn,ufn,lvs,ffmt,preamble,sysp,sysr,filename], ! ffmt:"gif", lvs:listofvars(ex), if length(lvs)#1 then *************** *** 211,219 **** filename:CONCAT("stackplot",string(rand(10^8))), tfn:CONCAT(TMP_IMAGE_DIR,filename,".plt"), ! afn:CONCAT("'",IMAGE_DIR,filename,".png","'"), ! if OPT_OUTPUT="MathML" then ! ufn:CONCAT(" <center><img src='",URL_BASE,filename,".png' alt='STACK autogenerated plot' /></center> ") ! else ! ufn:CONCAT(" <html><center><img src='",URL_BASE,filename,".png' alt='STACK autogenerated plot' /></center></html> "), /* Removed on Windows: cd '",IMAGE_DIR,"' */ --- 217,224 ---- filename:CONCAT("stackplot",string(rand(10^8))), tfn:CONCAT(TMP_IMAGE_DIR,filename,".plt"), ! afn:CONCAT("'",IMAGE_DIR,filename,".",ffmt,"'"), ! ufn:CONCAT(" <center><img src='",URL_BASE,filename,".",ffmt,"' alt='STACK autogenerated plot' /></center> "), ! if OPT_OUTPUT#"MathML" then ! ufn:CONCAT(" <html>",ufn,"</html> "), /* Removed on Windows: cd '",IMAGE_DIR,"' */ *************** *** 221,225 **** set zeroaxis set grid ! set terminal png transparent size 450,300 set output ",afn), --- 226,230 ---- set zeroaxis set grid ! set terminal ",ffmt," transparent size 450,300 set output ",afn), *************** *** 558,562 **** /* An answer test based expandp(sa). */ ! ATExpanded(SA) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str], RawMark:0, FeedBack:"", AnswerNote:"", --- 563,568 ---- /* An answer test based expandp(sa). */ ! /* Note, the TA is a dummy to allow one mechanism for calling functions */ ! ATExpanded(SA,TA) := BLOCK([KEEPFLOAT,RawMark,FeedBack,AnswerNote,str], RawMark:0, FeedBack:"", AnswerNote:"", --- NEW FILE: complexj.lisp --- ;; Customize Maxima's TEX() function. ;; Make %i print at a "j" ;; Chris Sangwin 19 August Jan 2005. ;; Useful files: ;; \Maxima-5.9.0\share\maxima\5.9.0\share\utils\mactex-utilities.lisp ;; \Maxima-5.9.0\share\maxima\5.9.0\src\mactex.lisp (defprop $%i "j" texword) |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:32
|
Update of /cvsroot/stack/stack-1-0/scripts/CASpool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/scripts/CASpool Modified Files: stackProcess.php Removed Files: stackRequest.php stackSocket.php startsocket.php stopsocket.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: stackProcess.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/CASpool/stackProcess.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackProcess.php 13 Mar 2005 15:44:27 -0000 1.2 --- stackProcess.php 25 Aug 2005 16:06:17 -0000 1.3 *************** *** 1,571 **** <?php - /** - * These classes send and receive data from an external process (e.g. CAS, TTH). - * - * @package lib - * @subpackage Stack - */ - - /** - * - */ - include_once("{$stack_root}/scripts/CASpool/stackCAS.php"); - - /** - * - */ - include_once("{$stack_root}/scripts/CASpool/stackRequest.php"); - - /** - * The base class to support communication with an external process. - * - * @see CASProcess - * @see TexProcess - * @package lib - * @subpackage Stack - */ - class StackProcess { - /** - * @var string $cpCmd Command to start the process - */ - var $cpCmd; - /** - * @var array $cpDescriptors Describes the communication pipes - */ - var $cpDescriptors; - /** - * @var array $cpPipes Pipes for stdin/stdout - */ - var $cpPipes; - /** - * @var resource $cpProcess The established communication process - */ - var $cpProcess; - - /** - * Constructor - * - * Initialises $cpCmd and $cpDescriptors. - * - * @param string $cmd Command to start the process - * @param array $descriptors Describes the communication pipes - * @return void - */ - function StackProcess($cmd, $descriptors) { - $this->cpCmd = $cmd; - $this->cpDescriptors = $descriptors; - } - - /** - * Opens communication with external process. - * - * @return boolean true if connected successfully, false otherwise - */ - function CPInitialise() { - $this->cpProcess = proc_open($this->cpCmd,$this->cpDescriptors, $this->cpPipes); - - if(is_resource($this->cpProcess)) { - return TRUE; - } else { - return FALSE; - } - } - - /** - * Send an interrupt signal to the external process. - * - * @return void - */ - function CPInterrupt() { - // retrieve status information into an array - $proc_array = proc_get_status($this->cpProcess); - // if the process is still running, send an interrupt - if ($proc_array['running']) { - // send interrupt signal (equivalent to keyboard Ctrl-C) - posix_kill($proc_array['pid'], SIGINT); - } - } - - /** - * Send and receive data from external process. - * - * Each child class must implement this function. - * - * @param StackRequest $request - * @return StackResponse - */ - function CPSend($request) { - } - - /** - * Closes communication with external process. - * - * @return void - */ - function CPClose() { - // only attempt to close if there is a connection - if (is_resource($this->cpProcess)) { - proc_close($this->cpProcess); - } - } - } - - /** - * Class to support communication with a TeX-HTML converter. - * - * @package lib - * @subpackage Stack - */ - class TexProcess extends StackProcess { - - /** - * Constructor - * - * Initialises $cpCmd and $cpDescriptors according to values set in stacksettings.inc - * - * @see StackProcess::StackProcess() - * @return void - */ - function TexProcess() { - // read values from stacksettings.inc - global $stack_logfiles; - global $stack_latex; - - $descriptors = array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('file', $stack_logfiles."tex_errors.txt", 'a')); - - parent::StackProcess($stack_latex['command'], $descriptors); - } - - /** - * Opens communication with external process. - * - * @see StackProcess::CPInitialise() - * @return boolean true if connected successfully, false otherwise - */ - function CPInitialise() { - $ret = parent::CPInitialise(); - return $ret; - } - - /** - * Send and receive data from stdin and stdout. - * - * Possible error: - * -'TEX-INVALID' if received from unknown source - * - * @param StackRequest $request Expecting $crType 'TEXCOMMAND', $crData contains TeX string to convert - * @return StackResponse $response $crReturn contains converted HTML string - */ - function CPSend($request) { - - $ret=''; - // write the data from the StackRequest object to stdin - if (strcmp($request->crType, 'TEXCOMMAND') == 0) { - fwrite($this->cpPipes[0], $request->crData); - fclose($this->cpPipes[0]); - - // read output from stdout - while (!feof($this->cpPipes[1])) { - $ret .= fgets($this->cpPipes[1], 1024); - } - fclose($this->cpPipes[1]); - - // create StackResponse object with returned results - $response = new StackResponse(); - $response->crData = trim($ret); - } else { - // invalid request - $response->crError['TEX-INVALID'] = TRUE; - } - - return $response; - } - } - - /** - * Class to support communication with an external CAS process. - * - * @package lib - * @subpackage Stack - */ - class CASProcess extends StackProcess { - - /** - * @var StackCAS $cpCAS Holds/produces CAS-specific information - */ - var $cpCAS; - /** - * @var char $cpOutputStartChar Marks the beginning of expected CAS output - */ - var $cpOutputStartChar; - /** - * @var char $cpOutputEndChar Marks the end of expected CAS output - */ - var $cpOutputEndChar; - - /** - * Constructor - * - * Uses information from stacksettings.inc to initialise $cpCmd and $cpDescriptors. The initial - * release of STACK supports the Axiom CAS, which is available from {@link http://www.nongnu.org/axiom Axiom}. - * - * @return void - */ - function CASProcess() { - // read values from stacksettings.inc - global $stack_cas; - global $stack_logfiles; - - // determine which type of StackCAS to use - if (strcmp($stack_cas['cas'], 'axiom') == 0) { - $this->cpCAS = new Axiom(); - } else if (strcmp($stack_cas['cas'], 'maxima') == 0) { - $this->cpCAS = new Maxima(); - } else { - // CAS is not supported, so exit the application (can't do much without a CAS!) - exit('The CAS specified in stacksettings.inc is not supported'); - } - - $this->cpOutputStartChar = '['; - $this->cpOutputEndChar = ']'; - - $descriptors = array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - 2 => array('file', $stack_logfiles.'cas_errors.txt', 'a')); - - parent::StackProcess($this->cpCAS->casCommand, $descriptors); - } - - /** - * Opens communication with external process. - * - * @return boolean true if connected successfully, false otherwise - */ - function CPInitialise() { - - $ret = parent::CPInitialise(); - - if ($ret) { - // CAS process has opened successfully - // send any initialisation commands to the CAS - $initRequest = new StackRequest('INITIALISE'); - $initRequest->crData = $this->cpCAS->casInitCommand; - $this->CPSend($initRequest); - return TRUE; - } else { - // CAS could not be initialised. - return FALSE; - } - } - - /** - * Send and receive data from stdin and stdout. - * - * Possible errors: - * - CAS-INVALID : indicates syntax error with CAS Command (didn't produce expected output) - * - CAS-TIMEOUT : took more than $stack_timeout seconds to finish processing - * - * @param StackRequest $request $crData contains the command to be sent to the CAS - * @return StackResponse $response $crReturn contains the CAS' returned value - */ - function CPSend($request) { - $response = new StackResponse(); - - if ($request->crTimed) { - global $stack_timeout; - $timeout = $stack_timeout; - } else { - $timeout = 0; - } - - // write to stdin - fwrite($this->cpPipes[0], $request->crData."\n"); - fflush($this->cpPipes[0]); - - // give the CAS a chance to process uninterrupted - sleep(1); - - fflush($this->cpPipes[1]); - stream_set_blocking($this->cpPipes[1], FALSE); - - // counters to keep track of the number of start and end characters - $left_char = 0; - $right_char = 0; - - $now = time(); - // read one character at a time until the output starting character is reached - // or until timeout - do { - $current = time(); - - if (($timeout > 0) && (($current - $now) > $timeout)) { - // character marking the start of expected output never received - // must have been a syntax error - $response->crError['CAS-INVALID'] = TRUE; - break; - } - - $ret = fread($this->cpPipes[1], 1); - //To see *exactly* what the CAS spits out: - //echo $ret; - - } while ($ret != $this->cpOutputStartChar); - - if ($response->crError['CAS-INVALID']) { - // nothing more to do, return $response with error - return $response; - } else { - // mark the beginning of the record - $response->crReturn = $this->cpOutputStartChar; - $left_char++; - $now = time(); - - // capture the output until the matching output ending character is reached - do { - $current = time(); - if (($timeout > 0) && (($current - $now) > $timeout)) { - // CAS has been evaluating for more than the prescribed value - // timeout - $response->crError['CAS-TIMEOUT'] = TRUE; - break; - } - - $ret = fread($this->cpPipes[1], 1); - //To see *exactly* what the CAS spits out: - //echo $ret; - $response->crReturn .= $ret; - - if (strcmp($ret, $this->cpOutputStartChar) == 0) { - $left_char++; - } else if (strcmp($ret, $this->cpOutputEndChar) == 0) { - $right_char++; - } - - } while ($left_char != $right_char); - - // return the response object - return $response; - } - } - - /** - * Evaluate an answer test. - * - * Possible errors: - * - TEST-UNPACK : couldn't read the data sent in the request, $crReturn contains keys of empty variables - * - TEST-UNKNOWN : an unsupported answer test was requested, $crReturn contains name of unsupported answer test - * - TEST-TIMESTAMP : output from CAS did not match with input - * - TEST-PARSE : output from CAS could not be parsed, $crReturn contains errors - * - * @param StackRequest $testRequest $crData contains answer test parameters - * @return StackResponse $testResponse $crReturn contains CAS output - */ - function CPAnswerTest($testRequest) { - // create a stackresponse object - $testResponse = new StackResponse(); - $unpackerrors = NULL; - - // $testRequest->crData contains variables - // unpack the data variables - // first check to make sure it is an array! - if (is_array($testRequest->crData)) { - foreach($testRequest->crData as $key => $val) { - if (strcmp($key, 'exp1') == 0 && isset($val)) { - $exp1 = $val; - } else if (strcmp($key, 'exp2') == 0 && isset($val)) { - $exp2 = $val; - } else if (strcmp($key, 'test') == 0 && isset($val)) { - $test = $val; - } else if (strcmp($key, 'display') == 0 && isset($val)) { - $display = $val; - } else { - $unpackerrors[] = $key; - } - } - - } else { - $testResponse->crReturn = "Expecting an array"; - $testResponse->crError['TEST-UNPACK'] = TRUE; - return $testResponse; - } - - if (is_array($unpackerrors)) { - // contains the variables that were empty - $testResponse->crReturn = $unpackerrors; - $testResponse->crError['TEST-UNPACK'] = TRUE; - return $testResponse; - } - - // get the command to send to the cas - $t = time(); - - // Hack: this should probably be a list from stackData? - $ATests = array('CASEqual','AlgEquiv','FacForm','Int','Diff'); - - if (array_search($test,$ATests,TRUE)) { - $testCommand = $this->cpCAS->CASAnsTestCmd($exp1, $exp2, $t, $display, $test); - } else { - $testResponse->crReturn = $test; - $testResponse->crError['TEST-UNKNOWN'] = TRUE; - return $testResponse; - } - - // send to CASProcess - $testRequest->crData = $testCommand; - $testRequest->crTimed = TRUE; - - // send it to the CAS - $testResponse = $this->CPSend($testRequest); - - // unparse the result - // no errors - if ($testResponse->crError === FALSE) { - - // check for the timestamp - // We need to coerce the numeric time stamp into a string. - $pos = strpos($testResponse->crReturn,"$t"); - - if (FALSE === $pos) { - $testResponse->crError['TEST-TIMESTAMP'] = TRUE; - } else { - $unp = $this->cpCAS->CASAnsTestParse($testResponse->crReturn); - - if (isset($unp['errors'])) { - - $testResponse->crReturn = $unp['errors']; - $testResponse->crError['TEST-PARSE'] = TRUE; - } else { - $testResponse->crReturn = $unp; - } - } - } - - return $testResponse; - } - - /** - * Instantiate a list of local variables. - * - * Possible errors: - * - VARS-UNPACK : request array was empty - * - VARS-CODEINST : error instantiating CAS-specific code - * - VARS-TIMESTAMP : output from CAS did not match with input - * - VARS-PARSE : output from CAS could not be parsed, any variables that could not be instantiated are restored to un-CASed value in $crReturn - * - * @param StackRequest $varRequest $crData contains the list of local variables - * @return StackResponse $varResponse $crReturn contains the instantiated values - */ - function CPProcessVars($varRequest) { - // create a StackResponse object - $varResponse = new StackResponse(); - - // local variables to be processed will be stored in - // $varRequest->crData - // generate CAS command - - $locals = $varRequest->crData['locals']; - $display = $varRequest->crData['display']; - // CJS - $seed = $varRequest->crData['randseed']; - - if (!is_array($locals)) { - // no data in $varRequest! - $varResponse->crError['VARS-UNPACK'] = TRUE; - return $varResponse; - } - - $t = time(); - $varCommand = $this->cpCAS->CASCodeInstantiate($locals, $t, $seed, $display); - - if ($varCommand != '') { - // send to CAS - $varRequest->crData = $varCommand; - $varResponse = $this->CPSend($varRequest); - - // check for errors - if ($varResponse->crError === FALSE) { - - // check timestamp - $pos = strpos($varResponse->crReturn,"$t"); // We need to coerce the numeric time stamp into a string. - if (FALSE === $pos) { - $varResponse->crError['VARS-TIMESTAMP'] = TRUE; - } else { - - $parsed = $this->cpCAS->CASParseCASOutput($varResponse->crReturn); - - // Get the CAS's values of the locals into an array. - // CJS: The whole of this foeach block has been re-written. - foreach ($locals as $lk => $locvar) { - $locals_inst[$lk] = $parsed['questionVarsInst'][$lk]; - if (isset($locals_inst[$lk]['error'])) { // There is a CAS error! - - // Get the command that went in. - $val = $locvar['value']; - if ('' == $locals_inst[$lk]['display']) { - // This must be a genuine error, since nothing is displayed. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - $locals_inst[$lk]['display'] = $val; // Restore the un-CASed value - } else if (FALSE != strstr($val,'plot')) { - // We asked for a plot, these always generate an error! (HACK) - unset($locals_inst[$lk]['error']); - $locals_inst[$lk]['display'] = $locals_inst[$lk]['value']; - } else { - // This must also be a genuine error, but keep the display, since we have it. - $locals_inst[$lk]['value'] = $val; // Restore the un-CASed value - $varResponse->crError['VARS-PARSE'] = TRUE; - } - - } - } - - $varResponse->crReturn = $locals_inst; - } - } - - } else { - $varResponse->crError['VARS-CODEINST'] = TRUE; - } - - return $varResponse; - } - - /** - * Closes communication with external process. - * - * Attempts to close CAS process nicely and terminates it if this doesn't work. - * - * @return void - */ - function CPClose() { - - if (is_resource($this->cpProcess)) { - - // write close command to stdin - fwrite($this->cpPipes[0], $this->cpCAS->casCloseCommand."\n"); - fflush($this->cpPipes[0]); - - // check to make sure it was closed - if (is_resource($this->cpProcess)) { - $proc_array = proc_get_status($this->cpProcess); - - if ($proc_array['running']) { - // kill off process - proc_terminate($this->cpProcess); - } - - fclose($this->cpPipes[0]); - fclose($this->cpPipes[1]); - - } - - parent::CPClose(); - } - } - } ?> --- 1,4 ---- --- stackSocket.php DELETED --- --- stopsocket.php DELETED --- --- stackRequest.php DELETED --- --- startsocket.php DELETED --- |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:32
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/scripts Modified Files: stackAuthor.php stackQuiz.php stackUnix.php stackUser.php stackUtility.php stackXML.php Added Files: stackCAS.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** stackAuthor.php 25 Jul 2005 14:11:25 -0000 1.29 --- stackAuthor.php 25 Aug 2005 16:06:17 -0000 1.30 *************** *** 4,7 **** --- 4,9 ---- * loaded when an edit page needs to be generated. * + * - Caters for question and quiz metadata + * * @package scripts * @subpackage Stack *************** *** 60,98 **** } - //<PDK> Added new function for stackQuestion fields - /** - * Generates the portion of the HTML question edit form for editing metadata of with an array of fields - * - * Checks that specified field is of type meta and that 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' - * - * @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 - */ - //$qfield,$question[$qfield],$errors, qfield = questionLanguage - function stack_question_edit_metadata_form($name,$opt,$optval,$sz=8) { - global $stackQuestion; - - $fields = $stackQuestion[$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 ('default'==$optval){echo " <option value='default' selected>default</option>\n";} - else {echo " <option value='default'>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"; - } - } - } - /** * Build the form to edit a list of STACK options. --- 62,65 ---- *************** *** 102,118 **** * @param array $options Their current values * @param string $fieldname The name of the field in the form - * @param boolean $fragment Is this a fragment, or a complete table? * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname,$fragment=TRUE) { global $stackOptions; ! if ($fragment) { ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! } ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); --- 69,82 ---- * @param array $options Their current values * @param string $fieldname The name of the field in the form * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname) { global $stackOptions; ! echo "<table cellpadding='4'><tr> ! <td> <b>".get_string('stackQuestion_questionOptions','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_value','stack')."</b> </td> ! <td> <b>".get_string('stackOptions_edit_default','stack')."</b> </td></tr>"; ! foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt); *************** *** 121,125 **** echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } --- 85,89 ---- echo "\n<tr>\n"; if ('' != $category) { ! echo " <td> <strong>$category</strong> </td>\n</tr>\n</tr>\n"; } *************** *** 138,144 **** } ! if ($fragment) { ! echo "\n</table>\n\n\n"; } } --- 102,129 ---- } ! echo "\n</table>\n\n\n"; ! } ! ! ! /** ! * Build an array which contains either the values of the options, or the ! * string "default" ! * ! * @param array $options The options array ! * @return array $optval The array to be displayed. ! */ ! function stack_options_formvals_set($options) { ! global $stackOptions; ! ! // Sort out the values of the options. ! foreach ($stackOptions as $opt => $fields) { ! $optval[$opt] = 'default'; ! // Sort out if a value has been set explicitly in the question. ! if (array_key_exists($opt,$options)) { ! $optval[$opt] = $options[$opt]; ! } } + + return $optval; } *************** *** 175,178 **** --- 160,184 ---- } + function stack_question_edit_form_rqp($question,&$errors,$PostTo = '') { + global $_PHP_SELF; + + $html = ''; + //show_array($question); + + if (empty($PostTo)) { + $PostTo=$_PHP_SELF; + } + + // Timestamp this edit + $html .= "<form name='stackeditqform' action='$PostTo' method='POST'>\n"; + + $html .=stack_question_edit_form_substance_rqp($question,$errors); + + $html .= "<input type='hidden' name='action' value='' />\n"; + $html .= "<submit name='dummy' value=''>"; + $html .= "</form>\n\n\n"; // form in which questions are edited. + + return $html; + } /** *************** *** 184,220 **** * @return void */ ! function stack_question_edit_form_substance($question,&$errors) { global $stack_stand_alone,$stackQuestion,$stackOptions,$debug,$user; $t=time(); $dts = strftime('%c',$t); // Format the string. ! // Sort out the values of the options. ! foreach ($stackOptions as $opt => $fields) { ! $optval[$opt] = ''; ! // Sort out if a value has been set explicitly in the question. ! if (array_key_exists('questionOptions',$question)) { // option set in question ! if (is_array($question['questionOptions'])) { ! if (array_key_exists($opt,$question['questionOptions'])) { ! $optval[$opt] = $question['questionOptions'][$opt]; ! } } } ! // In every other case.... ! if (''==$optval[$opt]) { ! $optval[$opt] = 'default'; } } ! // Add all the metadata to the question. ! // <PDK> Added hidden metadata here echo "\n<hr />\n <input type='hidden' name='questionID' value='".sf($question,'questionID')."' />\n <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='questionType' value='".sf($question,'questionType')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n <table cellboarder='0' cellpadding='2'> --- 190,426 ---- * @return void */ ! function stack_question_edit_form_substance_rqp($question,&$errors) { global $stack_stand_alone,$stackQuestion,$stackOptions,$debug,$user; $t=time(); $dts = strftime('%c',$t); // Format the string. + $html = ''; ! if (array_key_exists('questionOptions',$question)) { // option set in question ! $question_options = $question['questionOptions']; ! } else { ! $question_options = array(); ! } ! $optval = stack_options_formvals_set($question_options); ! ! // Add all the metadata to the question ! ! // hidden metadata ! $html .= "\n<hr />\n ! <input type='hidden' name='questionID' value='".sf($question,'questionID')."' />\n ! <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n ! <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionUserLastEdited' value='".sf($question,'questionUserLastEdited')."' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='type' value='".sf($question,'type')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! ! <table cellboarder='0' cellpadding='2'> ! <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> ! <td><input type='input' name='questionName' value='".sf($question,'questionName')."' size='25' /> (ID: ".sf($question,'questionID').") </td> </tr> ! <tr> <td>".get_string('stackQuestion_questionDescription','stack','').":</td> ! <td><input type='input' name='questionDescription' value='".sf($question,'questionDescription')."' size='60' /></tr> ! <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> ! <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> ! ! </table> "; ! ! // HACK: the field type in the database does not ! // allow these to be edited yet. ! // <tr> <td> Last edited by: </td> ! // <td> <input type='input' name='questionUserLastEdited' value='".stack_s($question['questionUserLastEdited'])."' size='40' /> on $dts.</td> ! // </tr> ! ! $html .= "\n<hr />\n"; ! ! // Buttons to go somewhere next ! if ($stack_stand_alone) { ! $html .= "<a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; ! if (''==$errors) { ! $html .= "<a href=\"javascript:EditQ('preview')\">Try question</a> \n"; ! $html .= "<a href=\"javascript:EditQ('export_xml')\">Export as XML</a> \n"; ! if ('admin'==$user['username']) { ! $html .= "<a href=\"javascript:EditQ('save')\">Store question</a>\n ! <a href=\"javascript:EditQ('save_as')\">Store as a new question </a>\n"; } } ! $html .= "</p>"; ! } ! ! // Add the meat of the question. ! $qfield='questionVarsRaw'; ! $html .= "<b>".stack_question_edit_dispquestionfield($qfield)."</b><br />"; ! ! // Replace all \n's with ;'s ! if (array_key_exists($qfield,$question)) { ! $strout = str_replace(";","\n",$question[$qfield]); ! } else { $strout = ''; } ! stack_question_edit_form_field($qfield,$strout,$errors); ! $html .= "\n\n<br />\n"; ! ! $qfield='questionStem'; ! $html .= "<b>".stack_question_edit_dispquestionfield($qfield)."</b><br />"; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! ! $html .= "<p><table align=top><tr align=top>\n"; ! if (array_key_exists('questionPotResp',$question)) { ! $html .= " <td><b>".stack_question_edit_dispquestionfield('questionAns')."</b></td>\n"; ! $html .= "<td> </td></tr>\n\n<tr align=top>\n <td align=top>"; ! $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "</td>\n <td> </td></tr>"; ! } else { ! // The questionAns and associated fields ! ! $html .= " <td><b>".stack_question_edit_dispquestionfield('questionAns')."</b></td>\n"; ! $html .= " <td><b>".stack_question_edit_dispoptionfield('AnsTest')."</b></td>\n"; ! $html .= " <td><b>".stack_question_edit_dispoptionfield('AnsTestOpt')."</b></td>\n"; ! $html .= "</tr>\n\n<tr align=top>\n <td align=top>"; ! ! $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "</td>\n <td align=top>\n"; ! ! $opt = 'AnsTest'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); ! $html .= "</td>\n <td align=top>\n"; ! ! $opt = 'AnsTestOpt'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt],20); ! $html .= "</td>\n</tr>"; ! ! $html .= "<tr align=top><td></td> ! <td>({$stackOptions['AnsTest']['default']})</td> ! <td>{$stackOptions['AnsTestOpt']['default']}</td></tr>"; ! } ! ! $html .= "<tr align=top>\n"; ! $html .= " <td> <b>".stack_question_edit_dispoptionfield('QuVal')."</b></td>\n"; ! $html .= " <td> <b>".stack_question_edit_dispoptionfield('Penalty')."</b></td>\n"; ! $html .= "<td></td><td></td></tr>\n<tr>\n <td>"; ! ! $opt = 'QuVal'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); ! $html .= " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; ! ! $opt = 'Penalty'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); ! $html .= " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; ! ! $html .= "</table></p>\n\n"; ! ! // Potential responses ! $html .= "<br /><a href=\"javascript:EditQ('edit')\">Edit</a> and add \n"; ! $html .= '<input type="input" name="questionPotResp[add]" value="0" size="3" />'; ! $html .= " potential responses<a href=\"javascript:HelpPopup('all','author_potresp');\"><img align=\"middle\" border=\"0\" height=\"17\" width=\"17\" src=\"pics/help.gif\" /></a> (distractors etc).<br />"; ! ! if (array_key_exists('questionPotResp',$question)) { ! if (array_key_exists('0',$question['questionPotResp'])) { ! // Add the AnsKey field ! $qfield='questionAnsKey'; ! $html .= '<p><b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= '</p>'; ! ! // Add the AnsVars field, isnce this may now be used. ! $qfield='questionAnsVarsRaw'; ! $html .= '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! $strout = ''; ! if (array_key_exists($qfield,$question)) { ! $strout = str_replace(";","\n",$question[$qfield]); ! } ! @stack_question_edit_form_field($qfield,$strout,$errors); ! $html .= "\n\n<br />\n"; ! ! $html .= '<p>'; ! $npr = count($question['questionPotResp']); ! foreach ($question['questionPotResp'] as $key => $potresp) { ! $potresp['order']=$key; ! @stack_question_edit_potresp($key,$potresp,$npr,$errors); ! } ! $html .= '</p>'; ! ! } // end questionPotResp ! } else { // This needs its default, non-empty value. ! $html .= "<input type='hidden' name='questionAnsKey' value='".stack_s($question['questionAnsKey'])."' />\n"; ! } ! ! $qfield='questionSol'; ! $html .= '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "\n\n<br />\n"; ! ! $qfield='questionNote'; ! $html .= '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "\n\n<br />\n"; ! ! // Buttons to go somewhere next ! if ($stack_stand_alone) { ! $html .= "<p><a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; ! if (''==$errors) { ! $html .= "<a href=\"javascript:EditQ('preview')\">Try question</a> \n"; ! $html .= "<a href=\"javascript:EditQ('export_xml')\">Export as XML</a> \n"; ! if ('admin'==$user['username']) { ! $html .= "<a href=\"javascript:EditQ('save')\">Store question</a>\n ! <a href=\"javascript:EditQ('save_as')\">Store as a new question</a>\n"; ! } } + $html .= "</p>"; } + + $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack')); + $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); + stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions'); + + $html .= "\n<hr />\n"; + + //List of metadata to display + $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', + 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); + stack_question_metadata_edit_form($question,$metadata_list); //Create all metadata fields on question form + + $html .= "\n<hr />\n"; ! return $html; ! } // end of edit_form_table ! ! /** ! * Build the substance of the form to edit a STACK question. ! * This needs to be wrapped in a <form> </form> structure. ! * ! * @param array $question The STACK question ! * @param array &$errors Repository for errors ! * @return void ! */ ! function stack_question_edit_form_substance($question,&$errors) { ! global $stack_stand_alone,$stackQuestion,$stackOptions,$debug,$user; ! ! $t=time(); ! $dts = strftime('%c',$t); // Format the string. ! ! if (array_key_exists('questionOptions',$question)) { // option set in question ! $question_options = $question['questionOptions']; ! } else { ! $question_options = array(); ! } ! $optval = stack_options_formvals_set($question_options); ! ! // Add all the metadata to the question ! ! // hidden metadata echo "\n<hr />\n <input type='hidden' name='questionID' value='".sf($question,'questionID')."' />\n <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionUserLastEdited' value='".sf($question,'questionUserLastEdited')."' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='type' value='".sf($question,'type')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n <table cellboarder='0' cellpadding='2'> *************** *** 376,450 **** } ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack'),''); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','ShowSol'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions'); echo "\n<hr />\n"; ! ! //<PDK> Insert user definable metadata here ! $qfield='questionLanguage'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! $qfield='questionLearningContext'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! ! ! $qfield='questionDifficulty'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetency'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionCompetencyLevel'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionExcerciseType'; ! $qfield_name = "question[{$qfield}]"; ! echo "<br /><b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! @stack_question_edit_metadata_form($qfield_name,$qfield,$errors); ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionTimeAllocated'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionTimeAllocated' value='".sf($question,'questionTimeAllocated')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; ! ! $qfield='questionRights'; ! $qfield_name = "question[{$qfield}]"; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b>"; ! echo "<input type='input' name='questionRights' value='".sf($question,'questionRights')."' size='20' />"; ! echo"({$stackQuestion[$qfield]['default']})";//</tr>"; ! echo "<br />"; echo "\n<hr />\n"; - } // end of edit_form_table --- 582,599 ---- } ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions'); echo "\n<hr />\n"; ! ! //List of metadata to display ! $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', ! 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); ! stack_question_metadata_edit_form($question,$metadata_list); //Create all metadata fields on question form echo "\n<hr />\n"; } // end of edit_form_table *************** *** 600,604 **** echo "<tr><td></td> <td></td><td align ='right' colspan='2'><a href=\"javascript:HelpPopup('AnswerNote','stackQuestionPotResp');\">AnswerNote</a></td>"; $strin = $potresp['true']['AnswerNote']; ! stack_question_edit_input_textfield($bname,$strin,get_string('stackQuestion_PR_AnswerNote','stack'),55,3); echo "</tr>"; --- 749,753 ---- echo "<tr><td></td> <td></td><td align ='right' colspan='2'><a href=\"javascript:HelpPopup('AnswerNote','stackQuestionPotResp');\">AnswerNote</a></td>"; $strin = $potresp['true']['AnswerNote']; ! stack_question_edit_input_textfield($bname,$strin,'AnswerNote',55,3); echo "</tr>"; *************** *** 757,783 **** */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! global $_PHP_SELF,$stackQuiz,$stackOptions; if (empty($PostTo)) { $PostTo=$_PHP_SELF; } // Timestamp this edit echo "<form name='stackquizeditform' action='$PostTo' method='POST'>\n"; ! // Edit the quiz ! echo "\n<table>\n"; ! foreach ($stackQuiz as $key => $fields) { $err = ''; ! echo "<tr><td><b>{$fields['descript']}</b></td>\n"; if ('quizid' == $key) { echo "<td><input type=\"hidden\" name=\"quiz[$key]\" value=\"{$quiz[$key]}\" alt=\"$key\" />{$quiz[$key]}</td><td>".$err.'</td></tr>'; ! } else if ('quizOptions' == $key){ ! echo '</tr>'; } else { echo "<td><input type=\"text\" name=\"quiz[$key]\" size=\"35\" value=\"".nsf($quiz,$key)."\" alt=\"$key\" /></td><td>".$err.'</td></tr>'; } ! } ! echo "\n</table>\n"; echo "<p><b>Questions attached to this quiz:</b><br />(An empty order field indicates they are attached but hidden)"; --- 906,973 ---- */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! ! //show_array($quiz); ! global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; if (empty($PostTo)) { $PostTo=$_PHP_SELF; } + + $t = time(); + $dts = strftime('%c',$t); // Format the string. + + //Does the quiz have options set? + $quiz_options = array(); + if (array_key_exists('quizOptions',$quiz)) { + if (is_array($quiz['quizOptions'])) { + $quiz_options = $quiz['quizOptions']; + } + } + $optval = stack_options_formvals_set($quiz_options); // Timestamp this edit echo "<form name='stackquizeditform' action='$PostTo' method='POST'>\n"; + + // Hidden metadata, + // Why are tags one more level deep than they should be + echo "<input type='hidden' name='quiz[quizDateLastEdited]' value='$t' />\n + + <input type='hidden' name='quiz[quizGUID]' value='".sf($quiz,'quizGUID')."' />\n + + <input type='hidden' name='quiz[quizUserLastEdited]' value='".sf($quiz,'quizUserLastEdited')."' />\n + <input type='hidden' name='quiz[quizPublisher]' value='".sf($quiz,'quizPublisher')."' />\n + <input type='hidden' name='quiz[type]' value='".sf($quiz,'type')."' />\n + <input type='hidden' name='quiz[quizFormat]' value='".sf($quiz,'quizFormat')."' />\n"; + + // Some Metadata is set at the top of the quiz form. + echo "\n<table>\n"; ! $display_fields = array('quizid','quizName','quizDescription','quizDueDate','quizKeywords'); ! foreach ($display_fields as $key) { ! //Check that within current field there is no type tag, otherwise skip $err = ''; ! echo "<tr><td><b>{$stackQuiz[$key]['descript']}</b></td>\n"; if ('quizid' == $key) { echo "<td><input type=\"hidden\" name=\"quiz[$key]\" value=\"{$quiz[$key]}\" alt=\"$key\" />{$quiz[$key]}</td><td>".$err.'</td></tr>'; ! } else if ('quizDueDate' == $key){ ! $stimestr = ''; ! if (!empty($quiz[$key])) { ! $stimestr = strftime('%c',$quiz[$key]); ! } ! echo "<td><input type=\"text\" name=\"quiz[quizDueDate_text]\" size=\"35\" value=\"$stimestr\" alt=\"$key\" /></td><td>".$err.'</td></tr>'; } else { echo "<td><input type=\"text\" name=\"quiz[$key]\" size=\"35\" value=\"".nsf($quiz,$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('QuizMode','TeacherEmail'); ! $fieldname = 'quiz[quizOptions]'; ! ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname); ! echo "<p><b>Questions attached to this quiz:</b><br />(An empty order field indicates they are attached but hidden)"; *************** *** 815,834 **** echo "<input type=\"submit\" value=\"Edit\" />\n"; - // Now add all the options. ! //Does the quiz have options set? ! $quiz_options = array(); ! if (array_key_exists('quizOptions',$quiz)) { ! if (is_array($quiz['quizOptions'])) { ! $quiz_options = $quiz['quizOptions']; ! } ! } ! ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display','ShowSol','Language'); $fieldname = 'quiz[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$quiz_options,$fieldname); // The end of the form! --- 1005,1032 ---- 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('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','AnsTest','AnsTestOpt','QuVal','Penalty','Forbid','Allow','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); $fieldname = 'quiz[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname); ! ! // Check if quiz has metadata set ! // $fieldname = 'quiz' ! $metadata_list = array('quizLanguage','quizLearningContext','quizDifficulty','quizCompetency', ! 'quizCompetencyLevel','quizTimeAllocated','quizExcerciseType','quizRights'); ! stack_quiz_metadata_edit_form($quiz, $metadata_list); + if ($stack_stand_alone) { + //echo "<a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; + //if (''==$errors) { + //echo "<a href=\"javascript:EditQ('preview')\">Try question</a> \n"; + echo "<a href=\"javascript:EditQ('export_xml')\">Export as XML</a> \n"; + //if ('admin'==$user['username']) { + //echo "<a href=\"javascript:EditQ('save')\">Store question</a>\n + // <a href=\"javascript:EditQ('save_as')\">Store as a new question </a>\n"; + //} + } + echo "</p>"; // The end of the form! *************** *** 850,854 **** */ function stack_quiz_edit(&$quiz,&$errors) { - // (0) Establish the quizid if (array_key_exists('quizid',$quiz)) { --- 1048,1051 ---- *************** *** 863,867 **** stack_options_validate($quiz['quizOptions']); } ! if (array_key_exists('questions',$quiz)) { // (2) Drop any questions no longer used. --- 1060,1064 ---- stack_options_validate($quiz['quizOptions']); } ! if (array_key_exists('questions',$quiz)) { // (2) Drop any questions no longer used. *************** *** 923,928 **** } - - } // End of if (array_key_exists('questions',$quiz)) .... --- 1120,1123 ---- *************** *** 949,953 **** } ! // (5) Update the quiz information itself stack_db_quiz_update($quiz); --- 1144,1159 ---- } ! // (5) Sort out any time stamp for the due date. ! if ('' != $quiz['quizDueDate_text']) { ! $duedate = strtotime($quiz['quizDueDate_text']); ! if ($duedate > -1) { ! $quiz['quizDueDate'] = $duedate; ! } else { ! $errors['quiz']['quizDueDate'] = '<br />Could not decode your quiz due date of '.$quiz['quizDueDate_text']; ! } ! unset($quiz['quizDueDate_text']); ! } ! ! // (\infty) Update the quiz information itself stack_db_quiz_update($quiz); *************** *** 955,957 **** --- 1161,1324 ---- } + /** + * Generates a portion of HTML which allows the editing of a particular question 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_question_edit_metadata_field($name,$opt,$optval,$default,$sz=8) { + global $stackQuestion; + //show_array($default); + $fields = $stackQuestion[$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' />";} + } + } + } + + /** + * Construct the metadata part of the question edit form + * + * @param string $question The current question being edited + * @param array $metadata_list The list of question metadata to display + * @return void + */ + function stack_question_metadata_edit_form($question,$metadata_list) + { + global $stackQuestion; + + //Create table to put 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_question_edit_dispquestionfield($metadata); //Display tag with help + $fieldname= $metadata; + + echo " <td> $descript </td>\n <td>"; + @stack_question_edit_metadata_field($fieldname,$metadata,$question[$metadata],$stackQuestion[$metadata]['default']); //Display correct UI component for field + echo "</td>\n"; + + $defval = $stackQuestion[$metadata]['default']; //Retrieve the metadata's default value + + echo " <td> $defval </td>\n</tr>\n"; + } + + echo "\n</table>\n\n\n"; + } + + /** + * Generates a portion of HTML which allows the editing of a particular quiz 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_quiz_edit_metadata_field($name,$opt,$optval,$default,$sz=8) { + global $stackQuiz; + + $fields = $stackQuiz[$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 quiz edit form + * + * @param string $question The current quiz being edited + * @param array $metadata_list The list of quiz metadata to display + * @return void + */ + function stack_quiz_metadata_edit_form($quiz, $metadata_list) + { + global $stackQuiz; + + //Create table to put quiz 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_quiz_edit_dispquizfield($metadata); //Display tag with help + $defval = $stackQuiz[$metadata]['default']; //Retrieve the metadata's default value + $fieldname= 'quiz'.'['.$metadata.']'; + + echo " <td> $descript </td>\n <td>"; + @stack_quiz_edit_metadata_field($fieldname,$metadata,$quiz[$metadata],$defval); //Display correct UI component for field + echo "</td>\n"; + + //$defval = $stackQuiz[$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 quizField, in a link generating a popup window. + * + * @param string $field The field name + * @return string The link to the popup window + */ + function stack_quiz_edit_dispquizfield($field) { + global $stackQuiz; + + $fd='stackQuiz_'.$field; + + $fd=get_string($fd,'stack',''); + $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuiz');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; + return($strout); + } + ?> Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stackQuiz.php 22 Jul 2005 12:47:41 -0000 1.5 --- stackQuiz.php 25 Aug 2005 16:06:17 -0000 1.6 *************** *** 1,197 **** ! <?php ! ! /** ! * This file contains most functions which deal with quizzes. ! * ! * @package scripts ! * @subpackage Stack ! */ ! ! /** ! * ! */ ! // 'Unique quiz ID - local mySQL value' ! $stackQuiz['quizid']['descript'] = 'Quiz ID number'; ! $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; ! ! // 'Quiz name' ! $stackQuiz['quizName']['descript'] = 'Quiz name'; ! $stackQuiz['quizName']['mysql'] = 'TINYTEXT'; ! ! // 'Quiz description' ! $stackQuiz['quizDescription']['descript'] = 'Description'; ! $stackQuiz['quizDescription']['mysql'] = 'TINYTEXT'; ! ! // 'Quiz options' ! $stackQuiz['quizOptions']['descript'] = 'Quiz options'; ! $stackQuiz['quizOptions']['mysql'] = 'TEXT'; ! ! // 'Quiz due date' ! $stackQuiz['quizDueDate']['descript'] = 'Due date'; ! $stackQuiz['quizDueDate']['mysql'] = 'int(10)'; ! ! // 'Quiz mode' ! $stackQuiz['quizMode']['descript'] = 'Mode'; ! $stackQuiz['quizMode']['mysql'] = 'TINYTEXT'; ! ! //<PDK> Quiz Metadata added - database updated ! // 'Globally unique quiz ID'; ! $stackQuiz['quizGUID']['type']='meta'; ! $stackQuiz['quizGUID']['required']='system'; ! $stackQuiz['quizGUID']['mysql']='CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters ! $stackQuiz['quizGUID']['metatag']='Identifier'; ! ! // 'Keywords'; ! $stackQuiz['quizKeywords']['type']='meta'; ! $stackQuiz['quizKeywords']['required']='optional'; ! $stackQuiz['quizKeywords']['mysql']='TINYTEXT'; ! $stackQuiz['quizKeywords']['metatag']='Keyword'; ! ! // 'Last edited by'; ! $stackQuiz['quizUserLastEdited']['type']='meta'; ! $stackQuiz['quizUserLastEdited']['required']='system'; ! $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; ! $stackQuiz['quizUserLastEdited']['metatag']='Creator'; ! ! // 'Last edited on'; ! $stackQuiz['quizDateLastEdited']['type']='meta'; ! $stackQuiz['quizDateLastEdited']['required']='system'; ! $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; ! $stackQuiz['quizDateLastEdited']['metatag']='Date'; ! ! //Publisher ! $stackQuiz['quizPublisher']['type']='meta'; ! $stackQuiz['quizPublisher']['required']='system'; ! $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; ! $stackQuiz['quizPublisher']['metatag']='Publisher'; ! ! //Type: Hidden from user ! $stackQuiz['type']['type']='meta'; ! $stackQuiz['type']['values']=array('quiz','quiz'); //Default to 'type' enumeration in XSD file ! $stackQuiz['type']['required']='optional'; ! $stackQuiz['type']['mysql']='TINYTEXT'; ! $stackQuiz['type']['metatag']='Type'; ! ! //Format: Hidden from user, selected by script ! $stackQuiz['quizFormat']['type']='meta'; ! $stackQuiz['quizFormat']['values']=array('application','audio','image', ! 'message','model','text','video', ! 'multipart'); ! $stackQuiz['quizFormat']['required']='optional'; ! $stackQuiz['quizFormat']['mysql']='TINYTEXT'; ! $stackQuiz['quizFormat']['metatag']='Format'; ! ! //Language: Defaulted to current system language, but user definable ! $stackQuiz['quizLanguage']['type']='meta'; ! $stackQuiz['quizLanguage']['values']=array('en','fr','nl','es','unspecified'); ! $stackQuiz['quizLanguage']['required']='optional'; ! $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; ! $stackQuiz['quizLanguage']['metatag']='Language'; ! $stackQuiz['quizLanguage']['default']='unspecified'; ! ! //Rights ! $stackQuiz['quizRights']['type']='meta'; ! $stackQuiz['quizRights']['required']='optional'; ! $stackQuiz['quizRights']['mysql']='TEXT'; ! $stackQuiz['quizRights']['metatag']='Rights'; ! $stackQuiz['quizRights']['default']='http://www.gnu.org/copyleft/gpl.html'; ! ! //Learning context: Defaulted to system context, but user definable ! $stackQuiz['quizLearningContext']['type']='meta'; ! $stackQuiz['quizLearningContext']['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'); ! $stackQuiz['quizLearningContext']['required']='optional'; ! $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; ! $stackQuiz['quizLearningContext']['metatag']='LearningContext'; ! $stackQuiz['quizLearningContext']['default']='unspecified'; ! ! //Difficulty: Default to null - up to user to specify this ! $stackQuiz['quizDifficulty']['type']='meta'; ! $stackQuiz['quizDifficulty']['values']=array('Very Easy','Easy','Medium', ! 'Difficult','Very Difficult','unspecified'); ! $stackQuiz['quizDifficulty']['required']='optional'; ! $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; ! $stackQuiz['quizDifficulty']['metatag']='Difficulty'; ! $stackQuiz['quizDifficulty']['default']='unspecified'; ! ! //Competency: Default to solve - then up to user ! $stackQuiz['quizCompetency']['type']='meta'; ! $stackQuiz['quizCompetency']['values']=array('think','argue','solve', ! 'represent','language','communicate', ! 'tools','unspecified'); ! $stackQuiz['quizCompetency']['required']='optional'; ! $stackQuiz['quizCompetency']['mysql']='TINYTEXT'; ! $stackQuiz['quizCompetency']['metatag']='Competency'; ! $stackQuiz['quizCompetency']['default']='unspecified'; ! ! //CompetencyLevel: Default to null - then up to user ! $stackQuiz['quizCompetencyLevel']['type']='meta'; ! $stackQuiz['quizCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', ! 'complex','unspecified'); ! $stackQuiz['quizCompetencyLevel']['required']='optional'; ! $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; ! $stackQuiz['quizCompetencyLevel']['metatag']='CompetencyLevel'; ! $stackQuiz['quizCompetencyLevel']['default']='unspecified'; ! ! //Time to allocate: Default to null - then up to user ! $stackQuiz['quizTimeAllocated']['type']='meta'; ! $stackQuiz['quizTimeAllocated']['required']='optional'; ! $stackQuiz['quizTimeAllocated']['mysql']='TIME'; ! $stackQuiz['quizTimeAllocated']['metatag']='TypicalLearningTime'; ! $stackQuiz['quizTimeAllocated']['default']='0'; ! ! //Type of quiz: Default to algebraicExpression as that is only type of quiz atm, but provides extensibility ! $stackQuiz['quizExcerciseType']['type']='meta'; ! $stackQuiz['quizExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', ! 'fillInBlank','unspecified'); ! $stackQuiz['quizExcerciseType']['required']='optional'; ! $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; ! $stackQuiz['quizExcerciseType']['metatag']='ExcerciseType'; ! $stackQuiz['quizExcerciseType']['default']='unspecified'; ! ! /** ! * 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) { ! global $stack_root; ! ! require_once("{$stack_root}/html/quizjava.html"); ! echo "<h1>Please choose a quiz to try</h1>"; ! global $stackQuiz; ! if (is_array($quiz_store)) { ! echo "<p>\n<form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='quizid' value='-1'> ! <input type='hidden' name='action' value='continue_quiz'>"; ! echo "\n<table cellpadding='2'>\n"; ! echo "\n<tr><th>{$stackQuiz['quizName']['descript']}</th><th>{$stackQuiz['quizDescription']['descript']}</th><th>Last mark (%)</th></tr>"; ! foreach ($quiz_store as $qs => $quiz) { ! $qname = $quiz['quizName']; ! $qID = $quiz['quizid']; ! $mark = '-'; ! 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']) { ! $mark = round(100*$userinfo['mark']/$userinfo['maxmark'],2); ! } ! } ! } ! } ! ! echo "<tr><td><a href=\"javascript:takeaction('continue_quiz','$qID');\">{$qname}</a></td>\n"; ! echo "<td>".$quiz['quizDescription']."</td><td align='center'>$mark</td></tr>\n"; ! } ! echo "\n</table>\n</form>\n</p>"; ! } else { ! echo "<p>You have no quizzes available to try.</p>"; ! } ! } ! ! ! ?> --- 1,436 ---- ! <?php ! ! /** ! * This file contains most functions which deal with quizzes. ! * ! * @package scripts ! * @subpackage Stack ! */ ! ! /* the stackQuiz data structure ! */ ! // 'Unique quiz ID - local mySQL value' ! $stackQuiz['quizid']['descript'] = 'Quiz ID number'; ! $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; ! $stackQuiz['quizid']['type'] = 'meta'; ! ! // 'Quiz name' ! $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' ! $stackQuiz['quizDescription']['descript'] = 'Description'; ! $stackQuiz['quizDescription']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizDescription']['type'] = 'meta'; ! $stackQuiz['quizDescription']['metatag'] = 'description'; //dc:description ! $stackQuiz['quizDescription']['metatype'] = 'dublincore'; ! ! // 'Quiz options' ! $stackQuiz['quizOptions']['descript'] = 'Quiz options'; ! $stackQuiz['quizOptions']['mysql'] = 'TEXT'; ! $stackQuiz['quizOptions']['type'] = 'other'; ! ! // 'Quiz due date' ! $stackQuiz['quizDueDate']['descript'] = 'Due date'; ! $stackQuiz['quizDueDate']['mysql'] = 'int(10)'; ! $stackQuiz['quizDueDate']['type'] = 'date'; ! ! // 'Quiz mode' ! $stackQuiz['quizMode']['descript'] = 'Mode'; ! $stackQuiz['quizMode']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizMode']['type'] = 'string'; ! ! //<PDK> Quiz Metadata added - database updated ! // 'Globally unique quiz ID'; ! $stackQuiz['quizGUID']['required'] = 'system'; ! $stackQuiz['quizGUID']['mysql'] = 'CHAR(22) UNIQUE KEY'; //GUID's are 32byte characters ! $stackQuiz['quizGUID']['type'] = 'meta'; ! $stackQuiz['quizGUID']['metatag'] = 'identifier'; ! $stackQuiz['quizGUID']['metatype'] = 'dublincore'; ! ! // 'Keywords'; ! $stackQuiz['quizKeywords']['required'] = 'optional'; ! $stackQuiz['quizKeywords']['mysql'] = 'TINYTEXT'; ! $stackQuiz['quizKeywords']['type'] = 'meta'; ! $stackQuiz['quizKeywords']['metatag'] = 'keyword'; //lom:keyword ! $stackQuiz['quizKeywords']['metatype'] = 'lom'; ! $stackQuiz['quizKeywords']['descript'] = 'Keywords'; //<PDK>Need for display purposes ! ! // 'Last edited by'; ! $stackQuiz['quizUserLastEdited']['required']='system'; ! $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; ! $stackQuiz['quizUserLastEdited']['type']='meta'; ! $stackQuiz['quizUserLastEdited']['metatag']='creator'; //dc:creator ! $stackQuiz['quizUserLastEdited']['metatype']='dublincore'; ! ! // 'Last edited on'; ! $stackQuiz['quizDateLastEdited']['required']='system'; ! $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; ! $stackQuiz['quizDateLastEdited']['type']='meta'; ! $stackQuiz['quizDateLastEdited']['metatag']='date'; //dc:date ! $stackQuiz['quizDateLastEdited']['metatype']='dublincore'; ! ! //Publisher ! $stackQuiz['quizPublisher']['required']='system'; ! $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; ! $stackQuiz['quizPublisher']['type']='meta'; ! $stackQuiz['quizPublisher']['metatag']='publisher'; //dc:publisher ! $stackQuiz['quizPublisher']['metatype']='dublincore'; ! ! //Type: Hidden from user ! $stackQuiz['type']['values']=array('quiz','quiz'); //Default to 'type' enumeration in XSD file ! $stackQuiz['type']['required']='optional'; ! $stackQuiz['type']['mysql']='TINYTEXT'; ! $stackQuiz['type']['type']='meta'; ! $stackQuiz['type']['metatag']='type'; //dc:type ! $stackQuiz['type']['metatype']='dublincore'; ! ! //Format: Hidden from user, selected by script ! $stackQuiz['quizFormat']['values']=array('application','audio','image', ! 'message','model','text','video', ! 'multipart'); ! $stackQuiz['quizFormat']['required']='optional'; ! $stackQuiz['quizFormat']['mysql']='TINYTEXT'; ! $stackQuiz['quizFormat']['type']='meta'; //dc:format ! $stackQuiz['quizFormat']['metatag']='format'; ! $stackQuiz['quizFormat']['metatype']='dublincore'; ! ! //Language: Defaulted to current system language, but user definable ! $stackQuiz['quizLanguage']['values']=array('en','fr','nl','es','unspecified'); ! $stackQuiz['quizLanguage']['required']='optional'; ! $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; ! $stackQuiz['quizLanguage']['type']='meta'; ! $stackQuiz['quizLanguage']['metatag']='language'; //dc:language ! $stackQuiz['quizLanguage']['metatype']='dublincore'; ! $stackQuiz['quizLanguage']['default']=$stack_defaultlang; //take the default language; ! ! //Rights ! $stackQuiz['quizRights']['required']='optional'; ! $stackQuiz['quizRights']['mysql']='TEXT'; ! $stackQuiz['quizRights']['type']='meta'; ! $stackQuiz['quizRights']['metatag']='rights'; //dc:rights ! $stackQuiz['quizRights']['metatype']='dublincore'; ! $stackQuiz['quizRights']['default']='http://www.gnu.org/copyleft/gpl.html'; ! ! //Learning context: Defaulted to system context, but user definable ! $stackQuiz['quizLearningContext']['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'); ! $stackQuiz['quizLearningContext']['required']='optional'; ! $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; ! $stackQuiz['quizLearningContext']['type']='meta'; ! $stackQuiz['quizLearningContext']['metatag']='context'; //lom:context ! $stackQuiz['quizLearningContext']['metatype']='lom'; ! $stackQuiz['quizLearningContext']['default']='unspecified'; ! ! //Difficulty: Default to null - up to user to specify this ! $stackQuiz['quizDifficulty']['values']=array('Very Easy','Easy','Medium', ! 'Difficult','Very Difficult','unspecified'); ! $stackQuiz['quizDifficulty']['required']='optional'; ! $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; ! $stackQuiz['quizDifficulty']['type']='meta'; ! $stackQuiz['quizDifficulty']['metatag']='difficulty'; //lom:difficulty ! $stackQuiz['quizDifficulty']['metatype']='lom'; ! $stackQuiz['quizDifficulty']['default']='unspecified'; ! ! //Competency: Default to solve - then up to user ! $stackQuiz['quizCompetency']['values']=array('think','argue','solve', ! 'represent','language','communicate', ! 'tools','unspecified'); ! $stackQuiz['quizCompetency']['required']='optional'; ! $stackQuiz['quizCompetency']['mysql']='TINYTEXT'; ! $stackQuiz['quizCompetency']['type']='meta'; ! $stackQuiz['quizCompetency']['metatag']='competency'; ! $stackQuiz['quizCompetency']['metatype']='stack'; //competency ! $stackQuiz['quizCompetency']['default']='unspecified'; ! ! //CompetencyLevel: Default to null - then up to user ! $stackQuiz['quizCompetencyLevel']['values']=array('elementary','simpleConceptual','multiStep', ! 'complex','unspecified'); ! $stackQuiz['quizCompetencyLevel']['required']='optional'; ! $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; ! $stackQuiz['quizCompetencyLevel']['type']='meta'; ! $stackQuiz['quizCompetencyLevel']['metatag']='competencylevel'; //competencylevel ! $stackQuiz['quizCompetencyLevel']['metatype']='stack'; ! $stackQuiz['quizCompetencyLevel']['default']='unspecified'; ! ! //Time to allocate: Default to null - then up to user ! $stackQuiz['quizTimeAllocated']['required']='optional'; ! $stackQuiz['quizTimeAllocated']['mysql']='TIME'; ! $stackQuiz['quizTimeAllocated']['type']='meta'; ! $stackQuiz['quizTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime ! $stackQuiz['quizTimeAllocated']['metatype']='lom'; ! $stackQuiz['quizTimeAllocated']['default']="00:00:00"; ! ! //Type of quiz: Default to algebraicExpression as that is only type of quiz atm, but provides extensibility ! $stackQuiz['quizExcerciseType']['values']=array('algebraicExpression','mcqSingleAnswer','mcqMultipleAnswer', ! 'fillInBlank','unspecified'); ! $stackQuiz['quizExcerciseType']['required']='optional'; ! $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; ! $stackQuiz['quizExcerciseType']['type']='meta'; ! $stackQuiz['quizExcerciseType']['metatag']='excercisetype'; //excercisetype ! $stackQuiz['quizExcerciseType']['metatype']='stack'; ! $stackQuiz['quizExcerciseType']['default']='unspecified'; ! ! /** ! * 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) { ! global $stack_root; ! ! require_once("{$stack_root}/html/quizjava.html"); ! echo "<h1>Please choose a quiz to try</h1>"; ! global $stackQuiz; ! if (is_array($quiz_store)) { ! echo "<p>\n<form name='quizform' action='quiz.php' method='POST'> ! <input type='hidden' name='quizid' value='-1'> ! <input type='hidden' name='action' value='continue_quiz'>"; ! 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']; ! $qID = $quiz['quizid']; ! $mark = '-'; ! 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']) { ! $mark = round(100*$userinfo['mark']/$userinfo['maxmark'],2); ! } ! } ! } ! } ! ! 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"; ! } ! echo "\n</table>\n</form>\n</p>"; ! } else { ! echo "<p>You have no quizzes available to try.</p>"; ! } ! } ! ! ! /** ! * Displays on the screen the results of this quiz. ! * @param int $quizID ! * @return void ! */ ! function stack_quiz_report($quizid) { ! global $stack_web_url; ! ! // Get the particular quiz, without hidden questions. ! $quiz = stack_db_quiz_get($quizid,FALSE); ! $quiz_options = $quiz['quizOptions']; ! ! echo "<h1>Quiz results: {$quiz['quizName']}</h1>"; ! // Print a summary of the context of this quiz. ! ! // Get a list of questionIDs in this quiz ! $quiz_questions = NULL; ! if (array_key_exists('questions',$quiz)) { ! if (is_array($quiz['questions'])) { ! foreach ($quiz['questions'] as $key => $val) { ! $quiz_questions[] = $val['questionID']; ! $quiz_questions_source[] = stack_db_getquestion($val['questionID']); ! } ! } ! } ! if (NULL == $quiz_questions) { ! echo 'There are no questions in this quiz! Please contact your administrator.'; ! return NULL; ! } ! ! // Obtain a list of users. ! $stack_users = stack_user_listall(); ! ! if (is_array($stack_users)) { ! ! echo "\n<table border='1' cellpadding='2'>\n"; ! echo " <tr>\n <th></th>\n"; ! foreach ($quiz_questions as $key => $qID) { ! $qn = $key+1; ! echo " <th width='30'>".$qn."</th>\n"; ! } // end foreach ! echo " <th>Total</th>\n"; ! echo " <th>%</th>\n</tr>\n"; ! ! echo " <tr>\n <th>Marks:</th>\n"; ! $qtot = 0; ! foreach ($quiz_questions as $key =... [truncated message content] |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:32
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/scripts/install Modified Files: stackUpdateDatabase.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: stackUpdateDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackUpdateDatabase.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stackUpdateDatabase.php 18 Jul 2005 12:09:12 -0000 1.3 --- stackUpdateDatabase.php 25 Aug 2005 16:06:17 -0000 1.4 *************** *** 6,13 **** <?php - require_once('stackstd.php'); ! /** This PHP script simply adds new fields to mySQL for metadata. This affects both questions and quizzes */ $addQuestionColumnQuery = ' ALTER TABLE stackQuestion --- 6,18 ---- <?php ! //<PDK>fresh installation fails to load stackstd, solved in new version ! require_once("{$stack_root}/stackstd.php"); ! ! /** This PHP script simply adds new fields to STACK database for question and quiz metadata, ! * and refines some existing fields */ + // v1.1 - Changed questionUserLastEdited, quizUserLastEdited field to text type + // v1.0 - initial - added metadata fields $addQuestionColumnQuery = ' ALTER TABLE stackQuestion *************** *** 23,28 **** ADD COLUMN questionTimeAllocated time NULL, ADD COLUMN questionExcerciseType tinytext NULL, ! ADD COLUMN questionDateLastEdited datetime NULL, ! DROP COLUMN questionDateLastEdited;'; $addQuizColumnQuery = ' --- 28,33 ---- ADD COLUMN questionTimeAllocated time NULL, ADD COLUMN questionExcerciseType tinytext NULL, ! CHANGE questionDateLastEdited questionDateLastEdited TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, ! CHANGE questionUserLastEdited questionUserLastEdited TEXT NULL;'; $addQuizColumnQuery = ' *************** *** 30,35 **** ADD COLUMN quizGUID varchar(22) NULL, ADD COLUMN quizKeywords tinytext NULL, ! ADD COLUMN quizUserLastEdited int NULL, ! ADD COLUMN quizDateLastEdited datetime NULL, ADD COLUMN quizPublisher tinytext NULL, ADD COLUMN type tinytext NULL, --- 35,40 ---- ADD COLUMN quizGUID varchar(22) NULL, ADD COLUMN quizKeywords tinytext NULL, ! ADD COLUMN quizUserLastEdited TEXT NULL, ! ADD COLUMN quizDateLastEdited TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD COLUMN quizPublisher tinytext NULL, ADD COLUMN type tinytext NULL, |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:32
|
Update of /cvsroot/stack/stack-1-0/scripts/axiom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/scripts/axiom Removed Files: axiom_initialisation.input Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch --- axiom_initialisation.input DELETED --- |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:31
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/lang/en Modified Files: stack.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/stack.php,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** stack.php 17 Aug 2005 11:35:35 -0000 1.20 --- stack.php 25 Aug 2005 16:06:17 -0000 1.21 *************** *** 11,43 **** */ ! $string['TrySTACKQuiz'] = 'Try a STACK quiz'; ! $string['STACKHomePage'] = 'STACK home page'; ! $string['Home'] = 'Home'; ! $string['ClickHereTryQuiz'] = 'Click here to try a new quiz.'; ! $string['ChooseQuiz'] = 'Choose quiz'; ! $string['Focus'] = 'Focus'; ! $string['FocusExplain'] = 'Click here to see one question at a time.'; ! $string['UnFocus'] = 'Unfocus'; ! $string['UnFocusExplain'] = 'Click here to see all questions in the quiz.'; ! $string['Score'] = 'Mark'; // Mark for a question. ! $string['Mark'] = 'Mark'; // Mark as an action request. ! $string['MarkThisQ'] = 'Mark this question'; // Mark as an action request. ! $string['MarkQ'] = 'Mark Q.'; // Mark as an action request. ! $string['MarkExplain'] = 'Click here to mark your answers.'; ! $string['Validate'] = 'Validate'; ! $string['ValidateExplain'] = 'Click here to check that your answers have no syntax errors and that the system interprets them in the way that you intended.'; ! $string['ValidateExplain2'] = '(Note, your answers will be stored when you validate.)'; ! $string['Solutions'] = 'Solutions'; ! $string['SolutionsExplain'] = 'Click here to mark the whole quiz and show all the solutions.'; ! $string['SolutionsExplain2'] = '(No further attempts will be permitted)'; ! $string['NewVersion'] = 'New version'; ! $string['NewVersionExplain'] = 'Click here to try a new version of this quiz.'; ! $string['MarkSummary'] = 'Mark Summary'; ! $string['Question'] = 'Question'; ! $string['Value'] = 'Value'; // Number of marks available for a question ! $string['Total'] = 'Total'; ! $string['Help'] = 'Help'; ! $string['End'] = 'End'; ! $string['Quiz_error_q'] = '<font color=\"red\">There were errors in the question.</font><br />Please contact your system administrator about questionID {$a[0]}.<br />'; --- 11,48 ---- */ ! $string['TrySTACKQuiz'] = 'Try a STACK quiz'; ! $string['ReviewSTACKQuiz'] = 'Review a STACK quiz'; ! $string['STACKHomePage'] = 'STACK home page'; ! $string['Home'] = 'Home'; ! $string['ClickHereTryQuiz'] = 'Click here to try a new quiz.'; ! $string['ChooseQuiz'] = 'Choose quiz'; ! $string['Focus'] = 'Focus'; ! $string['FocusExplain'] = 'Click here to see one question at a time.'; ! $string['UnFocus'] = 'Unfocus'; ! $string['UnFocusExplain'] = 'Click here to see all questions in the quiz.'; ! $string['Score'] = 'Mark'; // Mark for a question. ! $string['Mark'] = 'Mark'; // Mark as an action request. ! $string['MarkThisQ'] = 'Mark this question'; // Mark as an action request. ! $string['MarkQ'] = 'Mark Q.'; // Mark as an action request. ! $string['MarkExplain'] = 'Click here to mark your answers.'; ! $string['Validate'] = 'Validate'; ! $string['ValidateExplain'] = 'Click here to check that your answers have no syntax errors and that the system interprets them in the way that you intended.'; ! $string['ValidateExplain2'] = '(Note, your answers will be stored when you validate.)'; ! $string['Solutions'] = 'Solutions'; ! $string['SolutionsExplain'] = 'Click here to mark the whole quiz and show all the solutions.'; ! $string['SolutionsExplain2'] = '(No further attempts will be permitted)'; ! $string['NewVersion'] = 'New version'; ! $string['NewVersionExplain'] = 'Click here to try a new version of this quiz.'; ! $string['MarkSummary'] = 'Mark Summary'; ! $string['Question'] = 'Question'; ! $string['Value'] = 'Value'; // Number of marks available for a question ! $string['Total'] = 'Total'; ! $string['Help'] = 'Help'; ! $string['Top'] = 'Top'; ! $string['Bottom'] = 'Bottom'; ! $string['Quiz_error_q'] = '<font color=\"red\">There were errors in the question.</font><br />Please contact your system administrator about questionID {$a[0]}.<br />'; ! $string['quiz_page_created'] = 'Page created'; ! $string['quiz_duedate'] = 'Quiz due'; ! $string['quiz_duedate_passed'] = 'It is now after the quiz due date. You may not make further attempts at this quiz.'; *************** *** 202,217 **** // Quiz //////////////////////////////////// // <PDK> $stackQuestion metadata added ! $string['stackQuiz_quizPublisher'] = 'Server published'; ! $string['stackQuiz_quizType'] = 'Nature of content'; ! $string['stackQuiz_quizFormat'] = 'Digital manifestation'; ! $string['stackQuiz_quizLanguage'] = 'Language of content'; $string['stackQuiz_quizLearningContext']= 'Targetted to'; ! $string['stackQuiz_quizDifficulty'] = 'Difficulty'; ! $string['stackQuiz_quizCompetency'] = 'Competencies trained'; $string['stackQuiz_quizCompetencyLevel']= 'Skills required'; $string['stackQuiz_quizTimeAllocated'] = 'Recommended time to take'; $string['stackQuiz_quizExcerciseType'] = 'Type of quiz'; ! $string['stackQuiz_quizRights'] = 'Rights statement'; //////////////////////////////////// --- 207,224 ---- // Quiz //////////////////////////////////// + $string['stackQuiz_quizName'] = 'Quiz name'; + // <PDK> $stackQuestion metadata added ! $string['stackQuiz_quizPublisher'] = 'Server published'; ! $string['stackQuiz_quizType'] = 'Nature of content'; ! $string['stackQuiz_quizFormat'] = 'Digital manifestation'; ! $string['stackQuiz_quizLanguage'] = 'Language of content'; $string['stackQuiz_quizLearningContext']= 'Targetted to'; ! $string['stackQuiz_quizDifficulty'] = 'Difficulty'; ! $string['stackQuiz_quizCompetency'] = 'Competencies trained'; $string['stackQuiz_quizCompetencyLevel']= 'Skills required'; $string['stackQuiz_quizTimeAllocated'] = 'Recommended time to take'; $string['stackQuiz_quizExcerciseType'] = 'Type of quiz'; ! $string['stackQuiz_quizRights'] = 'Rights statement'; //////////////////////////////////// *************** *** 247,251 **** $string['stackOptions_FeedBackGenericPCorrect'] = 'Feedback: partially correct'; $string['stackOptions_FeedBackGenericPCorrect_def'] = "<font color='orange'>Your answer is partially correct.</font>"; ! $string['stackOptions_ShowSol'] = 'Show solution'; //////////////////////////////////// --- 254,258 ---- $string['stackOptions_FeedBackGenericPCorrect'] = 'Feedback: partially correct'; $string['stackOptions_FeedBackGenericPCorrect_def'] = "<font color='orange'>Your answer is partially correct.</font>"; ! $string['stackOptions_QuizMode'] = 'Quiz mode'; //////////////////////////////////// *************** *** 307,311 **** $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 --- 314,317 ---- |
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/lang/en/doc Modified Files: about_install.php author_gettingstarted.php author_testsuite.php student_assessmentmode.php student_input.php student_practicemode.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: about_install.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/about_install.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** about_install.php 14 Jul 2005 18:44:54 -0000 1.2 --- about_install.php 25 Aug 2005 16:06:17 -0000 1.3 *************** *** 1,384 **** ! <?php ! /** ! * Details of how to install STACK. ! * ! * @package documentation ! * @subpackage Stack ! * ! */ ! ! ?> [...1149 lines suppressed...] ! ! ! These classifications are given in the file, ! ! <tt>maximafun.php</tt>, which you can and should edit. <em>Once ! ! you have edited this file, you need to execute the file ! ! <tt>initmaxima.php</tt> to re-create ! ! <tt>CASkeywords.php</tt>.</em> (This in turn has been generated ! ! directly from the Maxima docs using another script, which you ! ! need not use). ! ! ! ! </p> ! Index: student_input.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/student_input.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** student_input.php 14 Jul 2005 17:46:58 -0000 1.2 --- student_input.php 25 Aug 2005 16:06:17 -0000 1.3 *************** *** 1,240 **** ! <?php ! /** ! * ! * 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... ! * ! * @package documentation ! * @subpackage Stack ! */ ! ! ! ?> ! ! <a name="entry"><h2>How do I enter my answers?</h2></a> ! ! You should type in your answers using the same syntax used in the ! symbolic mathematics package, known as a computer algebra system ! (cas), underpinning your implementation. This could be ! either <i>Axiom</i> or <i>Maxima</i>. The syntax is broadly similar ! to the syntax used for mathematical formulae in general programming ! languages such as Java, C and Basic and in spreadsheet programs such ! as Excel, so you will find it useful to master it. If you are ! taking the Applied Mathematics Core course AMA101 then you will ! learn to use such a system there. If you are not, the advice below should ! be sufficient. Stack tries quite hard to give helpful information ! about syntax errors. You can also learn about the right syntax by ! doing tests in practice mode and asking for ! the solutions; as well as displaying the right answers in ordinary ! mathematical notation, Stack will tell you how they could be ! entered. (However, there are often several possible ways, and Stack ! will not always suggest the easiest one.) ! <br /><br /> ! When you have entered your answer, you can always click on the ! <b>Validate</b> button at the bottom of the page to see how the CAS will ! interpret it. If there are any syntax errors or the cas has ! misunderstood what you meant then you can fix the problem before ! asking Stack to mark your work. ! ! <ul> ! <li> Numbers like <font color="BLUE">1/4</font> should be entered as ! <tt><font color="GREEN">1/4</font></tt>, not as ! <tt><font color="GREEN">0.25</font></tt>, which can cause some ! subtle problems. ! </li> ! <li> Use a star for multiplication: for example, ! <font color="BLUE">3x</font> should be ! entered as <tt><font color="GREEN">3*x</font></tt>. Forgetting this ! is by far the most ! common source of syntax errors. Note that you do <b>not</b> need ! a semicolon at the end, unlike when you are using a CAS directly. ! <br /><br /></li> ! <li> Use a caret (^) for raising something to a power: for example, ! <font color="BLUE">x<sup>2</sup></font> should be entered as ! <tt><font color="GREEN">x^2</font></tt>. You can get ! a caret by holding down the SHIFT key and pressing the 6 key ! on most keyboards. Negative or fractional powers need brackets: ! enter <font color="BLUE">x<sup>-2</sup></font> as ! <tt><font color="GREEN">x^(-2)</font></tt> ! and <font color="BLUE">x<sup>1/3</sup></font> as ! <tt><font color="GREEN">x^(1/3)</font></tt>. ! <br /><br /></li> ! <li> More generally, when in doubt, use brackets. For example, ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! </td><td nowrap="nowrap" align="center"> ! a + b<hr noshade="noshade"> ! c + d <br /></td><td nowrap="nowrap" align="center"> ! </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! should be entered as ! <tt><font color="GREEN">(a+b)/(c+d)</font></tt>. ! Note that in this context you should always use ordinary round ! bracket (like <tt><font color="GREEN">(a+b)</font></tt>), not ! square or curly ones (like <tt><font color="GREEN">[a+b]</font></tt> ! or <tt><font color="GREEN">{a+b}</font></tt>). ! <br /> ! If you type ! <tt><font color="GREEN">a+b/(c+d)</font></tt>, then Stack ! will think that you mean ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! a +</td><td nowrap="nowrap" align="center"> ! b<hr noshade="noshade"> ! c + d<br /></td><td nowrap="nowrap" align="center"> ! </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! If you type <tt><font color="GREEN">(a+b)/c+d</font></tt>, then Stack ! will think that you mean ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! </td><td nowrap="nowrap" align="center"> ! a + b<hr noshade="noshade"> ! c<br /></td><td nowrap="nowrap" align="center"> ! + d </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! If you type <tt><font color="GREEN">a+b/c+d</font></tt>, then Stack ! will think that you mean ! <font color="BLUE"> ! <center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! a +</td><td nowrap="nowrap" align="center"> ! b<hr noshade="noshade"> ! c<br /></td><td nowrap="nowrap" align="center"> ! + d </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! </font> ! <br /> ! Some other examples: ! <ul> ! <li> ! <font color="BLUE">2<sup>a+b</sup></font> should be entered as ! <tt><font color="GREEN">2^(a+b)</font></tt> ! </li> ! <li> ! <font color="BLUE">2 cos 3x</font> should be entered as ! <tt><font color="GREEN">2*cos(3*x)</font></tt> ! </li> ! <li> ! <font color="BLUE">e<sup>ax</sup>sin(bx)</font> should be entered as ! <tt><font color="GREEN">exp(a*x)*sin(b*x)</font></tt> ! </li> ! <li> ! <font color="BLUE">(a x<sup>2</sup> + b x + c)<sup>-1</sup></font> ! should be entered as ! <tt><font color="GREEN">(a*x^2 + b*x + c)^(-1)</font></tt>. ! </li> ! </ul> ! <br /><br /></li> ! <li>the CAS system is case-sensitive. Do not enter ! <tt><font color="GREEN">X</font></tt> instead of ! <tt><font color="GREEN">x</font></tt>, or ! <tt><font color="GREEN">a</font></tt> instead of ! <tt><font color="GREEN">A</font></tt>, or ! <tt><font color="GREEN">Log(Z)</font></tt> instead of ! <tt><font color="GREEN">log(z)</font></tt>. ! </li> ! <li>The absolute value of <font color="BLUE">x</font>, which is ! written as <font color="BLUE">|x|</font> in traditional notation, ! must be entered as <tt><font color="GREEN">abs(x)</font></tt>. ! </li> ! <li> ! Standard functions such as sin, cos, tan, exp, log and so on can ! be entered using their usual names. However, the argument must ! <font color="RED">always</font> be enclosed in brackets: ! <font color="BLUE">sin x</font> should be entered as ! <tt><font color="GREEN">sin(x)</font></tt>, ! <font color="BLUE">ln 3</font> should be entered as ! <tt><font color="GREEN">ln(3)</font></tt> and so on. You can use ! either <tt><font color="GREEN">log(x)</font></tt> or ! <tt><font color="GREEN">ln(x)</font></tt> for ! the natural logarithm of x (note that both of these start with a ! lower case l, not a capital I). The function ! <font color="BLUE">1/sin(x)</font> must be ! referred to as <tt><font color="GREEN">csc(x)</font></tt> rather ! than <tt><font color="GREEN">cosec(x)</font></tt> (or you can just call ! it <tt><font color="GREEN">1/sin(x)</font></tt> if you prefer). You ! should always write ! <tt><font color="GREEN">exp(x)</font></tt> for ! <font color="BLUE">e<sup>x</sup></font>. ! <br /><br /></li> ! <li> ! <font color="BLUE">sin<sup>2</sup>x</font> should be entered as ! <tt><font color="GREEN">sin(x)^2</font></tt> (which is ! what it really means, after all). Similarly for ! <font color="BLUE">tan<sup>2</sup>(x)</font>, ! <font color="BLUE">sinh<sup>2</sup>(x)</font> and so on. ! <br /><br /></li> ! <li> ! Recall that <font color="BLUE">sin<sup>-1</sup>(x)</font> ! traditionally means the number <font color="BLUE">t</font> such that ! <font color="BLUE">sin(t) = x</font>, which is of ! course completely different from the number ! <font color="BLUE">sin(x)<sup>-1</sup> = 1/sin(x)</font>. This ! traditional notation is really rather unfortunate and is not used ! by the CAS; instead, <font color="BLUE">sin<sup>-1</sup>(x)</font> ! should be entered as <tt><font color="GREEN">arcsin(x)</font></tt>. ! Similarly, <font color="BLUE">tan<sup>-1</sup>(x)</font> should be ! entered as <tt><font color="GREEN">arctan(x)</font></tt> and so on. ! <br /><br /></li> ! <li> ! Greek letters can be entered using their English names: for ! example, enter ! <font face="SYMBOL" color="BLUE">a+b</font> ! as <tt><font color="GREEN">alpha+beta</font></tt>, and ! <font face="SYMBOL" color="BLUE">2p</font> ! as <tt><font color="GREEN">2*pi</font></tt>. ! <br /><br /></li> ! <li> ! When you work directly with a CAS, the vector <font color="BLUE">(1,2,3)</font> must be entered as ! <tt><font color="GREEN">vector([1,2,3])</font></tt>. Many Stack ! questions are set up so that you can just enter <tt><font color="green">[1,2,3]</font></tt> instead. ! </li> ! <li> ! When you work directly with a CAS, the matrix ! <font color="BLUE"> ! </font><center><table border="0" align="center"><tbody><tr><td> ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! </td><td align="left"><font face="symbol"> ! é<br />ê<br /> ! ë ! </font></td><td align="center"> ! </td><td nowrap="nowrap"><table border="0" align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 1 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 2 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 3 </td></tr></tbody></table></td></tr><tr><td nowrap="nowrap" align="center" colspan="1"><table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 4 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! 5 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! <table><tbody><tr><td nowrap="nowrap" align="center" colspan="1">6</td></tr></tbody></table></td></tr></tbody></table> ! </td><td nowrap="nowrap"></td><td align="left"><font face="symbol"> ! ù<br />ú<br /> ! û ! </font></td><td align="center"> ! </td></tr></tbody></table> ! </td></tr></tbody></table></center> ! ! must be entered as ! <tt><font color="GREEN">matrix([1,2,3],[4,5,6])</font></tt>. ! </li> ! </ul> --- 1,480 ---- ! <?php ! ! /** ! ! * ! ! * 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... ! ! * ! ! * @package documentation ! ! * @subpackage Stack ! ! */ ! ! ! ! ! ! ?> ! ! ! ! <a name="entry"><h2>How do I enter my answers?</h2></a> ! ! ! ! You should type in your answers using the same syntax used in the ! ! symbolic mathematics package, known as a computer algebra system ! ! (cas), underpinning your implementation. This could be ! ! either <i>Axiom</i> or <i>Maxima</i>. The syntax is broadly similar ! ! to the syntax used for mathematical formulae in general programming ! ! languages such as Java, C and Basic and in spreadsheet programs such ! ! as Excel, so you will find it useful to master it. If you are ! ! taking the Applied Mathematics Core course AMA101 then you will ! ! learn to use such a system there. If you are not, the advice below should ! ! be sufficient. Stack tries quite hard to give helpful information ! ! about syntax errors. You can also learn about the right syntax by ! ! doing tests in practice mode and asking for ! ! the solutions; as well as displaying the right answers in ordinary ! ! mathematical notation, Stack will tell you how they could be ! ! entered. (However, there are often several possible ways, and Stack ! ! will not always suggest the easiest one.) ! ! <br /><br /> ! ! When you have entered your answer, you can always click on the ! ! <b>Validate</b> button at the bottom of the page to see how the CAS will ! ! interpret it. If there are any syntax errors or the cas has ! ! misunderstood what you meant then you can fix the problem before ! ! asking Stack to mark your work. ! ! ! ! <ul> ! ! <li> Numbers like <font color="BLUE">1/4</font> should be entered as ! ! <tt><font color="GREEN">1/4</font></tt>, not as ! ! <tt><font color="GREEN">0.25</font></tt>, which can cause some ! ! subtle problems. ! ! </li> ! ! <li> Use a star for multiplication: for example, ! ! <font color="BLUE">3x</font> should be ! ! entered as <tt><font color="GREEN">3*x</font></tt>. Forgetting this ! ! is by far the most ! ! common source of syntax errors. Note that you do <b>not</b> need ! ! a semicolon at the end, unlike when you are using a CAS directly. ! ! <br /><br /></li> ! ! <li> Use a caret (^) for raising something to a power: for example, ! ! <font color="BLUE">x<sup>2</sup></font> should be entered as ! ! <tt><font color="GREEN">x^2</font></tt>. You can get ! ! a caret by holding down the SHIFT key and pressing the 6 key ! ! on most keyboards. Negative or fractional powers need brackets: ! ! enter <font color="BLUE">x<sup>-2</sup></font> as ! ! <tt><font color="GREEN">x^(-2)</font></tt> ! ! and <font color="BLUE">x<sup>1/3</sup></font> as ! ! <tt><font color="GREEN">x^(1/3)</font></tt>. ! ! <br /><br /></li> ! ! <li> More generally, when in doubt, use brackets. For example, ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! </td><td nowrap="nowrap" align="center"> ! ! a + b<hr noshade="noshade"> ! ! c + d <br /></td><td nowrap="nowrap" align="center"> ! ! </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! should be entered as ! ! <tt><font color="GREEN">(a+b)/(c+d)</font></tt>. ! ! Note that in this context you should always use ordinary round ! ! bracket (like <tt><font color="GREEN">(a+b)</font></tt>), not ! ! square or curly ones (like <tt><font color="GREEN">[a+b]</font></tt> ! ! or <tt><font color="GREEN">{a+b}</font></tt>). ! ! <br /> ! ! If you type ! ! <tt><font color="GREEN">a+b/(c+d)</font></tt>, then Stack ! ! will think that you mean ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! a +</td><td nowrap="nowrap" align="center"> ! ! b<hr noshade="noshade"> ! ! c + d<br /></td><td nowrap="nowrap" align="center"> ! ! </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! If you type <tt><font color="GREEN">(a+b)/c+d</font></tt>, then Stack ! ! will think that you mean ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! </td><td nowrap="nowrap" align="center"> ! ! a + b<hr noshade="noshade"> ! ! c<br /></td><td nowrap="nowrap" align="center"> ! ! + d </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! If you type <tt><font color="GREEN">a+b/c+d</font></tt>, then Stack ! ! will think that you mean ! ! <font color="BLUE"> ! ! <center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! a +</td><td nowrap="nowrap" align="center"> ! ! b<hr noshade="noshade"> ! ! c<br /></td><td nowrap="nowrap" align="center"> ! ! + d </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! </font> ! ! <br /> ! ! Some other examples: ! ! <ul> ! ! <li> ! ! <font color="BLUE">2<sup>a+b</sup></font> should be entered as ! ! <tt><font color="GREEN">2^(a+b)</font></tt> ! ! </li> ! ! <li> ! ! <font color="BLUE">2 cos 3x</font> should be entered as ! ! <tt><font color="GREEN">2*cos(3*x)</font></tt> ! ! </li> ! ! <li> ! ! <font color="BLUE">e<sup>ax</sup>sin(bx)</font> should be entered as ! ! <tt><font color="GREEN">exp(a*x)*sin(b*x)</font></tt> ! ! </li> ! ! <li> ! ! <font color="BLUE">(a x<sup>2</sup> + b x + c)<sup>-1</sup></font> ! ! should be entered as ! ! <tt><font color="GREEN">(a*x^2 + b*x + c)^(-1)</font></tt>. ! ! </li> ! ! </ul> ! ! <br /><br /></li> ! ! <li>the CAS system is case-sensitive. Do not enter ! ! <tt><font color="GREEN">X</font></tt> instead of ! ! <tt><font color="GREEN">x</font></tt>, or ! ! <tt><font color="GREEN">a</font></tt> instead of ! ! <tt><font color="GREEN">A</font></tt>, or ! ! <tt><font color="GREEN">Log(Z)</font></tt> instead of ! ! <tt><font color="GREEN">log(z)</font></tt>. ! ! </li> ! ! <li>The absolute value of <font color="BLUE">x</font>, which is ! ! written as <font color="BLUE">|x|</font> in traditional notation, ! ! must be entered as <tt><font color="GREEN">abs(x)</font></tt>. ! ! </li> ! ! <li> ! ! Standard functions such as sin, cos, tan, exp, log and so on can ! ! be entered using their usual names. However, the argument must ! ! <font color="RED">always</font> be enclosed in brackets: ! ! <font color="BLUE">sin x</font> should be entered as ! ! <tt><font color="GREEN">sin(x)</font></tt>, ! ! <font color="BLUE">ln 3</font> should be entered as ! ! <tt><font color="GREEN">ln(3)</font></tt> and so on. You can use ! ! either <tt><font color="GREEN">log(x)</font></tt> or ! ! <tt><font color="GREEN">ln(x)</font></tt> for ! ! the natural logarithm of x (note that both of these start with a ! ! lower case l, not a capital I). The function ! ! <font color="BLUE">1/sin(x)</font> must be ! ! referred to as <tt><font color="GREEN">csc(x)</font></tt> rather ! ! than <tt><font color="GREEN">cosec(x)</font></tt> (or you can just call ! ! it <tt><font color="GREEN">1/sin(x)</font></tt> if you prefer). You ! ! should always write ! ! <tt><font color="GREEN">exp(x)</font></tt> for ! ! <font color="BLUE">e<sup>x</sup></font>. ! ! <br /><br /></li> ! ! <li> ! ! <font color="BLUE">sin<sup>2</sup>x</font> should be entered as ! ! <tt><font color="GREEN">sin(x)^2</font></tt> (which is ! ! what it really means, after all). Similarly for ! ! <font color="BLUE">tan<sup>2</sup>(x)</font>, ! ! <font color="BLUE">sinh<sup>2</sup>(x)</font> and so on. ! ! <br /><br /></li> ! ! <li> ! ! Recall that <font color="BLUE">sin<sup>-1</sup>(x)</font> ! ! traditionally means the number <font color="BLUE">t</font> such that ! ! <font color="BLUE">sin(t) = x</font>, which is of ! ! course completely different from the number ! ! <font color="BLUE">sin(x)<sup>-1</sup> = 1/sin(x)</font>. This ! ! traditional notation is really rather unfortunate and is not used ! ! by the CAS; instead, <font color="BLUE">sin<sup>-1</sup>(x)</font> ! ! should be entered as <tt><font color="GREEN">arcsin(x)</font></tt>. ! ! Similarly, <font color="BLUE">tan<sup>-1</sup>(x)</font> should be ! ! entered as <tt><font color="GREEN">arctan(x)</font></tt> and so on. ! ! <br /><br /></li> ! ! <li> ! ! Greek letters can be entered using their English names: for ! ! example, enter ! ! <font face="SYMBOL" color="BLUE">a+b</font> ! ! as <tt><font color="GREEN">alpha+beta</font></tt>, and ! ! <font face="SYMBOL" color="BLUE">2p</font> ! ! as <tt><font color="GREEN">2*pi</font></tt>. ! ! <br /><br /></li> ! ! <li> ! ! When you work directly with a CAS, the vector <font color="BLUE">(1,2,3)</font> must be entered as ! ! <tt><font color="GREEN">vector([1,2,3])</font></tt>. Many Stack ! ! questions are set up so that you can just enter <tt><font color="green">[1,2,3]</font></tt> instead. ! ! </li> ! ! <li> ! ! When you work directly with a CAS, the matrix ! ! <font color="BLUE"> ! ! </font><center><table border="0" align="center"><tbody><tr><td> ! ! <table align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! </td><td align="left"><font face="symbol"> ! ! é<br />ê<br /> ! ! ë ! ! </font></td><td align="center"> ! ! </td><td nowrap="nowrap"><table border="0" align="left"><tbody><tr><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 1 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 2 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 3 </td></tr></tbody></table></td></tr><tr><td nowrap="nowrap" align="center" colspan="1"><table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 4 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table border="0"><tbody><tr><td nowrap="nowrap" align="center"> ! ! 5 </td></tr></tbody></table></td><td nowrap="nowrap" align="center"> ! ! <table><tbody><tr><td nowrap="nowrap" align="center" colspan="1">6</td></tr></tbody></table></td></tr></tbody></table> ! ! </td><td nowrap="nowrap"></td><td align="left"><font face="symbol"> ! ! ù<br />ú<br /> ! ! û ! ! </font></td><td align="center"> ! ! </td></tr></tbody></table> ! ! </td></tr></tbody></table></center> ! ! ! ! must be entered as ! ! <tt><font color="GREEN">matrix([1,2,3],[4,5,6])</font></tt>. ! ! </li> ! ! </ul> ! Index: author_gettingstarted.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_gettingstarted.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** author_gettingstarted.php 14 Jul 2005 18:19:57 -0000 1.4 --- author_gettingstarted.php 25 Aug 2005 16:06:17 -0000 1.5 *************** *** 1,510 **** ! <?php ! /** ! * An authoring guide for STACK questions. ! * ! * @package documentation ! * @subpackage Stack ! */ ! ! /** ! * [...1501 lines suppressed...] ! <p>It is also possible to define functions within the Question ! ! Variables for use within a question. This is not recommended, ! ! and has not been widely tested. For example ! ! <pre>dum1 = f(x) := x^2 ! ! n = f(4)</pre> Again, the syntax requires this to be of the form ! ! <tt>key = value</tt>, so that another dummy assignment has taken ! ! place. Please look at Maxima's documentation for <?php ! ! $url = $stack_web_url."maximadocs/maxdoc/maxima_39.html#SEC120"; ! ! echo " <a href='$url'>functions</a>.</p> "; ! ! ?> ! Index: author_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_testsuite.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** author_testsuite.php 16 Aug 2005 12:44:30 -0000 1.8 --- author_testsuite.php 25 Aug 2005 16:06:17 -0000 1.9 *************** *** 198,201 **** --- 198,217 ---- $testsuite[] = stack_testsuite_construct('RegExp','cxcxcz','3.1415927',0,'[0-9]*\.[0-9]*',''); + $testsuite[] = stack_testsuite_construct('SA_True','TRUE','TRUE',1,'',''); + $testsuite[] = stack_testsuite_construct('SA_True','FALSE','TRUE',0,'',''); + $testsuite[] = stack_testsuite_construct('SA_True','integerp(3)','TRUE',1,'',''); + $testsuite[] = stack_testsuite_construct('SA_True','integerp(3.1)','TRUE',0,'',''); + + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.1','1',0,'','No option, so 5%'); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.05','1',1,'',''); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.05','1',1,'0.1','Options passed'); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','1.05','3',0,'0.1',''); + $testsuite[] = stack_testsuite_construct('Num_tol_relative','3.14','pi',1,'0.001',''); + + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.1','1',0,'','No option, so 5%'); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.05','1',1,'',''); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.05','1',1,'0.1','Options passed'); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','1.05','3',0,'0.1',''); + $testsuite[] = stack_testsuite_construct('Num_tol_absolute','3.14','pi',0,'0.001',''); /* ********************************************************** */ *************** *** 237,243 **** // (4) Sort out and display the output echo "<tr> <th> pass? </th> - <th> TAns </th> <th> SAns </th> <th> Ans </th> <th> Errors </th> <th> RawMark </th> --- 253,260 ---- // (4) Sort out and display the output echo "<tr> <th> pass? </th> <th> SAns </th> <th> Ans </th> + <th> TAns </th> + <th> Opt </th> <th> Errors </th> <th> RawMark </th> *************** *** 313,319 **** // (4) Construct the row. echo " <td> $outcome </td>\n"; - echo " <td nowrap=\"nowrap\">".stack_s($ts['TAns'])." </td>\n "; echo " <td nowrap=\"nowrap\">".stack_s($ts['SAns'])." </td>\n "; echo " <td> $dispans </td>\n "; echo " <td> $errans </td>\n "; echo " <td> $rawmark </td>\n "; --- 330,337 ---- // (4) Construct the row. echo " <td> $outcome </td>\n"; echo " <td nowrap=\"nowrap\">".stack_s($ts['SAns'])." </td>\n "; echo " <td> $dispans </td>\n "; + echo " <td nowrap=\"nowrap\">".stack_s($ts['TAns'])." </td>\n "; + echo " <td> {$ts['AnsTestOpt']} </td>\n "; echo " <td> $errans </td>\n "; echo " <td> $rawmark </td>\n "; Index: student_assessmentmode.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/student_assessmentmode.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** student_assessmentmode.php 14 Jul 2005 17:46:58 -0000 1.2 --- student_assessmentmode.php 25 Aug 2005 16:06:17 -0000 1.3 *************** *** 30,37 **** practice mode. ! The questions will involve some randomly generated parameters, so different students will get slightly different questions. ! <br /><br /> A test in assessment mode will usually have a "Due date" --- 30,37 ---- practice mode. ! The questions will often involve some randomly generated parameters, so different students will get slightly different questions. ! <br /> A test in assessment mode will usually have a "Due date" *************** *** 46,51 **** before proceeding. When you are satisfied with your answers, you can click the <b>Mark</b> button. Stack will tell you whether ! your answers are right or wrong (except for multiple choice ! questions) and may give some feedback about any answers that are wrong, but it will not tell you the right answers. --- 46,51 ---- before proceeding. When you are satisfied with your answers, you can click the <b>Mark</b> button. Stack will tell you whether ! your answers are right or wrong and may give some ! feedback about any answers that are wrong, but it will not tell you the right answers. *************** *** 81,83 **** If you access the test after the due date, then Stack will tell ! you your marks and give the solutions to the questions. --- 81,84 ---- If you access the test after the due date, then Stack will tell ! you your marks and give any solutions which the teacher ! has provided to the questions. Index: student_practicemode.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/student_practicemode.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** student_practicemode.php 14 Jul 2005 17:46:58 -0000 1.2 --- student_practicemode.php 25 Aug 2005 16:06:17 -0000 1.3 *************** *** 25,40 **** <a name="practice"><h2>Practice mode</h2></a> ! If a test is set up in practice mode, it will say so in the test ! selection menu, and also at the top of the test page. If so, you ! can do the same set of questions repeatedly, and mark them by ! clicking the <b>Mark</b> button at the bottom of the page. The ! system will tell you whether your answers are right or wrong (except ! for multiple choice questions) and may give some feedback about any ! answers that are wrong, but it will not tell you the right answers. ! You can click the <b>Back</b> button on your browser to get back to ! the page where you filled in your answers, correct any mistakes, and ! try again. Alternatively, you can go away and come back some other ! time; Stack will remember your previous answers, so you can ! correct any that were wrong, and leave the others as they are. The system will give you a numerical mark for your work which you may find informative, but it does not officially count for anything. --- 25,41 ---- <a name="practice"><h2>Practice mode</h2></a> ! If a test is set up in practice mode, it will say so when you ! load the test at the top of the test page. You can do the same ! set of questions repeatedly, and mark them by ! clicking the <b>Mark</b> button at the bottom of the page. The ! system will tell you whether your answers are right or wrong ! and may give some feedback about any answers that are wrong, ! but it will not tell you the right answers. ! You can correct any mistakes, and ! try again. ! ! If you would like to go away and come back some other ! time press the Validate button; Stack will remember your previous answers, ! so you can correct any that were wrong, and leave the others as they are. The system will give you a numerical mark for your work which you may find informative, but it does not officially count for anything. |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:31
|
Update of /cvsroot/stack/stack-1-0/schemas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/schemas Added Files: assessmentItem.jpg dc.xsd imsmd_v1p2.xsd mathQuiz.jpg Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch --- NEW FILE: assessmentItem.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dc.xsd --- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://purl.org/dc/elements/1.1/" targetNamespace="http://purl.org/dc/elements/1.1/" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:annotation> <xs:documentation xml:lang="en"> DCMES 1.1 XML Schema XML Schema for http://purl.org/dc/elements/1.1/ namespace Created 2003-04-02 Created by Tim Cole (t-...@ui...) Tom Habing (th...@ui...) Jane Hunter (ja...@ds...) Pete Johnston (p.j...@uk...), Carl Lagoze (la...@cs...) This schema declares XML elements for the 15 DC elements from the http://purl.org/dc/elements/1.1/ namespace. It defines a complexType SimpleLiteral which permits mixed content and makes the xml:lang attribute available. It disallows child elements by use of minOcccurs/maxOccurs. However, this complexType does permit the derivation of other complexTypes which would permit child elements. All elements are declared as substitutable for the abstract element any, which means that the default type for all elements is dc:SimpleLiteral. </xs:documentation> </xs:annotation> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"> </xs:import> <xs:complexType name="SimpleLiteral"> <xs:annotation> <xs:documentation xml:lang="en"> This is the default type for all of the DC elements. It permits text content only with optional xml:lang attribute. Text is allowed because mixed="true", but sub-elements are disallowed because minOccurs="0" and maxOccurs="0" are on the xs:any tag. This complexType allows for restriction or extension permitting child elements. </xs:documentation> </xs:annotation> <xs:complexContent mixed="true"> <xs:restriction base="xs:anyType"> <xs:sequence> <xs:any processContents="lax" minOccurs="0" maxOccurs="0"/> </xs:sequence> <xs:attribute ref="xml:lang" use="optional"/> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="any" type="SimpleLiteral" abstract="true"/> <xs:element name="title" substitutionGroup="any"/> <xs:element name="creator" substitutionGroup="any"/> <xs:element name="subject" substitutionGroup="any"/> <xs:element name="description" substitutionGroup="any"/> <xs:element name="publisher" substitutionGroup="any"/> <xs:element name="contributor" substitutionGroup="any"/> <xs:element name="date" substitutionGroup="any"/> <xs:element name="type" substitutionGroup="any"/> <xs:element name="format" substitutionGroup="any"/> <xs:element name="identifier" substitutionGroup="any"/> <xs:element name="source" substitutionGroup="any"/> <xs:element name="language" substitutionGroup="any"/> <xs:element name="relation" substitutionGroup="any"/> <xs:element name="coverage" substitutionGroup="any"/> <xs:element name="rights" substitutionGroup="any"/> <xs:group name="elementsGroup"> <xs:annotation> <xs:documentation xml:lang="en"> This group is included as a convenience for schema authors who need to refer to all the elements in the http://purl.org/dc/elements/1.1/ namespace. </xs:documentation> </xs:annotation> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="any"/> </xs:choice> </xs:sequence> </xs:group> <xs:complexType name="elementContainer"> <xs:annotation> <xs:documentation xml:lang="en"> This complexType is included as a convenience for schema authors who need to define a root or container element for all of the DC elements. </xs:documentation> </xs:annotation> <xs:choice> <xs:group ref="elementsGroup"/> </xs:choice> </xs:complexType> </xs:schema> --- NEW FILE: imsmd_v1p2.xsd --- <?xml version="1.0" encoding="UTF-8"?> <!-- edited by Thomas Wason --> <xsd:schema xmlns="http://www.imsglobal.org/xsd/imsmd_v1p2" targetNamespace="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" version="IMS MD 1.2.1"> <xsd:import namespace = "http://www.w3.org/XML/1998/namespace" schemaLocation = "http://www.w3.org/2001/03/xml.xsd"/> <!-- ******************** --> <!-- ** Change History ** --> <!-- ******************** --> <xsd:annotation> <xsd:documentation>2001-04-26 T.D.Wason. IMS meta-data 1.2 XML-Schema. </xsd:documentation> <xsd:documentation>2001-06-07 S.E.Thropp. Changed the multiplicity on all elements to match the </xsd:documentation> <xsd:documentation>Final 1.2 Binding Specification. </xsd:documentation> <xsd:documentation>Changed all elements that use the langstringType to a multiplicy of 1 or more </xsd:documentation> <xsd:documentation>Changed centity in the contribute element to have a multiplicity of 0 or more. </xsd:documentation> <xsd:documentation>Changed the requirement element to have a multiplicity of 0 or more. </xsd:documentation> <xsd:documentation> 2001-07-25 Schawn Thropp. Updates to bring the XSD up to speed with the W3C </xsd:documentation> <xsd:documentation> XML Schema Recommendation. The following changes were made: Change the </xsd:documentation> <xsd:documentation> namespace to reference the 5/2/2001 W3C XML Schema Recommendation,the base </xsd:documentation> <xsd:documentation> type for the durtimeType, simpleType, was changed from timeDuration to duration. </xsd:documentation> <xsd:documentation> Any attribute declarations that have use="default" had to change to use="optional" </xsd:documentation> <xsd:documentation> - attr.type. Any attribute declarations that have value ="somevalue" had to change </xsd:documentation> <xsd:documentation> to default = "somevalue" - attr.type (URI) </xsd:documentation> <xsd:documentation> 2001-09-04 Schawn Thropp </xsd:documentation> <xsd:documentation> Changed the targetNamespace and namespace of schema to reflect version change </xsd:documentation> </xsd:annotation> <!-- *************************** --> <!-- ** Attribute Declaration ** --> <!-- *************************** --> <xsd:attributeGroup name="attr.type"> <xsd:attribute name="type" use="optional" default="URI"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="URI"/> <xsd:enumeration value="TEXT"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:attributeGroup> <xsd:group name="grp.any"> <xsd:annotation> <xsd:documentation>Any namespaced element from any namespace may be used for an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. </xsd:documentation> </xsd:annotation> <xsd:sequence> <xsd:any namespace="##any" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:group> <!-- ************************* --> <!-- ** Element Declaration ** --> <!-- ************************* --> <xsd:element name="aggregationlevel" type="aggregationlevelType"/> <xsd:element name="annotation" type="annotationType"/> <xsd:element name="catalogentry" type="catalogentryType"/> <xsd:element name="catalog" type="catalogType"/> <xsd:element name="centity" type="centityType"/> <xsd:element name="classification" type="classificationType"/> <xsd:element name="context" type="contextType"/> <xsd:element name="contribute" type="contributeType"/> <xsd:element name="copyrightandotherrestrictions" type="copyrightandotherrestrictionsType"/> <xsd:element name="cost" type="costType"/> <xsd:element name="coverage" type="coverageType"/> <xsd:element name="date" type="dateType"/> <xsd:element name="datetime" type="datetimeType"/> <xsd:element name="description" type="descriptionType"/> <xsd:element name="difficulty" type="difficultyType"/> <xsd:element name="educational" type="educationalType"/> <xsd:element name="entry" type="entryType"/> <xsd:element name="format" type="formatType"/> <xsd:element name="general" type="generalType"/> <xsd:element name="identifier" type="xsd:string"/> <xsd:element name="intendedenduserrole" type="intendedenduserroleType"/> <xsd:element name="interactivitylevel" type="interactivitylevelType"/> <xsd:element name="interactivitytype" type="interactivitytypeType"/> <xsd:element name="keyword" type="keywordType"/> <xsd:element name="kind" type="kindType"/> <xsd:element name="langstring" type="langstringType"/> <xsd:element name="language" type="xsd:string"/> <xsd:element name="learningresourcetype" type="learningresourcetypeType"/> <xsd:element name="lifecycle" type="lifecycleType"/> <xsd:element name="location" type="locationType"/> <xsd:element name="lom" type="lomType"/> <xsd:element name="maximumversion" type="minimumversionType"/> <xsd:element name="metadatascheme" type="metadataschemeType"/> <xsd:element name="metametadata" type="metametadataType"/> <xsd:element name="minimumversion" type="maximumversionType"/> <xsd:element name="name" type="nameType"/> <xsd:element name="purpose" type="purposeType"/> <xsd:element name="relation" type="relationType"/> <xsd:element name="requirement" type="requirementType"/> <xsd:element name="resource" type="resourceType"/> <xsd:element name="rights" type="rightsType"/> <xsd:element name="role" type="roleType"/> <xsd:element name="semanticdensity" type="semanticdensityType"/> <xsd:element name="size" type="sizeType"/> <xsd:element name="source" type="sourceType"/> <xsd:element name="status" type="statusType"/> <xsd:element name="structure" type="structureType"/> <xsd:element name="taxon" type="taxonType"/> <xsd:element name="taxonpath" type="taxonpathType"/> <xsd:element name="technical" type="technicalType"/> <xsd:element name="title" type="titleType"/> <xsd:element name="type" type="typeType"/> <xsd:element name="typicalagerange" type="typicalagerangeType"/> <xsd:element name="typicallearningtime" type="typicallearningtimeType"/> <xsd:element name="value" type="valueType"/> <xsd:element name="person" type="personType"/> <xsd:element name="vcard" type="xsd:string"/> <xsd:element name="version" type="versionType"/> <xsd:element name="installationremarks" type="installationremarksType"/> <xsd:element name="otherplatformrequirements" type="otherplatformrequirementsType"/> <xsd:element name="duration" type="durationType"/> <xsd:element name="id" type="idType"/> <!-- ******************* --> <!-- ** Complex Types ** --> <!-- ******************* --> <xsd:complexType name="aggregationlevelType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="annotationType" mixed="true"> <xsd:sequence> <xsd:element ref="person" minOccurs="0"/> <xsd:element ref="date" minOccurs="0"/> <xsd:element ref="description" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="catalogentryType" mixed="true"> <xsd:sequence> <xsd:element ref="catalog"/> <xsd:element ref="entry"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="centityType"> <xsd:sequence> <xsd:element ref="vcard"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="classificationType" mixed="true"> <xsd:sequence> <xsd:element ref="purpose" minOccurs="0"/> <xsd:element ref="taxonpath" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="description" minOccurs="0"/> <xsd:element ref="keyword" minOccurs="0" maxOccurs="unbounded"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="contextType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="contributeType" mixed="true"> <xsd:sequence> <xsd:element ref="role"/> <xsd:element ref="centity" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="date" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="copyrightandotherrestrictionsType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="costType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="coverageType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="dateType"> <xsd:sequence> <xsd:element ref="datetime" minOccurs="0"/> <xsd:element ref="description" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="descriptionType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="difficultyType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="durationType"> <xsd:sequence> <xsd:element ref="datetime" minOccurs="0"/> <xsd:element ref="description" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="educationalType" mixed="true"> <xsd:sequence> <xsd:element ref="interactivitytype" minOccurs="0"/> <xsd:element ref="learningresourcetype" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="interactivitylevel" minOccurs="0"/> <xsd:element ref="semanticdensity" minOccurs="0"/> <xsd:element ref="intendedenduserrole" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="context" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="typicalagerange" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="difficulty" minOccurs="0"/> <xsd:element ref="typicallearningtime" minOccurs="0"/> <xsd:element ref="description" minOccurs="0"/> <xsd:element ref="language" minOccurs="0" maxOccurs="unbounded"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="entryType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="generalType" mixed="true"> <xsd:sequence> <xsd:element ref="identifier" minOccurs="0"/> <xsd:element ref="title" minOccurs="0"/> <xsd:element ref="catalogentry" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="language" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="description" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="keyword" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="coverage" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="structure" minOccurs="0"/> <xsd:element ref="aggregationlevel" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="installationremarksType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="intendedenduserroleType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="interactivitylevelType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="interactivitytypeType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="keywordType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="kindType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="langstringType"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute ref="xml:lang"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="learningresourcetypeType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="lifecycleType" mixed="true"> <xsd:sequence> <xsd:element ref="version" minOccurs="0"/> <xsd:element ref="status" minOccurs="0"/> <xsd:element ref="contribute" minOccurs="0" maxOccurs="unbounded"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="locationType"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attributeGroup ref="attr.type"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="lomType"> <xsd:sequence> <xsd:element ref="general" minOccurs="0"/> <xsd:element ref="lifecycle" minOccurs="0"/> <xsd:element ref="metametadata" minOccurs="0"/> <xsd:element ref="technical" minOccurs="0"/> <xsd:element ref="educational" minOccurs="0"/> <xsd:element ref="rights" minOccurs="0"/> <xsd:element ref="relation" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="annotation" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="classification" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="metametadataType" mixed="true"> <xsd:sequence> <xsd:element ref="identifier" minOccurs="0"/> <xsd:element ref="catalogentry" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="contribute" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="metadatascheme" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="language" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="nameType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="otherplatformrequirementsType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="personType"> <xsd:sequence> <xsd:element ref="vcard"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="purposeType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="relationType" mixed="true"> <xsd:sequence> <xsd:element ref="kind" minOccurs="0"/> <xsd:element ref="resource" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="requirementType" mixed="true"> <xsd:sequence> <xsd:element ref="type" minOccurs="0"/> <xsd:element ref="name" minOccurs="0"/> <xsd:element ref="minimumversion" minOccurs="0"/> <xsd:element ref="maximumversion" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="resourceType" mixed="true"> <xsd:sequence> <xsd:element ref="identifier" minOccurs="0"/> <xsd:element ref="description" minOccurs="0"/> <xsd:element ref="catalogentry" minOccurs="0" maxOccurs="unbounded"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="rightsType" mixed="true"> <xsd:sequence> <xsd:element ref="cost" minOccurs="0"/> <xsd:element ref="copyrightandotherrestrictions" minOccurs="0"/> <xsd:element ref="description" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="roleType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="semanticdensityType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="sourceType"> <xsd:sequence> <xsd:element ref="langstring"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="statusType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="stringType"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute ref="xml:lang"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="structureType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="taxonpathType"> <xsd:sequence> <xsd:element ref="source" minOccurs="0"/> <xsd:element ref="taxon" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="taxonType"> <xsd:sequence> <xsd:element ref="id" minOccurs="0"/> <xsd:element ref="entry" minOccurs="0"/> <xsd:element ref="taxon" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="technicalType" mixed="true"> <xsd:sequence> <xsd:element ref="format" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="size" minOccurs="0"/> <xsd:element ref="location" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="requirement" minOccurs="0" maxOccurs="unbounded"/> <xsd:element ref="installationremarks" minOccurs="0"/> <xsd:element ref="otherplatformrequirements" minOccurs="0"/> <xsd:element ref="duration" minOccurs="0"/> <xsd:group ref="grp.any"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="titleType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="typeType"> <xsd:sequence> <xsd:element ref="source"/> <xsd:element ref="value"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="typicalagerangeType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="typicallearningtimeType"> <xsd:sequence> <xsd:element ref="datetime" minOccurs="0"/> <xsd:element ref="description" minOccurs="0"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="valueType"> <xsd:sequence> <xsd:element ref="langstring"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="versionType"> <xsd:sequence> <xsd:element ref="langstring" minOccurs="1" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <!-- ****************** --> <!-- ** Simple Types ** --> <!-- ****************** --> <xsd:simpleType name="formatType"> <xsd:restriction base="xsd:string"/> </xsd:simpleType> <xsd:simpleType name="sizeType"> <xsd:restriction base="xsd:int"/> </xsd:simpleType> <xsd:simpleType name="datetimeType"> <xsd:restriction base="xsd:string"/> </xsd:simpleType> <xsd:simpleType name="idType"> <xsd:restriction base="xsd:string"/> </xsd:simpleType> <xsd:simpleType name="metadataschemeType"> <xsd:restriction base="xsd:string"/> </xsd:simpleType> <xsd:simpleType name="catalogType"> <xsd:restriction base="xsd:string"/> </xsd:simpleType> <xsd:simpleType name="minimumversionType"> <xsd:restriction base="xsd:string"/> </xsd:simpleType> <xsd:simpleType name="maximumversionType"> <xsd:restriction base="xsd:string"/> </xsd:simpleType> </xsd:schema> --- NEW FILE: mathQuiz.jpg --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646 Modified Files: analysis.php editquiz.php index.php question_bank.php quiz.php readme.txt rqp_server.php stackstd.php.dist Added Files: import.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: rqp_server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/rqp_server.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rqp_server.php 8 Apr 2005 15:10:29 -0000 1.4 --- rqp_server.php 25 Aug 2005 16:06:16 -0000 1.5 *************** *** 8,33 **** */ - // STACK specific code require_once('stackstd.php'); ! require_once($stack_root.'/scripts/rqp/rqp_calls.php'); require_once($stack_root.'/scripts/stackXML.php'); ! ! // Does this implementation offer others web services? if (!$stack_web_services_provide) { echo "This STACK server does not offer web services."; die(); ! } // Load nusoap if PHP 5 native support is not present. ! require_once($stack_root.'/scripts/rqp/uni_soap.php'); ! // Allow the WSDL to be returned by adding '?wsdl' to our URL ! if (isset($_GET['wsdl'])) ! handle_soap_wsdl_request($stack_root.'/scripts/rqp/rqp.wsdl', true); // Handle the SOAP request ! soap_serve($stack_root.'/scripts/rqp/rqp.wsdl', array('RQP_ServerInformation', 'RQP_ItemInformation', 'RQP_ProcessTemplate', 'RQP_Clone', 'RQP_SessionInformation', 'RQP_Render')); /** --- 8,37 ---- */ // STACK specific code require_once('stackstd.php'); ! //require_once($stack_root.'/scripts/rqp/rqp_calls.php'); ! require_once($stack_root.'/scripts/rqp/RQPv1p0Server.php'); require_once($stack_root.'/scripts/stackXML.php'); ! ! //Instance a new RQP server which deals with backend SOAP responses ! $rqpserver = new RQPv1p0(); ! $rqpserver->Url = "http://localhost/stack-1-0/rqp/RQPv1p0Server.php"; ! ! echo serialize($rqpserver->RQP_ServerInformation()); ! // Does this implementatio/n offer others web services? if (!$stack_web_services_provide) { echo "This STACK server does not offer web services."; die(); ! } // Load nusoap if PHP 5 native support is not present. ! //require_once($stack_root.'/scripts/rqp/uni_soap.php'); // Allow the WSDL to be returned by adding '?wsdl' to our URL ! //if (isset($_GET['wsdl'])) ! // handle_soap_wsdl_request($stack_root.'/scripts/rqp/rqp.wsdl', true); // Handle the SOAP request ! //soap_serve($stack_root.'/scripts/rqp/rqp.wsdl', array('RQP_ServerInformation', 'RQP_ItemInformation', 'RQP_ProcessTemplate', 'RQP_Clone', 'RQP_SessionInformation', 'RQP_Render')); /** *************** *** 60,66 **** * The first entry is the default. */ function RQP_ServerInformation() { ! $return = stack_rqp_ServerInformationCall(); ! return $return; } --- 64,70 ---- * The first entry is the default. */ + //<TODO> Update documentation for serverinformation function RQP_ServerInformation() { ! return $rqpserver->RQP_ServerInformation(); } --- NEW FILE: import.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... * @author Juliette White jv...@jv... * * Provides the front end interactions for the import functionality, and then returns the user to the * correct page, i.e. if they are uploading a question,quiz or list of questions * <TODO> Returning the user to the correct page * <TODO> Errors should be placed into 'localised' documentation * <TODO> Is this right quiz GUID behaviour? * <TODO> Error errc and errs behaviour * <TODO> Quiz validation always returns true - stub function stack_quiz_validate * * @package frontend * @subpackage Stack */ session_start(); include('stackstd.php'); require_once("{$stack_root}/html/trypopupform.html"); require_once("{$stack_root}/frontend_general/editquiz_display.php"); require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/quizjava.html"); require_once("{$stack_root}/scripts/stackAuthor.php"); $default_action = 'import'; include('frontend_general/process_input.php'); $PostTo = 'import.php'; $filter = ''; $quizid = NULL; 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; $errors = ''; if ($action == 'uploaded_xml') { if (array_key_exists('xmlfile',$_FILES)) { if (is_uploaded_file($_FILES['xmlfile']['tmp_name'])) { //Check a file has actually been uploaded if (findtype($_FILES['xmlfile']['name'])=='xml') { //Only allow the uploading of files with 'xml' extension include_once("{$stack_root}/scripts/stackXML.php"); $imported = stack_xml_parse_file($_FILES['xmlfile']['tmp_name'],$errors); //Returns an array corresponding to imported XML //Incorrect XML file input, no [mathQuiz] or [assessmentItem] head element if (!$imported) { $upload_successful = FALSE; echo("<font color=\"red\">The XML file uploaded is not a question, question list or quiz</font><br />"); echo("<b>Further information: $errors</b><br /><br />"); } //Import is an array of values else { $upload_successful = TRUE; } } else { //extension is not XML echo("<font color=\"red\">The selected file is not an XML file</font><br /><br />"); } } else { //no file selected to upload echo("<font color=\"red\">You have not selected an XML file to upload</font><br /><br />"); } } } //Provides front-end logic depending on POST variable '$action' switch ($action) { case 'uploaded_xml': if ($upload_successful) { stack_display_parse_imported($imported); break; } else { //!upload_successful $action='import'; } case 'import': //initial import page stack_display_import(); break; } /** * Returns the extension of the uploaded file * * @param string $file The filename of the file uploaded * @return string $type The uploaded file's extension */ function findtype($file) { $revfile = strrev($file); $type = strtolower( strrev(substr($revfile,0,strpos($revfile,"."))) ); return $type; } /** * Displays the form for importing a file * * @return void */ function stack_display_import() { echo "Select an XML file to upload and edit: <br /> <form enctype='multipart/form-data' action=\"import.php\"' method='POST'><br />\n <input type ='file' name='xmlfile' />\n <input type ='hidden' name='action' value='uploaded_xml' /> <input type ='submit' name='go' value='Upload'> </form>\n\n"; } /** * Parses the head element in order to detect what has just been uploaded - a quiz, question, or list of questions. * A quiz will have <mathQuiz> element and mathQuiz level metadata and options * A list of questions will have a <mathQuiz> element without mathQuiz level metadata and options * A question will have an <assessmentItem> element. * * @param array $imported The imported XML file in array format * @return void */ function stack_display_parse_imported($imported) { global $stackQuiz; //1. Decide what has been imported if (array_key_exists('mathQuiz',$imported)) //If it is a quiz/list of questions { $quiz = $imported['mathQuiz']; $isQuiz=false; //Check for quiz level components, like a GUID foreach($stackQuiz as $arrayKey=>$quizField) { if (array_key_exists($arrayKey,$quiz)) //If one quiz level metadata element exists, then it must be a quiz { $isQuiz = true; break; //no need to keep iterating } } //We are ready to decide if its a quiz or list of questions if ($isQuiz) { stack_display_show_imported_quiz($quiz); } else //!isQuiz { //List of questions $quiz=$imported['mathQuiz']['assessmentItem']; stack_display_show_imported_qulist($quiz); } } else if (array_key_exists('assessmentItem',$imported)) //A single question { $question = $imported['assessmentItem']; stack_display_show_imported_question($question); } else //If neither <mathQuiz> or <assessmentItem> is head element { //do not continue to parse array echo("<font color=\"red\">The XML file uploaded is not a question, question list or quiz</font><br />"); echo("<b>Further information: $errors</b><br /><br />"); $action='import'; } } /** * Performs the actual import of a quiz file into STACK, and provided the front-end interaction * to show a successful/unsuccessful import * * @param array $quiz A mathQuiz array * @return void */ function stack_display_show_imported_quiz($quiz) { global $stack_web_url; echo "<h2>Details of quiz uploaded</h2>"; echo '<table><thead><tr>'; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; $errs = NULL; $errc = FALSE; stack_quiz_validate($quiz,$errs); // Validate quiz (TODO) stack_xml_reinstate_quiz_meta_defaults($quiz); // Reinstate any default (empty) metadata fields /*if (nsf($errs,$key)) { if (is_array($errs[$key])) { $errc = TRUE; } }*/ //Each imported quiz should have a unique GUID; generate a new one here if (array_key_exists('quizGUID',$quiz)) { $quiz['quizGUID']=stack_generate_guid($stack_web_url) ; } //Add quiz to database & retrieve its new quizID to add question to respective quiz $quiz['quizid'] = stack_db_quiz_update($quiz); //Show quiz details on screen echo "<tr>\n <td>".sf($quiz,'quizid')."</td> <td>".sf($quiz,'quizName')." </td> <td>".sf($quiz,'quizDescription')." </td> <td>".sf($quiz,'quizKeywords')." </td>"; if ($errc) { echo "<td><font color=\"red\">Invalid quiz</font></td>"; echo "</tr></tbody></table>\n\n"; echo stack_question_errstr($errs[$key]); echo "\n\n<table><thead><tr>"; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; } else { echo "<td><font color=\"greed\">Valid quiz</font></td>"; } echo "</tr>\n"; echo "</tbody></table>\n"; //end of quiz table echo "<h2>Details of questions uploaded</h2>"; //Start of questions within quiz table echo '<table><thead><tr>'; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; $errs = NULL; $quizQuestions = $quiz['assessmentItem']; //Point to assessmentItems only foreach ($quizQuestions as $key => $qu) { //Iterate through each question stack_question_validate($quizQuestions[$key],$errs[$key]); stack_xml_reinstate_question_meta_defaults($qu); //Reinstate any missing question metadata $qu['questionID'] = stack_db_question_add($qu); //Add question to db, and retrieve its new ID echo "<tr>\n <td>".sf($qu,'questionID')."</td> <td>".sf($qu,'questionName')." </td> <td>".sf($qu,'questionDescription')." </td> <td>".sf($qu,'questionKeywords')." </td>"; $errc = FALSE; if (nsf($errs,$key)) { if (is_array($errs[$key])) { $errc = TRUE; } } if ($errc) { echo "<td><font color=\"red\">Invalid question</font></td>"; echo "</tr></tbody></table>\n\n"; echo stack_question_errstr($errs[$key]); echo "\n\n<table><thead><tr>"; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; } else { echo "<td><font color=\"greed\">Valid question</font></td>"; //For each valid question we must also add the question to the database stack_db_quiz_add_question($quiz['quizid'],$qu['questionID']); //For each question, add link from quiz to question } echo "</tr>\n"; } echo "</tbody></table>\n"; //end of question table //<TODO: Chris to implement these links> echo "<p><a href=\"javascript:void(0);\">Edit imported quiz</a> "; echo "<p><a href=\"javascript:void(0);\">View list of quizzes</a> "; } /** * Performs the actual import of a question list file into STACK, and provide the front-end interaction * to show a successful/unsuccessful import * * @param array $quiz A mathQuiz array * @return void */ function stack_display_show_imported_qulist($quiz) { echo "<h2>Details of questions uploaded</h2>"; echo '<table><thead><tr>'; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; $errs = NULL; foreach ($quiz as $key => $qu) { //Iterate through each question stack_question_validate($quiz[$key],$errs[$key]); stack_xml_reinstate_question_meta_defaults($qu); //Reinstate any missing metadata in order to all fields to database $qu['questionID'] = stack_db_question_add($qu); echo "<tr>\n <td>".sf($qu,'questionID')."</td> <td>".sf($qu,'questionName')." </td> <td>".sf($qu,'questionDescription')." </td> <td>".sf($qu,'questionKeywords')." </td>"; $errc = FALSE; if (nsf($errs,$key)) { if (is_array($errs[$key])) { $errc = TRUE; } } if ($errc) { echo "<td><font color=\"red\">Invalid question</font></td>"; echo "</tr></tbody></table>\n\n"; echo stack_question_errstr($errs[$key]); echo "\n\n<table><thead><tr>"; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; } else { echo "<td><font color=\"greed\">Valid question</font></td>"; } echo "</tr>\n"; } echo "</tbody></table>\n"; //<TODO: Chris to implement these links> echo "<p><a href=\"javascript:void(0);\">View list of questions</a> "; } /** * Performs the actual import of a question file into STACK, and provide the front-end interaction * to show a successful/unsuccessful import * * @param array $quiz A mathQuiz array * @return void */ function stack_display_show_imported_question($question) { //include("{$stack_root}/html/qselectform.php"); echo "<h2>Details of the uploaded question</h2>"; echo '<table><thead><tr>'; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; stack_question_validate($question,$errs); stack_xml_reinstate_question_meta_defaults($question); //Reinstate any missing metadata in order to all fields to database $question['questionID'] = stack_db_question_add($question); echo "<tr>\n <td>".sf($question,'questionID')."</td> <td>".sf($question,'questionName')." </td> <td>".sf($question,'questionDescription')." </td> <td>".sf($question,'questionKeywords')." </td>"; $errc = FALSE; if (!empty($errs)) { $errc = TRUE; } if ($errc) { echo "<td><font color=\"red\">Invalid question</font></td>"; echo "</tr></tbody></table>\n\n"; echo stack_question_errstr($errs); echo "\n\n<table><thead><tr>"; echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; } else { echo "<td><font color=\"greed\">Valid question</font></td>"; } echo "</tr>\n"; echo "</tbody></table>\n"; //<TODO: Chris to implement these links> echo "<p><a href=\"javascript:void(0);\">Edit imported question</a> "; echo "<p><a href=\"javascript:void(0);\">View list of questions</a> "; } ?> Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** quiz.php 14 Jul 2005 18:26:03 -0000 1.25 --- quiz.php 25 Aug 2005 16:06:16 -0000 1.26 *************** *** 52,55 **** --- 52,59 ---- } + // Now datetime + $tnow = time(); + $dtnow = stack_time_display($tnow); + //////////////////////////////////////////////// // (3) Decide what we are trying to do. *************** *** 66,69 **** --- 70,75 ---- // action = solutions Mark the response to *every question* then show the solutions // This prevents further attempts + // action = review Review a student's quiz, as the teacher. + // If there is a quiz stored in the $_SESSION, we should use this. *************** *** 102,106 **** // (4.3) construct the $quiz ! if ('continue_quiz' == $action or 'new_quiz_version' == $action) { // Clear any existing quiz and quizInst from the $_SESSION session_unregister('quizInst'); --- 108,112 ---- // (4.3) construct the $quiz ! if ('continue_quiz' == $action or 'new_quiz_version' == $action or 'review' == $action) { // Clear any existing quiz and quizInst from the $_SESSION session_unregister('quizInst'); *************** *** 128,131 **** --- 134,138 ---- // (4.4) At this point we should have a $quiz and $quizInst to work on. + // Find out if we have quiz options. $quiz_options = array(); *************** *** 133,139 **** $quiz_options = $quiz['quizOptions']; } // (4.5) Reconstruct $quizInst from previous data ! if ('continue_quiz' == $action) { $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$user['id']); --- 140,166 ---- $quiz_options = $quiz['quizOptions']; } + + $quizmode = $quiz_options['QuizMode']; + + $duedate = ''; + $duedate_display = ''; + $duedate_passed = FALSE; + if (array_key_exists('quizDueDate',$quiz)){ + if ('' != $quiz['quizDueDate']) { + $duedate = $quiz['quizDueDate']; + $duedate_display = stack_time_display($duedate); + if ($tnow>$duedate) { + $duedate_passed = TRUE; + } + } + } + + if ('review' == $action) { + $student_user = $_POST['userid']; + $user = stack_db_user_get_ID($student_user); + } // (4.5) Reconstruct $quizInst from previous data ! if ('continue_quiz' == $action or 'review' == $action) { $userinfo = stack_db_quiz_quizattempt_getlast($quizid,$user['id']); *************** *** 399,403 **** ! // (2.9) Store the modified information in the $_SESSION if ('solutions' == $action) { // (2.9.1) record the fact we have asked for solutions --- 426,430 ---- ! // (2.9) if ('solutions' == $action) { // (2.9.1) record the fact we have asked for solutions *************** *** 478,481 **** --- 505,511 ---- $title = get_string('TrySTACKQuiz','stack','').": {$user['firstname']} {$user['lastname']} ({$user['username']})"; + if ('review' == $action) { + $title = get_string('ReviewSTACKQuiz','stack','').": {$user['firstname']} {$user['lastname']} ({$user['username']})"; + } // TODO : The second argument needs to be 'MathML' when required *************** *** 485,488 **** --- 515,536 ---- require_once("{$stack_root}/html/quizjava.html"); + + // (3.1) Print a summary of the context of this quiz. + echo "\n<a name='top'></a>\n"; + echo '<table>'; + echo '<tr><td><b>'.get_string('stackQuiz_quizName','stack','').'</b></td><td>'.$quiz['quizName'].'</td></tr>'; + echo '<tr><td><b>'.get_string('stackOptions_QuizMode','stack','').'</b></td><td>'.$quizmode.'</td></tr>'; + echo '<tr><td><b>'.get_string('quiz_page_created','stack','').'</b></td><td>'.$dtnow.'</td></tr>'; + if ( '' != $duedate_display) { + echo '<tr><td><b>'.get_string('quiz_duedate','stack','').'</b></td><td>'. $duedate_display.'</td></tr>'; + } + //echo '<tr><td><b></b></td><td></td></tr>'; + echo '</table>'; + + // (3.2) Has the due date passed? + if ($duedate_passed) { + echo "<p><font color='red'>".get_string('quiz_duedate_passed','stack','')."</font></p>"; + } + if ('quiz_error' == $action) { *************** *** 536,566 **** echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'><tr> <td align='left'><a name=\"q$qn\"><b>".get_string('Question','stack','')." $qn</b></a></td><td align='right'>"; ! if ($focus) { foreach ($quizInst as $qk => $dum) { $qnn = $qk+1; echo "<a href=\"javascript:takeaction('focus',$qk);\">$qnn</a> "; } ! if ('solutions' != $action) { ! echo" <a href=\"javascript:takeaction('validate',0);\">".get_string('Validate','stack','')."</a>  ! <a href=\"javascript:takeaction('mark_question',$key);\">".get_string('MarkThisQ','stack','')."</a>  "; ! } } else { //unfocus ! if ('solutions' != $action) { echo "<a href=\"javascript:takeaction('focus',$key);\">".get_string('Focus','stack','')."</a> "; ! } foreach ($quizInst as $qk => $dum) { $qnn = $qk+1; echo "<a href='#q$qnn'>$qnn</a> "; } ! echo "<a href='#quizend'>".get_string('End','stack','')."</a>  "; ! if ('solutions' != $action) { echo" <a href=\"javascript:takeaction('validate',0);\">".get_string('Validate','stack','')."</a>  ! <a href=\"javascript:takeaction('mark_question',$key);\">".get_string('MarkQ','stack','')." $qn</a>  "; } ! } echo "<a href=\"javascript:HelpPopup('student','');\">".get_string('Help','stack','')."</a></td> --- 584,615 ---- echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'><tr> <td align='left'><a name=\"q$qn\"><b>".get_string('Question','stack','')." $qn</b></a></td><td align='right'>"; ! if ($focus) { + echo "<a href='#top'>".get_string('Top','stack','')."</a>  "; foreach ($quizInst as $qk => $dum) { $qnn = $qk+1; echo "<a href=\"javascript:takeaction('focus',$qk);\">$qnn</a> "; } ! echo "<a href='#bottom'>".get_string('Bottom','stack','')."</a>  "; } else { //unfocus ! if ('solutions' != $action and 'review' != $action) { echo "<a href=\"javascript:takeaction('focus',$key);\">".get_string('Focus','stack','')."</a> "; ! } + echo "<a href='#top'>".get_string('Top','stack','')."</a>  "; foreach ($quizInst as $qk => $dum) { $qnn = $qk+1; echo "<a href='#q$qnn'>$qnn</a> "; } + echo "<a href='#bottom'>".get_string('Bottom','stack','')."</a>  "; ! } ! ! if ('solutions' != $action and 'review' != $action) { echo" <a href=\"javascript:takeaction('validate',0);\">".get_string('Validate','stack','')."</a>  ! <a href=\"javascript:takeaction('mark_question',$key);\">".get_string('MarkThisQ','stack','')."</a>  "; } ! echo "<a href=\"javascript:HelpPopup('student','');\">".get_string('Help','stack','')."</a></td> *************** *** 581,614 **** } ! if ('solutions' != $action) { $RA = $this_attempt['RawAns']; ! echo stack_question_inst_try_formfrag($RA,"RawAns[$key]"); } // Do we show solutions? ! if ('Always' == $options['ShowSol']) { ! stack_question_inst_show_sol($qInst,$errors); ! } else if ('Never' != $options['ShowSol'] and 'solutions' == $action) { stack_question_inst_show_sol($qInst,$errors); ! } else if ('After correct answer' == $options['ShowSol']) { ! ! $show_sol = FALSE; ! if (array_key_exists('questionAttempts',$qInst)) { ! if (is_array($qInst['questionAttempts'])) { ! foreach($qInst['questionAttempts'] as $atn=>$anattempt) { ! if (1 == $anattempt['RawMark'] and 'mark' == $anattempt['Action'] ) { ! $show_sol = TRUE; ! } ! } ! } ! } ! if ($show_sol) { ! stack_question_inst_show_sol($qInst,$errors); ! } ! } ! ! } // End of feedback & errors } // End of print if focused. --- 630,652 ---- } ! if ('solutions' != $action and TRUE != $duedate_passed and 'review' != $action) { $RA = $this_attempt['RawAns']; ! echo stack_question_inst_try_formfrag($RA,"RawAns[$key]"); } // Do we show solutions? ! if ('solutions' == $action or $duedate_passed) { stack_question_inst_show_sol($qInst,$errors); ! } ! // Show a review table. ! if ('review' == $action) { ! echo "<p><table bgcolor='#CCCCCC' width='100%' cellpadding='2'><tr><td>"; ! stack_question_inst_show_attempts($qInst,$errors); ! echo "</td></tr><tr><td><b>".get_string('QTestQuestionNote','stack','')."</b> ".nsf($qInst,'questionNoteInst'); ! echo "</td></tr></table></p>"; ! stack_question_inst_show_sol($qInst,$errors); } ! } // End of feedback & errors } // End of print if focused. *************** *** 647,675 **** echo "<table>\n"; ! if ('solutions' != $action) { ! if ($focus) { ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('unfocus',0);\">".get_string('UnFocus','stack','')."</a></td> ! <td> ".get_string('UnFocusExplain','stack','')."</td></tr>\n"; ! } else { ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('focus',0);\">".get_string('Focus','stack','')."</a></td> ! <td> ".get_string('FocusExplain','stack','')."</td></tr>\n"; ! } ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('validate',0);\">".get_string('Validate','stack','')."</a></td> ! <td> ".get_string('ValidateExplain','stack','')."</td></tr>\n ! <tr><td></td><td>".get_string('ValidateExplain2','stack','')."</td></tr> ! <tr><td><a href=\"javascript:takeaction('mark',0);\">".get_string('Mark','stack','')."</a></td> ! <td>".get_string('MarkExplain','stack','')."</td></tr>\n"; } ! echo " <tr><td><a href=\"javascript:takeaction('solutions',0);\">".get_string('Solutions','stack','')."</a></td> ! <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n ! <tr><td></td><td>".get_string('SolutionsExplain2','stack','')."</td></tr> ! <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('new_quiz_version',$quizid);\">".get_string('NewVersion','stack','')."</a></td> ! <td>".get_string('NewVersionExplain','stack','')."</td></tr>"; ! echo "<tr><td nowrap='nowrap'><a href=\"index.php?action=choose_quiz\">".get_string('ChooseQuiz','stack','')."</a></td> ! <td>".get_string('ClickHereTryQuiz','stack','')."</td></tr>\n ! <tr><td><a href='index.php?action=choose_quiz'>".get_string('Home','stack','')."</a></td> <td>".get_string('STACKHomePage','stack','')."</td></tr>\n"; echo "</table>"; --- 685,714 ---- echo "<table>\n"; ! if ('solutions' != $action and 'review' != $action) { ! if ($focus) { ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('unfocus',0);\">".get_string('UnFocus','stack','')."</a></td> ! <td> ".get_string('UnFocusExplain','stack','')."</td></tr>\n"; ! } else { ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('focus',0);\">".get_string('Focus','stack','')."</a></td> ! <td> ".get_string('FocusExplain','stack','')."</td></tr>\n"; ! } ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('validate',0);\">".get_string('Validate','stack','')."</a></td> ! <td> ".get_string('ValidateExplain','stack','')."</td></tr>\n ! <tr><td></td><td>".get_string('ValidateExplain2','stack','')."</td></tr> ! <tr><td><a href=\"javascript:takeaction('mark',0);\">".get_string('Mark','stack','')."</a></td> ! <td>".get_string('MarkExplain','stack','')."</td></tr>\n"; } ! if ('Practice' == $quizmode and 'review' != $action) { ! echo " <tr><td><a href=\"javascript:takeaction('solutions',0);\">".get_string('Solutions','stack','')."</a></td> ! <td>".get_string('SolutionsExplain','stack','')."</td></tr>\n ! <tr><td></td><td>".get_string('SolutionsExplain2','stack','')."</td></tr>"; ! echo " <tr><td nowrap='nowrap'><a href=\"javascript:takeaction('new_quiz_version',$quizid);\">".get_string('NewVersion','stack','')."</a></td> ! <td>".get_string('NewVersionExplain','stack','')."</td></tr>"; ! } ! ! echo "<tr><td><a href='index.php?action=choose_quiz'>".get_string('Home','stack','')."</a></td> <td>".get_string('STACKHomePage','stack','')."</td></tr>\n"; echo "</table>"; *************** *** 679,682 **** --- 718,722 ---- } + echo "\n<a name='bottom'></a>\n"; stack_page_footer(); Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** index.php 14 Jul 2005 18:44:54 -0000 1.23 --- index.php 25 Aug 2005 16:06:16 -0000 1.24 *************** *** 1,118 **** ! <?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... ! * @author Juliette White jv...@jv... ! * ! * This file contains the front end logic for the main frontend pages ! * 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. ! * @package Stack ! */ ! ! ! /** ! * ! */ ! session_start(); ! ! /////////////////////////////////////////////////////////////// ! // (1) Process Input - this sets $action, $user and $username ! /////////////////////////////////////////////////////////////// ! ! if (file_exists('stackstd.php')) { ! include('stackstd.php'); ! } else { ! echo "STACK is not correctly installed."; ! die(); ! } ! ! $default_action = 'loginscreen'; ! include_once($stack_root.'/frontend_general/front_end_display.php'); ! 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 ('logout' == $action) { ! $user = NULL; ! session_unregister('user'); ! unset($_SESSION['user']); ! $_GET['expand'] = 0; ! } ! ! include('frontend_general/loginregister.php'); ! $err = nsf($errors,'user'); ! $errun = stack_get_errun($err); ! $errps = stack_get_errps($err); ! ! ////////////////////////////////////////////////////////////// ! // (2) Print the page. ! ////////////////////////////////////////////////////////////// ! ! include('html/pagehead.php'); ! ! if ('logout' == $action) { ! echo '<h1>Thank you</h1><p>Thank you for using STACK.'; ! $action = 'loginscreen'; ! } ! ! if ('welcome' == $action) { ! echo "<h1>Welcome</h1> <p>Welcome to STACK, {$user['firstname']} {$user['lastname']}.</p>"; ! if ('admin' != $user['username']) { ! $action = 'choose_quiz'; ! } ! } ! ! if ('loginerr' == $action) { ! echo "<h1>Problems with your login.</h1> <p>You could not be logged into STACK as <tt>{$user['username']}</tt> for the following reason.</p>"; ! echo $errors['user']; ! $action = 'loginscreen'; ! } ! ! switch ($action) { ! case 'loginscreen': ! stack_display_main_login($username, $errun, $errps); ! break; ! case 'registration_screen': ! include_once($stack_root."/scripts/stackUser.php"); ! stack_display_main_register($username, $user, $errors, $err); ! break; ! case 'update_info': ! if (stack_is_logged_in($user) and !stack_user_is_guest($user)) { ! stack_user_update_info($user, $errors); ! } else { ! echo '<h1>Update user information</h1>'; ! echo '<p>Please logout and login as a personal user first to update your information.</p>'; ! } ! break; ! case 'error': ! echo "There was an error with the login or registration"; ! break; ! case 'choose_quiz': ! $quiz_store = stack_db_quiz_get(); ! stack_quiz_student_select($quiz_store, $user); ! break; ! } ! ! include('html/pagefoot.php'); ! ! ?> ! --- 1,282 ---- ! <?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... ! ! * @author Juliette White jv...@jv... ! ! * ! ! * This file contains the front end logic for the main frontend pages ! ! * 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. ! ! * - Added logic to view installation instructions if stackstd.php not dectected ! ! * @package Stack ! ! */ ! ! ! ! ! ! /** ! ! * ! ! */ ! ! session_start(); ! ! ! ! /////////////////////////////////////////////////////////////// ! ! // (1) Process Input - this sets $action, $user and $username ! ! /////////////////////////////////////////////////////////////// ! ! ! ! if (file_exists('stackstd.php')) { ! ! include('stackstd.php'); ! ! } else { ! ! //echo "STACK is not correctly installed."; ! ! //View the installation instructions ! ! include('lang/en/doc/about_install.php'); ! ! die(); ! ! } ! ! ! ! $default_action = 'loginscreen'; ! ! include_once($stack_root.'/frontend_general/front_end_display.php'); ! ! include($stack_root.'/frontend_general/process_input.php'); ! ! ! ! //Initialisation ! ! include_once("{$stack_root}/scripts/stackXML.php"); ! ! //1. Check that XML schemas are up to date ! ! if (!stack_xml_check_schema_version(schemaBaseDir)) ! ! { ! ! $action = 'update_schema'; ! ! } ! ! ! ! //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'; ! ! } ! ! ! ! /////////////////////////////////////////////////////////////// ! ! // (2) Take any actions required ! ! /////////////////////////////////////////////////////////////// ! ! ! ! // Note that we need to unset the user before printing the header. ! ! if ('logout' == $action) { ! ! $user = NULL; ! ! session_unregister('user'); ! ! unset($_SESSION['user']); ! ! $_GET['expand'] = 0; ! ! } ! ! ! ! include('frontend_general/loginregister.php'); ! ! $err = nsf($errors,'user'); ! ! $errun = stack_get_errun($err); ! ! $errps = stack_get_errps($err); ! ! ! ! ////////////////////////////////////////////////////////////// ! ! // (2) Print the page. ! ! ////////////////////////////////////////////////////////////// ! ! ! ! include('html/pagehead.php'); ! ! ! ! if ('logout' == $action) { ! ! echo '<h1>Thank you</h1><p>Thank you for using STACK.'; ! ! $action = 'loginscreen'; ! ! } ! ! ! ! if ('welcome' == $action) { ! ! echo "<h1>Welcome</h1> <p>Welcome to STACK, {$user['firstname']} {$user['lastname']}.</p>"; ! ! if ('admin' != $user['username']) { ! ! $action = 'choose_quiz'; ! ! } ! ! } ! ! ! ! if ('loginerr' == $action) { ! ! echo "<h1>Problems with your login.</h1> <p>You could not be logged into STACK as <tt>{$user['username']}</tt> for the following reason.</p>"; ! ! echo $errors['user']; ! ! $action = 'loginscreen'; ! ! } ! ! ! ! switch ($action) { ! ! case 'loginscreen': ! ! stack_display_main_login($username, $errun, $errps); ! ! break; ! ! case 'registration_screen': ! ! include_once($stack_root."/scripts/stackUser.php"); ! ! stack_display_main_register($username, $user, $errors, $err); ! ! break; ! ! case 'update_info': ! ! if (stack_is_logged_in($user) and !stack_user_is_guest($user)) { ! ! stack_user_update_info($user, $errors); ! ! } else { ! ! echo '<h1>Update user information</h1>'; ! ! echo '<p>Please logout and login as a personal user first to update your information.</p>'; ! ! } ! ! break; ! ! case 'error': ! ! echo "There was an error with the login or registration"; ! ! break; ! ! case 'choose_quiz': ! ! $quiz_store = stack_db_quiz_get(); ! ! stack_quiz_student_select($quiz_store, $user); ! ! break; ! ! case 'update_schema': ! ! stack_xml_update_schema(schemaBaseDir); ! ! break; ! ! case 'update_db': ! ! include("{$stack_root}/scripts/install/stackUpdateDatabase.php"); ! ! break; ! ! } ! ! ! ! include('html/pagefoot.php'); ! ! ! ! ?> ! ! ! Index: stackstd.php.dist =================================================================== RCS file: /cvsroot/stack/stack-1-0/stackstd.php.dist,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** stackstd.php.dist 14 Jul 2005 07:27:03 -0000 1.19 --- stackstd.php.dist 25 Aug 2005 16:06:16 -0000 1.20 *************** *** 63,66 **** --- 63,68 ---- $stack_stand_alone = TRUE; $stack_adminpswd = ''; + $stack_adminfirstname = ''; + $stack_adminsurname = ''; $stack_defaultlang = 'en'; // Use the two letter country codes. *************** *** 104,108 **** // The forbidden commands are generated dynamically, and stored here ! include($stack_logfiles.'CASkeywords.php'); // Anything in the associative array $maximalocal will become --- 106,112 ---- // The forbidden commands are generated dynamically, and stored here ! if (file_exists($stack_logfiles.'CASkeywords.php')) { ! include($stack_logfiles.'CASkeywords.php'); ! } // Anything in the associative array $maximalocal will become *************** *** 159,188 **** /***************************************************/ ! require_once("{$stack_root}/scripts/stackUtility.php"); ! $stack_page_start_time = stack_microtime_float(); ! require_once("{$stack_root}/scripts/stackQuestion.php"); ! require_once("{$stack_root}/scripts/stackQuiz.php"); ! require_once("{$stack_root}/scripts/stackDatabase.php"); ! require_once("{$stack_root}/scripts/stackSocketSend.php"); ! require_once("{$stack_root}/scripts/CASpool/stackProcess.php"); ! if ('unix' == $stack_os) { ! require_once("{$stack_root}/scripts/stackUnix.php"); ! } ! if ('win' == $stack_os) { ! require_once("{$stack_root}/scripts/stackWin.php"); ! } ! // Set the default language. ! $stackOptions['Language']['default'] = $stack_defaultlang; ! if ($stack_stand_alone) { ! require_once("{$stack_root}/scripts/moodlelib.php"); } --- 163,195 ---- /***************************************************/ ! //Check a valid path has been supplied to library files ! if (file_exists("{$stack_root}/scripts/")) { ! require_once("{$stack_root}/scripts/stackUtility.php"); ! $stack_page_start_time = stack_microtime_float(); ! require_once("{$stack_root}/scripts/stackQuestion.php"); ! require_once("{$stack_root}/scripts/stackQuiz.php"); ! require_once("{$stack_root}/scripts/stackDatabase.php"); ! require_once("{$stack_root}/scripts/stackSocketSend.php"); ! require_once("{$stack_root}/scripts/CASpool/stackProcess.php"); ! if ('unix' == $stack_os) { ! require_once("{$stack_root}/scripts/stackUnix.php"); ! } ! if ('win' == $stack_os) { ! require_once("{$stack_root}/scripts/stackWin.php"); ! } ! // Set the default language. ! $stackOptions['Language']['default'] = $stack_defaultlang; ! if ($stack_stand_alone) { ! require_once("{$stack_root}/scripts/moodlelib.php"); ! } } Index: analysis.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/analysis.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** analysis.php 31 Jul 2005 07:42:27 -0000 1.16 --- analysis.php 25 Aug 2005 16:06:16 -0000 1.17 *************** *** 84,88 **** // Carry out the analysis requested in $_POST //////////////////////////////////////////////// ! echo '<h1>Student answers</h1>'; if (''!= $questionID and '(none)' != $questionID) { --- 84,88 ---- // Carry out the analysis requested in $_POST //////////////////////////////////////////////// ! echo '<h1>Analysis of answers to a single question</h1>'; if (''!= $questionID and '(none)' != $questionID) { *************** *** 170,173 **** --- 170,176 ---- $query .= " AND RawMark='1.0' "; break; + case 'partial': + $query .= " AND RawMark<'1.0' "; + break; case 'nonzero': $query .= " AND RawMark>'0.0' "; *************** *** 371,374 **** --- 374,378 ---- <option value='any' ".nsf($s,'any').">Any</option>\n <option value='full' ".nsf($s,'full').">Full marks</option>\n + <option value='partial' ".nsf($s,'partial').">Not full marks</option>\n <option value='nonzero' ".nsf($s,'nonzero').">Non zero</option> <option value='zero' ".nsf($s,'zero').">Zero</option> Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** question_bank.php 25 Jul 2005 11:24:08 -0000 1.8 --- question_bank.php 25 Aug 2005 16:06:16 -0000 1.9 *************** *** 1,338 **** ! <?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... ! * @author Juliette White jv...@jv... ! * ! * This file contains the front end logic for the question bank ! * 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. ! * @package frontend ! * @subpackage Stack ! */ ! ! /************************************************************ ! * (1) Process Input - this sets $action, $user and $username ! *************************************************************/ ! session_start(); ! include('stackstd.php'); ! $default_action = 'questionbank_screen'; ! include($stack_root.'/frontend_general/process_input.php'); ! include('html/trypopupform.html'); ! include('html/helpform.php'); ! include('html/javascripthead.html'); ! include('html/inputtool.html'); ! include_once($stack_root.'/frontend_general/question_bank_util.php'); ! include_once($stack_root.'/frontend_general/qb_display.php'); ! ! $question = ''; ! $questionInst = ''; ! ! $options = ''; ! $RawAns = ''; ! ! /************************************************************ ! * (2) Perform any actions on entering the page ! *************************************************************/ ! ! // Possible values for $action at this point are ! // edit_new Edit a blank question ! // edit Edit a question, in $SESSION or $POST ! // edit_from_db Get a question from db and edit. ! // preview Try a question in $SESSION or $POST. ! // preview_from_db Get a question from db. Instantiate and try. ! // new_version Try a new version of this question. ! // validate Validate the response to the current question. ! // mark Mark the response to the current question. ! // save Store a question in the db. ! // save_as Store as a new question in the db. ! // delete Delete a question from the db. ! // export_xml Export current question as xml. ! // export_xml_db Export single question as xml from the database. ! // export_xml_list Export the list of selected questions as a single XML file ! // import Present a form to add file name to upload. ! // uploaded_xml Deal with an uploaded file. ! // edit_metadata Edit all the meta data fields in the question bank. ! // questionbank_screen Begin again. ! ! ! $admin = FALSE; ! if ('admin' == $user['username']) { ! $admin = TRUE; ! } ! ! $new_question = FALSE; ! if ('edit_new' == $action) { ! $new_question = TRUE; ! $action = 'edit'; ! } ! ! $database = FALSE; ! if ('edit_from_db'==$action or 'preview_from_db'==$action or 'export_xml_db'==$action) { ! $database = TRUE; ! } ! ! if ('edit_from_db' == $action or 'edit_new' == $action) { ! $action = 'edit'; ! } ! ! if ('preview_from_db' == $action) { ! $action = 'preview'; ! } ! ! if ('export_xml_db' == $action) { ! $action = 'export_xml'; ! } ! ! $get_question = FALSE; ! if ('edit' == $action ! or 'mark' == $action ! or 'validate' == $action ! or 'save' == $action ! or 'save_as' == $action ! or 'preview' == $action ! or 'new_version' == $action ! or 'export_xml' == $action) { ! ! $get_question = TRUE; ! $source = 'default'; ! ! if ($database) { ! $source = 'database'; ! } else if ($new_question) { ! $source = 'new'; ! } ! } ! ! // Get the question, question options and question instance if required ! if ($get_question) { ! $question = stack_get_question($source); ! $options = stack_options_set($question); ! $questionInst = stack_get_questionInst(); ! } ! ! // Work out the correct value for any filter to be applied to the question ! // bank. This is not needed by all actions, but it is harmless to set it. ! $question_bank_filter = stack_get_questionbank_filter(); ! ! $upload_successful = FALSE; ! if ('uploaded_xml' == $action) { ! if (array_key_exists('xmlfile',$_FILES)) { ! if (is_uploaded_file($_FILES['xmlfile']['tmp_name'])) { ! $pq = file_get_contents($_FILES['xmlfile']['tmp_name']); ! include_once("{$stack_root}/scripts/stackXML.php"); ! $qu = stack_xml_parse_question_string($pq); ! // If a single question has been uploaded, edit it, if multiple ! // questions store them in the database ! if (array_key_exists('assessmentItem',$qu)) { ! $question = $qu['assessmentItem']; ! $action = 'edit'; ! } else if (array_key_exists('mathQuiz',$qu)) { ! $quiz = $qu['mathQuiz']['assessmentItem']; ! $upload_successful = TRUE; ! } ! } ! } ! } ! ! if ('export_xml' == $action) { ! include_once("{$stack_root}/scripts/stackXML.php"); ! stack_question_validate($question,$errors); ! $name = stack_xml_write_question_file($question, "{$stack_root}/tmp/"); ! $questions_to_export = TRUE; ! } ! ! if ('export_xml_list' == $action) { ! include_once("{$stack_root}/scripts/stackXML.php"); ! $questions_to_export = stack_get_selected_questions(); ! $name = ''; ! if (NULL !== $questions_to_export) { ! $name = stack_xml_write_quiz_file($questions_to_export, "{$stack_root}/tmp/"); ! } ! $action = 'export_xml'; ! } ! ! ! if ('edit_metadata' == $action ) { ! if ($admin) { ! // If needed update the database ! if (array_key_exists('edit_metadata',$_POST)) { ! $edit_metadata = $_POST['edit_metadata']; ! if (is_array($edit_metadata)) { ! stack_db_edit_metadata($edit_metadata); ! } ! } ! } ! } ! ! switch ($action) { ! case 'save': ! stack_db_question_add($question); ! $action = 'questionbank_screen'; ! break; ! case 'save_as': ! stack_db_question_add($question,TRUE); ! $action = 'questionbank_screen'; ! break; ! case 'edit': ! if (!$new_question) { ! stack_question_validate($question,$errors); ! } ! break; ! } ! ! ! /************************************************************ ! * (3) Print the page. ! *************************************************************/ ! ! include('html/pagehead.php'); ! ! switch ($action) { ! case 'delete': ! $questionID = $_POST['questionID']; ! if ($admin) { ! $quiz_list = stack_db_question_quiz_list($questionID); ! if (!empty($quiz_list)) { ! echo '<font color="red">Question ID '.$questionID.' has been deleted, it was used in the following quiz(zes)'; ! echo stack_db_question_quiz_list_printquizname($questionID)."</font>\n"; ! } ! stack_db_question_drop($questionID); ! } ! $action = 'questionbank_screen'; ! break; ! case 'uploaded_xml': ! if ($upload_successful) { ! stack_display_qb_show_imported($quiz); ! } else { ! echo '<p>Could not extract a question or quiz from your uploaded file. Please edit your file carefully and try again.</p>'; ! } ! $action = 'questionbank_screen'; ! break; ! case 'import': ! stack_display_qb_import($errors); ! break; ! case 'export_xml': ! if (NULL == $questions_to_export) { ! echo "<p>Could not get any ticked questions! Please try again.</p>"; ! } else { ! echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; ! } ! $action = 'questionbank_screen'; ! break; ! case 'edit_metadata': ! if (!$admin) { ! print_string('qp_notadmin','stack'); ! } ! stack_display_qb_edit_metadata($question_bank_filter); ! break; ! } ! ! ! // Preview a new version of the quiz. ! if ('new_version' == $action) { ! foreach ($stackQuestion as $qfield => $val) { ! if (array_key_exists($qfield,$questionInst)) { ! $question[$qfield] = $questionInst[$qfield]; ! } ! } ! unset($questionInst); ! $action = 'preview'; ! } ! ! if ('mark' == $action or 'validate' == $action) { ! if (array_key_exists('RawAns',$_POST) ){ ! $RawAns=$_POST['RawAns']; ! } else { ! $error['RawAns'] = '<font color="red">You have not entered an answer!</font>'; } ! } ! ! ! if ('preview'==$action) { ! ! stack_question_validate($question,$errors); ! ! if ('' == $errors) { ! if ($database) { ! $action = 'validate'; ! } else { ! $action = 'mark'; ! } ! ! $seed = stack_get_seed(); ! $options = stack_options_set($question); ! $questionInst = stack_question_inst($question,$seed,$options,$errors); ! ! // For the purposes of this test, fill in the correct answer ! if ($database) { ! if (array_key_exists('RawAns',$_POST)) { ! $RawAns=$_POST['RawAns']; ! } ! } else { ! ! $RawAns = $questionInst['questionAnsInst']['value']; ! } ! } ! ! if (''!=$errors) { ! echo '<p>Could not instantiate the question, because of errors.<br />Try to edit the question instead.</p>'; ! $action='edit'; ! } ! } ! ! ! // Now deal with the answer ! if ('mark'==$action or 'validate'==$action) { ! ! $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); ! } ! ! ! switch ($action) { ! case 'questionbank_screen': ! stack_display_qb_main($admin, $question_bank_filter); ! break; ! case 'edit': ! if (!$admin) { ! print_string('qp_notadmin','stack'); ! } ! stack_display_qb_edit($question, $errors); ! break; ! } ! ! include('html/pagefoot.php'); ! ! ////////////////////////////////////////////////////////////// ! // (3) Deal with any actions on leaving the page ! ////////////////////////////////////////////////////////////// ! ! if ('questionbank_screen'==$action or 'edit_metadata' == $action){ ! session_unregister('question'); ! session_unregister('questionInst'); ! } ! ! ?> --- 1,302 ---- ! <?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... ! * @author Juliette White jv...@jv... ! * ! * This file contains the front end logic for the question bank ! * 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. ! * - Removed all references to import quiz ! * @package frontend ! * @subpackage Stack ! */ ! ! /************************************************************ ! * (1) Process Input - this sets $action, $user and $username ! *************************************************************/ ! session_start(); ! include('stackstd.php'); ! $default_action = 'questionbank_screen'; ! include($stack_root.'/frontend_general/process_input.php'); ! include('html/trypopupform.html'); ! include('html/helpform.php'); ! include('html/javascripthead.html'); ! include('html/inputtool.html'); ! include_once($stack_root.'/frontend_general/question_bank_util.php'); ! include_once($stack_root.'/frontend_general/qb_display.php'); ! ! $question = ''; ! $questionInst = ''; ! ! $options = ''; ! $RawAns = ''; ! ! /************************************************************ ! * (2) Perform any actions on entering the page ! *************************************************************/ ! ! // Possible values for $action at this point are ! // edit_new Edit a blank question ! // edit Edit a question, in $SESSION or $POST ! // edit_from_db Get a question from db and edit. ! // preview Try a question in $SESSION or $POST. ! // preview_from_db Get a question from db. Instantiate and try. ! // new_version Try a new version of this question. ! // validate Validate the response to the current question. ! // mark Mark the response to the current question. ! // save Store a question in the db. ! // save_as Store as a new question in the db. ! // delete Delete a question from the db. ! // export_xml Export current question as xml. ! // export_xml_db Export single question as xml from the database. ! // export_xml_list Export the list of selected questions as a single XML file ! // edit_metadata Edit all the meta data fields in the question bank. ! // questionbank_screen Begin again. ! ! $admin = FALSE; ! if ('admin' == $user['username']) { ! $admin = TRUE; ! } ! ! $new_question = FALSE; ! if ('edit_new' == $action) { ! $new_question = TRUE; ! $action = 'edit'; ! } ! ! $database = FALSE; ! if ('edit_from_db'==$action or 'preview_from_db'==$action or 'export_xml_db'==$action) { ! $database = TRUE; ! } ! ! if ('edit_from_db' == $action) { ! $action = 'edit'; ! } ! ! if ('preview_from_db' == $action) { ! $action = 'preview'; ! } ! ! if ('export_xml_db' == $action) { ! $action = 'export_xml'; ! } ! ! $get_question = FALSE; ! if ('edit' == $action ! or 'mark' == $action ! or 'validate' == $action ! or 'save' == $action ! or 'save_as' == $action ! or 'preview' == $action ! or 'new_version' == $action ! or 'export_xml' == $action) { ! ! $get_question = TRUE; ! $source = 'default'; ! ! if ($database) { ! $source = 'database'; ! } else if ($new_question) { ! $source = 'new'; ! } ! } ! ! // Get the question, question options and question instance if required ! if ($get_question) { ! $question = stack_get_question($source); ! if (!$new_question) { ! stack_question_validate($question,$errors); ! } ! $options = stack_options_set($question); ! $questionInst = stack_get_questionInst(); ! } ! ! // Work out the correct value for any filter to be applied to the question ! // bank. This is not needed by all actions, but it is harmless to set it. ... [truncated message content] |
From: pkiddie <pk...@us...> - 2005-08-25 16:06:30
|
Update of /cvsroot/stack/stack-1-0/frontend_general In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17646/frontend_general Modified Files: editquiz_display.php qb_display.php question_bank_util.php Log Message: Merging of Paul Kiddie's work into main STACK HEAD branch Index: qb_display.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/qb_display.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** qb_display.php 14 Jul 2005 18:44:54 -0000 1.5 --- qb_display.php 25 Aug 2005 16:06:16 -0000 1.6 *************** *** 1,155 **** ! <?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 ! * ! * This file contains display functions used by question_bank.php ! * ! * ! * @author Chris Sangwin C.J...@bh... ! * @author Laura Naismith L.N...@bh... ! * @author Juliette White jv...@jv... ! * ! * @package frontend ! * @subpackage Stack ! * ! */ ! ! /** ! * Displays the main question bank page ! * @param bool $admin TRUE if the user is the admin user, FALSE otherwise ! * @param array $question_bank_filter The question bank filter ! * @return void ! */ ! function stack_display_qb_main($admin, $question_bank_filter) { ! global $stack_root; ! $options = ''; ! include("{$stack_root}/html/qselectform.php"); ! ! if ($admin) { ! stack_db_listquestions('edit',$question_bank_filter); ! } else { ! stack_db_listquestions('try',$question_bank_filter); ! } ! ! echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Export selected as XML</a> "; ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! } ! ! ! /** ! * Displays the form for editting a question ! * @param array $question The question to edit ! * @param array $errors The question bank filter ! * @return void ! */ ! function stack_display_qb_edit($question, $errors) { ! global $stack_root; ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! include("{$stack_root}/html/qselectform.php"); ! stack_question_edit_form($question,$errors); ! ! echo "<p><a href=\"javascript:HelpPopup('all','author_questionfields');\">Help with question fields.</a>\n ! <a href=\"javascript:HelpPopup('all','author_options');\">Help with options.</a>\n ! <a href=\"javascript:HelpPopup('all','author_answertest');\">Help with answer tests.</a>\n ! <a href=\"javascript:HelpPopup('all','author_potresp');\">Help with potential responses.</a></p>"; ! } ! ! ! /** ! * Displays the edit metadate form ! * @param array $question_bank_filter The question bank filter to apply ! * @return void ! */ ! function stack_display_qb_edit_metadata($question_bank_filter) { ! global $stack_root; ! include("{$stack_root}/html/qselectform.php"); ! ! stack_db_listquestions('edit_metadata',$question_bank_filter); ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! } ! ! ! /** ! * Displays the form for importing a file ! * @return void ! */ ! function stack_display_qb_import($errors) { ! echo nsf($errors,'import'); ! echo "Select a file to upload and edit: ! <br /> ! <form enctype='multipart/form-data' action=\"question_bank.php\"' method='POST'><br />\n ! <input type ='file' name='xmlfile' />\n ! <input type ='hidden' name='action' value='uploaded_xml' /> ! <input type ='submit' name='go' value='Upload'> ! </form>\n\n"; ! } ! ! /** ! * Displays the imported questions ! * @param array $quiz The imported quiz ! * @return void ! */ ! function stack_display_qb_show_imported($quiz) { ! ! echo "<h2>Details of questions uploaded</h2>"; ! echo '<table><thead><tr>'; ! echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; ! echo '</tr></thead><tbody>'; ! ! $errs = NULL; ! ! foreach ($quiz as $key => $qu) { ! ! stack_question_validate($quiz[$key],$errs[$key]); ! $qu['questionID'] = stack_db_question_add($qu); ! echo "<tr>\n <td>".sf($qu,'questionID')."</td> <td>".sf($qu,'questionName')." </td> <td>".sf($qu,'questionDescription')." </td> <td>".sf($qu,'questionKeywords')." </td>"; ! $errc = FALSE; ! if (nsf($errs,$key)) { ! if (is_array($errs[$key])) { ! $errc = TRUE; ! } ! } ! if ($errc) { ! echo "<td><font color=\"red\">Invalid question</font></td>"; ! echo "</tr></tbody></table>\n\n"; ! echo stack_question_errstr($errs[$key]); ! echo "\n\n<table><thead><tr>"; ! echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; ! echo '</tr></thead><tbody>'; ! } else { ! echo "<td><font color=\"greed\">Valid question</font></td>"; ! } ! echo "</tr>\n"; ! } ! ! echo "</tbody></table>\n"; ! echo "<h2>Current database of questions</h2>"; ! } ! ! ! /** ! * Displays the preview of a question ! * @return void ! */ ! function stack_display_qb_preview($questionInst) { ! echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'> ! <td align='left'> ! ! <b>Question: ".sf($questionInst,'questionName')."</b> (".sf($questionInst,'questionID'); ! echo ")</td><td align='right'>"; ! echo "<a href=\"javascript:HelpPopup('student','');\">Help</a></td></tr></table></center>"; ! } ! ! ?> --- 1,192 ---- ! <?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 ! ! * ! ! * This file contains display functions used by question_bank.php ! ! * - Removed import references - now factored out to import.php ! ! * ! ! * ! ! * @author Chris Sangwin C.J...@bh... ! ! * @author Laura Naismith L.N...@bh... ! ! * @author Juliette White jv...@jv... ! ! * ! ! * @package frontend ! ! * @subpackage Stack ! ! * ! ! */ ! ! ! ! /** ! ! * Displays the main question bank page ! ! * @param bool $admin TRUE if the user is the admin user, FALSE otherwise ! ! * @param array $question_bank_filter The question bank filter ! ! * @return void ! ! */ ! ! function stack_display_qb_main($admin, $question_bank_filter) { ! ! global $stack_root; ! ! $options = ''; ! ! include("{$stack_root}/html/qselectform.php"); ! ! ! ! if ($admin) { ! ! stack_db_listquestions('edit',$question_bank_filter); ! ! } else { ! ! stack_db_listquestions('try',$question_bank_filter); ! ! } ! ! ! ! echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Export selected as XML</a> "; ! ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! ! } ! ! ! ! ! ! /** ! ! * Displays the form for editting a question ! ! * @param array $question The question to edit ! ! * @param array $errors The question bank filter ! ! * @return void ! ! */ ! ! function stack_display_qb_edit($question, $errors) { ! ! global $stack_root; ! ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! ! include("{$stack_root}/html/qselectform.php"); ! ! stack_question_edit_form($question,$errors); ! ! ! ! echo "<p><a href=\"javascript:HelpPopup('all','author_questionfields');\">Help with question fields.</a>\n ! ! <a href=\"javascript:HelpPopup('all','author_options');\">Help with options.</a>\n ! ! <a href=\"javascript:HelpPopup('all','author_answertest');\">Help with answer tests.</a>\n ! ! <a href=\"javascript:HelpPopup('all','author_potresp');\">Help with potential responses.</a></p>"; ! ! } ! ! ! ! ! ! /** ! ! * Displays the edit metadate form ! ! * @param array $question_bank_filter The question bank filter to apply ! ! * @return void ! ! */ ! ! function stack_display_qb_edit_metadata($question_bank_filter) { ! ! global $stack_root; ! ! include("{$stack_root}/html/qselectform.php"); ! ! ! ! stack_db_listquestions('edit_metadata',$question_bank_filter); ! ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; ! ! } ! ! /** ! ! * Displays the preview of a question ! ! * @return void ! ! */ ! ! function stack_display_qb_preview($questionInst) { ! ! echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'> ! ! <td align='left'> ! ! ! ! <b>Question: ".sf($questionInst,'questionName')."</b> (".sf($questionInst,'questionID'); ! ! echo ")</td><td align='right'>"; ! ! echo "<a href=\"javascript:HelpPopup('student','');\">Help</a></td></tr></table></center>"; ! ! } ! ! ! ! ?> ! Index: question_bank_util.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/question_bank_util.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** question_bank_util.php 14 Jul 2005 18:44:54 -0000 1.3 --- question_bank_util.php 25 Aug 2005 16:06:16 -0000 1.4 *************** *** 95,99 **** */ function stack_get_question($source) { ! $question = NULL; --- 95,100 ---- */ function stack_get_question($source) { ! global $stack_web_url,$user; ! $question = NULL; *************** *** 111,116 **** if ('new' == $source or NULL == $question) { ! $question['questionID']='0'; ! $question['questionAnsKey']='ans1'; } return $question; --- 112,129 ---- if ('new' == $source or NULL == $question) { ! ! //show_array($user); ! $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'; ! $question['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! ! if ($user['email']!='') ! { ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; ! } } return $question; Index: editquiz_display.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/frontend_general/editquiz_display.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** editquiz_display.php 14 Jul 2005 18:44:54 -0000 1.8 --- editquiz_display.php 25 Aug 2005 16:06:16 -0000 1.9 *************** *** 53,56 **** --- 53,57 ---- 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"; *************** *** 95,100 **** */ function stack_display_editquiz_error($errors) { ! echo "<font color=\"red\">"; show_array($errors); ! echo "</font>"; } --- 96,109 ---- */ function stack_display_editquiz_error($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; ! } ! } ! ! } } |